godown 3.0.0-canary.13 → 3.0.0-canary.15
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/alert.js +1 -5
- package/alert.js.map +1 -1
- package/avatar.js +1 -5
- package/avatar.js.map +1 -1
- package/breath.js +1 -5
- package/breath.js.map +1 -1
- package/button.js +1 -5
- package/button.js.map +1 -1
- package/card.js +1 -5
- package/card.js.map +1 -1
- package/carousel.js +1 -5
- package/carousel.js.map +1 -1
- package/components/alert.js +1 -174
- package/components/alert.js.map +1 -1
- package/components/avatar.js +1 -68
- package/components/avatar.js.map +1 -1
- package/components/breath.d.ts +2 -2
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -81
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +1 -1
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -185
- package/components/button.js.map +1 -1
- package/components/card.d.ts.map +1 -1
- package/components/card.js +1 -49
- package/components/card.js.map +1 -1
- package/components/carousel.js +1 -119
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +0 -1
- package/components/details.d.ts.map +1 -1
- package/components/details.js +1 -53
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +1 -1
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -98
- package/components/dialog.js.map +1 -1
- package/components/divider.js +1 -35
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts +1 -1
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +1 -111
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +1 -63
- package/components/flex.js.map +1 -1
- package/components/form.js +1 -75
- package/components/form.js.map +1 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -57
- package/components/grid.js.map +1 -1
- package/components/input.js +1 -51
- package/components/input.js.map +1 -1
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -58
- package/components/layout.js.map +1 -1
- package/components/link.js +1 -53
- package/components/link.js.map +1 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -59
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +1 -0
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -267
- package/components/range.js.map +1 -1
- package/components/rotate.js +1 -56
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +3 -5
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -247
- package/components/router.js.map +1 -1
- package/components/select.d.ts +1 -1
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -217
- package/components/select.js.map +1 -1
- package/components/skeleton.js +1 -55
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -154
- package/components/split.js.map +1 -1
- package/components/switch.js +1 -93
- package/components/switch.js.map +1 -1
- package/components/text.d.ts.map +1 -1
- package/components/text.js +1 -46
- package/components/text.js.map +1 -1
- package/components/time.d.ts +1 -1
- package/components/time.d.ts.map +1 -1
- package/components/time.js +1 -78
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +1 -85
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +1 -1
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +1 -128
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +1 -52
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +1 -39
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +1 -1
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -117
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts +1 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js +1 -37
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/details.js +1 -5
- package/details.js.map +1 -1
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +5 -7
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +3 -5
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/breath.d.ts +2 -2
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +13 -20
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +1 -1
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +1 -1
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +1 -5
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +4 -10
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +0 -1
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +14 -23
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +1 -1
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/divider.js +22 -22
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +1 -1
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +2 -1
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +1 -1
- package/dev/components/flex.js.map +1 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +2 -2
- package/dev/components/grid.js.map +1 -1
- package/dev/components/input.js +12 -12
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +3 -7
- package/dev/components/layout.js.map +1 -1
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +38 -38
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +1 -0
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +14 -12
- package/dev/components/range.js.map +1 -1
- package/dev/components/router.d.ts +3 -5
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +10 -18
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +1 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +23 -21
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +3 -2
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +7 -6
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +6 -9
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +2 -6
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +1 -1
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +1 -3
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +8 -11
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +1 -1
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +1 -1
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +20 -18
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +1 -1
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +34 -34
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts +1 -1
- package/dev/core/super-openable.d.ts.map +1 -1
- package/dialog.js +1 -5
- package/dialog.js.map +1 -1
- package/divider.js +1 -5
- package/divider.js.map +1 -1
- package/dragbox.js +1 -5
- package/dragbox.js.map +1 -1
- package/flex.js +1 -5
- package/flex.js.map +1 -1
- package/form.js +1 -5
- package/form.js.map +1 -1
- package/grid.js +1 -5
- package/grid.js.map +1 -1
- package/index.js +1 -56
- package/index.js.map +1 -1
- package/input.js +1 -5
- package/input.js.map +1 -1
- package/layout.js +1 -5
- package/layout.js.map +1 -1
- package/link.js +1 -5
- package/link.js.map +1 -1
- package/package.json +3 -3
- package/progress.js +1 -5
- package/progress.js.map +1 -1
- package/range.js +1 -5
- package/range.js.map +1 -1
- package/rotate.js +1 -5
- package/rotate.js.map +1 -1
- package/router.js +1 -5
- package/router.js.map +1 -1
- package/select.js +1 -5
- package/select.js.map +1 -1
- package/skeleton.js +1 -5
- package/skeleton.js.map +1 -1
- package/split.js +1 -5
- package/split.js.map +1 -1
- package/src/components/alert.ts +5 -7
- package/src/components/avatar.ts +3 -5
- package/src/components/breath.ts +17 -22
- package/src/components/button.ts +2 -2
- package/src/components/card.ts +1 -5
- package/src/components/carousel.ts +4 -10
- package/src/components/details.ts +14 -23
- package/src/components/dialog.ts +1 -1
- package/src/components/divider.ts +25 -25
- package/src/components/dragbox.ts +3 -2
- package/src/components/flex.ts +4 -2
- package/src/components/grid.ts +5 -3
- package/src/components/input.ts +12 -12
- package/src/components/layout.ts +3 -11
- package/src/components/progress.ts +41 -39
- package/src/components/range.ts +15 -14
- package/src/components/router.ts +14 -14
- package/src/components/select.ts +24 -22
- package/src/components/skeleton.ts +3 -2
- package/src/components/split.ts +12 -8
- package/src/components/switch.ts +6 -9
- package/src/components/text.ts +5 -7
- package/src/components/time.ts +2 -4
- package/src/components/tooltip.ts +8 -13
- package/src/components/typewriter.ts +5 -3
- package/src/core/global-style.ts +2 -2
- package/src/core/super-anchor.ts +23 -19
- package/src/core/super-input.ts +35 -35
- package/src/core/super-openable.ts +1 -1
- package/switch.js +1 -5
- package/switch.js.map +1 -1
- package/text.js +1 -5
- package/text.js.map +1 -1
- package/time.js +1 -5
- package/time.js.map +1 -1
- package/tooltip.js +1 -5
- package/tooltip.js.map +1 -1
- package/typewriter.js +1 -5
- package/typewriter.js.map +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
@@ -15,31 +15,31 @@ const protoName = "divider";
|
|
15
15
|
@godown(protoName)
|
16
16
|
@styles(
|
17
17
|
css`
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
`,
|
18
|
+
:host {
|
19
|
+
width: 100%;
|
20
|
+
height: .05em;
|
21
|
+
margin: auto;
|
22
|
+
display: block;
|
23
|
+
background: currentColor;
|
24
|
+
}
|
25
|
+
|
26
|
+
:host([vertical]) {
|
27
|
+
width: .05em;
|
28
|
+
height: max(1em, 100%);
|
29
|
+
}
|
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
|
+
`,
|
43
43
|
)
|
44
44
|
class Divider extends GlobalStyle {
|
45
45
|
/**
|
@@ -2,7 +2,7 @@ import { godown } from "@godown/element/decorators/godown.js";
|
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
3
|
import { attr } from "@godown/element/directives/attr.js";
|
4
4
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
5
|
-
import { EventListenerFunc } from "@godown/element/tools/events.js";
|
5
|
+
import type { EventListenerFunc } from "@godown/element/tools/events.js";
|
6
6
|
import { css, html, type TemplateResult } from "lit";
|
7
7
|
import { property } from "lit/decorators.js";
|
8
8
|
|
@@ -67,7 +67,8 @@ class Dragbox extends GlobalStyle {
|
|
67
67
|
part="root"
|
68
68
|
${attr(this.observedRecord)}
|
69
69
|
@mousedown="${this._handleDragStart}"
|
70
|
-
@mouseup="${this._handleDragEnd}"
|
70
|
+
@mouseup="${this._handleDragEnd}"
|
71
|
+
>
|
71
72
|
${htmlSlot()}
|
72
73
|
</div>`;
|
73
74
|
}
|
package/src/components/flex.ts
CHANGED
@@ -18,7 +18,8 @@ const protoName = "flex";
|
|
18
18
|
* @category layout
|
19
19
|
*/
|
20
20
|
@godown(protoName)
|
21
|
-
@styles(
|
21
|
+
@styles(
|
22
|
+
css`
|
22
23
|
:host,
|
23
24
|
:host([contents]) [part=root] {
|
24
25
|
display: flex;
|
@@ -27,7 +28,8 @@ const protoName = "flex";
|
|
27
28
|
[part=root] {
|
28
29
|
display: contents;
|
29
30
|
}
|
30
|
-
|
31
|
+
`,
|
32
|
+
)
|
31
33
|
class Flex extends GlobalStyle {
|
32
34
|
/**
|
33
35
|
* CSS property `flex-flow` (`flex-direction flex-wrap`).
|
package/src/components/grid.ts
CHANGED
@@ -19,7 +19,8 @@ const protoName = "grid";
|
|
19
19
|
* @category layout
|
20
20
|
*/
|
21
21
|
@godown(protoName)
|
22
|
-
@styles(
|
22
|
+
@styles(
|
23
|
+
css`
|
23
24
|
:host,
|
24
25
|
:host([contents]) [part=root] {
|
25
26
|
display: grid;
|
@@ -28,7 +29,8 @@ const protoName = "grid";
|
|
28
29
|
[part=root] {
|
29
30
|
display: contents;
|
30
31
|
}
|
31
|
-
|
32
|
+
`,
|
33
|
+
)
|
32
34
|
class Grid extends GlobalStyle {
|
33
35
|
/**
|
34
36
|
* CSS property `gap`.
|
@@ -66,7 +68,7 @@ class Grid extends GlobalStyle {
|
|
66
68
|
|
67
69
|
protected render(): TemplateResult<1> {
|
68
70
|
return html`<div part="root" ${attr(this.observedRecord)}>
|
69
|
-
|
71
|
+
${[
|
70
72
|
htmlSlot(),
|
71
73
|
htmlStyle(
|
72
74
|
joinRules({
|
package/src/components/input.ts
CHANGED
@@ -45,20 +45,20 @@ class Input extends SuperInput {
|
|
45
45
|
|
46
46
|
protected render(): TemplateResult<1> {
|
47
47
|
return html`<div part="root" ${attr(this.observedRecord)} class="${classList("input-field", this.variant)}">
|
48
|
-
|
48
|
+
${[
|
49
49
|
this._renderPrefix(),
|
50
50
|
html`<input
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
51
|
+
part="input"
|
52
|
+
type="${this.type}"
|
53
|
+
id="${this.makeId}"
|
54
|
+
.value="${this.value}"
|
55
|
+
placeholder="${this.placeholder || nothing}"
|
56
|
+
?autofocus="${this.autofocus}"
|
57
|
+
autocapitalize="${this.autocapitalize || nothing}"
|
58
|
+
autocomplete="${this.autocomplete || nothing}"
|
59
|
+
?disabled="${this.disabled}"
|
60
|
+
@input="${this._handleInput}"
|
61
|
+
>`,
|
62
62
|
this._renderSuffix(),
|
63
63
|
]}
|
64
64
|
</div>`;
|
package/src/components/layout.ts
CHANGED
@@ -71,17 +71,9 @@ class NavLayout extends GlobalStyle {
|
|
71
71
|
|
72
72
|
protected render(): TemplateResult<1> {
|
73
73
|
return html`<div part="root" ${attr(this.observedRecord)}>
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
: ""
|
78
|
-
}
|
79
|
-
<main part="main">${htmlSlot()}</main>
|
80
|
-
${
|
81
|
-
!this.noFooter
|
82
|
-
? html`<footer part="footer">${htmlSlot("footer")}</footer>`
|
83
|
-
: ""
|
84
|
-
}
|
74
|
+
${!this.noHeader ? html`<header part="header">${htmlSlot("header")}</header>` : ""}
|
75
|
+
<main part="main">${htmlSlot()}</main>
|
76
|
+
${!this.noFooter ? html`<footer part="footer">${htmlSlot("footer")}</footer>` : ""}
|
85
77
|
</div>`;
|
86
78
|
}
|
87
79
|
}
|
@@ -15,52 +15,54 @@ const protoName = "progress";
|
|
15
15
|
* @category feedback
|
16
16
|
*/
|
17
17
|
@godown(protoName)
|
18
|
-
@styles(
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
:host,
|
28
|
-
[part=root] {
|
29
|
-
display: block;
|
30
|
-
}
|
18
|
+
@styles(
|
19
|
+
css`
|
20
|
+
:host {
|
21
|
+
width: 100%;
|
22
|
+
height: 0.5em;
|
23
|
+
border-radius: 0.25em;
|
24
|
+
background: var(${cssGlobalVars.passive});
|
25
|
+
color: var(${cssGlobalVars.active});
|
26
|
+
}
|
31
27
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
border-radius: inherit;
|
37
|
-
}
|
28
|
+
:host,
|
29
|
+
[part=root] {
|
30
|
+
display: block;
|
31
|
+
}
|
38
32
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
border-radius: inherit;
|
46
|
-
transition: all 0.3s;
|
47
|
-
animation: progress 1.8s ease-in-out infinite alternate;
|
48
|
-
background: currentColor;
|
49
|
-
}
|
33
|
+
[part=root] {
|
34
|
+
height: inherit;
|
35
|
+
z-index: 1;
|
36
|
+
position: relative;
|
37
|
+
border-radius: inherit;
|
38
|
+
}
|
50
39
|
|
51
|
-
|
52
|
-
|
40
|
+
[part=value] {
|
41
|
+
position: absolute;
|
42
|
+
z-index: 2;
|
43
|
+
top: 0;
|
53
44
|
left: 0;
|
45
|
+
height: 100%;
|
46
|
+
border-radius: inherit;
|
47
|
+
transition: all 0.3s;
|
48
|
+
animation: progress 1.8s ease-in-out infinite alternate;
|
49
|
+
background: currentColor;
|
54
50
|
}
|
55
|
-
|
56
|
-
|
51
|
+
|
52
|
+
@keyframes progress {
|
53
|
+
from {
|
54
|
+
left: 0;
|
55
|
+
}
|
56
|
+
to {
|
57
|
+
left: 80%;
|
58
|
+
}
|
57
59
|
}
|
58
|
-
}
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
.static [part=value] {
|
62
|
+
animation: none;
|
63
|
+
}
|
64
|
+
`,
|
65
|
+
)
|
64
66
|
class Progress extends GlobalStyle {
|
65
67
|
@property({ type: Number })
|
66
68
|
max = 1;
|
package/src/components/range.ts
CHANGED
@@ -45,8 +45,7 @@ const cssScope = scopePrefix(protoName);
|
|
45
45
|
}
|
46
46
|
|
47
47
|
:host(:not([disabled])) .last-focus {
|
48
|
-
|
49
|
-
${cssScope}--handle-scale:1.05;
|
48
|
+
${cssScope}--handle-scale: 1.05;
|
50
49
|
background: var(${cssScope}--handle-active);
|
51
50
|
}
|
52
51
|
|
@@ -166,6 +165,8 @@ class Range extends SuperInput {
|
|
166
165
|
@state()
|
167
166
|
lastFocus?: number;
|
168
167
|
|
168
|
+
protected _focusStack: number[] = [];
|
169
|
+
|
169
170
|
/**
|
170
171
|
* Returns true when the second number is greater than the first number.
|
171
172
|
*/
|
@@ -217,19 +218,14 @@ class Range extends SuperInput {
|
|
217
218
|
"--to": `${((to - this.min) / gap) * 100}%`,
|
218
219
|
...(this.range
|
219
220
|
? Object.fromEntries(
|
220
|
-
rangeValue.map((value, index) => [
|
221
|
-
`--handle-${index}`,
|
222
|
-
`${((value - this.min) / gap) * 100}%`,
|
223
|
-
]),
|
221
|
+
rangeValue.map((value, index) => [`--handle-${index}`, `${((value - this.min) / gap) * 100}%`]),
|
224
222
|
)
|
225
223
|
: {}),
|
226
224
|
})
|
227
|
-
}"
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
: this.renderHandle(0)
|
232
|
-
}
|
225
|
+
}"
|
226
|
+
>
|
227
|
+
<div part="track"></div>
|
228
|
+
${this.range ? (this.value as number[]).map((_, index) => this.renderHandle(index)) : this.renderHandle(0)}
|
233
229
|
</div>`;
|
234
230
|
}
|
235
231
|
|
@@ -243,9 +239,9 @@ class Range extends SuperInput {
|
|
243
239
|
@mousedown="${this.disabled ? null : this.createMouseDown(index)}"
|
244
240
|
@focus="${this.disabled ? null : () => this.focusHandle(index)}"
|
245
241
|
@blur="${this.disabled ? null : this.blurHandle}"
|
246
|
-
style="
|
242
|
+
style="z-index:${this._focusStack.indexOf(index) + 1};--handle:var(--${
|
247
243
|
/* In single-handle mod or end, it is max value */
|
248
|
-
(!range && end) ?
|
244
|
+
(!range && end) ? "to" : `handle-${index}`})"
|
249
245
|
></i>
|
250
246
|
`;
|
251
247
|
}
|
@@ -254,6 +250,11 @@ class Range extends SuperInput {
|
|
254
250
|
|
255
251
|
focusHandle(index: number): void {
|
256
252
|
this.lastFocus = index;
|
253
|
+
const indexOfFocusStack = this._focusStack.indexOf(index);
|
254
|
+
if (indexOfFocusStack !== -1) {
|
255
|
+
this._focusStack.splice(indexOfFocusStack, 1);
|
256
|
+
}
|
257
|
+
this._focusStack.push(index);
|
257
258
|
const handleItem = this._handles.item(index);
|
258
259
|
handleItem?.focus();
|
259
260
|
if (!this._keydownEvent) {
|
package/src/components/router.ts
CHANGED
@@ -69,13 +69,7 @@ class Router extends GlobalStyle {
|
|
69
69
|
* Current pathname (equals to location.pathname).
|
70
70
|
*/
|
71
71
|
@property()
|
72
|
-
pathname
|
73
|
-
|
74
|
-
/**
|
75
|
-
* Path prefix.
|
76
|
-
*/
|
77
|
-
@property()
|
78
|
-
baseURL = "";
|
72
|
+
pathname: string;
|
79
73
|
|
80
74
|
/**
|
81
75
|
* Rendered content when there is no match.
|
@@ -109,6 +103,7 @@ class Router extends GlobalStyle {
|
|
109
103
|
|
110
104
|
get routes(): (Record<string, any> & {
|
111
105
|
path: string;
|
106
|
+
render?: (ur: ReturnType<Router["useRouter"]>) => unknown;
|
112
107
|
component?: unknown;
|
113
108
|
})[] {
|
114
109
|
return this.__routes;
|
@@ -202,7 +197,7 @@ class Router extends GlobalStyle {
|
|
202
197
|
* Get component from {@linkcode routes} by query.
|
203
198
|
*/
|
204
199
|
fieldComponent(query?: string): unknown {
|
205
|
-
query ||= this.__fieldRouteTree.search(
|
200
|
+
query ||= this.__fieldRouteTree.search(this.pathname)?.pattern;
|
206
201
|
this.path = query;
|
207
202
|
|
208
203
|
if (!query) {
|
@@ -214,26 +209,31 @@ class Router extends GlobalStyle {
|
|
214
209
|
if (!route) {
|
215
210
|
return null;
|
216
211
|
}
|
212
|
+
|
213
|
+
if ("render" in route) {
|
214
|
+
return route.render?.(this.useRouter()) || null;
|
215
|
+
}
|
216
|
+
|
217
217
|
return route.component;
|
218
218
|
}
|
219
219
|
|
220
220
|
/**
|
221
221
|
* Get component from slotted elements by query.
|
222
222
|
*/
|
223
|
-
slottedComponent(
|
223
|
+
slottedComponent(query?: string): TemplateResult<1> {
|
224
224
|
const slottedPaths = this._slottedNames;
|
225
|
-
|
226
|
-
this.path =
|
225
|
+
query ||= this.__slottedRouteTree.search(this.pathname)?.pattern;
|
226
|
+
this.path = query;
|
227
227
|
|
228
|
-
if (!
|
228
|
+
if (!query) {
|
229
229
|
return null;
|
230
230
|
}
|
231
231
|
|
232
|
-
this.path = slottedPaths.find((s) => s ===
|
232
|
+
this.path = slottedPaths.find((s) => s === query);
|
233
233
|
if (!this.path) {
|
234
234
|
return null;
|
235
235
|
}
|
236
|
-
this.params = this.parseParams(
|
236
|
+
this.params = this.parseParams(query, this.pathname);
|
237
237
|
return htmlSlot(this.path);
|
238
238
|
}
|
239
239
|
|
package/src/components/select.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { HandlerEvent } from "@godown/element";
|
1
|
+
import type { HandlerEvent } from "@godown/element";
|
2
2
|
import { godown } from "@godown/element/decorators/godown.js";
|
3
3
|
import { part } from "@godown/element/decorators/part.js";
|
4
4
|
import { styles } from "@godown/element/decorators/styles.js";
|
@@ -105,34 +105,36 @@ class Select extends Input {
|
|
105
105
|
private _store: { value: string; text: string; }[] = [];
|
106
106
|
|
107
107
|
protected render(): TemplateResult<1> {
|
108
|
-
return html`<div
|
108
|
+
return html`<div
|
109
|
+
part="root"
|
110
|
+
${
|
109
111
|
attr({
|
110
112
|
...this.observedRecord,
|
111
113
|
direction: this.direction || this.autoDirection,
|
112
114
|
})
|
113
|
-
}
|
114
|
-
|
115
|
+
}
|
116
|
+
class="input-field"
|
117
|
+
>
|
118
|
+
${[
|
115
119
|
this._renderPrefix(),
|
116
120
|
html`<input
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
121
|
+
part="input"
|
122
|
+
dir="${ifDefined(this.dir)}"
|
123
|
+
id="${this.makeId}"
|
124
|
+
.value="${this.text}"
|
125
|
+
type="${this.type}"
|
126
|
+
placeholder="${this.placeholder || nothing}"
|
127
|
+
?autofocus="${this.autofocus}"
|
128
|
+
autocapitalize="${this.autocapitalize || nothing}"
|
129
|
+
autocomplete="${this.autocomplete || nothing}"
|
130
|
+
?disabled="${this.disabled}"
|
131
|
+
@focus="${this._handleFocus}"
|
132
|
+
@input="${this._handleInput}"
|
133
|
+
>`,
|
130
134
|
html`<label for="${this.makeId}" part="suffix">
|
131
|
-
|
132
|
-
|
133
|
-
html`<label for="${this.makeId}" part="content">
|
134
|
-
${htmlSlot()}
|
135
|
-
</label>`,
|
135
|
+
<i part="icon">${svgCaretDown()}</i>
|
136
|
+
</label>`,
|
137
|
+
html`<label for="${this.makeId}" part="content"> ${htmlSlot()} </label>`,
|
136
138
|
]}
|
137
139
|
</div>`;
|
138
140
|
}
|
@@ -111,8 +111,9 @@ class Skeleton extends GlobalStyle {
|
|
111
111
|
return htmlSlot();
|
112
112
|
}
|
113
113
|
return html`<div part="root" ${attr(this.observedRecord)}>
|
114
|
-
|
115
|
-
|
114
|
+
${this.type === "image" ? iconPhoto() : ""}
|
115
|
+
${htmlSlot("loading")}
|
116
|
+
</div>`;
|
116
117
|
}
|
117
118
|
}
|
118
119
|
|
package/src/components/split.ts
CHANGED
@@ -99,12 +99,17 @@ class Split extends SuperInput {
|
|
99
99
|
|
100
100
|
protected render(): TemplateResult<1> {
|
101
101
|
return html`<div part="root" ${attr(this.observedRecord)}>
|
102
|
-
|
103
|
-
loop(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
102
|
+
${
|
103
|
+
loop(
|
104
|
+
this.len,
|
105
|
+
(index: number) =>
|
106
|
+
html`<span
|
107
|
+
part="input-box"
|
108
|
+
@click="${this.disabled ? null : () => this.focusAt(index)}"
|
109
|
+
class="${classList({ focus: this.current === index }) || nothing}"
|
110
|
+
>${this.currentValue[index]}</span
|
111
|
+
>`,
|
112
|
+
)
|
108
113
|
}
|
109
114
|
<input
|
110
115
|
part="input"
|
@@ -115,8 +120,7 @@ class Split extends SuperInput {
|
|
115
120
|
/* Ensure that input always has a value of length this.len */
|
116
121
|
this.value.padStart(this.len, " ")}"
|
117
122
|
>
|
118
|
-
</div>
|
119
|
-
`;
|
123
|
+
</div> `;
|
120
124
|
}
|
121
125
|
|
122
126
|
connectedCallback(): void {
|
package/src/components/switch.ts
CHANGED
@@ -40,7 +40,7 @@ const cssScope = scopePrefix(protoName);
|
|
40
40
|
}
|
41
41
|
|
42
42
|
[part=root],
|
43
|
-
|
43
|
+
[part=handle] {
|
44
44
|
transition: var(${cssScope}-transition);
|
45
45
|
}
|
46
46
|
|
@@ -50,14 +50,14 @@ const cssScope = scopePrefix(protoName);
|
|
50
50
|
height: inherit;
|
51
51
|
}
|
52
52
|
|
53
|
-
input {
|
53
|
+
[part=input] {
|
54
54
|
opacity: 0;
|
55
55
|
width: 100%;
|
56
56
|
height: 100%;
|
57
57
|
appearance: none;
|
58
58
|
}
|
59
59
|
|
60
|
-
|
60
|
+
[part=handle] {
|
61
61
|
height: 100%;
|
62
62
|
display: inline-flex;
|
63
63
|
align-items: center;
|
@@ -74,7 +74,7 @@ const cssScope = scopePrefix(protoName);
|
|
74
74
|
background: var(${cssGlobalVars.passive});
|
75
75
|
}
|
76
76
|
|
77
|
-
:host([checked])
|
77
|
+
:host([checked]) [part=handle] {
|
78
78
|
left: 50%;
|
79
79
|
}
|
80
80
|
|
@@ -86,7 +86,7 @@ const cssScope = scopePrefix(protoName);
|
|
86
86
|
background: var(${cssGlobalVars.passive});
|
87
87
|
}
|
88
88
|
|
89
|
-
.round
|
89
|
+
.round [part=handle] {
|
90
90
|
--size: var(${cssScope}-handle-size);
|
91
91
|
border-radius: 100%;
|
92
92
|
background: var(--godown--input-control);
|
@@ -135,10 +135,7 @@ class Switch extends SuperInput {
|
|
135
135
|
protected _input: HTMLInputElement;
|
136
136
|
|
137
137
|
protected render(): TemplateResult<1> {
|
138
|
-
return html`<div part="root"
|
139
|
-
${attr(this.observedRecord)}
|
140
|
-
class="${this.round ? "round" : "rect"}"
|
141
|
-
>
|
138
|
+
return html`<div part="root" ${attr(this.observedRecord)} class="${this.round ? "round" : "rect"}">
|
142
139
|
<input
|
143
140
|
part="input"
|
144
141
|
@change="${this._handleChange}"
|
package/src/components/text.ts
CHANGED
@@ -18,7 +18,8 @@ const cssScope = scopePrefix(protoName);
|
|
18
18
|
* @category display
|
19
19
|
*/
|
20
20
|
@godown(protoName)
|
21
|
-
@styles(
|
21
|
+
@styles(
|
22
|
+
css`
|
22
23
|
:host {
|
23
24
|
${cssScope}--color: currentColor;
|
24
25
|
${cssScope}--color-hover: currentColor;
|
@@ -65,7 +66,8 @@ const cssScope = scopePrefix(protoName);
|
|
65
66
|
background-clip: text;
|
66
67
|
-webkit-background-clip: text;
|
67
68
|
}
|
68
|
-
|
69
|
+
`,
|
70
|
+
)
|
69
71
|
class Text extends GlobalStyle {
|
70
72
|
/**
|
71
73
|
* Underline behavior.
|
@@ -80,11 +82,7 @@ class Text extends GlobalStyle {
|
|
80
82
|
clip = false;
|
81
83
|
|
82
84
|
protected render(): TemplateResult<1> {
|
83
|
-
return html`<span
|
84
|
-
part="root"
|
85
|
-
${attr(this.observedRecord)}
|
86
|
-
class="${classList(this.underline)}"
|
87
|
-
>
|
85
|
+
return html`<span part="root" ${attr(this.observedRecord)} class="${classList(this.underline)}">
|
88
86
|
${htmlSlot()}
|
89
87
|
</span>`;
|
90
88
|
}
|
package/src/components/time.ts
CHANGED
@@ -2,7 +2,7 @@ import { godown } from "@godown/element/decorators/godown.js";
|
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
3
|
import { attr } from "@godown/element/directives/attr.js";
|
4
4
|
import fmtime from "fmtime";
|
5
|
-
import { css, html, type PropertyValues, TemplateResult } from "lit";
|
5
|
+
import { css, html, type PropertyValues, type TemplateResult } from "lit";
|
6
6
|
import { property } from "lit/decorators.js";
|
7
7
|
|
8
8
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -50,9 +50,7 @@ class Time extends GlobalStyle {
|
|
50
50
|
protected timeoutId: number;
|
51
51
|
|
52
52
|
protected render(): TemplateResult<1> {
|
53
|
-
return html`<span part="root" ${attr(this.observedRecord)}>
|
54
|
-
${fmtime(this.format, this.time, this.escape)}
|
55
|
-
</span>`;
|
53
|
+
return html`<span part="root" ${attr(this.observedRecord)}> ${fmtime(this.format, this.time, this.escape)} </span>`;
|
56
54
|
}
|
57
55
|
|
58
56
|
protected firstUpdated(): void {
|
@@ -126,23 +126,18 @@ class Tooltip extends SuperOpenable {
|
|
126
126
|
protected render(): TemplateResult<1> {
|
127
127
|
const align = Tooltip.aligns[this.align] || "inherit";
|
128
128
|
const isFocusable = this.type === "focus";
|
129
|
-
return html`<div
|
129
|
+
return html`<div
|
130
130
|
part="root"
|
131
131
|
${attr(this.observedRecord)}
|
132
132
|
tabindex="${isFocusable ? 0 : -1}"
|
133
|
-
@focus="${isFocusable ? () => this.open = true : null}"
|
134
|
-
@blur="${isFocusable ? () => this.open = false : null}"
|
135
|
-
@mouseenter="${isFocusable ? null : () => this.open = true}"
|
136
|
-
@mouseleave="${isFocusable ? null : () => this.open = false}"
|
137
|
-
style="justify-content:${align};align-items:${align}"
|
133
|
+
@focus="${isFocusable ? () => (this.open = true) : null}"
|
134
|
+
@blur="${isFocusable ? () => (this.open = false) : null}"
|
135
|
+
@mouseenter="${isFocusable ? null : () => (this.open = true)}"
|
136
|
+
@mouseleave="${isFocusable ? null : () => (this.open = false)}"
|
137
|
+
style="justify-content:${align};align-items:${align}"
|
138
|
+
>
|
138
139
|
${htmlSlot()}
|
139
|
-
<div part="tip">
|
140
|
-
${
|
141
|
-
this.tip
|
142
|
-
? html`<span class="passive">${this.tip}</span>`
|
143
|
-
: htmlSlot("tip")
|
144
|
-
}
|
145
|
-
</div>
|
140
|
+
<div part="tip">${this.tip ? html`<span class="passive">${this.tip}</span>` : htmlSlot("tip")}</div>
|
146
141
|
</div>`;
|
147
142
|
}
|
148
143
|
}
|