godown 3.0.0-canary.1 → 3.0.0-canary.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -9
- package/components/alert.d.ts +6 -3
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +22 -14
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts +7 -2
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +13 -6
- package/components/avatar.js.map +1 -1
- package/components/breath.d.ts +4 -2
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +8 -6
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +20 -11
- package/components/button.d.ts.map +1 -1
- package/components/button.js +23 -20
- package/components/button.js.map +1 -1
- package/components/card.d.ts +2 -2
- package/components/card.d.ts.map +1 -1
- package/components/card.js +8 -13
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +8 -5
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +18 -11
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +7 -3
- package/components/details.d.ts.map +1 -1
- package/components/details.js +7 -3
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +9 -5
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +20 -14
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts +3 -4
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +6 -7
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts +9 -8
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +3 -2
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts +3 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +13 -4
- package/components/flex.js.map +1 -1
- package/components/form.d.ts +2 -3
- package/components/form.d.ts.map +1 -1
- package/components/form.js +0 -2
- package/components/form.js.map +1 -1
- package/components/grid.d.ts +9 -3
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +6 -4
- package/components/grid.js.map +1 -1
- package/components/input.d.ts +4 -4
- package/components/input.d.ts.map +1 -1
- package/components/input.js +5 -7
- package/components/input.js.map +1 -1
- package/components/layout.d.ts +4 -6
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +23 -12
- package/components/layout.js.map +1 -1
- package/components/link.d.ts +3 -1
- package/components/link.d.ts.map +1 -1
- package/components/link.js +3 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts +4 -12
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +9 -17
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +45 -18
- package/components/range.d.ts.map +1 -1
- package/components/range.js +133 -62
- package/components/range.js.map +1 -1
- package/components/rotate.d.ts +3 -2
- package/components/rotate.d.ts.map +1 -1
- package/components/rotate.js +1 -1
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +15 -17
- package/components/router.d.ts.map +1 -1
- package/components/router.js +10 -10
- package/components/router.js.map +1 -1
- package/components/select.d.ts +6 -9
- package/components/select.d.ts.map +1 -1
- package/components/select.js +48 -43
- package/components/select.js.map +1 -1
- package/components/skeleton.d.ts +2 -1
- package/components/skeleton.d.ts.map +1 -1
- package/components/skeleton.js +5 -5
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts +20 -2
- package/components/split.d.ts.map +1 -1
- package/components/split.js +54 -20
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +6 -5
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +7 -6
- package/components/switch.js.map +1 -1
- package/components/text.d.ts +2 -1
- package/components/text.d.ts.map +1 -1
- package/components/text.js +5 -6
- package/components/text.js.map +1 -1
- package/components/time.d.ts +6 -22
- package/components/time.d.ts.map +1 -1
- package/components/time.js +7 -67
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +13 -2
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +24 -5
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +4 -4
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +4 -5
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +9 -2
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.d.ts +2 -1
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +4 -3
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +5 -5
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +3 -6
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js +1 -1
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/dev/components/alert.d.ts +6 -3
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +38 -25
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +7 -2
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +28 -13
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/breath.d.ts +4 -2
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +20 -6
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +20 -11
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +34 -25
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts +2 -2
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +25 -30
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts +8 -5
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +35 -20
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +7 -3
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +12 -4
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +9 -5
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +30 -24
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts +3 -4
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +20 -8
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +9 -8
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +8 -1
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts +3 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +24 -4
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts +2 -3
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +0 -2
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts +9 -3
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +17 -4
- package/dev/components/grid.js.map +1 -1
- package/dev/components/input.d.ts +4 -4
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +3 -21
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts +4 -6
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +33 -13
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.d.ts +3 -1
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +3 -1
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts +4 -12
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +14 -18
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +45 -18
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +164 -109
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +3 -2
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +1 -1
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +15 -17
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +10 -10
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +6 -9
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +58 -45
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts +2 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +6 -6
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts +20 -2
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +69 -32
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts +6 -5
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +23 -20
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts +2 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +7 -7
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +6 -22
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +9 -67
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts +13 -2
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +55 -20
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +4 -4
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +11 -5
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +18 -10
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/super-anchor.d.ts +2 -1
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +8 -5
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +5 -5
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +21 -20
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts.map +1 -1
- package/dev/core/super-openable.js +1 -1
- package/dev/core/super-openable.js.map +1 -1
- package/dev/range.d.ts +1 -1
- package/dev/range.d.ts.map +1 -1
- package/index.js +13 -13
- package/package.json +11 -8
- package/range.d.ts +1 -1
- package/range.d.ts.map +1 -1
- package/src/alert.ts +11 -0
- package/src/avatar.ts +11 -0
- package/src/breath.ts +13 -0
- package/src/button.ts +11 -0
- package/src/card.ts +11 -0
- package/src/carousel.ts +11 -0
- package/src/components/alert.ts +284 -0
- package/src/components/avatar.ts +109 -0
- package/src/components/breath.ts +165 -0
- package/src/components/button.ts +292 -0
- package/src/components/card.ts +83 -0
- package/src/components/carousel.ts +183 -0
- package/src/components/details.ts +121 -0
- package/src/components/dialog.ts +166 -0
- package/src/components/divider.ts +56 -0
- package/src/components/dragbox.ts +134 -0
- package/src/components/flex.ts +82 -0
- package/src/components/form.ts +82 -0
- package/src/components/grid.ts +87 -0
- package/src/components/input.ts +73 -0
- package/src/components/layout.ts +89 -0
- package/src/components/link.ts +38 -0
- package/src/components/progress.ts +100 -0
- package/src/components/range.ts +399 -0
- package/src/components/rotate.ts +95 -0
- package/src/components/router.ts +281 -0
- package/src/components/select.ts +281 -0
- package/src/components/skeleton.ts +119 -0
- package/src/components/split.ts +225 -0
- package/src/components/switch.ts +184 -0
- package/src/components/text.ts +93 -0
- package/src/components/time.ts +84 -0
- package/src/components/tooltip.ts +150 -0
- package/src/components/typewriter.ts +159 -0
- package/src/core/global-style.ts +105 -0
- package/src/core/super-anchor.ts +55 -0
- package/src/core/super-input.ts +230 -0
- package/src/core/super-openable.ts +51 -0
- package/src/details.ts +11 -0
- package/src/dialog.ts +11 -0
- package/src/divider.ts +11 -0
- package/src/dragbox.ts +11 -0
- package/src/flex.ts +11 -0
- package/src/form.ts +11 -0
- package/src/grid.ts +11 -0
- package/src/index.ts +28 -0
- package/src/input.ts +13 -0
- package/src/layout.ts +12 -0
- package/src/link.ts +13 -0
- package/src/progress.ts +12 -0
- package/src/range.ts +13 -0
- package/src/rotate.ts +13 -0
- package/src/router.ts +12 -0
- package/src/select.ts +13 -0
- package/src/skeleton.ts +13 -0
- package/src/split.ts +13 -0
- package/src/switch.ts +13 -0
- package/src/text.ts +13 -0
- package/src/time.ts +13 -0
- package/src/tooltip.ts +13 -0
- package/src/typewriter.ts +11 -0
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# godown
|
2
2
|
|
3
|
-
|
3
|
+
`Non Composite` Web Components Library.
|
4
4
|
|
5
5
|
## Install
|
6
6
|
|
@@ -8,7 +8,21 @@ Simple, stylized, semantic web components.
|
|
8
8
|
npm i godown
|
9
9
|
```
|
10
10
|
|
11
|
-
##
|
11
|
+
## Import
|
12
|
+
|
13
|
+
Import all components.
|
14
|
+
|
15
|
+
```js
|
16
|
+
import Alert from "godown/alert.js";
|
17
|
+
```
|
18
|
+
|
19
|
+
Import one component.
|
20
|
+
|
21
|
+
```js
|
22
|
+
import { Alert } from "godown";
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
12
26
|
|
13
27
|
### HTML
|
14
28
|
|
@@ -19,12 +33,8 @@ npm i godown
|
|
19
33
|
### JS
|
20
34
|
|
21
35
|
```js
|
22
|
-
// import all
|
23
36
|
import { Alert } from "godown";
|
24
37
|
|
25
|
-
// import one
|
26
|
-
import Alert from "godown/alert.js";
|
27
|
-
|
28
38
|
const alert = new Alert();
|
29
39
|
alert.title = "Alert";
|
30
40
|
|
@@ -33,11 +43,12 @@ document.body.appendChild(alert);
|
|
33
43
|
|
34
44
|
### React
|
35
45
|
|
36
|
-
|
46
|
+
React components is now in the standalone package (@godown/react).
|
47
|
+
|
48
|
+
This package only provides empty conversion.
|
37
49
|
|
38
50
|
```jsx
|
39
|
-
import { Alert } from "@godown/react";
|
40
|
-
// import { Alert } from "@godown/react/alert.js"; // import one
|
51
|
+
import { Alert } from "@godown/react";
|
41
52
|
|
42
53
|
export default function () {
|
43
54
|
return <Alert title="Alert" />;
|
@@ -110,3 +121,21 @@ Element-scoped css variables will start with `--${tagName}--`.
|
|
110
121
|
```html
|
111
122
|
<godown-button style="--godown-button--focus-scale: .95;"></godown-button>
|
112
123
|
```
|
124
|
+
|
125
|
+
### Undefined
|
126
|
+
|
127
|
+
Undefined elements in the `./components` sub path.
|
128
|
+
|
129
|
+
```ts
|
130
|
+
import Button "godown/components/button.js";
|
131
|
+
|
132
|
+
customElements.define("my-button", Button);
|
133
|
+
```
|
134
|
+
|
135
|
+
```html
|
136
|
+
<my-button>Click me</my-button>
|
137
|
+
```
|
138
|
+
|
139
|
+
### Conditional import
|
140
|
+
|
141
|
+
Under "development" condition, the template will not be compressed.
|
package/components/alert.d.ts
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
import { type TemplateResult } from "lit";
|
1
2
|
import { GlobalStyle } from "../core/global-style.js";
|
2
3
|
/**
|
3
4
|
* {@linkcode Alert} renders a alert.
|
4
5
|
*
|
6
|
+
* Color defaults to blue.
|
7
|
+
*
|
5
8
|
* @slot - Alert content.
|
6
9
|
* @slot title - Alert title.
|
7
10
|
* @slot icon - Alert icon.
|
@@ -16,7 +19,7 @@ declare class Alert extends GlobalStyle {
|
|
16
19
|
* The tone of the component.
|
17
20
|
* Overrides the color of the call.
|
18
21
|
*/
|
19
|
-
color: "white" | "black" | "gray" | "green" | "teal" | "blue" | "red" | "purple" | "orange" | "yellow" | "pink";
|
22
|
+
color: "white" | "black" | "gray" | "green" | "teal" | "blue" | "red" | "purple" | "orange" | "yellow" | "pink" | "none";
|
20
23
|
/**
|
21
24
|
* Close delay, if 0, it will not be closed automatically.
|
22
25
|
*/
|
@@ -32,7 +35,7 @@ declare class Alert extends GlobalStyle {
|
|
32
35
|
/**
|
33
36
|
* Set true to hide the close button.
|
34
37
|
*
|
35
|
-
* The behavior may change due to the {@linkcode variant} property
|
38
|
+
* The behavior may change due to the {@linkcode variant} property.
|
36
39
|
*/
|
37
40
|
hideClose: boolean;
|
38
41
|
/**
|
@@ -41,7 +44,7 @@ declare class Alert extends GlobalStyle {
|
|
41
44
|
* If variant is `"blockquote"`, hide the close button.
|
42
45
|
*/
|
43
46
|
variant: "blockquote" | "dark" | "light";
|
44
|
-
protected render():
|
47
|
+
protected render(): TemplateResult<1>;
|
45
48
|
close(): void;
|
46
49
|
protected firstUpdated(): void;
|
47
50
|
static alert(root: HTMLElement, option: Partial<Alert>): Alert;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../src/components/alert.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../src/components/alert.ts"],"names":[],"mappings":"AAcA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAiB,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAwFlF;;;;;;;;;GASG;AACH,cAIM,KAAM,SAAQ,WAAW;IAC7B;;OAEG;IAEH,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;IAE1F;;;OAGG;IAEH,KAAK,EACD,OAAO,GACP,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,CAAU;IAEpB;;OAEG;IAEH,SAAS,SAAK;IAEd;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IAEH,SAAS,UAAS;IAElB;;;;OAIG;IAEH,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,CAAU;IAElD,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAUrC,KAAK,IAAI,IAAI;IAKb,SAAS,CAAC,YAAY,IAAI,IAAI;IAM9B,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK;CAM/D;AAED,eAAe,KAAK,CAAC"}
|
package/components/alert.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import { __decorate } from 'tslib';
|
2
2
|
import { godown } from '@godown/element/decorators/godown.js';
|
3
3
|
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import {
|
4
|
+
import { attr } from '@godown/element/directives/attr.js';
|
5
5
|
import { htmlSlot } from '@godown/element/directives/html-slot.js';
|
6
|
-
import {
|
6
|
+
import { htmlStyle } from '@godown/element/directives/html-style.js';
|
7
|
+
import { constructCSSObject, toVar } from '@godown/element/tools/css.js';
|
7
8
|
import iconCheckAltCircle from '@godown/f7-icon/icons/checkmark-alt-circle.js';
|
8
9
|
import iconExclamationCircle from '@godown/f7-icon/icons/exclamationmark-circle.js';
|
9
10
|
import iconInfoCircle from '@godown/f7-icon/icons/info-circle.js';
|
@@ -12,7 +13,7 @@ import iconQuestionCircle from '@godown/f7-icon/icons/question-circle.js';
|
|
12
13
|
import iconSlashCircle from '@godown/f7-icon/icons/slash-circle.js';
|
13
14
|
import iconXmark from '@godown/f7-icon/icons/xmark.js';
|
14
15
|
import iconXmarkCircle from '@godown/f7-icon/icons/xmark-circle.js';
|
15
|
-
import {
|
16
|
+
import { html, css } from 'lit';
|
16
17
|
import { property } from 'lit/decorators.js';
|
17
18
|
import { scopePrefix, cssGlobalVars, GlobalStyle } from '../core/global-style.js';
|
18
19
|
|
@@ -22,7 +23,7 @@ const vars = ["color", "background"].map((v) => `${cssScope}--${v}`);
|
|
22
23
|
const genDark = (key) => {
|
23
24
|
return [cssGlobalVars._colors[key][5], cssGlobalVars._colors[key][9]];
|
24
25
|
};
|
25
|
-
const darkStyles =
|
26
|
+
const darkStyles = constructCSSObject(vars, {
|
26
27
|
green: genDark("green"),
|
27
28
|
blue: genDark("blue"),
|
28
29
|
orange: genDark("orange"),
|
@@ -34,11 +35,11 @@ const darkStyles = constructCSS(vars, {
|
|
34
35
|
gray: [cssGlobalVars._colors.lightgray[5], cssGlobalVars._colors.darkgray[5]],
|
35
36
|
white: [cssGlobalVars._colors.lightgray[2], cssGlobalVars._colors.darkgray[7]],
|
36
37
|
black: [cssGlobalVars._colors.darkgray[8], cssGlobalVars._colors.lightgray[5]],
|
37
|
-
}, (
|
38
|
+
}, () => `:host`, (prop) => toVar(prop));
|
38
39
|
const genLight = (key) => {
|
39
40
|
return [cssGlobalVars._colors[key][6], cssGlobalVars._colors[key][0]];
|
40
41
|
};
|
41
|
-
const lightStyles =
|
42
|
+
const lightStyles = constructCSSObject(vars, {
|
42
43
|
green: genLight("green"),
|
43
44
|
blue: genLight("blue"),
|
44
45
|
orange: genLight("orange"),
|
@@ -50,7 +51,7 @@ const lightStyles = constructCSS(vars, {
|
|
50
51
|
gray: [cssGlobalVars._colors.darkgray[5], cssGlobalVars._colors.lightgray[7]],
|
51
52
|
white: [cssGlobalVars._colors.lightgray[0], cssGlobalVars._colors.darkgray[0]],
|
52
53
|
black: [cssGlobalVars._colors.darkgray[7], cssGlobalVars._colors.lightgray[3]],
|
53
|
-
}, (
|
54
|
+
}, () => `:host`, (prop) => toVar(prop));
|
54
55
|
const calls = {
|
55
56
|
tip: {
|
56
57
|
color: "teal",
|
@@ -88,6 +89,8 @@ const calls = {
|
|
88
89
|
/**
|
89
90
|
* {@linkcode Alert} renders a alert.
|
90
91
|
*
|
92
|
+
* Color defaults to blue.
|
93
|
+
*
|
91
94
|
* @slot - Alert content.
|
92
95
|
* @slot title - Alert title.
|
93
96
|
* @slot icon - Alert icon.
|
@@ -96,6 +99,11 @@ const calls = {
|
|
96
99
|
let Alert = class Alert extends GlobalStyle {
|
97
100
|
constructor() {
|
98
101
|
super(...arguments);
|
102
|
+
/**
|
103
|
+
* The tone of the component.
|
104
|
+
* Overrides the color of the call.
|
105
|
+
*/
|
106
|
+
this.color = "blue";
|
99
107
|
/**
|
100
108
|
* Close delay, if 0, it will not be closed automatically.
|
101
109
|
*/
|
@@ -103,7 +111,7 @@ let Alert = class Alert extends GlobalStyle {
|
|
103
111
|
/**
|
104
112
|
* Set true to hide the close button.
|
105
113
|
*
|
106
|
-
* The behavior may change due to the {@linkcode variant} property
|
114
|
+
* The behavior may change due to the {@linkcode variant} property.
|
107
115
|
*/
|
108
116
|
this.hideClose = false;
|
109
117
|
/**
|
@@ -114,9 +122,11 @@ let Alert = class Alert extends GlobalStyle {
|
|
114
122
|
this.variant = "dark";
|
115
123
|
}
|
116
124
|
render() {
|
117
|
-
const color =
|
125
|
+
const color = calls[this.call]?.color || this.color;
|
118
126
|
const icon = this.call ? calls[this.call].icon() : htmlSlot("icon");
|
119
|
-
return html `<div part="root"
|
127
|
+
return html `<div part="root" ${attr(this.observedRecord)}><div part="icon">${icon}</div><div part="content"><strong part="title">${this.title || htmlSlot("title")} </strong>${this.content || htmlSlot()}</div>${!this.hideClose && this.variant !== "blockquote"
|
128
|
+
? html `<div part="close" tabindex="0" @click="${this.close}">${iconXmark()}</div>`
|
129
|
+
: ""} ${htmlStyle(this.variant === "light" ? lightStyles[color] : darkStyles[color])}</div>`;
|
120
130
|
}
|
121
131
|
close() {
|
122
132
|
this.remove();
|
@@ -150,16 +160,14 @@ __decorate([
|
|
150
160
|
property()
|
151
161
|
], Alert.prototype, "content", void 0);
|
152
162
|
__decorate([
|
153
|
-
property({
|
154
|
-
type: Boolean,
|
155
|
-
})
|
163
|
+
property({ type: Boolean })
|
156
164
|
], Alert.prototype, "hideClose", void 0);
|
157
165
|
__decorate([
|
158
166
|
property()
|
159
167
|
], Alert.prototype, "variant", void 0);
|
160
168
|
Alert = __decorate([
|
161
169
|
godown(protoName),
|
162
|
-
styles(
|
170
|
+
styles(css `:host,:where(:host([contents]) [part=root]){border-radius:var(${cssScope}--border-radius);${cssScope}--border-radius:.25em;${cssScope}--border-width:.075em;${cssScope}--blockquote-width:.2em;${cssScope}--padding:.5em;display:block;width:100%}[part=root]{--color:var(${cssScope}--color);color:var(--color);width:100%;transition:.25s;display:flex;justify-content:space-between;padding:var(${cssScope}--padding);border-radius:inherit;border:var(${cssScope}--border-width) solid var(--color);background:var(${cssScope}--background)}[variant=blockquote]{border-radius:0;border-left:var(${cssScope}--blockquote-width) solid var(--color);border-bottom:none;border-right:none;border-top:none;background:0 0}[part=content]{color:var(--color)}[part=root]{display:grid;align-items:center;grid-template-columns:auto 1fr auto;grid-template-rows:auto 1fr}[part=title]{line-height:2em}[part=icon]{display:inline-grid;align-items:center;height:2em}[part=icon] svg{margin-right:.5em;width:1.25em;height:1.25em}[part=content]{grid-row:span 2/span 2;line-height:1.5em}`)
|
163
171
|
], Alert);
|
164
172
|
var Alert$1 = Alert;
|
165
173
|
|
package/components/alert.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"alert.js","sources":["../src/components/alert.ts"],"sourcesContent":null,"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"alert.js","sources":["../src/components/alert.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,SAAS,GAAG,OAAO;AACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;AAEvC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAA,EAAG,QAAQ,CAAK,EAAA,EAAA,CAAC,CAAE,CAAA,CAAC;AAEpE,MAAM,OAAO,GAAG,CAAC,GAAW,KAAI;IAC9B,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,GAAG,kBAAkB,CACnC,IAAI,EACJ;AACE,IAAA,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;AACvB,IAAA,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;AACrB,IAAA,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC;AACzB,IAAA,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC;AACnB,IAAA,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC;AACzB,IAAA,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC;AACzB,IAAA,IAAI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A,EAAA,KAAA,CAAA,CAAA;AAQjB,UAAA,CAAA;AADC,IAAA,QAAQ;AACwC,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA;AA1D7C,KAAK,GAAA,UAAA,CAAA;IAJV,MAAM,CAAC,SAAS,CAAA;IAChB,MAAM,CACL,GAAG,CAAA,CAAiE,8DAAA,EAAA,QAAQ,oBAAoB,QAAQ,CAAA,sBAAA,EAAyB,QAAQ,CAAA,sBAAA,EAAyB,QAAQ,CAAA,wBAAA,EAA2B,QAAQ,CAAmE,gEAAA,EAAA,QAAQ,CAAkH,8GAAA,EAAA,QAAQ,CAA+C,4CAAA,EAAA,QAAQ,qDAAqD,QAAQ,CAAA,mEAAA,EAAsE,QAAQ,CAAA,ycAAA,CAAmd;AAEniC,CAAA,EAAA,KAAK,CAiGX;AAEA,cAAe,KAAK;;;;"}
|
package/components/avatar.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type TemplateResult } from "lit";
|
1
2
|
import { GlobalStyle } from "../core/global-style.js";
|
2
3
|
/**
|
3
4
|
* {@linkcode Avatar} renders a avatar.
|
@@ -5,6 +6,7 @@ import { GlobalStyle } from "../core/global-style.js";
|
|
5
6
|
* Renders as an image if it has a src property,
|
6
7
|
* otherwise falls back to name or nameless slot.
|
7
8
|
*
|
9
|
+
* @slot - Display content if no `src` or `name` provided.
|
8
10
|
* @category display
|
9
11
|
*/
|
10
12
|
declare class Avatar extends GlobalStyle {
|
@@ -13,11 +15,14 @@ declare class Avatar extends GlobalStyle {
|
|
13
15
|
*/
|
14
16
|
src: string | undefined | null;
|
15
17
|
/**
|
16
|
-
* If the image is not available,
|
18
|
+
* If the image is not available, display name (call {@linkcode Avatar.format}).
|
17
19
|
*/
|
18
20
|
name: string;
|
21
|
+
/**
|
22
|
+
* Display rounded.
|
23
|
+
*/
|
19
24
|
round: boolean;
|
20
|
-
protected render():
|
25
|
+
protected render(): TemplateResult<1>;
|
21
26
|
private _renderAvatar;
|
22
27
|
format(): string;
|
23
28
|
_handleError(): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../src/components/avatar.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAKnE
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../src/components/avatar.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAKnE;;;;;;;;GAQG;AACH,cAIM,MAAO,SAAQ,WAAW;IAC9B;;OAEG;IAEH,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAE/B;;OAEG;IAEH,IAAI,SAAM;IAEV;;OAEG;IAEH,KAAK,UAAS;IAEd,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAIrC,OAAO,CAAC,aAAa;IAUrB,MAAM,IAAI,MAAM;IAIhB,YAAY,IAAI,IAAI;CAGrB;AAED,eAAe,MAAM,CAAC"}
|
package/components/avatar.js
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
import { __decorate } from 'tslib';
|
2
|
-
import { godown
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { godown } from '@godown/element/decorators/godown.js';
|
3
|
+
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
+
import { attr } from '@godown/element/directives/attr.js';
|
5
|
+
import { htmlSlot } from '@godown/element/directives/html-slot.js';
|
6
|
+
import { omit } from '@godown/element/tools/lib.js';
|
7
|
+
import { html, css } from 'lit';
|
5
8
|
import { property } from 'lit/decorators.js';
|
6
9
|
import { scopePrefix, GlobalStyle } from '../core/global-style.js';
|
7
10
|
|
@@ -13,19 +16,23 @@ const cssScope = scopePrefix(protoName);
|
|
13
16
|
* Renders as an image if it has a src property,
|
14
17
|
* otherwise falls back to name or nameless slot.
|
15
18
|
*
|
19
|
+
* @slot - Display content if no `src` or `name` provided.
|
16
20
|
* @category display
|
17
21
|
*/
|
18
22
|
let Avatar = class Avatar extends GlobalStyle {
|
19
23
|
constructor() {
|
20
24
|
super(...arguments);
|
21
25
|
/**
|
22
|
-
* If the image is not available,
|
26
|
+
* If the image is not available, display name (call {@linkcode Avatar.format}).
|
23
27
|
*/
|
24
28
|
this.name = "";
|
29
|
+
/**
|
30
|
+
* Display rounded.
|
31
|
+
*/
|
25
32
|
this.round = false;
|
26
33
|
}
|
27
34
|
render() {
|
28
|
-
return html `<div part="root">${this._renderAvatar()}</div>`;
|
35
|
+
return html `<div part="root" ${attr(omit(this.observedRecord, "src"))}>${this._renderAvatar()}</div>`;
|
29
36
|
}
|
30
37
|
_renderAvatar() {
|
31
38
|
if (this.src) {
|
@@ -54,7 +61,7 @@ __decorate([
|
|
54
61
|
], Avatar.prototype, "round", void 0);
|
55
62
|
Avatar = __decorate([
|
56
63
|
godown(protoName),
|
57
|
-
styles(css `:host{${cssScope}--size:2em;width:var(${cssScope}--size);height:var(${cssScope}--size);display:inline-
|
64
|
+
styles(css `:host{${cssScope}--size:2em;width:var(${cssScope}--size);height:var(${cssScope}--size);vertical-align:bottom}:host,[part=root]{display:inline-flex}:host([contents]) [part=root]{display:inline-flex;width:inherit;height:inherit}:host([round]){border-radius:50%}[part=image]{width:100%;height:100%;object-fit:cover}[part=root]{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;align-items:center;justify-content:center}`)
|
58
65
|
], Avatar);
|
59
66
|
var Avatar$1 = Avatar;
|
60
67
|
|
package/components/avatar.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"avatar.js","sources":["../src/components/avatar.ts"],"sourcesContent":null,"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"avatar.js","sources":["../src/components/avatar.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,SAAS,G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AA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;AAjBT,MAAM,GAAA,UAAA,CAAA;IAJX,MAAM,CAAC,SAAS,CAAA;IAChB,MAAM,CACL,GAAG,CAAA,CAAS,MAAA,EAAA,QAAQ,wBAAwB,QAAQ,CAAA,mBAAA,EAAsB,QAAQ,CAAA,8WAAA,CAAgX;AAE9b,CAAA,EAAA,MAAM,CA0CZ;AAEA,eAAe,MAAM;;;;"}
|
package/components/breath.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type TemplateResult } from "lit";
|
1
2
|
import { GlobalStyle } from "../core/global-style.js";
|
2
3
|
/**
|
3
4
|
* {@linkcode Breath} render the text with a breathing effect.
|
@@ -11,6 +12,7 @@ import { GlobalStyle } from "../core/global-style.js";
|
|
11
12
|
*
|
12
13
|
* Inspired by Vercel home page (2023).
|
13
14
|
*
|
15
|
+
* @slot - Breathing parts.
|
14
16
|
* @category effect
|
15
17
|
*/
|
16
18
|
declare class Breath extends GlobalStyle {
|
@@ -24,8 +26,8 @@ declare class Breath extends GlobalStyle {
|
|
24
26
|
* Effect duration, ending in s or ms.
|
25
27
|
*/
|
26
28
|
duration: string;
|
27
|
-
protected render():
|
28
|
-
protected renderText(text: string):
|
29
|
+
protected render(): TemplateResult<1>;
|
30
|
+
protected renderText(text: string): TemplateResult<1>;
|
29
31
|
protected getTexts(): string[];
|
30
32
|
protected computeStyle(len: number): string;
|
31
33
|
protected parseDuration(): number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breath.d.ts","sourceRoot":"","sources":["../src/components/breath.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"breath.d.ts","sourceRoot":"","sources":["../src/components/breath.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAiB,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAKlF;;;;;;;;;;;;;;GAcG;AACH,cAMM,MAAO,SAAQ,WAAW;IAC9B;;;;OAIG;IAEH,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB;;OAEG;IAEH,QAAQ,EAAE,MAAM,CAAC;IAEjB,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAQrC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAIrD,SAAS,CAAC,QAAQ,IAAI,MAAM,EAAE;IAI9B,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAoB3C,SAAS,CAAC,aAAa,IAAI,MAAM;CAUlC;AAED,eAAe,MAAM,CAAC"}
|
package/components/breath.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
import { __decorate } from 'tslib';
|
2
2
|
import { godown } from '@godown/element/decorators/godown.js';
|
3
3
|
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
+
import { attr } from '@godown/element/directives/attr.js';
|
4
5
|
import { htmlStyle } from '@godown/element/directives/html-style.js';
|
5
|
-
import {
|
6
|
+
import { html, css } from 'lit';
|
6
7
|
import { property } from 'lit/decorators.js';
|
7
|
-
import { scopePrefix,
|
8
|
+
import { scopePrefix, GlobalStyle, cssGlobalVars } from '../core/global-style.js';
|
8
9
|
|
9
10
|
const defineName = "breath";
|
10
11
|
const cssScope = scopePrefix(defineName);
|
@@ -20,15 +21,16 @@ const cssScope = scopePrefix(defineName);
|
|
20
21
|
*
|
21
22
|
* Inspired by Vercel home page (2023).
|
22
23
|
*
|
24
|
+
* @slot - Breathing parts.
|
23
25
|
* @category effect
|
24
26
|
*/
|
25
27
|
let Breath = class Breath extends GlobalStyle {
|
26
28
|
render() {
|
27
29
|
const texts = this.getTexts();
|
28
|
-
return [
|
30
|
+
return html `<div part="root" ${attr(this.observedRecord)}>${[
|
29
31
|
texts.map(this.renderText),
|
30
32
|
htmlStyle(this.computeStyle(texts.length)),
|
31
|
-
]
|
33
|
+
]}</div>`;
|
32
34
|
}
|
33
35
|
renderText(text) {
|
34
36
|
return html `<span class="rel"><span class="nocolor">${text}</span> <span class="colorful">${text}</span></span>`;
|
@@ -44,7 +46,7 @@ let Breath = class Breath extends GlobalStyle {
|
|
44
46
|
+ (() => {
|
45
47
|
let style1 = "";
|
46
48
|
for (let number = 1; number <= len; number++) {
|
47
|
-
const delay = -
|
49
|
+
const delay = -duration / len * (len - number + 1);
|
48
50
|
const defaultNumber = ((number - 1) % 3) + 1;
|
49
51
|
style1 +=
|
50
52
|
`.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
@@ -72,7 +74,7 @@ __decorate([
|
|
72
74
|
], Breath.prototype, "duration", void 0);
|
73
75
|
Breath = __decorate([
|
74
76
|
godown(defineName),
|
75
|
-
styles(css `:host{${cssScope}--deg:60deg;${cssScope}--1-1:var(${cssGlobalVars._colors.red[5]});${cssScope}--1-2:var(${cssGlobalVars._colors.yellow[5]});${cssScope}--2-1:var(${cssGlobalVars._colors.green[5]});${cssScope}--2-2:var(${cssGlobalVars._colors.purple[5]});${cssScope}--3-1:var(${cssGlobalVars._colors.blue[5]});${cssScope}--3-2:var(${cssGlobalVars._colors.pink[5]});${cssScope}--1:linear-gradient(var(${cssScope}--deg),var(${cssScope}--1-1),var(${cssScope}--1-2));${cssScope}--2:linear-gradient(var(${cssScope}--deg),var(${cssScope}--2-1),var(${cssScope}--2-2));${cssScope}--3:linear-gradient(var(${cssScope}--deg),var(${cssScope}--3-1),var(${cssScope}--3-2))}`, css `:host{
|
77
|
+
styles(css `:host{${cssScope}--deg:60deg;${cssScope}--1-1:var(${cssGlobalVars._colors.red[5]});${cssScope}--1-2:var(${cssGlobalVars._colors.yellow[5]});${cssScope}--2-1:var(${cssGlobalVars._colors.green[5]});${cssScope}--2-2:var(${cssGlobalVars._colors.purple[5]});${cssScope}--3-1:var(${cssGlobalVars._colors.blue[5]});${cssScope}--3-2:var(${cssGlobalVars._colors.pink[5]});${cssScope}--1:linear-gradient(var(${cssScope}--deg),var(${cssScope}--1-1),var(${cssScope}--1-2));${cssScope}--2:linear-gradient(var(${cssScope}--deg),var(${cssScope}--2-1),var(${cssScope}--2-2));${cssScope}--3:linear-gradient(var(${cssScope}--deg),var(${cssScope}--3-1),var(${cssScope}--3-2))}`, css `:host{margin:auto;width:-moz-fit-content;width:fit-content;font-size:2em;align-items:center;direction:ltr}:host,:host([contents]) [part=root]{display:flex}[part=root]{display:contents}::selection{background:0 0}.rel{position:relative;font-weight:800;font-size:inherit;letter-spacing:-.05em}`, css `.colorful,.nocolor{padding:0 .05em;box-sizing:border-box;display:inline-block;animation-iteration-count:infinite;color:transparent;-webkit-background-clip:text!important;background-clip:text!important}.colorful{opacity:0;animation-name:colorfulN}.nocolor{position:absolute;top:0;background:var(${cssGlobalVars.clipBackground})}`)
|
76
78
|
], Breath);
|
77
79
|
var Breath$1 = Breath;
|
78
80
|
|
package/components/breath.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breath.js","sources":["../src/components/breath.ts"],"sourcesContent":null,"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"breath.js","sources":["../src/components/breath.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;AASA,MAAM,UAAU,GAAG,QAAQ;AAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC;AAExC;;;;;;;;;;;;;;AAcE;AAOF,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,WAAW,CAAA;IAepB,MAAM,GAAA;AACd,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE;QAC7B,OAAO,IAAI,CAAA,CAAoB,iBAAA,EAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CACtD,CAAA,EAAA;AACA,YAAA,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;YAC1B,SAAS,CAAC,IAAI,CAAC,YAAY,CAA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AA,EAAA,EAAK,QAAQ,CAAA,UAAA,EAAa,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,EAAA,EAAK,QAAQ,CAAa,UAAA,EAAA,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAK,EAAA,EAAA,QAAQ,CAA2B,wBAAA,EAAA,QAAQ,cAAc,QAAQ,CAAA,WAAA,EAAc,QAAQ,CAAA,QAAA,EAAW,QAAQ,CAAA,wBAAA,EAA2B,QAAQ,CAAc,WAAA,EAAA,QAAQ,CAAc,WAAA,EAAA,QAAQ,CAAW,QAAA,EAAA,QAAQ,2BAA2B,QAAQ,CAAA,WAAA,EAAc,QAAQ,CAAA,WAAA,EAAc,QAAQ,CAAA,QAAA,CAAU,EACtpB,GAAG,CAAA,CAAsS,kSAAA,CAAA,EACzS,GAAG,CAAA,ySAA4S,aAAa,CAAC,cAAc,CAAA,EAAA,CAAI;AAE3U,CAAA,EAAA,MAAM,CAkEZ;AAEA,eAAe,MAAM;;;;"}
|
package/components/button.d.ts
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
import { TemplateResult } from "lit";
|
1
2
|
import { GlobalStyle } from "../core/global-style.js";
|
2
|
-
|
3
|
+
type Colors = "teal" | "blue" | "green" | "red" | "purple" | "orange" | "yellow" | "pink" | "gray" | "white" | "black";
|
4
|
+
declare const colors: Record<Colors, string>;
|
3
5
|
/**
|
4
|
-
* {@linkcode Button}.
|
6
|
+
* {@linkcode Button} renders a button.
|
7
|
+
*
|
8
|
+
* Create modal animation upon clicking.
|
9
|
+
*
|
10
|
+
* Available colors (background): none, black, gray, white, blue, green, red, orange, pink, purple, yellow, teal.
|
11
|
+
*
|
12
|
+
* Default color is `black`.
|
13
|
+
*
|
14
|
+
* Set the color to `none` to prevent applying styles.
|
5
15
|
*
|
6
16
|
* @category input
|
7
17
|
*/
|
@@ -11,7 +21,7 @@ declare class Button extends GlobalStyle {
|
|
11
21
|
*/
|
12
22
|
disabled: boolean;
|
13
23
|
/**
|
14
|
-
*
|
24
|
+
* Display ghost.
|
15
25
|
*/
|
16
26
|
ghost: boolean;
|
17
27
|
/**
|
@@ -19,7 +29,7 @@ declare class Button extends GlobalStyle {
|
|
19
29
|
*/
|
20
30
|
active: boolean;
|
21
31
|
/**
|
22
|
-
*
|
32
|
+
* Display rounded.
|
23
33
|
*/
|
24
34
|
round: boolean;
|
25
35
|
/**
|
@@ -27,19 +37,18 @@ declare class Button extends GlobalStyle {
|
|
27
37
|
*/
|
28
38
|
color: "none" | keyof typeof colors;
|
29
39
|
/**
|
30
|
-
*
|
40
|
+
* Content text.
|
31
41
|
*/
|
32
|
-
|
33
|
-
_modalRoot: HTMLElement;
|
34
|
-
_root: HTMLElement;
|
35
|
-
|
36
|
-
protected render(): import("lit").TemplateResult<1>[];
|
42
|
+
content: string;
|
43
|
+
protected _modalRoot: HTMLElement;
|
44
|
+
protected _root: HTMLElement;
|
45
|
+
protected render(): TemplateResult<1>;
|
37
46
|
focus(): void;
|
38
47
|
blur(): void;
|
39
48
|
firstUpdated(): void;
|
40
49
|
protected _handelClick(e: MouseEvent): void;
|
41
50
|
protected _handleModal(e: MouseEvent): void;
|
42
|
-
nextColor():
|
51
|
+
nextColor(): Colors | "none";
|
43
52
|
}
|
44
53
|
export default Button;
|
45
54
|
//# sourceMappingURL=button.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../src/components/button.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../src/components/button.ts"],"names":[],"mappings":"AAOA,OAAO,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,EAAiB,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAQlF,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AACvH,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6DlC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,cAKM,MAAO,SAAQ,WAAW;IAC9B;;OAEG;IAEH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IAEH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IAEH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IAEH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IAEH,KAAK,EAAE,MAAM,GAAG,MAAM,OAAO,MAAM,CAAW;IAE9C;;OAEG;IAEH,OAAO,EAAE,MAAM,CAAC;IAGhB,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;IAElC,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAE7B,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAKrC,KAAK,IAAI,IAAI;IAQb,IAAI,IAAI,IAAI;IAKZ,YAAY,IAAI,IAAI;IAIpB,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAS3C,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAe3C,SAAS,IAAI,MAAM,GAAG,MAAM;CAG7B;AAED,eAAe,MAAM,CAAC"}
|