godown 3.0.0 → 3.0.1
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/build/godown+lit.iife.js +12 -12
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +12 -12
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +12 -12
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +11 -11
- package/build/godown.js +11 -11
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +11 -11
- package/build/godown.umd.js.map +1 -1
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +1 -1
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +1 -1
- package/components/avatar.js.map +1 -1
- package/components/badge.d.ts.map +1 -1
- package/components/badge.js +1 -1
- package/components/badge.js.map +1 -1
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -1
- package/components/breath.js.map +1 -1
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -1
- package/components/button.js.map +1 -1
- package/components/card.d.ts.map +1 -1
- package/components/card.js +1 -1
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +1 -1
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts.map +1 -1
- package/components/details.js +1 -1
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -1
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +1 -1
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +1 -1
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js.map +1 -1
- package/components/form.d.ts.map +1 -1
- package/components/form.js.map +1 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js.map +1 -1
- package/components/heading.d.ts.map +1 -1
- package/components/heading.js +1 -1
- package/components/heading.js.map +1 -1
- package/components/input.d.ts.map +1 -1
- package/components/input.js +1 -1
- package/components/input.js.map +1 -1
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -1
- package/components/layout.js.map +1 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -1
- package/components/progress.js.map +1 -1
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -1
- package/components/range.js.map +1 -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 +20 -25
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -1
- package/components/router.js.map +1 -1
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -1
- package/components/select.js.map +1 -1
- package/components/skeleton.d.ts.map +1 -1
- package/components/skeleton.js +1 -1
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -1
- package/components/split.js.map +1 -1
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +1 -1
- package/components/switch.js.map +1 -1
- package/components/text.d.ts.map +1 -1
- package/components/text.js +1 -1
- package/components/text.js.map +1 -1
- package/components/time.d.ts.map +1 -1
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +1 -1
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +1 -1
- 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.map +1 -1
- package/core/super-anchor.js +1 -1
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -1
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +82 -69
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +52 -36
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/badge.d.ts.map +1 -1
- package/dev/components/badge.js +57 -50
- package/dev/components/badge.js.map +1 -1
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +20 -14
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +13 -10
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +40 -35
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +63 -43
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +72 -61
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +61 -57
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +28 -23
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +19 -17
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +16 -11
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +4 -4
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +16 -11
- package/dev/components/grid.js.map +1 -1
- package/dev/components/heading.d.ts.map +1 -1
- package/dev/components/heading.js +62 -40
- package/dev/components/heading.js.map +1 -1
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +32 -24
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +43 -30
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.js +1 -1
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +51 -42
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +33 -30
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +12 -5
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +20 -25
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +17 -17
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +65 -57
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +65 -61
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +66 -58
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +88 -79
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +51 -45
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +13 -2
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +31 -23
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +35 -27
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +9 -9
- 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 +27 -26
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +83 -68
- 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 -2
- package/dev/core/super-openable.js.map +1 -1
- package/package.json +5 -5
- package/src/components/alert.ts +84 -75
- package/src/components/avatar.ts +54 -40
- package/src/components/badge.ts +68 -65
- package/src/components/breath.ts +23 -19
- package/src/components/button.ts +14 -11
- package/src/components/card.ts +42 -40
- package/src/components/carousel.ts +65 -47
- package/src/components/details.ts +74 -65
- package/src/components/dialog.ts +64 -62
- package/src/components/divider.ts +33 -30
- package/src/components/dragbox.ts +22 -22
- package/src/components/flex.ts +31 -28
- package/src/components/form.ts +7 -9
- package/src/components/grid.ts +31 -28
- package/src/components/heading.ts +67 -49
- package/src/components/input.ts +37 -31
- package/src/components/layout.ts +45 -34
- package/src/components/link.ts +1 -1
- package/src/components/progress.ts +53 -46
- package/src/components/range.ts +58 -52
- package/src/components/rotate.ts +15 -10
- package/src/components/router.ts +40 -45
- package/src/components/select.ts +74 -70
- package/src/components/skeleton.ts +67 -65
- package/src/components/split.ts +73 -69
- package/src/components/switch.ts +90 -83
- package/src/components/text.ts +53 -49
- package/src/components/time.ts +14 -3
- package/src/components/tooltip.ts +32 -24
- package/src/components/typewriter.ts +37 -31
- package/src/core/global-style.ts +11 -12
- package/src/core/super-anchor.ts +29 -30
- package/src/core/super-input.ts +86 -73
- package/src/core/super-openable.ts +2 -8
- package/web-types.json +1 -1
package/src/components/switch.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, styles } from "@godown/element";
|
2
|
-
import { css, html
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property, query } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
@@ -18,87 +18,85 @@ const cssScope = scopePrefix(protoName);
|
|
18
18
|
* @category input
|
19
19
|
*/
|
20
20
|
@godown(protoName)
|
21
|
-
@styles(
|
22
|
-
|
23
|
-
|
24
|
-
:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
21
|
+
@styles(css`
|
22
|
+
:host,
|
23
|
+
:host([contents]) [part="root"] {
|
24
|
+
width: var(${cssScope}-width);
|
25
|
+
height: var(${cssScope}-height);
|
26
|
+
display: inline-block;
|
27
|
+
}
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
29
|
+
:host {
|
30
|
+
${cssScope}-width: 3em;
|
31
|
+
${cssScope}-height: calc(var(${cssScope}-width) / 2);
|
32
|
+
${cssScope}-handle-size: 1.25em;
|
33
|
+
${cssScope}-handle-space: .125em;
|
34
|
+
${cssScope}-transition: .2s ease-in-out;
|
35
|
+
background: var(${cssGlobalVars.input}-background);
|
36
|
+
vertical-align: bottom;
|
37
|
+
border-radius: 0;
|
38
|
+
}
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
[part="root"],
|
41
|
+
[part="handle"] {
|
42
|
+
transition: var(${cssScope}-transition);
|
43
|
+
}
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
[part=input] {
|
53
|
-
opacity: 0;
|
54
|
-
width: 100%;
|
55
|
-
height: 100%;
|
56
|
-
appearance: none;
|
57
|
-
}
|
45
|
+
[part="root"] {
|
46
|
+
border-radius: inherit;
|
47
|
+
position: relative;
|
48
|
+
height: inherit;
|
49
|
+
}
|
58
50
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
left: 0;
|
66
|
-
width: 50%;
|
67
|
-
pointer-events: none;
|
68
|
-
border-radius: inherit;
|
69
|
-
}
|
51
|
+
[part="input"] {
|
52
|
+
opacity: 0;
|
53
|
+
width: 100%;
|
54
|
+
height: 100%;
|
55
|
+
appearance: none;
|
56
|
+
}
|
70
57
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
58
|
+
[part="handle"] {
|
59
|
+
height: 100%;
|
60
|
+
display: inline-flex;
|
61
|
+
align-items: center;
|
62
|
+
justify-content: center;
|
63
|
+
position: absolute;
|
64
|
+
left: 0;
|
65
|
+
width: 50%;
|
66
|
+
pointer-events: none;
|
67
|
+
border-radius: inherit;
|
68
|
+
}
|
75
69
|
|
76
|
-
|
77
|
-
|
78
|
-
}
|
70
|
+
:host([round]) {
|
71
|
+
border-radius: calc(var(${cssScope}-height) / 2);
|
72
|
+
background: var(${cssGlobalVars.passive});
|
73
|
+
}
|
79
74
|
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
:host([checked]) [part="handle"] {
|
76
|
+
left: 50%;
|
77
|
+
}
|
83
78
|
|
84
|
-
|
85
|
-
|
86
|
-
|
79
|
+
.rect .true {
|
80
|
+
background: var(${cssGlobalVars.active});
|
81
|
+
}
|
87
82
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
background: var(--godown--input-control);
|
92
|
-
width: var(--size);
|
93
|
-
height: var(--size);
|
94
|
-
margin: var(${cssScope}-handle-space);
|
95
|
-
}
|
83
|
+
.rect .false {
|
84
|
+
background: var(${cssGlobalVars.passive});
|
85
|
+
}
|
96
86
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
)
|
87
|
+
.round [part="handle"] {
|
88
|
+
--size: var(${cssScope}-handle-size);
|
89
|
+
border-radius: 100%;
|
90
|
+
background: var(--godown--input-control);
|
91
|
+
width: var(--size);
|
92
|
+
height: var(--size);
|
93
|
+
margin: var(${cssScope}-handle-space);
|
94
|
+
}
|
95
|
+
|
96
|
+
:host([checked]) .round {
|
97
|
+
background: var(${cssGlobalVars.active});
|
98
|
+
}
|
99
|
+
`)
|
102
100
|
class Switch extends SuperInput {
|
103
101
|
/**
|
104
102
|
* Display rounded.
|
@@ -134,18 +132,27 @@ class Switch extends SuperInput {
|
|
134
132
|
protected _input: HTMLInputElement;
|
135
133
|
|
136
134
|
protected render(): TemplateResult<1> {
|
137
|
-
return html
|
138
|
-
<
|
139
|
-
part="
|
140
|
-
|
141
|
-
|
142
|
-
?checked="${this.checked}"
|
143
|
-
name="${this.name}"
|
144
|
-
id="${this.makeId}"
|
145
|
-
type="checkbox"
|
135
|
+
return html`
|
136
|
+
<div
|
137
|
+
part="root"
|
138
|
+
${attr(this.observedRecord)}
|
139
|
+
class="${this.round ? "round" : "rect"}"
|
146
140
|
>
|
147
|
-
|
148
|
-
|
141
|
+
<input
|
142
|
+
part="input"
|
143
|
+
type="checkbox"
|
144
|
+
?disabled="${this.disabled}"
|
145
|
+
?checked="${this.checked}"
|
146
|
+
name="${this.name}"
|
147
|
+
id="${this.makeId}"
|
148
|
+
@change="${this._handleChange}"
|
149
|
+
/>
|
150
|
+
<span
|
151
|
+
part="handle"
|
152
|
+
class="${this.checked}"
|
153
|
+
></span>
|
154
|
+
</div>
|
155
|
+
`;
|
149
156
|
}
|
150
157
|
|
151
158
|
reset(): void {
|
package/src/components/text.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { attr, classList, godown, htmlSlot, styles } from "@godown/element";
|
2
|
-
import { css, html
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
|
-
import {
|
5
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../core/global-style.js";
|
6
6
|
|
7
7
|
const protoName = "text";
|
8
8
|
|
@@ -14,56 +14,54 @@ const cssScope = scopePrefix(protoName);
|
|
14
14
|
* @category display
|
15
15
|
*/
|
16
16
|
@godown(protoName)
|
17
|
-
@styles(
|
18
|
-
|
19
|
-
:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
17
|
+
@styles(css`
|
18
|
+
:host {
|
19
|
+
${cssScope}--color: currentColor;
|
20
|
+
${cssScope}--color-hover: currentColor;
|
21
|
+
${cssScope}--color-active: currentColor;
|
22
|
+
display: inline-block;
|
23
|
+
text-overflow: ellipsis;
|
24
|
+
overflow-wrap: break-word;
|
25
|
+
}
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
[part="root"] {
|
28
|
+
white-space: nowrap;
|
29
|
+
width: 100%;
|
30
|
+
vertical-align: bottom;
|
31
|
+
display: inline-block;
|
32
|
+
text-overflow: inherit;
|
33
|
+
overflow-wrap: inherit;
|
34
|
+
overflow: hidden;
|
35
|
+
color: var(${cssScope}--color);
|
36
|
+
}
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
[part="root"]:hover {
|
39
|
+
color: var(${cssScope}--color-hover, var(${cssScope}--color));
|
40
|
+
}
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
[part="root"]:active {
|
43
|
+
color: var(${cssScope}--color-active, var(${cssScope}--color));
|
44
|
+
}
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
.hover:hover,
|
47
|
+
.active:active,
|
48
|
+
.always {
|
49
|
+
text-decoration: underline;
|
50
|
+
}
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
.none {
|
53
|
+
text-decoration: none;
|
54
|
+
}
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
)
|
56
|
+
[clip] {
|
57
|
+
background: var(${cssGlobalVars.clipBackground});
|
58
|
+
display: inline-block;
|
59
|
+
color: transparent;
|
60
|
+
-webkit-text-fill-color: transparent;
|
61
|
+
background-clip: text;
|
62
|
+
-webkit-background-clip: text;
|
63
|
+
}
|
64
|
+
`)
|
67
65
|
class Text extends GlobalStyle {
|
68
66
|
/**
|
69
67
|
* Underline behavior.
|
@@ -78,9 +76,15 @@ class Text extends GlobalStyle {
|
|
78
76
|
clip = false;
|
79
77
|
|
80
78
|
protected render(): TemplateResult<1> {
|
81
|
-
return html
|
82
|
-
|
83
|
-
|
79
|
+
return html`
|
80
|
+
<span
|
81
|
+
part="root"
|
82
|
+
${attr(this.observedRecord)}
|
83
|
+
class="${classList(this.underline)}"
|
84
|
+
>
|
85
|
+
${htmlSlot()}
|
86
|
+
</span>
|
87
|
+
`;
|
84
88
|
}
|
85
89
|
}
|
86
90
|
|
package/src/components/time.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { attr, godown, styles } from "@godown/element";
|
2
2
|
import fmtime from "fmtime";
|
3
|
-
import {
|
3
|
+
import { type PropertyValues, type TemplateResult, css, html } from "lit";
|
4
4
|
import { property } from "lit/decorators.js";
|
5
5
|
|
6
6
|
import { GlobalStyle } from "../core/global-style.js";
|
@@ -14,7 +14,11 @@ const protoName = "time";
|
|
14
14
|
* @category display
|
15
15
|
*/
|
16
16
|
@godown(protoName)
|
17
|
-
@styles(css
|
17
|
+
@styles(css`
|
18
|
+
:host {
|
19
|
+
text-align: center;
|
20
|
+
}
|
21
|
+
`)
|
18
22
|
class Time extends GlobalStyle {
|
19
23
|
/**
|
20
24
|
* Escape symbol.
|
@@ -49,7 +53,14 @@ class Time extends GlobalStyle {
|
|
49
53
|
protected timeoutId: number;
|
50
54
|
|
51
55
|
protected render(): TemplateResult<1> {
|
52
|
-
return html
|
56
|
+
return html`
|
57
|
+
<span
|
58
|
+
part="root"
|
59
|
+
${attr(this.observedRecord)}
|
60
|
+
>
|
61
|
+
${fmtime(this.format, this.time, this.escape)}
|
62
|
+
</span>
|
63
|
+
`;
|
53
64
|
}
|
54
65
|
|
55
66
|
protected firstUpdated(): void {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
-
import { css, html
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { scopePrefix } from "../core/global-style.js";
|
@@ -24,19 +24,19 @@ const cssScope = scopePrefix(protoName);
|
|
24
24
|
${cssScope}--tip-background: inherit;
|
25
25
|
width: fit-content;
|
26
26
|
}
|
27
|
-
|
27
|
+
|
28
28
|
:host,
|
29
|
-
[part=root] {
|
29
|
+
[part="root"] {
|
30
30
|
display: inline-flex;
|
31
31
|
}
|
32
32
|
|
33
|
-
[part=root] {
|
33
|
+
[part="root"] {
|
34
34
|
position: relative;
|
35
35
|
transition: inherit;
|
36
36
|
border-radius: inherit;
|
37
37
|
}
|
38
38
|
|
39
|
-
[part=tip] {
|
39
|
+
[part="tip"] {
|
40
40
|
width: fit-content;
|
41
41
|
height: fit-content;
|
42
42
|
position: absolute;
|
@@ -45,7 +45,7 @@ const cssScope = scopePrefix(protoName);
|
|
45
45
|
user-select: none;
|
46
46
|
}
|
47
47
|
|
48
|
-
:host([open]) [part=tip] {
|
48
|
+
:host([open]) [part="tip"] {
|
49
49
|
visibility: visible;
|
50
50
|
}
|
51
51
|
|
@@ -53,24 +53,24 @@ const cssScope = scopePrefix(protoName);
|
|
53
53
|
background: var(${cssScope}--tip-background);
|
54
54
|
}
|
55
55
|
|
56
|
-
[propagation] [part=tip] {
|
56
|
+
[propagation] [part="tip"] {
|
57
57
|
pointer-events: none;
|
58
58
|
}
|
59
59
|
`,
|
60
60
|
css`
|
61
|
-
[direction^=top] [part=tip] {
|
61
|
+
[direction^="top"] [part="tip"] {
|
62
62
|
bottom: 100%;
|
63
63
|
}
|
64
64
|
|
65
|
-
[direction^=bottom] [part=tip] {
|
65
|
+
[direction^="bottom"] [part="tip"] {
|
66
66
|
top: 100%;
|
67
67
|
}
|
68
68
|
|
69
|
-
[direction$=right] [part=tip] {
|
69
|
+
[direction$="right"] [part="tip"] {
|
70
70
|
left: 100%;
|
71
71
|
}
|
72
72
|
|
73
|
-
[direction$=left] [part=tip] {
|
73
|
+
[direction$="left"] [part="tip"] {
|
74
74
|
right: 100%;
|
75
75
|
}
|
76
76
|
`,
|
@@ -123,19 +123,27 @@ class Tooltip extends SuperOpenable {
|
|
123
123
|
protected render(): TemplateResult<1> {
|
124
124
|
const align = Tooltip.aligns[this.align] || "inherit";
|
125
125
|
const isFocusable = this.type === "focus";
|
126
|
-
return html
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
126
|
+
return html`
|
127
|
+
<div
|
128
|
+
part="root"
|
129
|
+
${attr(this.observedRecord)}
|
130
|
+
tabindex="${isFocusable ? 0 : -1}"
|
131
|
+
@focus="${isFocusable ? () => (this.open = true) : null}"
|
132
|
+
@blur="${isFocusable ? () => (this.open = false) : null}"
|
133
|
+
@mouseenter="${isFocusable ? null : () => (this.open = true)}"
|
134
|
+
@mouseleave="${isFocusable ? null : () => (this.open = false)}"
|
135
|
+
style="justify-content:${align};align-items:${align}"
|
136
|
+
>
|
137
|
+
${htmlSlot()}
|
138
|
+
<div part="tip">
|
139
|
+
${this.tip
|
140
|
+
? html`
|
141
|
+
<span class="passive">${this.tip}</span>
|
142
|
+
`
|
143
|
+
: htmlSlot("tip")}
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
`;
|
139
147
|
}
|
140
148
|
}
|
141
149
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, random, styles } from "@godown/element";
|
2
|
-
import {
|
2
|
+
import { type PropertyValueMap, type TemplateResult, css, html } from "lit";
|
3
3
|
import { property, query, state } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -13,37 +13,35 @@ const cssScope = scopePrefix(protoName);
|
|
13
13
|
* @category effect
|
14
14
|
*/
|
15
15
|
@godown(protoName)
|
16
|
-
@styles(
|
17
|
-
|
18
|
-
:
|
19
|
-
|
20
|
-
}
|
16
|
+
@styles(css`
|
17
|
+
:host {
|
18
|
+
${cssScope}--cursor-width: .05em;
|
19
|
+
}
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
:host,
|
22
|
+
:host([contents]) [part="root"] {
|
23
|
+
display: inline-block;
|
24
|
+
}
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
i {
|
27
|
+
border-right: var(${cssScope}--cursor-width) solid;
|
28
|
+
margin-left: 0.02em;
|
29
|
+
animation: s 1.5s steps(1) infinite;
|
30
|
+
}
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}
|
37
|
-
50% {
|
38
|
-
border-color: transparent;
|
39
|
-
}
|
32
|
+
@keyframes s {
|
33
|
+
0% {
|
34
|
+
border-color: currentColor;
|
40
35
|
}
|
41
|
-
|
42
|
-
|
43
|
-
display: none;
|
36
|
+
50% {
|
37
|
+
border-color: transparent;
|
44
38
|
}
|
45
|
-
|
46
|
-
|
39
|
+
}
|
40
|
+
|
41
|
+
slot {
|
42
|
+
display: none;
|
43
|
+
}
|
44
|
+
`)
|
47
45
|
class Typewriter extends GlobalStyle {
|
48
46
|
/**
|
49
47
|
* Raw text.
|
@@ -97,10 +95,18 @@ class Typewriter extends GlobalStyle {
|
|
97
95
|
}
|
98
96
|
|
99
97
|
protected render(): TemplateResult<1> {
|
100
|
-
return html
|
101
|
-
|
102
|
-
|
103
|
-
|
98
|
+
return html`
|
99
|
+
<div
|
100
|
+
part="root"
|
101
|
+
${attr(this.observedRecord)}
|
102
|
+
>
|
103
|
+
${htmlSlot()} ${this.contentInternal}
|
104
|
+
<i
|
105
|
+
part="cursor"
|
106
|
+
?hidden="${this.ended}"
|
107
|
+
></i>
|
108
|
+
</div>
|
109
|
+
`;
|
104
110
|
}
|
105
111
|
|
106
112
|
protected firstUpdated(): void {
|
package/src/core/global-style.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import { type Gradients, presetsRGB } from "@godown/colors/presets-rgb.js";
|
2
2
|
import { travel } from "@godown/colors/travel.js";
|
3
3
|
import { GodownElement, joinProperties, trim } from "@godown/element";
|
4
|
-
import {
|
4
|
+
import { type CSSResult, css, unsafeCSS } from "lit";
|
5
5
|
|
6
|
-
export class GlobalStyle extends GodownElement {
|
7
|
-
}
|
6
|
+
export class GlobalStyle extends GodownElement {}
|
8
7
|
|
9
8
|
const cssvar = trim(GlobalStyle.godownConfig.prefix, "-");
|
10
9
|
|
@@ -41,25 +40,25 @@ export const cssGlobalVars: {
|
|
41
40
|
type PresetsGradientsCSSResult = Record<keyof typeof presetsRGB, Gradients<CSSResult>>;
|
42
41
|
GlobalStyle.styles = [
|
43
42
|
unsafeCSS(
|
44
|
-
":host{"
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
":host{" +
|
44
|
+
`${cssGlobalVars.black}:rgb(0 0 0);` +
|
45
|
+
`${cssGlobalVars.white}:rgb(255 255 255);` +
|
46
|
+
travel((key, gradient, rgb) => {
|
48
47
|
cssGlobalVars._colors[key] ||= [] as any;
|
49
48
|
cssGlobalVars._colors[key].push(unsafeCSS(scopePrefix("color", 2) + "-" + key + "-" + gradient));
|
50
49
|
const endKey = `-${key}-${gradient}`;
|
51
50
|
const colorKey = scopePrefix("color", 2) + endKey;
|
52
51
|
return `${colorKey}:rgb(${rgb});`;
|
53
|
-
}, presetsRGB).join("")
|
54
|
-
|
52
|
+
}, presetsRGB).join("") +
|
53
|
+
joinProperties({
|
55
54
|
[cssGlobalVars.background + ""]: `var(${cssGlobalVars._colors.darkgray[9]})`,
|
56
55
|
[cssGlobalVars.foreground + ""]: `var(${cssGlobalVars._colors.lightgray[0]})`,
|
57
56
|
[cssGlobalVars.active + ""]: `var(${cssGlobalVars._colors.blue[6]})`,
|
58
57
|
[cssGlobalVars.passive + ""]: `var(${cssGlobalVars._colors.darkgray[6]})`,
|
59
58
|
[cssGlobalVars.clipBackground + ""]:
|
60
59
|
`linear-gradient(to bottom, var(${cssGlobalVars.foreground}), var(${cssGlobalVars.passive}))`,
|
61
|
-
})
|
62
|
-
|
60
|
+
}) +
|
61
|
+
"}",
|
63
62
|
),
|
64
63
|
css`
|
65
64
|
* {
|
@@ -92,7 +91,7 @@ GlobalStyle.styles = [
|
|
92
91
|
display: contents;
|
93
92
|
}
|
94
93
|
|
95
|
-
:where(:host([contents]) [part=root]) {
|
94
|
+
:where(:host([contents]) [part="root"]) {
|
96
95
|
all: inherit;
|
97
96
|
display: revert;
|
98
97
|
}
|