godown 3.0.0-canary.10 → 3.0.0-canary.12
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 +3 -3
- package/alert.d.ts +1 -0
- package/alert.d.ts.map +1 -1
- package/avatar.d.ts +1 -0
- package/avatar.d.ts.map +1 -1
- package/button.d.ts +1 -0
- package/button.d.ts.map +1 -1
- package/card.d.ts +1 -0
- package/card.d.ts.map +1 -1
- package/carousel.d.ts +1 -0
- package/carousel.d.ts.map +1 -1
- package/components/alert.d.ts +2 -1
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +6 -8
- 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 +8 -5
- 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 +6 -5
- 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 +20 -3
- 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 +5 -4
- 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 +17 -11
- 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 +3 -2
- 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 +5 -3
- 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 +4 -2
- 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 +3 -2
- 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 +6 -6
- package/components/layout.js.map +1 -1
- package/components/link.d.ts +4 -0
- package/components/link.d.ts.map +1 -1
- package/components/link.js +10 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts +2 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +5 -4
- 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 +8 -7
- 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 +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 +11 -5
- 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 -4
- 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 +4 -3
- 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 +4 -3
- 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 +9 -6
- 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 +4 -3
- 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 +4 -5
- 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 +4 -3
- 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 +10 -4
- 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/details.d.ts +1 -0
- package/details.d.ts.map +1 -1
- package/dev/alert.d.ts +1 -0
- package/dev/alert.d.ts.map +1 -1
- package/dev/alert.js +1 -0
- package/dev/alert.js.map +1 -1
- package/dev/avatar.d.ts +1 -0
- package/dev/avatar.d.ts.map +1 -1
- package/dev/avatar.js +1 -0
- package/dev/avatar.js.map +1 -1
- package/dev/button.d.ts +1 -0
- package/dev/button.d.ts.map +1 -1
- package/dev/button.js +1 -0
- package/dev/button.js.map +1 -1
- package/dev/card.d.ts +1 -0
- package/dev/card.d.ts.map +1 -1
- package/dev/card.js +1 -0
- package/dev/card.js.map +1 -1
- package/dev/carousel.d.ts +1 -0
- package/dev/carousel.d.ts.map +1 -1
- package/dev/carousel.js +1 -0
- package/dev/carousel.js.map +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 +23 -2
- 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 +27 -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 +12 -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 +9 -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 +4 -0
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +10 -1
- package/dev/components/link.js.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 +27 -22
- 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 +15 -11
- 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 +15 -14
- 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 +8 -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 +13 -5
- 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/details.d.ts +1 -0
- package/dev/details.d.ts.map +1 -1
- package/dev/details.js +1 -0
- package/dev/details.js.map +1 -1
- package/dev/dialog.d.ts +1 -0
- package/dev/dialog.d.ts.map +1 -1
- package/dev/dialog.js +1 -0
- package/dev/dialog.js.map +1 -1
- package/dev/divider.d.ts +1 -0
- package/dev/divider.d.ts.map +1 -1
- package/dev/divider.js +1 -0
- package/dev/divider.js.map +1 -1
- package/dev/dragbox.d.ts +1 -0
- package/dev/dragbox.d.ts.map +1 -1
- package/dev/dragbox.js +1 -0
- package/dev/dragbox.js.map +1 -1
- package/dev/flex.d.ts +1 -0
- package/dev/flex.d.ts.map +1 -1
- package/dev/flex.js +1 -0
- package/dev/flex.js.map +1 -1
- package/dev/form.d.ts +1 -0
- package/dev/form.d.ts.map +1 -1
- package/dev/form.js +1 -0
- package/dev/form.js.map +1 -1
- package/dev/grid.d.ts +1 -0
- package/dev/grid.d.ts.map +1 -1
- package/dev/grid.js +1 -0
- package/dev/grid.js.map +1 -1
- package/dev/layout.d.ts.map +1 -1
- package/dev/progress.d.ts.map +1 -1
- package/dev/router.d.ts.map +1 -1
- package/dev/split.d.ts +1 -1
- package/dev/split.d.ts.map +1 -1
- package/dev/typewriter.d.ts +1 -0
- package/dev/typewriter.d.ts.map +1 -1
- package/dev/typewriter.js +1 -0
- package/dev/typewriter.js.map +1 -1
- package/dialog.d.ts +1 -0
- package/dialog.d.ts.map +1 -1
- package/divider.d.ts +1 -0
- package/divider.d.ts.map +1 -1
- package/dragbox.d.ts +1 -0
- package/dragbox.d.ts.map +1 -1
- package/flex.d.ts +1 -0
- package/flex.d.ts.map +1 -1
- package/form.d.ts +1 -0
- package/form.d.ts.map +1 -1
- package/grid.d.ts +1 -0
- package/grid.d.ts.map +1 -1
- package/layout.d.ts.map +1 -1
- package/package.json +9 -5
- package/progress.d.ts.map +1 -1
- package/router.d.ts.map +1 -1
- package/split.d.ts +1 -1
- package/split.d.ts.map +1 -1
- package/src/alert.ts +2 -0
- package/src/avatar.ts +2 -0
- package/src/button.ts +2 -0
- package/src/card.ts +2 -0
- package/src/carousel.ts +2 -0
- 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 +21 -15
- package/src/components/card.ts +9 -6
- package/src/components/carousel.ts +36 -21
- package/src/components/details.ts +10 -5
- package/src/components/dialog.ts +19 -18
- package/src/components/divider.ts +19 -7
- package/src/components/dragbox.ts +16 -9
- 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 +10 -2
- package/src/components/progress.ts +9 -4
- package/src/components/range.ts +44 -45
- package/src/components/rotate.ts +9 -6
- package/src/components/router.ts +27 -19
- package/src/components/select.ts +31 -20
- package/src/components/skeleton.ts +6 -5
- package/src/components/split.ts +23 -19
- package/src/components/switch.ts +20 -19
- package/src/components/text.ts +7 -9
- 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 +23 -21
- package/src/core/super-openable.ts +5 -5
- package/src/details.ts +2 -0
- package/src/dialog.ts +2 -0
- package/src/divider.ts +2 -0
- package/src/dragbox.ts +2 -0
- package/src/flex.ts +2 -0
- package/src/form.ts +2 -0
- package/src/grid.ts +2 -0
- package/src/layout.ts +1 -0
- package/src/progress.ts +1 -0
- package/src/router.ts +1 -0
- package/src/split.ts +1 -1
- package/src/typewriter.ts +2 -0
- package/typewriter.d.ts +1 -0
- package/typewriter.d.ts.map +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
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";
|
@@ -34,6 +35,7 @@ const protoName = "carousel";
|
|
34
35
|
}
|
35
36
|
|
36
37
|
[part=root] {
|
38
|
+
direction: ltr;
|
37
39
|
overflow: hidden;
|
38
40
|
}
|
39
41
|
|
@@ -99,18 +101,22 @@ class Carousel extends GlobalStyle {
|
|
99
101
|
|
100
102
|
private _cloneLast: HTMLElement | undefined;
|
101
103
|
|
102
|
-
protected render() {
|
103
|
-
return
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
104
|
+
protected render(): TemplateResult<1> {
|
105
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
106
|
+
<i part="prev" @click="${this.prev}">
|
107
|
+
${iconChevronLeft()}
|
108
|
+
</i>
|
109
|
+
<div part="move-root" style="transform:${`translateX(-${this.index + 1}00%)`}">
|
110
|
+
${htmlSlot()}
|
111
|
+
</div>
|
112
|
+
<i part="next" @click="${this.next}">
|
113
|
+
${iconChevronRight()}
|
114
|
+
</i>
|
115
|
+
${htmlStyle(`:host,:host([contents]) [part=root]{width:${this.width};}`)}
|
116
|
+
</div>`;
|
111
117
|
}
|
112
118
|
|
113
|
-
protected async firstUpdated() {
|
119
|
+
protected async firstUpdated(): Promise<void> {
|
114
120
|
await this.updateComplete;
|
115
121
|
|
116
122
|
if (this.children.length) {
|
@@ -124,46 +130,55 @@ class Carousel extends GlobalStyle {
|
|
124
130
|
this.insertBefore(this._cloneFirst, this.firstElementChild);
|
125
131
|
this.show(this.index);
|
126
132
|
}
|
127
|
-
|
128
|
-
this.intervalID = window.setInterval(() => {
|
129
|
-
this.next();
|
130
|
-
}, this.autoChange);
|
131
|
-
}
|
133
|
+
this.checkInterval();
|
132
134
|
}
|
133
135
|
|
134
|
-
disconnectedCallback() {
|
136
|
+
disconnectedCallback(): void {
|
135
137
|
clearInterval(this.intervalID);
|
136
138
|
}
|
137
139
|
|
138
|
-
show(i: number) {
|
140
|
+
show(i: number): void {
|
139
141
|
this.index = i;
|
140
142
|
}
|
141
143
|
|
142
|
-
next() {
|
144
|
+
next(): void {
|
143
145
|
if (this.index === this.childElementCount - 3) {
|
144
146
|
this._doTranslateX("0", true);
|
145
147
|
this.show(0);
|
146
148
|
} else {
|
147
149
|
this.show(this.index + 1);
|
148
150
|
}
|
151
|
+
this.checkInterval();
|
149
152
|
}
|
150
153
|
|
151
|
-
prev() {
|
154
|
+
prev(): void {
|
152
155
|
if (this.index === 0) {
|
153
156
|
this._doTranslateX(`-${this.childElementCount - 1}00%`, true);
|
154
157
|
this.show(this.children.length - 3);
|
155
158
|
} else {
|
156
159
|
this.show(this.index - 1);
|
157
160
|
}
|
161
|
+
this.checkInterval();
|
158
162
|
}
|
159
163
|
|
160
|
-
protected _doTranslateX(xValue: string, noTransition?: boolean) {
|
164
|
+
protected _doTranslateX(xValue: string, noTransition?: boolean): void {
|
161
165
|
this._moveRoot.style.transform = `translateX(${xValue})`;
|
162
166
|
if (noTransition) {
|
163
167
|
this._moveRoot.style.transition = `none`;
|
164
168
|
}
|
165
169
|
this._moveRoot.getBoundingClientRect();
|
166
170
|
}
|
171
|
+
|
172
|
+
checkInterval(): void {
|
173
|
+
if (this.autoChange) {
|
174
|
+
if (this.intervalID) {
|
175
|
+
clearInterval(this.intervalID);
|
176
|
+
}
|
177
|
+
this.intervalID = window.setInterval(() => {
|
178
|
+
this.next();
|
179
|
+
}, this.autoChange);
|
180
|
+
}
|
181
|
+
}
|
167
182
|
}
|
168
183
|
|
169
184
|
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
|
)
|
@@ -105,16 +106,16 @@ class Dialog extends SuperOpenable {
|
|
105
106
|
@property()
|
106
107
|
key = "Escape";
|
107
108
|
|
108
|
-
private _modalInvoke
|
109
|
+
private _modalInvoke = false;
|
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;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { godown, styles } from "@godown/element/decorators/index.js";
|
2
|
-
import {
|
2
|
+
import { attr } from "@godown/element/directives/attr.js";
|
3
|
+
import { css, html, type TemplateResult } from "lit";
|
3
4
|
import { property } from "lit/decorators.js";
|
4
5
|
|
5
6
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -9,25 +10,36 @@ const protoName = "divider";
|
|
9
10
|
/**
|
10
11
|
* {@linkcode Divider} similar to `<hr>`.
|
11
12
|
*
|
12
|
-
* This component does not render content.
|
13
|
-
*
|
14
13
|
* @category layout
|
15
14
|
*/
|
16
15
|
@godown(protoName)
|
17
16
|
@styles(
|
18
17
|
css`
|
19
|
-
:host{
|
18
|
+
:host {
|
20
19
|
width: 100%;
|
21
20
|
height: .05em;
|
22
21
|
margin: auto;
|
23
22
|
display: block;
|
24
23
|
background: currentColor;
|
25
24
|
}
|
25
|
+
|
26
26
|
:host([vertical]) {
|
27
27
|
width: .05em;
|
28
28
|
height: max(1em, 100%);
|
29
29
|
}
|
30
|
-
|
30
|
+
|
31
|
+
:host([contents]) [part=root] {
|
32
|
+
width: 100%;
|
33
|
+
height: .05em;
|
34
|
+
margin: auto;
|
35
|
+
display: block;
|
36
|
+
background: currentColor;
|
37
|
+
}
|
38
|
+
|
39
|
+
[part=root] {
|
40
|
+
display: contents;
|
41
|
+
}
|
42
|
+
`,
|
31
43
|
)
|
32
44
|
class Divider extends GlobalStyle {
|
33
45
|
/**
|
@@ -36,8 +48,8 @@ class Divider extends GlobalStyle {
|
|
36
48
|
@property({ type: Boolean, reflect: true })
|
37
49
|
vertical = false;
|
38
50
|
|
39
|
-
|
40
|
-
this.
|
51
|
+
protected render(): TemplateResult<1> {
|
52
|
+
return html`<div part="root" ${attr(this.observedRecord)}></div>`;
|
41
53
|
}
|
42
54
|
}
|
43
55
|
|
@@ -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 { EventListenerFunc } from "@godown/element/tools/events.js";
|
5
|
-
import { css, html } from "lit";
|
6
|
+
import { css, html, type TemplateResult } from "lit";
|
6
7
|
import { property } from "lit/decorators.js";
|
7
8
|
|
8
9
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -43,7 +44,7 @@ class Dragbox extends GlobalStyle {
|
|
43
44
|
return this.offsetParent?.clientHeight ?? document.body.offsetHeight;
|
44
45
|
}
|
45
46
|
|
46
|
-
private drag
|
47
|
+
private drag = false;
|
47
48
|
private t: number;
|
48
49
|
private l: number;
|
49
50
|
private cx: number;
|
@@ -61,15 +62,21 @@ class Dragbox extends GlobalStyle {
|
|
61
62
|
@property()
|
62
63
|
y = "auto";
|
63
64
|
|
64
|
-
protected render() {
|
65
|
-
return html`<div
|
65
|
+
protected render(): TemplateResult<1> {
|
66
|
+
return html`<div
|
67
|
+
part="root"
|
68
|
+
${attr(this.observedRecord)}
|
69
|
+
@mousedown="${this._handleDragStart}"
|
70
|
+
@mouseup="${this._handleDragEnd}">
|
71
|
+
${htmlSlot()}
|
72
|
+
</div>`;
|
66
73
|
}
|
67
74
|
|
68
|
-
protected firstUpdated() {
|
75
|
+
protected firstUpdated(): void {
|
69
76
|
this.reset();
|
70
77
|
}
|
71
78
|
|
72
|
-
protected _handleDragStart(e: MouseEvent) {
|
79
|
+
protected _handleDragStart(e: MouseEvent): void {
|
73
80
|
this.cx = e.clientX;
|
74
81
|
this.cy = e.clientY;
|
75
82
|
this.t = this.offsetTop;
|
@@ -82,13 +89,13 @@ class Dragbox extends GlobalStyle {
|
|
82
89
|
protected _handleMouseMove: EventListenerFunc;
|
83
90
|
protected _handleMouseLeave: EventListenerFunc;
|
84
91
|
|
85
|
-
protected _handleDragEnd() {
|
92
|
+
protected _handleDragEnd(): void {
|
86
93
|
this.drag = false;
|
87
94
|
this.events.remove(document, "mousemove", this._handleMouseMove);
|
88
95
|
this.events.remove(document, "mouseleave", this._handleMouseLeave);
|
89
96
|
}
|
90
97
|
|
91
|
-
protected _handleDrag(e: MouseEvent) {
|
98
|
+
protected _handleDrag(e: MouseEvent): void {
|
92
99
|
if (!this.drag) {
|
93
100
|
return;
|
94
101
|
}
|
@@ -111,7 +118,7 @@ class Dragbox extends GlobalStyle {
|
|
111
118
|
}
|
112
119
|
}
|
113
120
|
|
114
|
-
reset() {
|
121
|
+
reset(): void {
|
115
122
|
const { x, y, style, offsetsWidth, offsetsHeight, offsetWidth, offsetHeight, offsetLeft, offsetTop } = this;
|
116
123
|
style.left = x || "0";
|
117
124
|
style.top = y || "0";
|
package/src/components/flex.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
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 { joinRules } from "@godown/element/tools/css.js";
|
6
|
-
import { css } from "lit";
|
7
|
+
import { css, html, type TemplateResult } from "lit";
|
7
8
|
import { property } from "lit/decorators.js";
|
8
9
|
|
9
10
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -17,7 +18,16 @@ const protoName = "flex";
|
|
17
18
|
* @category layout
|
18
19
|
*/
|
19
20
|
@godown(protoName)
|
20
|
-
@styles(css
|
21
|
+
@styles(css`
|
22
|
+
:host,
|
23
|
+
:host([contents]) [part=root] {
|
24
|
+
display: flex;
|
25
|
+
}
|
26
|
+
|
27
|
+
[part=root] {
|
28
|
+
display: contents;
|
29
|
+
}
|
30
|
+
`)
|
21
31
|
class Flex extends GlobalStyle {
|
22
32
|
/**
|
23
33
|
* CSS property `flex-flow` (`flex-direction flex-wrap`).
|
@@ -49,8 +59,9 @@ class Flex extends GlobalStyle {
|
|
49
59
|
@property({ type: Boolean })
|
50
60
|
vertical = false;
|
51
61
|
|
52
|
-
protected render() {
|
53
|
-
return
|
62
|
+
protected render(): TemplateResult<1> {
|
63
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
64
|
+
${[
|
54
65
|
htmlSlot(),
|
55
66
|
htmlStyle(
|
56
67
|
joinRules({
|
@@ -63,7 +74,8 @@ class Flex extends GlobalStyle {
|
|
63
74
|
},
|
64
75
|
}),
|
65
76
|
),
|
66
|
-
]
|
77
|
+
]}
|
78
|
+
</div>`;
|
67
79
|
}
|
68
80
|
}
|
69
81
|
|
package/src/components/form.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
3
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
4
|
-
import { css } from "lit";
|
4
|
+
import { css, type TemplateResult } from "lit";
|
5
5
|
import { property } from "lit/decorators.js";
|
6
6
|
|
7
7
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -30,13 +30,13 @@ class Form<T = object> extends GlobalStyle {
|
|
30
30
|
return Form.buildValue(this._slot.assignedElements()) as T;
|
31
31
|
}
|
32
32
|
|
33
|
-
nameValue = this.namevalue;
|
33
|
+
nameValue: () => [string, T] = this.namevalue;
|
34
34
|
|
35
|
-
protected render() {
|
35
|
+
protected render(): TemplateResult<1> {
|
36
36
|
return htmlSlot();
|
37
37
|
}
|
38
38
|
|
39
|
-
reset() {
|
39
|
+
reset(): void {
|
40
40
|
this.deepQuerySelectorAll<HTMLElement & { reset?: () => void; }>("*").forEach((el) => {
|
41
41
|
if (el.tagName === this.tagName) {
|
42
42
|
return;
|
package/src/components/grid.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
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 { joinRules } from "@godown/element/tools/css.js";
|
6
7
|
import { isNumerical } from "@godown/element/tools/lib.js";
|
7
|
-
import { css } from "lit";
|
8
|
+
import { css, html, type TemplateResult } from "lit";
|
8
9
|
import { property } from "lit/decorators.js";
|
9
10
|
|
10
11
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -18,7 +19,16 @@ const protoName = "grid";
|
|
18
19
|
* @category layout
|
19
20
|
*/
|
20
21
|
@godown(protoName)
|
21
|
-
@styles(css
|
22
|
+
@styles(css`
|
23
|
+
:host,
|
24
|
+
:host([contents]) [part=root] {
|
25
|
+
display: grid;
|
26
|
+
}
|
27
|
+
|
28
|
+
[part=root] {
|
29
|
+
display: contents;
|
30
|
+
}
|
31
|
+
`)
|
22
32
|
class Grid extends GlobalStyle {
|
23
33
|
/**
|
24
34
|
* CSS property `gap`.
|
@@ -54,8 +64,9 @@ class Grid extends GlobalStyle {
|
|
54
64
|
@property()
|
55
65
|
items: string;
|
56
66
|
|
57
|
-
protected render() {
|
58
|
-
return
|
67
|
+
protected render(): TemplateResult<1> {
|
68
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
69
|
+
${[
|
59
70
|
htmlSlot(),
|
60
71
|
htmlStyle(
|
61
72
|
joinRules({
|
@@ -68,7 +79,8 @@ class Grid extends GlobalStyle {
|
|
68
79
|
},
|
69
80
|
}),
|
70
81
|
),
|
71
|
-
]
|
82
|
+
]}
|
83
|
+
</div>`;
|
72
84
|
}
|
73
85
|
}
|
74
86
|
|
package/src/components/input.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
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 { classList } from "@godown/element/directives/class-list.js";
|
5
|
-
import { css, html, nothing } from "lit";
|
6
|
+
import { css, html, nothing, type TemplateResult } from "lit";
|
6
7
|
import { property } from "lit/decorators.js";
|
7
8
|
|
8
9
|
import { cssGlobalVars } from "../core/global-style.js";
|
@@ -42,8 +43,8 @@ class Input extends SuperInput {
|
|
42
43
|
@part("input")
|
43
44
|
protected _input: HTMLInputElement;
|
44
45
|
|
45
|
-
protected render() {
|
46
|
-
return html`<div part="root" class="${classList("input-field", this.variant)}">
|
46
|
+
protected render(): TemplateResult<1> {
|
47
|
+
return html`<div part="root" ${attr(this.observedRecord)} class="${classList("input-field", this.variant)}">
|
47
48
|
${[
|
48
49
|
this._renderPrefix(),
|
49
50
|
html`<input
|
@@ -63,7 +64,7 @@ class Input extends SuperInput {
|
|
63
64
|
</div>`;
|
64
65
|
}
|
65
66
|
|
66
|
-
reset() {
|
67
|
+
reset(): void {
|
67
68
|
this._input.value = this.default;
|
68
69
|
this.value = this.default;
|
69
70
|
}
|
package/src/components/layout.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { godown } from "@godown/element/decorators/godown.js";
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
|
-
import {
|
3
|
+
import { attr } from "@godown/element/directives/attr.js";
|
4
4
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import { css, html } from "lit";
|
5
|
+
import { css, html, type TemplateResult } from "lit";
|
6
6
|
import { property } from "lit/decorators.js";
|
7
7
|
|
8
8
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -20,13 +20,18 @@ const protoName = "layout";
|
|
20
20
|
@godown(protoName)
|
21
21
|
@styles(
|
22
22
|
css`
|
23
|
-
:host
|
23
|
+
:host,
|
24
|
+
:host([contents]) [part=root] {
|
24
25
|
min-height: 100%;
|
25
26
|
display: flex;
|
26
27
|
flex-direction: column;
|
27
28
|
}
|
28
29
|
|
29
|
-
|
30
|
+
[part=root] {
|
31
|
+
display: contents;
|
32
|
+
}
|
33
|
+
|
34
|
+
[sticky] header {
|
30
35
|
position: sticky;
|
31
36
|
top: 0;
|
32
37
|
z-index: 1;
|
@@ -64,10 +69,11 @@ class NavLayout extends GlobalStyle {
|
|
64
69
|
@property({ type: Boolean })
|
65
70
|
sticky = false;
|
66
71
|
|
67
|
-
protected render() {
|
68
|
-
return html
|
72
|
+
protected render(): TemplateResult<1> {
|
73
|
+
return html`<div part="root" ${attr(this.observedRecord)}>
|
74
|
+
${
|
69
75
|
!this.noHeader
|
70
|
-
? html`<header part="header"
|
76
|
+
? html`<header part="header">${htmlSlot("header")}</header>`
|
71
77
|
: ""
|
72
78
|
}
|
73
79
|
<main part="main">${htmlSlot()}</main>
|
@@ -75,7 +81,8 @@ class NavLayout extends GlobalStyle {
|
|
75
81
|
!this.noFooter
|
76
82
|
? html`<footer part="footer">${htmlSlot("footer")}</footer>`
|
77
83
|
: ""
|
78
|
-
}
|
84
|
+
}
|
85
|
+
</div>`;
|
79
86
|
}
|
80
87
|
}
|
81
88
|
|
package/src/components/link.ts
CHANGED
@@ -26,11 +26,19 @@ class Link extends SuperAnchor {
|
|
26
26
|
@property()
|
27
27
|
type: "push" | "replace" | "normal" = "normal";
|
28
28
|
|
29
|
-
|
29
|
+
/**
|
30
|
+
* Suppress the update of the {@linkcode Router}.
|
31
|
+
*/
|
32
|
+
@property({ type: Boolean })
|
33
|
+
suppress = false;
|
34
|
+
|
35
|
+
protected _handleClick(e: MouseEvent): void {
|
30
36
|
if (this.type === "push" || this.type === "replace") {
|
31
37
|
e.preventDefault();
|
32
38
|
(history[`${this.type}State`])(null, "", this.href);
|
33
|
-
|
39
|
+
if (!this.suppress) {
|
40
|
+
Router.updateAll();
|
41
|
+
}
|
34
42
|
}
|
35
43
|
}
|
36
44
|
}
|