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
@@ -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,cAqEM,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;IAoBrC,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/dev/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 { css, html
|
16
|
+
import { css, html } from "lit";
|
16
17
|
import { property } from "lit/decorators.js";
|
17
18
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
18
19
|
const protoName = "alert";
|
@@ -21,7 +22,7 @@ const vars = ["color", "background"].map((v) => `${cssScope}--${v}`);
|
|
21
22
|
const genDark = (key) => {
|
22
23
|
return [cssGlobalVars._colors[key][5], cssGlobalVars._colors[key][9]];
|
23
24
|
};
|
24
|
-
const darkStyles =
|
25
|
+
const darkStyles = constructCSSObject(vars, {
|
25
26
|
green: genDark("green"),
|
26
27
|
blue: genDark("blue"),
|
27
28
|
orange: genDark("orange"),
|
@@ -33,11 +34,11 @@ const darkStyles = constructCSS(vars, {
|
|
33
34
|
gray: [cssGlobalVars._colors.lightgray[5], cssGlobalVars._colors.darkgray[5]],
|
34
35
|
white: [cssGlobalVars._colors.lightgray[2], cssGlobalVars._colors.darkgray[7]],
|
35
36
|
black: [cssGlobalVars._colors.darkgray[8], cssGlobalVars._colors.lightgray[5]],
|
36
|
-
}, (
|
37
|
+
}, () => `:host`, (prop) => toVar(prop));
|
37
38
|
const genLight = (key) => {
|
38
39
|
return [cssGlobalVars._colors[key][6], cssGlobalVars._colors[key][0]];
|
39
40
|
};
|
40
|
-
const lightStyles =
|
41
|
+
const lightStyles = constructCSSObject(vars, {
|
41
42
|
green: genLight("green"),
|
42
43
|
blue: genLight("blue"),
|
43
44
|
orange: genLight("orange"),
|
@@ -49,7 +50,7 @@ const lightStyles = constructCSS(vars, {
|
|
49
50
|
gray: [cssGlobalVars._colors.darkgray[5], cssGlobalVars._colors.lightgray[7]],
|
50
51
|
white: [cssGlobalVars._colors.lightgray[0], cssGlobalVars._colors.darkgray[0]],
|
51
52
|
black: [cssGlobalVars._colors.darkgray[7], cssGlobalVars._colors.lightgray[3]],
|
52
|
-
}, (
|
53
|
+
}, () => `:host`, (prop) => toVar(prop));
|
53
54
|
const calls = {
|
54
55
|
tip: {
|
55
56
|
color: "teal",
|
@@ -87,6 +88,8 @@ const calls = {
|
|
87
88
|
/**
|
88
89
|
* {@linkcode Alert} renders a alert.
|
89
90
|
*
|
91
|
+
* Color defaults to blue.
|
92
|
+
*
|
90
93
|
* @slot - Alert content.
|
91
94
|
* @slot title - Alert title.
|
92
95
|
* @slot icon - Alert icon.
|
@@ -95,6 +98,11 @@ const calls = {
|
|
95
98
|
let Alert = class Alert extends GlobalStyle {
|
96
99
|
constructor() {
|
97
100
|
super(...arguments);
|
101
|
+
/**
|
102
|
+
* The tone of the component.
|
103
|
+
* Overrides the color of the call.
|
104
|
+
*/
|
105
|
+
this.color = "blue";
|
98
106
|
/**
|
99
107
|
* Close delay, if 0, it will not be closed automatically.
|
100
108
|
*/
|
@@ -102,7 +110,7 @@ let Alert = class Alert extends GlobalStyle {
|
|
102
110
|
/**
|
103
111
|
* Set true to hide the close button.
|
104
112
|
*
|
105
|
-
* The behavior may change due to the {@linkcode variant} property
|
113
|
+
* The behavior may change due to the {@linkcode variant} property.
|
106
114
|
*/
|
107
115
|
this.hideClose = false;
|
108
116
|
/**
|
@@ -113,15 +121,20 @@ let Alert = class Alert extends GlobalStyle {
|
|
113
121
|
this.variant = "dark";
|
114
122
|
}
|
115
123
|
render() {
|
116
|
-
const color =
|
124
|
+
const color = calls[this.call]?.color || this.color;
|
117
125
|
const icon = this.call ? calls[this.call].icon() : htmlSlot("icon");
|
118
|
-
return html `<div part="root"
|
126
|
+
return html `<div part="root" ${attr(this.observedRecord)}>
|
119
127
|
<div part="icon">${icon}</div>
|
120
128
|
<div part="content">
|
121
|
-
<strong part="title"
|
129
|
+
<strong part="title">
|
130
|
+
${this.title || htmlSlot("title")}
|
131
|
+
</strong>
|
122
132
|
${this.content || htmlSlot()}
|
123
133
|
</div>
|
124
|
-
|
134
|
+
${!this.hideClose && this.variant !== "blockquote"
|
135
|
+
? html `<div part="close" tabindex=0 @click="${this.close}">${iconXmark()}</div>`
|
136
|
+
: ""}
|
137
|
+
${htmlStyle(this.variant === "light" ? lightStyles[color] : darkStyles[color])}
|
125
138
|
</div>`;
|
126
139
|
}
|
127
140
|
close() {
|
@@ -156,17 +169,16 @@ __decorate([
|
|
156
169
|
property()
|
157
170
|
], Alert.prototype, "content", void 0);
|
158
171
|
__decorate([
|
159
|
-
property({
|
160
|
-
type: Boolean,
|
161
|
-
})
|
172
|
+
property({ type: Boolean })
|
162
173
|
], Alert.prototype, "hideClose", void 0);
|
163
174
|
__decorate([
|
164
175
|
property()
|
165
176
|
], Alert.prototype, "variant", void 0);
|
166
177
|
Alert = __decorate([
|
167
178
|
godown(protoName),
|
168
|
-
styles(
|
169
|
-
:host
|
179
|
+
styles(css `
|
180
|
+
:host,
|
181
|
+
:where(:host([contents]) [part=root]) {
|
170
182
|
border-radius: var(${cssScope}--border-radius);
|
171
183
|
${cssScope}--border-radius: .25em;
|
172
184
|
${cssScope}--border-width: .075em;
|
@@ -176,9 +188,10 @@ Alert = __decorate([
|
|
176
188
|
width: 100%;
|
177
189
|
}
|
178
190
|
|
179
|
-
[part=
|
191
|
+
[part=root] {
|
180
192
|
--color: var(${cssScope}--color);
|
181
193
|
color: var(--color);
|
194
|
+
width: 100%;
|
182
195
|
transition: 0.25s;
|
183
196
|
display: flex;
|
184
197
|
justify-content: space-between;
|
@@ -188,7 +201,7 @@ Alert = __decorate([
|
|
188
201
|
background: var(${cssScope}--background);
|
189
202
|
}
|
190
203
|
|
191
|
-
[variant=
|
204
|
+
[variant=blockquote] {
|
192
205
|
border-radius: 0;
|
193
206
|
border-left: var(${cssScope}--blockquote-width) solid var(--color);
|
194
207
|
border-bottom: none;
|
@@ -197,34 +210,34 @@ Alert = __decorate([
|
|
197
210
|
background: transparent;
|
198
211
|
}
|
199
212
|
|
200
|
-
[part=
|
213
|
+
[part=content] {
|
201
214
|
color: var(--color);
|
202
215
|
}
|
203
216
|
|
204
|
-
[part=
|
217
|
+
[part=root] {
|
205
218
|
display: grid;
|
206
219
|
align-items: center;
|
207
220
|
grid-template-columns: auto 1fr auto;
|
208
221
|
grid-template-rows: auto 1fr;
|
209
222
|
}
|
210
223
|
|
211
|
-
[part=
|
224
|
+
[part=title] {
|
212
225
|
line-height: 2em;
|
213
226
|
}
|
214
227
|
|
215
|
-
[part=
|
228
|
+
[part=icon] {
|
216
229
|
display: inline-grid;
|
217
230
|
align-items: center;
|
218
231
|
height: 2em;
|
219
232
|
}
|
220
233
|
|
221
|
-
[part=
|
234
|
+
[part=icon] svg {
|
222
235
|
margin-right: .5em;
|
223
236
|
width: 1.25em;
|
224
237
|
height: 1.25em;
|
225
238
|
}
|
226
239
|
|
227
|
-
[part=
|
240
|
+
[part=content] {
|
228
241
|
grid-row: span 2 / span 2;
|
229
242
|
line-height: 1.5em;
|
230
243
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../src/components/alert.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"","sources":["../../src/components/alert.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CA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{ 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,cA0CM,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;IAMrC,OAAO,CAAC,aAAa;IAUrB,MAAM,IAAI,MAAM;IAIhB,YAAY,IAAI,IAAI;CAGrB;AAED,eAAe,MAAM,CAAC"}
|
package/dev/components/avatar.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
|
-
import { godown
|
3
|
-
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";
|
4
7
|
import { css, html } from "lit";
|
5
8
|
import { property } from "lit/decorators.js";
|
6
9
|
import { GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -12,19 +15,25 @@ const cssScope = scopePrefix(protoName);
|
|
12
15
|
* Renders as an image if it has a src property,
|
13
16
|
* otherwise falls back to name or nameless slot.
|
14
17
|
*
|
18
|
+
* @slot - Display content if no `src` or `name` provided.
|
15
19
|
* @category display
|
16
20
|
*/
|
17
21
|
let Avatar = class Avatar extends GlobalStyle {
|
18
22
|
constructor() {
|
19
23
|
super(...arguments);
|
20
24
|
/**
|
21
|
-
* If the image is not available,
|
25
|
+
* If the image is not available, display name (call {@linkcode Avatar.format}).
|
22
26
|
*/
|
23
27
|
this.name = "";
|
28
|
+
/**
|
29
|
+
* Display rounded.
|
30
|
+
*/
|
24
31
|
this.round = false;
|
25
32
|
}
|
26
33
|
render() {
|
27
|
-
return html `<div part="root"
|
34
|
+
return html `<div part="root" ${attr(omit(this.observedRecord, "src"))}>
|
35
|
+
${this._renderAvatar()}
|
36
|
+
</div>`;
|
28
37
|
}
|
29
38
|
_renderAvatar() {
|
30
39
|
if (this.src) {
|
@@ -54,34 +63,40 @@ __decorate([
|
|
54
63
|
Avatar = __decorate([
|
55
64
|
godown(protoName),
|
56
65
|
styles(css `
|
57
|
-
:host
|
66
|
+
:host{
|
58
67
|
${cssScope}--size: 2em;
|
59
68
|
width: var(${cssScope}--size);
|
60
69
|
height: var(${cssScope}--size);
|
61
|
-
display: inline-block;
|
62
70
|
vertical-align: bottom;
|
63
71
|
}
|
64
72
|
|
65
|
-
:host
|
73
|
+
:host,
|
74
|
+
[part=root] {
|
75
|
+
display: inline-flex;
|
76
|
+
}
|
77
|
+
|
78
|
+
:host([contents]) [part=root] {
|
79
|
+
display: inline-flex;
|
80
|
+
width: inherit;
|
81
|
+
height: inherit;
|
82
|
+
}
|
83
|
+
|
84
|
+
:host([round]) {
|
66
85
|
border-radius:50%;
|
67
86
|
}
|
68
87
|
|
69
|
-
[part=
|
88
|
+
[part=image] {
|
70
89
|
width: 100%;
|
71
90
|
height: 100%;
|
72
91
|
object-fit: cover;
|
73
92
|
}
|
74
93
|
|
75
|
-
[part=
|
94
|
+
[part=root] {
|
76
95
|
overflow: hidden;
|
77
96
|
position: relative;
|
78
97
|
border-radius: inherit;
|
79
98
|
width: 100%;
|
80
99
|
height: 100%;
|
81
|
-
}
|
82
|
-
|
83
|
-
[part="root"] {
|
84
|
-
display: flex;
|
85
100
|
align-items: center;
|
86
101
|
justify-content: center;
|
87
102
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/components/avatar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/components/avatar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC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IA1CX,MAAM,CAAC,SAAS,CAAC;IACjB,MAAM,CACL,GAAG,CAAA;;QAEG,QAAQ;mBACG,QAAQ;oBACP,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCzB,CACF;GACK,MAAM,CA0CX;AAED,eAAe,MAAM,CAAC"}
|
@@ -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,cAqEM,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;IAUrC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAOrD,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/dev/components/breath.js
CHANGED
@@ -1,6 +1,7 @@
|
|
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
6
|
import { css, html } from "lit";
|
6
7
|
import { property } from "lit/decorators.js";
|
@@ -19,15 +20,18 @@ const cssScope = scopePrefix(defineName);
|
|
19
20
|
*
|
20
21
|
* Inspired by Vercel home page (2023).
|
21
22
|
*
|
23
|
+
* @slot - Breathing parts.
|
22
24
|
* @category effect
|
23
25
|
*/
|
24
26
|
let Breath = class Breath extends GlobalStyle {
|
25
27
|
render() {
|
26
28
|
const texts = this.getTexts();
|
27
|
-
return
|
29
|
+
return html `<div part="root" ${attr(this.observedRecord)}>
|
30
|
+
${[
|
28
31
|
texts.map(this.renderText),
|
29
32
|
htmlStyle(this.computeStyle(texts.length)),
|
30
|
-
]
|
33
|
+
]}
|
34
|
+
</div>`;
|
31
35
|
}
|
32
36
|
renderText(text) {
|
33
37
|
return html `<span class="rel">
|
@@ -46,7 +50,7 @@ let Breath = class Breath extends GlobalStyle {
|
|
46
50
|
+ (() => {
|
47
51
|
let style1 = "";
|
48
52
|
for (let number = 1; number <= len; number++) {
|
49
|
-
const delay = -
|
53
|
+
const delay = -duration / len * (len - number + 1);
|
50
54
|
const defaultNumber = ((number - 1) % 3) + 1;
|
51
55
|
style1 +=
|
52
56
|
`.rel:nth-child(${number}) .colorful{animation-delay:${delay}s;background:var(${cssScope}--${number},var(${cssScope}--${defaultNumber}));}`;
|
@@ -89,12 +93,20 @@ Breath = __decorate([
|
|
89
93
|
}
|
90
94
|
`, css `
|
91
95
|
:host {
|
92
|
-
display: flex;
|
93
96
|
margin: auto;
|
94
|
-
width: -moz-fit-content;
|
95
97
|
width: fit-content;
|
96
98
|
font-size: 2em;
|
97
99
|
align-items: center;
|
100
|
+
direction: ltr;
|
101
|
+
}
|
102
|
+
|
103
|
+
:host,
|
104
|
+
:host([contents]) [part=root] {
|
105
|
+
display: flex;
|
106
|
+
}
|
107
|
+
|
108
|
+
[part=root] {
|
109
|
+
display: contents;
|
98
110
|
}
|
99
111
|
|
100
112
|
::selection {
|
@@ -114,14 +126,16 @@ Breath = __decorate([
|
|
114
126
|
box-sizing: border-box;
|
115
127
|
display: inline-block;
|
116
128
|
animation-iteration-count: infinite;
|
117
|
-
|
129
|
+
color: transparent;
|
118
130
|
-webkit-background-clip: text !important;
|
119
131
|
background-clip: text !important;
|
120
132
|
}
|
133
|
+
|
121
134
|
.colorful {
|
122
135
|
opacity: 0;
|
123
136
|
animation-name: colorfulN;
|
124
137
|
}
|
138
|
+
|
125
139
|
.nocolor {
|
126
140
|
position: absolute;
|
127
141
|
top: 0;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"breath.js","sourceRoot":"","sources":["../../src/components/breath.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,IAAI,
|
1
|
+
{"version":3,"file":"breath.js","sourceRoot":"","sources":["../../src/components/breath.ts"],"names":[],"mappings":";AAAA,OA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CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AA3DC;IADC,QAAQ,EAAE;oCACa;AAMxB;IADC,QAAQ,EAAE;wCACM;AAbb,MAAM;IArEX,MAAM,CAAC,UAAU,CAAC;IAClB,MAAM,CACL,GAAG,CAAA;;QAEG,QAAQ;QACR,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACpD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACnD,QAAQ,cAAc,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACnD,QAAQ,4BAA4B,QAAQ,eAAe,QAAQ,eAAe,QAAQ;QAC1F,QAAQ,4BAA4B,QAAQ,eAAe,QAAQ,eAAe,QAAQ;QAC1F,QAAQ,4BAA4B,QAAQ,eAAe,QAAQ,eAAe,QAAQ;;GAE/F,EACD,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BF,EACD,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;wBAoBmB,aAAa,CAAC,cAAc;;GAEjD,CACF;GACK,MAAM,CAkEX;AAED,eAAe,MAAM,CAAC"}
|
@@ -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,cAkGM,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;IAUrC,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"}
|