godown 3.0.0-canary.10 → 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 +1 -1
- package/components/alert.d.ts +2 -1
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +5 -7
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts +2 -1
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +7 -4
- package/components/avatar.js.map +1 -1
- package/components/breath.d.ts +3 -2
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +4 -3
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +5 -3
- package/components/button.d.ts.map +1 -1
- package/components/button.js +3 -2
- package/components/button.js.map +1 -1
- package/components/card.d.ts +2 -1
- package/components/card.d.ts.map +1 -1
- package/components/card.js +4 -3
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +3 -1
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +15 -9
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +2 -1
- package/components/details.d.ts.map +1 -1
- package/components/details.js +2 -1
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +2 -2
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +3 -2
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts +2 -3
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +5 -6
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts +2 -1
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +2 -1
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts +2 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +5 -4
- package/components/flex.js.map +1 -1
- package/components/form.d.ts +2 -1
- package/components/form.d.ts.map +1 -1
- package/components/form.js.map +1 -1
- package/components/grid.d.ts +2 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +5 -4
- package/components/grid.js.map +1 -1
- package/components/input.d.ts +2 -1
- package/components/input.d.ts.map +1 -1
- package/components/input.js +2 -1
- package/components/input.js.map +1 -1
- package/components/layout.d.ts +2 -1
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +5 -5
- package/components/layout.js.map +1 -1
- package/components/link.d.ts.map +1 -1
- package/components/progress.d.ts +2 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +3 -2
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +3 -2
- package/components/range.d.ts.map +1 -1
- package/components/range.js +3 -6
- package/components/range.js.map +1 -1
- package/components/rotate.d.ts +2 -1
- package/components/rotate.d.ts.map +1 -1
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +9 -9
- package/components/router.d.ts.map +1 -1
- package/components/router.js.map +1 -1
- package/components/select.d.ts +2 -1
- package/components/select.d.ts.map +1 -1
- package/components/select.js +8 -4
- 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 +3 -2
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts +2 -1
- package/components/split.d.ts.map +1 -1
- package/components/split.js +3 -2
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +2 -1
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +3 -2
- 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 +3 -4
- package/components/text.js.map +1 -1
- package/components/time.d.ts +2 -2
- package/components/time.d.ts.map +1 -1
- package/components/time.js +3 -2
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +2 -1
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +3 -2
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +2 -2
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +3 -4
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +1 -1
- 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 +3 -2
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +3 -2
- package/core/super-input.d.ts.map +1 -1
- 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 +2 -1
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +12 -10
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +2 -1
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +21 -7
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/breath.d.ts +3 -2
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +17 -5
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +5 -3
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +6 -1
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts +2 -1
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +8 -5
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts +3 -1
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +26 -13
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +2 -1
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +8 -3
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +2 -2
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +11 -10
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts +2 -3
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +19 -7
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +2 -1
- 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 +2 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +16 -4
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts +2 -1
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts +2 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +16 -4
- package/dev/components/grid.js.map +1 -1
- package/dev/components/input.d.ts +2 -1
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +2 -1
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts +2 -1
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +13 -6
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/progress.d.ts +2 -1
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +7 -2
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +3 -2
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +9 -12
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +2 -1
- 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 +9 -9
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +2 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +18 -7
- 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 +4 -3
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts +2 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +14 -10
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts +2 -1
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +13 -9
- 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 +4 -4
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +2 -2
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +5 -2
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts +2 -1
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +24 -12
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +2 -2
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +11 -4
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +10 -1
- 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 +3 -2
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +1 -1
- 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/package.json +5 -4
- package/src/components/alert.ts +18 -16
- package/src/components/avatar.ts +25 -11
- package/src/components/breath.ts +22 -10
- package/src/components/button.ts +16 -10
- package/src/components/card.ts +9 -6
- package/src/components/carousel.ts +35 -21
- package/src/components/details.ts +10 -5
- package/src/components/dialog.ts +18 -17
- package/src/components/divider.ts +19 -7
- package/src/components/dragbox.ts +15 -8
- package/src/components/flex.ts +17 -5
- package/src/components/form.ts +4 -4
- package/src/components/grid.ts +17 -5
- package/src/components/input.ts +5 -4
- package/src/components/layout.ts +15 -8
- package/src/components/link.ts +1 -1
- package/src/components/progress.ts +9 -4
- package/src/components/range.ts +29 -34
- package/src/components/rotate.ts +9 -6
- package/src/components/router.ts +27 -19
- package/src/components/select.ts +31 -18
- package/src/components/skeleton.ts +6 -5
- package/src/components/split.ts +22 -18
- package/src/components/switch.ts +18 -14
- package/src/components/text.ts +6 -8
- package/src/components/time.ts +12 -9
- package/src/components/tooltip.ts +26 -14
- package/src/components/typewriter.ts +19 -14
- package/src/core/global-style.ts +23 -4
- package/src/core/super-anchor.ts +11 -8
- package/src/core/super-input.ts +14 -14
- package/src/core/super-openable.ts +5 -5
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"super-openable.js","sourceRoot":"","sources":["../../src/core/super-openable.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,aAAc,SAAQ,WAAW;IAAvC;;QACE;;WAEG;QAEH,SAAI,GAAG,KAAK,CAAC;IAyBf,CAAC;IAvBC,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"super-openable.js","sourceRoot":"","sources":["../../src/core/super-openable.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,aAAc,SAAQ,WAAW;IAAvC;;QACE;;WAEG;QAEH,SAAI,GAAG,KAAK,CAAC;IAyBf,CAAC;IAvBC,MAAM,CAAC,KAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAmB;QACjD,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAES,OAAO,CAAC,iBAAyC;QACzD,MAAM,IAAI,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,2BAA2B;IACjB,YAAY,CAAC,CAAa;QAClC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF;AAzBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAC9B;AA2Bf,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "godown",
|
3
|
-
"version": "3.0.0-canary.
|
4
|
-
"description": "
|
3
|
+
"version": "3.0.0-canary.11",
|
4
|
+
"description": "Non Composite Web Components Library",
|
5
5
|
"type": "module",
|
6
6
|
"main": "index.js",
|
7
7
|
"exports": {
|
@@ -13,6 +13,7 @@
|
|
13
13
|
"development": "./dev/*",
|
14
14
|
"default": "./*"
|
15
15
|
},
|
16
|
+
"./src/*": "./src/*",
|
16
17
|
"./*.json": "./*.json"
|
17
18
|
},
|
18
19
|
"repository": {
|
@@ -28,8 +29,8 @@
|
|
28
29
|
"lit": "^3.0.0",
|
29
30
|
"tslib": "^2.7.0",
|
30
31
|
"@godown/colors": "^0.0.1",
|
31
|
-
"@godown/element": "^0.0
|
32
|
-
"@godown/f7-icon": "^0.0.
|
32
|
+
"@godown/element": "^0.1.0",
|
33
|
+
"@godown/f7-icon": "^0.0.4"
|
33
34
|
},
|
34
35
|
"publishConfig": {
|
35
36
|
"access": "public"
|
package/src/components/alert.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
+
import { attr } from "@godown/element/directives/attr.js";
|
3
4
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
5
|
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
5
6
|
import { constructCSSObject, toVar } from "@godown/element/tools/css.js";
|
@@ -11,7 +12,7 @@ import iconQuestionCircle from "@godown/f7-icon/icons/question-circle.js";
|
|
11
12
|
import iconSlashCircle from "@godown/f7-icon/icons/slash-circle.js";
|
12
13
|
import iconXmark from "@godown/f7-icon/icons/xmark.js";
|
13
14
|
import iconXmarkCircle from "@godown/f7-icon/icons/xmark-circle.js";
|
14
|
-
import { css, html } from "lit";
|
15
|
+
import { css, html, type TemplateResult } from "lit";
|
15
16
|
import { property } from "lit/decorators.js";
|
16
17
|
|
17
18
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -115,7 +116,8 @@ const calls = {
|
|
115
116
|
@godown(protoName)
|
116
117
|
@styles(
|
117
118
|
css`
|
118
|
-
:host
|
119
|
+
:host,
|
120
|
+
:where(:host([contents]) [part=root]) {
|
119
121
|
border-radius: var(${cssScope}--border-radius);
|
120
122
|
${cssScope}--border-radius: .25em;
|
121
123
|
${cssScope}--border-width: .075em;
|
@@ -147,7 +149,7 @@ const calls = {
|
|
147
149
|
background: transparent;
|
148
150
|
}
|
149
151
|
|
150
|
-
[part=content]{
|
152
|
+
[part=content] {
|
151
153
|
color: var(--color);
|
152
154
|
}
|
153
155
|
|
@@ -240,32 +242,32 @@ class Alert extends GlobalStyle {
|
|
240
242
|
@property()
|
241
243
|
variant: "blockquote" | "dark" | "light" = "dark";
|
242
244
|
|
243
|
-
protected render() {
|
245
|
+
protected render(): TemplateResult<1> {
|
244
246
|
const color = calls[this.call]?.color || this.color;
|
245
247
|
const icon = this.call ? calls[this.call].icon() : htmlSlot("icon");
|
246
|
-
return
|
247
|
-
html`<div part="root" variant="${this.variant}">
|
248
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
248
249
|
<div part="icon">${icon}</div>
|
249
250
|
<div part="content">
|
250
|
-
<strong part="title"
|
251
|
+
<strong part="title">
|
252
|
+
${this.title || htmlSlot("title")}
|
253
|
+
</strong>
|
251
254
|
${this.content || htmlSlot()}
|
252
255
|
</div>
|
253
256
|
${
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
];
|
257
|
+
!this.hideClose && this.variant !== "blockquote"
|
258
|
+
? html`<div part="close" tabindex=0 @click="${this.close}">${iconXmark()}</div>`
|
259
|
+
: ""
|
260
|
+
}
|
261
|
+
${htmlStyle(this.variant === "light" ? lightStyles[color] : darkStyles[color])}
|
262
|
+
</div>`;
|
261
263
|
}
|
262
264
|
|
263
|
-
close() {
|
265
|
+
close(): void {
|
264
266
|
this.remove();
|
265
267
|
this.dispatchEvent(new CustomEvent("close", { bubbles: true, composed: true }));
|
266
268
|
}
|
267
269
|
|
268
|
-
protected firstUpdated() {
|
270
|
+
protected firstUpdated(): void {
|
269
271
|
if (this.autoclose) {
|
270
272
|
setTimeout(() => this.close(), this.autoclose);
|
271
273
|
}
|
package/src/components/avatar.ts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
import { godown
|
2
|
-
import {
|
3
|
-
import {
|
1
|
+
import { godown } from "@godown/element/decorators/godown.js";
|
2
|
+
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
+
import { attr } from "@godown/element/directives/attr.js";
|
4
|
+
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
+
import { omit } from "@godown/element/tools/lib.js";
|
6
|
+
import { css, html, type TemplateResult } from "lit";
|
4
7
|
import { property } from "lit/decorators.js";
|
5
8
|
|
6
9
|
import { GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -20,15 +23,25 @@ const cssScope = scopePrefix(protoName);
|
|
20
23
|
@godown(protoName)
|
21
24
|
@styles(
|
22
25
|
css`
|
23
|
-
:host
|
26
|
+
:host{
|
24
27
|
${cssScope}--size: 2em;
|
25
28
|
width: var(${cssScope}--size);
|
26
29
|
height: var(${cssScope}--size);
|
27
|
-
display: inline-block;
|
28
30
|
vertical-align: bottom;
|
29
31
|
}
|
30
32
|
|
31
|
-
:host
|
33
|
+
:host,
|
34
|
+
[part=root] {
|
35
|
+
display: inline-flex;
|
36
|
+
}
|
37
|
+
|
38
|
+
:host([contents]) [part=root] {
|
39
|
+
display: inline-flex;
|
40
|
+
width: inherit;
|
41
|
+
height: inherit;
|
42
|
+
}
|
43
|
+
|
44
|
+
:host([round]) {
|
32
45
|
border-radius:50%;
|
33
46
|
}
|
34
47
|
|
@@ -44,7 +57,6 @@ const cssScope = scopePrefix(protoName);
|
|
44
57
|
border-radius: inherit;
|
45
58
|
width: 100%;
|
46
59
|
height: 100%;
|
47
|
-
display: flex;
|
48
60
|
align-items: center;
|
49
61
|
justify-content: center;
|
50
62
|
}
|
@@ -69,8 +81,10 @@ class Avatar extends GlobalStyle {
|
|
69
81
|
@property({ type: Boolean })
|
70
82
|
round = false;
|
71
83
|
|
72
|
-
protected render() {
|
73
|
-
return html`<div part="root"
|
84
|
+
protected render(): TemplateResult<1> {
|
85
|
+
return html`<div part="root" ${attr(omit(this.observedRecord, "src"))}>
|
86
|
+
${this._renderAvatar()}
|
87
|
+
</div>`;
|
74
88
|
}
|
75
89
|
|
76
90
|
private _renderAvatar() {
|
@@ -83,11 +97,11 @@ class Avatar extends GlobalStyle {
|
|
83
97
|
return htmlSlot();
|
84
98
|
}
|
85
99
|
|
86
|
-
format() {
|
100
|
+
format(): string {
|
87
101
|
return this.name;
|
88
102
|
}
|
89
103
|
|
90
|
-
_handleError() {
|
104
|
+
_handleError(): void {
|
91
105
|
this.src = undefined;
|
92
106
|
}
|
93
107
|
}
|
package/src/components/breath.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
+
import { attr } from "@godown/element/directives/attr.js";
|
3
4
|
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
4
|
-
import { css, html } from "lit";
|
5
|
+
import { css, html, type TemplateResult } from "lit";
|
5
6
|
import { property } from "lit/decorators.js";
|
6
7
|
|
7
8
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -42,15 +43,22 @@ const cssScope = scopePrefix(defineName);
|
|
42
43
|
`,
|
43
44
|
css`
|
44
45
|
:host {
|
45
|
-
display: flex;
|
46
46
|
margin: auto;
|
47
|
-
width: -moz-fit-content;
|
48
47
|
width: fit-content;
|
49
48
|
font-size: 2em;
|
50
49
|
align-items: center;
|
51
50
|
direction: ltr;
|
52
51
|
}
|
53
52
|
|
53
|
+
:host,
|
54
|
+
:host([contents]) [part=root] {
|
55
|
+
display: flex;
|
56
|
+
}
|
57
|
+
|
58
|
+
[part=root] {
|
59
|
+
display: contents;
|
60
|
+
}
|
61
|
+
|
54
62
|
::selection {
|
55
63
|
background: none;
|
56
64
|
}
|
@@ -69,14 +77,16 @@ const cssScope = scopePrefix(defineName);
|
|
69
77
|
box-sizing: border-box;
|
70
78
|
display: inline-block;
|
71
79
|
animation-iteration-count: infinite;
|
72
|
-
|
80
|
+
color: transparent;
|
73
81
|
-webkit-background-clip: text !important;
|
74
82
|
background-clip: text !important;
|
75
83
|
}
|
84
|
+
|
76
85
|
.colorful {
|
77
86
|
opacity: 0;
|
78
87
|
animation-name: colorfulN;
|
79
88
|
}
|
89
|
+
|
80
90
|
.nocolor {
|
81
91
|
position: absolute;
|
82
92
|
top: 0;
|
@@ -99,15 +109,17 @@ class Breath extends GlobalStyle {
|
|
99
109
|
@property()
|
100
110
|
duration: string;
|
101
111
|
|
102
|
-
protected render() {
|
112
|
+
protected render(): TemplateResult<1> {
|
103
113
|
const texts = this.getTexts();
|
104
|
-
return
|
114
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
115
|
+
${[
|
105
116
|
texts.map(this.renderText),
|
106
117
|
htmlStyle(this.computeStyle(texts.length)),
|
107
|
-
]
|
118
|
+
]}
|
119
|
+
</div>`;
|
108
120
|
}
|
109
121
|
|
110
|
-
protected renderText(text: string) {
|
122
|
+
protected renderText(text: string): TemplateResult<1> {
|
111
123
|
return html`<span class="rel">
|
112
124
|
<span class="nocolor">${text}</span>
|
113
125
|
<span class="colorful">${text}</span>
|
@@ -118,7 +130,7 @@ class Breath extends GlobalStyle {
|
|
118
130
|
return Array.isArray(this.text) ? this.text : (this.text || this.textContent).split(/\s+/).filter((x) => x);
|
119
131
|
}
|
120
132
|
|
121
|
-
protected computeStyle(len: number) {
|
133
|
+
protected computeStyle(len: number): string {
|
122
134
|
const gap = 100 / 2 / len;
|
123
135
|
const duration = this.parseDuration() || len * 2 + 2;
|
124
136
|
|
@@ -138,7 +150,7 @@ class Breath extends GlobalStyle {
|
|
138
150
|
);
|
139
151
|
}
|
140
152
|
|
141
|
-
protected parseDuration() {
|
153
|
+
protected parseDuration(): number {
|
142
154
|
const { duration } = this;
|
143
155
|
if (duration) {
|
144
156
|
if (duration.endsWith("s")) {
|
package/src/components/button.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { part } from "@godown/element/decorators/part.js";
|
3
3
|
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
+
import { attr } from "@godown/element/directives/attr.js";
|
4
5
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
6
|
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
6
7
|
import { constructCSSObject, toVar } from "@godown/element/tools/css.js";
|
7
|
-
import { css, html } from "lit";
|
8
|
+
import { css, html, TemplateResult } from "lit";
|
8
9
|
import { property } from "lit/decorators.js";
|
9
10
|
|
10
11
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -15,7 +16,8 @@ const cssScope = scopePrefix(protoName);
|
|
15
16
|
const whiteFont = cssGlobalVars.white;
|
16
17
|
const blackFont = cssGlobalVars.black;
|
17
18
|
|
18
|
-
|
19
|
+
type Colors = "teal" | "blue" | "green" | "red" | "purple" | "orange" | "yellow" | "pink" | "gray" | "white" | "black";
|
20
|
+
const colors: Record<Colors, string> = constructCSSObject(
|
19
21
|
["color", "background", "gradients"].map((k) => `${cssScope}--${k}`),
|
20
22
|
{
|
21
23
|
black: [
|
@@ -142,6 +144,10 @@ const colors = constructCSSObject(
|
|
142
144
|
cursor: pointer;
|
143
145
|
}
|
144
146
|
|
147
|
+
:host([contents]) [part=root] {
|
148
|
+
width: fit-content;
|
149
|
+
}
|
150
|
+
|
145
151
|
[part=root] {
|
146
152
|
width: 100%;
|
147
153
|
height: 100%;
|
@@ -227,9 +233,9 @@ class Button extends GlobalStyle {
|
|
227
233
|
@part("root")
|
228
234
|
protected _root: HTMLElement;
|
229
235
|
|
230
|
-
protected render() {
|
236
|
+
protected render(): TemplateResult<1> {
|
231
237
|
const color = this.nextColor();
|
232
|
-
return html`<div part="root">
|
238
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
233
239
|
<span part="modal-root"></span>
|
234
240
|
<div part="content">
|
235
241
|
${[this.content || htmlSlot(), htmlStyle(colors[color])]}
|
@@ -237,7 +243,7 @@ class Button extends GlobalStyle {
|
|
237
243
|
</div>`;
|
238
244
|
}
|
239
245
|
|
240
|
-
focus() {
|
246
|
+
focus(): void {
|
241
247
|
if (this.disabled) {
|
242
248
|
return;
|
243
249
|
}
|
@@ -245,16 +251,16 @@ class Button extends GlobalStyle {
|
|
245
251
|
super.focus();
|
246
252
|
}
|
247
253
|
|
248
|
-
blur() {
|
254
|
+
blur(): void {
|
249
255
|
this.active = false;
|
250
256
|
super.blur();
|
251
257
|
}
|
252
258
|
|
253
|
-
firstUpdated() {
|
259
|
+
firstUpdated(): void {
|
254
260
|
this.events.add(this, "click", this._handelClick, true);
|
255
261
|
}
|
256
262
|
|
257
|
-
protected _handelClick(e: MouseEvent) {
|
263
|
+
protected _handelClick(e: MouseEvent): void {
|
258
264
|
if (this.disabled) {
|
259
265
|
e.stopPropagation();
|
260
266
|
e.preventDefault();
|
@@ -263,7 +269,7 @@ class Button extends GlobalStyle {
|
|
263
269
|
this._handleModal(e);
|
264
270
|
}
|
265
271
|
|
266
|
-
protected _handleModal(e: MouseEvent) {
|
272
|
+
protected _handleModal(e: MouseEvent): void {
|
267
273
|
const modal = document.createElement("i");
|
268
274
|
const rect = this.getBoundingClientRect();
|
269
275
|
const h = rect.height;
|
@@ -278,7 +284,7 @@ class Button extends GlobalStyle {
|
|
278
284
|
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
279
285
|
}
|
280
286
|
|
281
|
-
nextColor() {
|
287
|
+
nextColor(): Colors | "none" {
|
282
288
|
return this.color;
|
283
289
|
}
|
284
290
|
}
|
package/src/components/card.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
+
import { attr } from "@godown/element/directives/attr.js";
|
3
4
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
|
-
import { css } from "lit";
|
5
|
+
import { css, html, type TemplateResult } from "lit";
|
5
6
|
import { property } from "lit/decorators.js";
|
6
7
|
|
7
8
|
import { cssGlobalVars, GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -52,11 +53,11 @@ const cssScope = scopePrefix(protoName);
|
|
52
53
|
border-style: solid;
|
53
54
|
}
|
54
55
|
|
55
|
-
[name=footer]{
|
56
|
+
[name=footer] {
|
56
57
|
border-top-width: var(${cssScope}--border-width);
|
57
58
|
}
|
58
59
|
|
59
|
-
[name=header]{
|
60
|
+
[name=header] {
|
60
61
|
border-bottom-width: var(${cssScope}--border-width);
|
61
62
|
}
|
62
63
|
`,
|
@@ -68,12 +69,14 @@ class Card extends GlobalStyle {
|
|
68
69
|
@property({ type: Boolean })
|
69
70
|
header = false;
|
70
71
|
|
71
|
-
protected render() {
|
72
|
-
return
|
72
|
+
protected render(): TemplateResult<1> {
|
73
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
74
|
+
${[
|
73
75
|
this.header ? htmlSlot("header") : "",
|
74
76
|
htmlSlot(),
|
75
77
|
this.footer ? htmlSlot("footer") : "",
|
76
|
-
]
|
78
|
+
]}
|
79
|
+
</div>`;
|
77
80
|
}
|
78
81
|
}
|
79
82
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { part } from "@godown/element/decorators/part.js";
|
3
3
|
import { styles } from "@godown/element/decorators/styles.js";
|
4
|
+
import { attr } from "@godown/element/directives/attr.js";
|
4
5
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
6
|
import { htmlStyle } from "@godown/element/directives/html-style.js";
|
6
7
|
import iconChevronLeft from "@godown/f7-icon/icons/chevron-left.js";
|
7
8
|
import iconChevronRight from "@godown/f7-icon/icons/chevron-right.js";
|
8
|
-
import { css, html } from "lit";
|
9
|
+
import { css, html, type TemplateResult } from "lit";
|
9
10
|
import { property } from "lit/decorators.js";
|
10
11
|
|
11
12
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -99,18 +100,22 @@ class Carousel extends GlobalStyle {
|
|
99
100
|
|
100
101
|
private _cloneLast: HTMLElement | undefined;
|
101
102
|
|
102
|
-
protected render() {
|
103
|
-
return
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
103
|
+
protected render(): TemplateResult<1> {
|
104
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
105
|
+
<i part="prev" @click="${this.prev}">
|
106
|
+
${iconChevronLeft()}
|
107
|
+
</i>
|
108
|
+
<div part="move-root" style="transform:${`translateX(-${this.index + 1}00%)`}">
|
109
|
+
${htmlSlot()}
|
110
|
+
</div>
|
111
|
+
<i part="next" @click="${this.next}">
|
112
|
+
${iconChevronRight()}
|
113
|
+
</i>
|
114
|
+
${htmlStyle(`:host,:host([contents]) [part=root]{width:${this.width};}`)}
|
115
|
+
</div>`;
|
111
116
|
}
|
112
117
|
|
113
|
-
protected async firstUpdated() {
|
118
|
+
protected async firstUpdated(): Promise<void> {
|
114
119
|
await this.updateComplete;
|
115
120
|
|
116
121
|
if (this.children.length) {
|
@@ -124,46 +129,55 @@ class Carousel extends GlobalStyle {
|
|
124
129
|
this.insertBefore(this._cloneFirst, this.firstElementChild);
|
125
130
|
this.show(this.index);
|
126
131
|
}
|
127
|
-
|
128
|
-
this.intervalID = window.setInterval(() => {
|
129
|
-
this.next();
|
130
|
-
}, this.autoChange);
|
131
|
-
}
|
132
|
+
this.checkInterval();
|
132
133
|
}
|
133
134
|
|
134
|
-
disconnectedCallback() {
|
135
|
+
disconnectedCallback(): void {
|
135
136
|
clearInterval(this.intervalID);
|
136
137
|
}
|
137
138
|
|
138
|
-
show(i: number) {
|
139
|
+
show(i: number): void {
|
139
140
|
this.index = i;
|
140
141
|
}
|
141
142
|
|
142
|
-
next() {
|
143
|
+
next(): void {
|
143
144
|
if (this.index === this.childElementCount - 3) {
|
144
145
|
this._doTranslateX("0", true);
|
145
146
|
this.show(0);
|
146
147
|
} else {
|
147
148
|
this.show(this.index + 1);
|
148
149
|
}
|
150
|
+
this.checkInterval();
|
149
151
|
}
|
150
152
|
|
151
|
-
prev() {
|
153
|
+
prev(): void {
|
152
154
|
if (this.index === 0) {
|
153
155
|
this._doTranslateX(`-${this.childElementCount - 1}00%`, true);
|
154
156
|
this.show(this.children.length - 3);
|
155
157
|
} else {
|
156
158
|
this.show(this.index - 1);
|
157
159
|
}
|
160
|
+
this.checkInterval();
|
158
161
|
}
|
159
162
|
|
160
|
-
protected _doTranslateX(xValue: string, noTransition?: boolean) {
|
163
|
+
protected _doTranslateX(xValue: string, noTransition?: boolean): void {
|
161
164
|
this._moveRoot.style.transform = `translateX(${xValue})`;
|
162
165
|
if (noTransition) {
|
163
166
|
this._moveRoot.style.transition = `none`;
|
164
167
|
}
|
165
168
|
this._moveRoot.getBoundingClientRect();
|
166
169
|
}
|
170
|
+
|
171
|
+
checkInterval(): void {
|
172
|
+
if (this.autoChange) {
|
173
|
+
if (this.intervalID) {
|
174
|
+
clearInterval(this.intervalID);
|
175
|
+
}
|
176
|
+
this.intervalID = window.setInterval(() => {
|
177
|
+
this.next();
|
178
|
+
}, this.autoChange);
|
179
|
+
}
|
180
|
+
}
|
167
181
|
}
|
168
182
|
|
169
183
|
export default Carousel;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
+
import { attr } from "@godown/element/directives/attr.js";
|
3
4
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
5
|
import svgCaretDown from "@godown/f7-icon/icons/chevron-down.js";
|
5
|
-
import { css, html } from "lit";
|
6
|
+
import { css, html, type TemplateResult } from "lit";
|
6
7
|
import { property, query } from "lit/decorators.js";
|
7
8
|
|
8
9
|
import { scopePrefix } from "../core/global-style.js";
|
@@ -100,11 +101,15 @@ class Details extends SuperOpenable {
|
|
100
101
|
@query("dd")
|
101
102
|
protected _dd: HTMLDataListElement;
|
102
103
|
|
103
|
-
protected render() {
|
104
|
-
return html`<dl part="root">
|
104
|
+
protected render(): TemplateResult<1> {
|
105
|
+
return html`<dl part="root" ${attr(this.observedRecord)}>
|
105
106
|
<dt part="title" @click="${this._handelClick}">
|
106
|
-
<span part="summary"
|
107
|
-
|
107
|
+
<span part="summary">
|
108
|
+
${this.summary || htmlSlot("summary")}
|
109
|
+
</span>
|
110
|
+
<span>
|
111
|
+
<i part="icon">${svgCaretDown()}</i>
|
112
|
+
</span>
|
108
113
|
</dt>
|
109
114
|
<dd part="details" @click=${this.fill ? () => this.toggle() : null}>
|
110
115
|
<div style="min-height: 0;">${htmlSlot()}</div>
|
package/src/components/dialog.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import { type HandlerEvent } from "@godown/element";
|
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 { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import { css, html, type PropertyValues } from "lit";
|
6
|
+
import { css, html, type PropertyValues, type TemplateResult } from "lit";
|
6
7
|
import { property } from "lit/decorators.js";
|
7
8
|
|
8
9
|
import { cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
@@ -32,7 +33,7 @@ const cssScope = scopePrefix(protoName);
|
|
32
33
|
visibility: hidden;
|
33
34
|
position: fixed;
|
34
35
|
z-index: 1;
|
35
|
-
inset:0;
|
36
|
+
inset: 0;
|
36
37
|
}
|
37
38
|
|
38
39
|
:host([open]) {
|
@@ -64,25 +65,25 @@ const cssScope = scopePrefix(protoName);
|
|
64
65
|
justify-content: center;
|
65
66
|
}
|
66
67
|
|
67
|
-
[
|
68
|
+
[part=container] {
|
68
69
|
pointer-events: all;
|
69
70
|
position: absolute;
|
70
71
|
}
|
71
72
|
|
72
|
-
[direction^=top] {
|
73
|
+
[direction^=top] [part=container] {
|
73
74
|
top: 0;
|
74
75
|
}
|
75
76
|
|
76
|
-
[direction^=bottom] {
|
77
|
+
[direction^=bottom] [part=container] {
|
77
78
|
bottom: 0;
|
78
79
|
}
|
79
80
|
|
80
|
-
[direction$=right] {
|
81
|
-
right: 0
|
81
|
+
[direction$=right] [part=container] {
|
82
|
+
right: 0;
|
82
83
|
}
|
83
84
|
|
84
|
-
[direction$=left] {
|
85
|
-
left: 0
|
85
|
+
[direction$=left] [part=container] {
|
86
|
+
left: 0;
|
86
87
|
}
|
87
88
|
`,
|
88
89
|
)
|
@@ -107,14 +108,14 @@ class Dialog extends SuperOpenable {
|
|
107
108
|
|
108
109
|
private _modalInvoke: boolean;
|
109
110
|
|
110
|
-
protected render() {
|
111
|
-
return html`<div part="root">
|
111
|
+
protected render(): TemplateResult<1> {
|
112
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
112
113
|
<div part="modal"></div>
|
113
|
-
<div part="container"
|
114
|
+
<div part="container">${htmlSlot()}</div>
|
114
115
|
</div>`;
|
115
116
|
}
|
116
117
|
|
117
|
-
showModal() {
|
118
|
+
showModal(): void {
|
118
119
|
if (!this.modal) {
|
119
120
|
this.modal = true;
|
120
121
|
this._modalInvoke = true;
|
@@ -125,7 +126,7 @@ class Dialog extends SuperOpenable {
|
|
125
126
|
private _submitEvent: EventListenerOrEventListenerObject;
|
126
127
|
private _keydownEvent: EventListenerOrEventListenerObject;
|
127
128
|
|
128
|
-
protected updated(changedProperties: PropertyValues) {
|
129
|
+
protected updated(changedProperties: PropertyValues): void {
|
129
130
|
if (changedProperties.has("open")) {
|
130
131
|
if (this.open) {
|
131
132
|
this._submitEvent = this.events.add(this, "submit", this._handelSubmit);
|
@@ -139,7 +140,7 @@ class Dialog extends SuperOpenable {
|
|
139
140
|
}
|
140
141
|
}
|
141
142
|
|
142
|
-
protected _handleKeydown(e: KeyboardEvent) {
|
143
|
+
protected _handleKeydown(e: KeyboardEvent): void {
|
143
144
|
e.preventDefault();
|
144
145
|
const keys = this.key.split(/[\s,]/);
|
145
146
|
if (keys.includes(e.key) || keys.includes(e.code)) {
|
@@ -147,13 +148,13 @@ class Dialog extends SuperOpenable {
|
|
147
148
|
}
|
148
149
|
}
|
149
150
|
|
150
|
-
protected _handelSubmit(e: HandlerEvent<HTMLFormElement>) {
|
151
|
+
protected _handelSubmit(e: HandlerEvent<HTMLFormElement>): void {
|
151
152
|
if (e.target.method === "dialog") {
|
152
153
|
this.close();
|
153
154
|
}
|
154
155
|
}
|
155
156
|
|
156
|
-
close() {
|
157
|
+
close(): void {
|
157
158
|
if (this._modalInvoke) {
|
158
159
|
this.modal = false;
|
159
160
|
this._modalInvoke = false;
|