2.7.5 • Published 2 months ago

godown v2.7.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Godown

Simple, stylized, semantic web components.

Install

npm i godown

Usages

HTML

<g-alert title="Alert"></g-alert>

Can't use a single tag.

<g-alert title="Alert"/>
<!-- ERROR -->

JS

import { Alert } from "godown"; // import all
// import Alert from "godown/alert"; // import one

const alert = new Alert();
alert.title = "Alert";
/*
const alert = new Alert({
  title: "Alert"
});
 */
document.body.appendChild(alert);

deno

import { Alert } from "npm:godown";

React

import { Alert } from "godown/react"; // import all

export default function () {
  return <Alert title="Alert" />;
}

Custom

Custom element tag name

The name must contain -.

import { defineConfig } from "godown/conf";

const newNames = {
  "old-name": "new-name",
};

function getName(constructorDashName: string) {
  return newNames[constructorDashName];
}

defineConfig({
  tag: getName,
  prefix: "prefix-",
  suffix: "",
});

The element will be renamed to ${prefix} + ${tag( ${constructorDashName} )} + ${suffix}

<prefix-new-name title="Alert"></prefix-new-name>

Custom element styles

Font color and background

* {
  --godown--background-rgb: 12 12 12;
  --godown--foreground-rgb: 240 240 240;
}

See With CSS.

Custom element CSS variable prefix

import { defineConfig } from "godown/conf";

defineConfig({
  cssvar: "ge",
});

The CSS variable of the element will be ${cssvar} + element name + description.

The following CSS variables now affect element styles.

<g-button style="--ge--g-button--focus-scale: .95;"></g-button>

Custom initial property

All element.

import { defineConfig } from "godown/conf";
defineConfig({
  assign: {
    classList: ["godown-element", "custom-element"],
    color: "blue", // button property
  },
});

Assign when elements are connected.

<g-button class="godown-element custom-element" color="blue">Button</g-button>

<g-input class="godown-element custom-element" color="blue"></g-input>

One element.

const RedGhostButton = new Button({
  // ...
  color: "red", // overwrite
  ghost: true, // button property
});

With CSS

It can be used to set CSS variables.

.godown-element {
  --ge--foreground-rgb: 0 0 0;
  --ge--background-rgb: 255 255 255;
}

Compatibility

import { defineConfig } from "godown/conf";
defineConfig({
  naming: "legacy", // default is "latest"
});

Legacy names can now be used.

<base-button>legacy</base-button>
2.7.4

2 months ago

2.7.3

2 months ago

2.7.5

2 months ago

2.7.2

2 months ago

2.7.1

2 months ago

2.7.0

3 months ago

2.6.1

3 months ago

2.6.0

3 months ago

2.6.2

3 months ago

2.5.1

3 months ago

2.5.0

3 months ago

2.4.2

3 months ago

2.4.1

4 months ago

2.4.0

4 months ago

2.3.1

5 months ago

2.3.0

5 months ago

1.2.0

7 months ago

2.0.3

7 months ago

2.2.0

5 months ago

2.0.2

7 months ago

2.0.5

7 months ago

2.0.4

7 months ago

2.0.7

7 months ago

2.0.6

7 months ago

2.0.9

6 months ago

2.0.8

6 months ago

2.0.1

7 months ago

2.0.0

7 months ago

2.1.2

5 months ago

2.0.15

5 months ago

2.1.1

5 months ago

2.0.13

6 months ago

2.0.14

5 months ago

2.0.11

6 months ago

2.0.12

6 months ago

2.0.10

6 months ago

2.1.0

5 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

8 months ago

1.1.3

9 months ago

1.1.1

10 months ago

1.1.0

11 months ago

1.1.2

10 months ago

1.0.44

11 months ago

1.0.43

11 months ago

1.0.42

12 months ago

1.0.48

11 months ago

1.0.47

11 months ago

1.0.46

11 months ago

1.0.45

11 months ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.7

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.40

1 year ago

1.0.41

12 months ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.33

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago