godown 3.0.0-canary.14 → 3.0.0-canary.16
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/alert.js +1 -1
- package/alert.js.map +1 -1
- package/avatar.js +1 -1
- package/avatar.js.map +1 -1
- package/breath.js +1 -1
- package/breath.js.map +1 -1
- package/button.js +1 -1
- package/button.js.map +1 -1
- package/card.js +1 -1
- package/card.js.map +1 -1
- package/carousel.js +1 -1
- package/carousel.js.map +1 -1
- package/components/alert.d.ts +2 -0
- 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 +1 -0
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +1 -1
- 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 +1 -1
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +2 -1
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -1
- package/components/card.d.ts +1 -0
- 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 +2 -0
- 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 +2 -2
- 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 +3 -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 +1 -0
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +1 -1
- package/components/dragbox.d.ts +2 -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 +1 -0
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +1 -1
- package/components/flex.js.map +1 -1
- package/components/form.d.ts +1 -0
- package/components/form.d.ts.map +1 -1
- package/components/form.js +1 -1
- package/components/grid.d.ts +1 -0
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -1
- package/components/grid.js.map +1 -1
- package/components/input.d.ts +3 -0
- 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 +4 -3
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -1
- package/components/layout.js.map +1 -1
- package/components/link.d.ts +1 -0
- package/components/link.d.ts.map +1 -1
- package/components/link.js +1 -1
- package/components/progress.d.ts +1 -0
- 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 +6 -2
- 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 +1 -0
- package/components/rotate.d.ts.map +1 -1
- package/components/rotate.js +1 -1
- package/components/router.d.ts +4 -5
- 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 +5 -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 +1 -0
- 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 +5 -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 +2 -0
- 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 +1 -0
- 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 +3 -1
- package/components/time.d.ts.map +1 -1
- package/components/time.js +1 -1
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +1 -0
- 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 +2 -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 +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.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 -1
- 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 -1
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/details.js +1 -1
- package/details.js.map +1 -1
- package/dev/components/alert.d.ts +2 -0
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +7 -7
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +1 -0
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +4 -5
- 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 +14 -20
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +2 -1
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +2 -1
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts +1 -0
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +2 -5
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts +2 -0
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +7 -10
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +2 -2
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +16 -24
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +3 -1
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +2 -0
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts +1 -0
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +23 -22
- 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 +3 -1
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts +1 -0
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +2 -1
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts +1 -0
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +1 -0
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts +1 -0
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +3 -2
- package/dev/components/grid.js.map +1 -1
- package/dev/components/input.d.ts +3 -0
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +15 -12
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts +4 -3
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +12 -15
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.d.ts +1 -0
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +1 -0
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts +1 -0
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +39 -38
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +6 -2
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +15 -17
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +1 -0
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +1 -0
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +4 -5
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +11 -18
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +5 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +30 -23
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts +1 -0
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +4 -2
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts +5 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +14 -8
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts +2 -0
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +8 -10
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts +1 -0
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +3 -6
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +3 -1
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +4 -3
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts +1 -0
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +9 -11
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +2 -1
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +1 -0
- 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 +2 -4
- 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 +35 -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/dev/core/super-openable.js +1 -1
- package/dev/core/super-openable.js.map +1 -1
- package/dialog.js +1 -1
- package/dialog.js.map +1 -1
- package/divider.js +1 -1
- package/divider.js.map +1 -1
- package/dragbox.js +1 -1
- package/dragbox.js.map +1 -1
- package/flex.js +1 -1
- package/flex.js.map +1 -1
- package/form.js +1 -1
- package/form.js.map +1 -1
- package/grid.js +1 -1
- package/grid.js.map +1 -1
- package/input.js +1 -1
- package/input.js.map +1 -1
- package/layout.js +1 -1
- package/layout.js.map +1 -1
- package/link.js +1 -1
- package/link.js.map +1 -1
- package/package.json +4 -4
- package/progress.js +1 -1
- package/progress.js.map +1 -1
- package/range.js +1 -1
- package/range.js.map +1 -1
- package/rotate.js +1 -1
- package/rotate.js.map +1 -1
- package/router.js +1 -1
- package/router.js.map +1 -1
- package/select.js +1 -1
- package/select.js.map +1 -1
- package/skeleton.js +1 -1
- package/skeleton.js.map +1 -1
- package/src/components/alert.ts +7 -7
- package/src/components/avatar.ts +4 -5
- package/src/components/breath.ts +18 -22
- package/src/components/button.ts +3 -2
- package/src/components/card.ts +2 -5
- package/src/components/carousel.ts +7 -10
- package/src/components/details.ts +16 -24
- package/src/components/dialog.ts +3 -1
- package/src/components/divider.ts +26 -25
- package/src/components/dragbox.ts +4 -2
- package/src/components/flex.ts +5 -2
- package/src/components/form.ts +1 -0
- package/src/components/grid.ts +6 -3
- package/src/components/input.ts +15 -12
- package/src/components/layout.ts +7 -14
- package/src/components/link.ts +1 -0
- package/src/components/progress.ts +42 -39
- package/src/components/range.ts +15 -21
- package/src/components/rotate.ts +1 -0
- package/src/components/router.ts +15 -14
- package/src/components/select.ts +31 -24
- package/src/components/skeleton.ts +4 -2
- package/src/components/split.ts +20 -11
- package/src/components/switch.ts +8 -10
- package/src/components/text.ts +6 -7
- package/src/components/time.ts +5 -4
- package/src/components/tooltip.ts +9 -13
- package/src/components/typewriter.ts +6 -3
- package/src/core/global-style.ts +3 -6
- package/src/core/super-anchor.ts +23 -19
- package/src/core/super-input.ts +36 -35
- package/src/core/super-openable.ts +2 -2
- package/switch.js +1 -1
- package/switch.js.map +1 -1
- package/text.js +1 -1
- package/text.js.map +1 -1
- package/time.js +1 -1
- package/time.js.map +1 -1
- package/tooltip.js +1 -1
- package/tooltip.js.map +1 -1
- package/typewriter.js +1 -1
- package/typewriter.js.map +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
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";
|
@@ -45,6 +45,9 @@ const protoName = "select";
|
|
45
45
|
*
|
46
46
|
* Input will filter the element.
|
47
47
|
*
|
48
|
+
* @fires input - Fires when the input value changes.
|
49
|
+
* @fires change - Fires when the input value changes.
|
50
|
+
* @fires select - Fires when select an option.
|
48
51
|
* @slot - Options.
|
49
52
|
* @category input
|
50
53
|
*/
|
@@ -105,34 +108,36 @@ class Select extends Input {
|
|
105
108
|
private _store: { value: string; text: string; }[] = [];
|
106
109
|
|
107
110
|
protected render(): TemplateResult<1> {
|
108
|
-
return html`<div
|
111
|
+
return html`<div
|
112
|
+
part="root"
|
113
|
+
${
|
109
114
|
attr({
|
110
115
|
...this.observedRecord,
|
111
116
|
direction: this.direction || this.autoDirection,
|
112
117
|
})
|
113
|
-
}
|
114
|
-
|
118
|
+
}
|
119
|
+
class="input-field"
|
120
|
+
>
|
121
|
+
${[
|
115
122
|
this._renderPrefix(),
|
116
123
|
html`<input
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
124
|
+
part="input"
|
125
|
+
dir="${ifDefined(this.dir)}"
|
126
|
+
id="${this.makeId}"
|
127
|
+
.value="${this.text}"
|
128
|
+
type="${this.type}"
|
129
|
+
placeholder="${this.placeholder || nothing}"
|
130
|
+
?autofocus="${this.autofocus}"
|
131
|
+
autocapitalize="${this.autocapitalize || nothing}"
|
132
|
+
autocomplete="${this.autocomplete || nothing}"
|
133
|
+
?disabled="${this.disabled}"
|
134
|
+
@focus="${this._handleFocus}"
|
135
|
+
@input="${this._handleInput}"
|
136
|
+
>`,
|
130
137
|
html`<label for="${this.makeId}" part="suffix">
|
131
|
-
|
132
|
-
|
133
|
-
html`<label for="${this.makeId}" part="content">
|
134
|
-
${htmlSlot()}
|
135
|
-
</label>`,
|
138
|
+
<i part="icon">${svgCaretDown()}</i>
|
139
|
+
</label>`,
|
140
|
+
html`<label for="${this.makeId}" part="content"> ${htmlSlot()} </label>`,
|
136
141
|
]}
|
137
142
|
</div>`;
|
138
143
|
}
|
@@ -227,7 +232,7 @@ class Select extends Input {
|
|
227
232
|
operation = 1;
|
228
233
|
}
|
229
234
|
}
|
230
|
-
this.dispatchEvent(new CustomEvent("
|
235
|
+
this.dispatchEvent(new CustomEvent("select", { detail: this.value, composed: true }));
|
231
236
|
this.filter();
|
232
237
|
return operation;
|
233
238
|
}
|
@@ -257,7 +262,8 @@ class Select extends Input {
|
|
257
262
|
}
|
258
263
|
const s = this._input.value;
|
259
264
|
this.filter(this.multiple ? betweenAt(this._input.selectionStart, s, ",") : s);
|
260
|
-
this.dispatchEvent(new CustomEvent("input", { detail: this.
|
265
|
+
this.dispatchEvent(new CustomEvent("input", { detail: this.value, composed: true, bubbles: true }));
|
266
|
+
this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
|
261
267
|
}
|
262
268
|
|
263
269
|
focus(options?: FocusOptions): void {
|
@@ -277,3 +283,4 @@ class Select extends Input {
|
|
277
283
|
}
|
278
284
|
|
279
285
|
export default Select;
|
286
|
+
export { Select };
|
@@ -111,9 +111,11 @@ 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
|
|
119
120
|
export default Skeleton;
|
121
|
+
export { Skeleton };
|
package/src/components/split.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 { classList } from "@godown/element/directives/class-list.js";
|
5
|
-
import {
|
5
|
+
import type { HandlerEvent } from "@godown/element/element.js";
|
6
6
|
import { css, html, nothing, type TemplateResult } from "lit";
|
7
7
|
import { property, state } from "lit/decorators.js";
|
8
8
|
|
@@ -27,6 +27,10 @@ const loop = <T>(len: number, fn: (index?: number) => T) => {
|
|
27
27
|
*
|
28
28
|
* Delete: will move the focus box forward until the first and no inputs for each.
|
29
29
|
*
|
30
|
+
* @fires input - Fires when the input value changes.
|
31
|
+
* @fires change - Fires when the input value changes.
|
32
|
+
* @fires focus - Fires when the input is focused.
|
33
|
+
* @fires blur - Fires when the input is blurred.
|
30
34
|
* @category input
|
31
35
|
*/
|
32
36
|
@godown(protoName)
|
@@ -99,12 +103,17 @@ class Split extends SuperInput {
|
|
99
103
|
|
100
104
|
protected render(): TemplateResult<1> {
|
101
105
|
return html`<div part="root" ${attr(this.observedRecord)}>
|
102
|
-
|
103
|
-
loop(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
106
|
+
${
|
107
|
+
loop(
|
108
|
+
this.len,
|
109
|
+
(index: number) =>
|
110
|
+
html`<span
|
111
|
+
part="input-box"
|
112
|
+
@click="${this.disabled ? null : () => this.focusAt(index)}"
|
113
|
+
class="${classList({ focus: this.current === index }) || nothing}"
|
114
|
+
>${this.currentValue[index]}</span
|
115
|
+
>`,
|
116
|
+
)
|
108
117
|
}
|
109
118
|
<input
|
110
119
|
part="input"
|
@@ -115,8 +124,7 @@ class Split extends SuperInput {
|
|
115
124
|
/* Ensure that input always has a value of length this.len */
|
116
125
|
this.value.padStart(this.len, " ")}"
|
117
126
|
>
|
118
|
-
</div>
|
119
|
-
`;
|
127
|
+
</div> `;
|
120
128
|
}
|
121
129
|
|
122
130
|
connectedCallback(): void {
|
@@ -133,8 +141,7 @@ class Split extends SuperInput {
|
|
133
141
|
this.fillInput(e.data);
|
134
142
|
this.value = this.currentValue.join("");
|
135
143
|
|
136
|
-
this.dispatchEvent(new CustomEvent("input", { detail: this.value,
|
137
|
-
this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
|
144
|
+
this.dispatchEvent(new CustomEvent("input", { detail: this.value, composed: true, bubbles: true }));
|
138
145
|
}
|
139
146
|
|
140
147
|
/**
|
@@ -204,12 +211,14 @@ class Split extends SuperInput {
|
|
204
211
|
focusAt(i: number): void {
|
205
212
|
this.current = i;
|
206
213
|
this._input.focus();
|
214
|
+
this.dispatchEvent(new CustomEvent("focus", { detail: i, bubbles: true, composed: true }));
|
207
215
|
}
|
208
216
|
|
209
217
|
blur(): void {
|
210
218
|
this._input.blur();
|
211
219
|
this.current = -1;
|
212
220
|
super.blur();
|
221
|
+
this.dispatchEvent(new CustomEvent("blur", { bubbles: true, composed: true }));
|
213
222
|
}
|
214
223
|
|
215
224
|
reset(): void {
|
package/src/components/switch.ts
CHANGED
@@ -16,6 +16,7 @@ const cssScope = scopePrefix(protoName);
|
|
16
16
|
* The switch is rectangular by default,
|
17
17
|
* set the round property to rounded switch.
|
18
18
|
*
|
19
|
+
* @fires change - Fires when the switch is switched.
|
19
20
|
* @category input
|
20
21
|
*/
|
21
22
|
@godown(protoName)
|
@@ -40,7 +41,7 @@ const cssScope = scopePrefix(protoName);
|
|
40
41
|
}
|
41
42
|
|
42
43
|
[part=root],
|
43
|
-
|
44
|
+
[part=handle] {
|
44
45
|
transition: var(${cssScope}-transition);
|
45
46
|
}
|
46
47
|
|
@@ -50,14 +51,14 @@ const cssScope = scopePrefix(protoName);
|
|
50
51
|
height: inherit;
|
51
52
|
}
|
52
53
|
|
53
|
-
input {
|
54
|
+
[part=input] {
|
54
55
|
opacity: 0;
|
55
56
|
width: 100%;
|
56
57
|
height: 100%;
|
57
58
|
appearance: none;
|
58
59
|
}
|
59
60
|
|
60
|
-
|
61
|
+
[part=handle] {
|
61
62
|
height: 100%;
|
62
63
|
display: inline-flex;
|
63
64
|
align-items: center;
|
@@ -74,7 +75,7 @@ const cssScope = scopePrefix(protoName);
|
|
74
75
|
background: var(${cssGlobalVars.passive});
|
75
76
|
}
|
76
77
|
|
77
|
-
:host([checked])
|
78
|
+
:host([checked]) [part=handle] {
|
78
79
|
left: 50%;
|
79
80
|
}
|
80
81
|
|
@@ -86,7 +87,7 @@ const cssScope = scopePrefix(protoName);
|
|
86
87
|
background: var(${cssGlobalVars.passive});
|
87
88
|
}
|
88
89
|
|
89
|
-
.round
|
90
|
+
.round [part=handle] {
|
90
91
|
--size: var(${cssScope}-handle-size);
|
91
92
|
border-radius: 100%;
|
92
93
|
background: var(--godown--input-control);
|
@@ -135,10 +136,7 @@ class Switch extends SuperInput {
|
|
135
136
|
protected _input: HTMLInputElement;
|
136
137
|
|
137
138
|
protected render(): TemplateResult<1> {
|
138
|
-
return html`<div part="root"
|
139
|
-
${attr(this.observedRecord)}
|
140
|
-
class="${this.round ? "round" : "rect"}"
|
141
|
-
>
|
139
|
+
return html`<div part="root" ${attr(this.observedRecord)} class="${this.round ? "round" : "rect"}">
|
142
140
|
<input
|
143
141
|
part="input"
|
144
142
|
@change="${this._handleChange}"
|
@@ -169,7 +167,6 @@ class Switch extends SuperInput {
|
|
169
167
|
|
170
168
|
protected _handleChange(): void {
|
171
169
|
this.checked = this._input.checked;
|
172
|
-
this.dispatchEvent(new CustomEvent("input", { detail: this.checked, bubbles: true, composed: true }));
|
173
170
|
this.dispatchEvent(new CustomEvent("change", { detail: this.checked, composed: true }));
|
174
171
|
}
|
175
172
|
|
@@ -179,3 +176,4 @@ class Switch extends SuperInput {
|
|
179
176
|
}
|
180
177
|
|
181
178
|
export default Switch;
|
179
|
+
export { Switch };
|
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,14 +82,11 @@ 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
|
}
|
91
89
|
}
|
92
90
|
|
93
91
|
export default Text;
|
92
|
+
export { Text };
|
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";
|
@@ -12,6 +12,7 @@ const protoName = "time";
|
|
12
12
|
/**
|
13
13
|
* {@linkcode Time} renders a formatting time.
|
14
14
|
*
|
15
|
+
* @fires time - Fires when the time changes.
|
15
16
|
* @category display
|
16
17
|
*/
|
17
18
|
@godown(protoName)
|
@@ -50,9 +51,7 @@ class Time extends GlobalStyle {
|
|
50
51
|
protected timeoutId: number;
|
51
52
|
|
52
53
|
protected render(): TemplateResult<1> {
|
53
|
-
return html`<span part="root" ${attr(this.observedRecord)}
|
54
|
-
${fmtime(this.format, this.time, this.escape)}
|
55
|
-
</span>`;
|
54
|
+
return html`<span part="root" ${attr(this.observedRecord)}>${fmtime(this.format, this.time, this.escape)}</span>`;
|
56
55
|
}
|
57
56
|
|
58
57
|
protected firstUpdated(): void {
|
@@ -76,9 +75,11 @@ class Time extends GlobalStyle {
|
|
76
75
|
|
77
76
|
startTimeout(): number {
|
78
77
|
return window.setInterval(() => {
|
78
|
+
this.dispatchEvent(new CustomEvent("time", { detail: this.time, composed: true }));
|
79
79
|
this.time = new Date(this.time.getTime() + (this.gap || this.timeout));
|
80
80
|
}, Math.abs(this.timeout));
|
81
81
|
}
|
82
82
|
}
|
83
83
|
|
84
84
|
export default Time;
|
85
|
+
export { Time };
|
@@ -126,25 +126,21 @@ 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
|
}
|
149
144
|
|
150
145
|
export default Tooltip;
|
146
|
+
export { Tooltip };
|
@@ -4,7 +4,7 @@ import { attr } from "@godown/element/directives/attr.js";
|
|
4
4
|
import { classList } from "@godown/element/directives/class-list.js";
|
5
5
|
import { htmlSlot } from "@godown/element/directives/html-slot.js";
|
6
6
|
import { random } from "@godown/element/tools/lib.js";
|
7
|
-
import { css, html, type PropertyValueMap, TemplateResult } from "lit";
|
7
|
+
import { css, html, type PropertyValueMap, type TemplateResult } from "lit";
|
8
8
|
import { property, query, state } from "lit/decorators.js";
|
9
9
|
|
10
10
|
import { GlobalStyle, scopePrefix } from "../core/global-style.js";
|
@@ -18,7 +18,8 @@ const cssScope = scopePrefix(protoName);
|
|
18
18
|
* @category effect
|
19
19
|
*/
|
20
20
|
@godown(protoName)
|
21
|
-
@styles(
|
21
|
+
@styles(
|
22
|
+
css`
|
22
23
|
:host {
|
23
24
|
${cssScope}--cursor-width: .05em;
|
24
25
|
}
|
@@ -50,7 +51,8 @@ const cssScope = scopePrefix(protoName);
|
|
50
51
|
.hidden {
|
51
52
|
visibility: hidden;
|
52
53
|
}
|
53
|
-
|
54
|
+
`,
|
55
|
+
)
|
54
56
|
class Typewriter extends GlobalStyle {
|
55
57
|
/**
|
56
58
|
* Raw text.
|
@@ -157,3 +159,4 @@ class Typewriter extends GlobalStyle {
|
|
157
159
|
}
|
158
160
|
|
159
161
|
export default Typewriter;
|
162
|
+
export { Typewriter };
|
package/src/core/global-style.ts
CHANGED
@@ -1,12 +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 from "@godown/element";
|
4
|
-
import GodownConfig from "@godown/element/config.js";
|
5
4
|
import { joinProperties } from "@godown/element/tools/css.js";
|
6
5
|
import { trim } from "@godown/element/tools/lib.js";
|
7
|
-
import { css, CSSResult, unsafeCSS } from "lit";
|
8
|
-
|
9
|
-
GodownElement.godownConfig ||= new GodownConfig();
|
6
|
+
import { css, type CSSResult, unsafeCSS } from "lit";
|
10
7
|
|
11
8
|
export class GlobalStyle extends GodownElement {
|
12
9
|
}
|
@@ -18,7 +15,7 @@ export function scopePrefix(scope: string, len = 1): CSSResult {
|
|
18
15
|
}
|
19
16
|
|
20
17
|
export function variablePrefix(variable: string): CSSResult {
|
21
|
-
return unsafeCSS(
|
18
|
+
return unsafeCSS(`--${variable}`);
|
22
19
|
}
|
23
20
|
|
24
21
|
export const cssGlobalVars: {
|
@@ -101,5 +98,5 @@ GlobalStyle.styles = [
|
|
101
98
|
all: inherit;
|
102
99
|
display: revert;
|
103
100
|
}
|
104
|
-
`,
|
101
|
+
`,
|
105
102
|
];
|
package/src/core/super-anchor.ts
CHANGED
@@ -7,25 +7,27 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
7
7
|
|
8
8
|
import { GlobalStyle } from "./global-style.js";
|
9
9
|
|
10
|
-
@styles(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
@styles(
|
11
|
+
css`
|
12
|
+
:host {
|
13
|
+
display: inline-block;
|
14
|
+
color: currentColor;
|
15
|
+
text-decoration: none;
|
16
|
+
cursor: default;
|
17
|
+
}
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
:host([href]) {
|
20
|
+
cursor: pointer;
|
21
|
+
}
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
[part=root] {
|
24
|
+
width: 100%;
|
25
|
+
color: inherit;
|
26
|
+
display: inline-block;
|
27
|
+
text-decoration: inherit;
|
28
|
+
}
|
29
|
+
`,
|
30
|
+
)
|
29
31
|
class SuperAnchor extends GlobalStyle {
|
30
32
|
/**
|
31
33
|
* A element href.
|
@@ -39,11 +41,13 @@ class SuperAnchor extends GlobalStyle {
|
|
39
41
|
target: "_blank" | "_self" | "_parent" | "_top" = "_self";
|
40
42
|
|
41
43
|
protected render(): TemplateResult<1> {
|
42
|
-
return html`<a
|
44
|
+
return html`<a
|
45
|
+
part="root"
|
43
46
|
${attr(this.observedRecord)}
|
44
47
|
href="${ifDefined(this.href)}"
|
45
48
|
target="${this.target}"
|
46
|
-
@click=${this._handleClick}
|
49
|
+
@click=${this._handleClick}
|
50
|
+
>
|
47
51
|
${htmlSlot()}
|
48
52
|
</a>`;
|
49
53
|
}
|
package/src/core/super-input.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { part } from "@godown/element/decorators/part.js";
|
2
2
|
import { styles } from "@godown/element/decorators/styles.js";
|
3
3
|
import { htmlSlot } from "@godown/element/directives/index.js";
|
4
|
-
import {
|
4
|
+
import type { HandlerEvent } from "@godown/element/element.js";
|
5
5
|
import iconEyeSlashFill from "@godown/f7-icon/icons/eye-slash-fill.js";
|
6
6
|
import { css, html, type TemplateResult } from "lit";
|
7
7
|
import { property } from "lit/decorators.js";
|
@@ -9,46 +9,46 @@ import { property } from "lit/decorators.js";
|
|
9
9
|
import { cssGlobalVars, GlobalStyle } from "./global-style.js";
|
10
10
|
|
11
11
|
const fieldStyle = css`
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
.input-field {
|
13
|
+
display: flex;
|
14
|
+
position: relative;
|
15
|
+
align-items: center;
|
16
|
+
border-radius: inherit;
|
17
|
+
height: inherit;
|
18
|
+
}
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
.input-field [part=input] {
|
21
|
+
background: transparent;
|
22
|
+
height: 100%;
|
23
|
+
width: 100%;
|
24
|
+
color: inherit;
|
25
|
+
padding: 0 var(${cssGlobalVars.input}-space);
|
26
|
+
}
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
.input-field:focus-within,
|
29
|
+
.input-field.outline {
|
30
|
+
box-shadow: var(${cssGlobalVars.input}-box-shadow);
|
31
|
+
}
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
.input-field [part=icon] {
|
34
|
+
display: flex;
|
35
|
+
align-items: center;
|
36
|
+
justify-content: center;
|
37
|
+
}
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
.input-field [part=prefix],
|
40
|
+
.input-field [part=suffix] {
|
41
|
+
height: 100%;
|
42
|
+
display: flex;
|
43
|
+
}
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
.input-field [part=suffix] [part=icon] {
|
46
|
+
padding-inline-end: var(${cssGlobalVars.input}-space);
|
47
|
+
}
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
.input-field [part=prefix] [part=icon] {
|
50
|
+
padding-inline-start: var(${cssGlobalVars.input}-space);
|
51
|
+
}
|
52
52
|
`;
|
53
53
|
|
54
54
|
const inputStyle = css`
|
@@ -148,6 +148,7 @@ class SuperInput extends GlobalStyle {
|
|
148
148
|
composed: true,
|
149
149
|
}),
|
150
150
|
);
|
151
|
+
this.dispatchEvent(new CustomEvent("input", { detail: this.value, composed: true, bubbles: true }));
|
151
152
|
this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
|
152
153
|
}
|
153
154
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import type { PropertyValueMap } from "lit";
|
2
2
|
import { property } from "lit/decorators.js";
|
3
3
|
|
4
4
|
import { GlobalStyle } from "./global-style.js";
|
@@ -25,7 +25,7 @@ class SuperOpenable extends GlobalStyle {
|
|
25
25
|
protected updated(changedProperties: PropertyValueMap<this>): void {
|
26
26
|
const open = changedProperties.get("open");
|
27
27
|
if (open !== undefined) {
|
28
|
-
this.dispatchEvent(new CustomEvent("change", { detail: this.open }));
|
28
|
+
this.dispatchEvent(new CustomEvent("change", { detail: this.open, composed: true }));
|
29
29
|
}
|
30
30
|
}
|
31
31
|
|
package/switch.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import o from"./components/switch.js";export{Switch}from"./components/switch.js";o.define();export{o as default};
|
2
2
|
//# sourceMappingURL=switch.js.map
|
package/switch.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"switch.js","sources":["src/switch.ts"],"sourcesContent":null,"names":["Switch","define"],"mappings":"
|
1
|
+
{"version":3,"file":"switch.js","sources":["src/switch.ts"],"sourcesContent":null,"names":["Switch","define"],"mappings":"iFAEAA,EAAOC"}
|
package/text.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import t from"./components/text.js";export{Text}from"./components/text.js";t.define();export{t as default};
|
2
2
|
//# sourceMappingURL=text.js.map
|
package/text.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"text.js","sources":["src/text.ts"],"sourcesContent":null,"names":["Text","define"],"mappings":"
|
1
|
+
{"version":3,"file":"text.js","sources":["src/text.ts"],"sourcesContent":null,"names":["Text","define"],"mappings":"2EAEAA,EAAKC"}
|
package/time.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import e from"./components/time.js";e.define();export{e as default};
|
1
|
+
import e from"./components/time.js";export{Time}from"./components/time.js";e.define();export{e as default};
|
2
2
|
//# sourceMappingURL=time.js.map
|
package/time.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"time.js","sources":["src/time.ts"],"sourcesContent":null,"names":["Time","define"],"mappings":"
|
1
|
+
{"version":3,"file":"time.js","sources":["src/time.ts"],"sourcesContent":null,"names":["Time","define"],"mappings":"2EAEAA,EAAKC"}
|
package/tooltip.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import o from"./components/tooltip.js";o.define();export{o as default};
|
1
|
+
import o from"./components/tooltip.js";export{Tooltip}from"./components/tooltip.js";o.define();export{o as default};
|
2
2
|
//# sourceMappingURL=tooltip.js.map
|
package/tooltip.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["src/tooltip.ts"],"sourcesContent":null,"names":["Tooltip","define"],"mappings":"
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["src/tooltip.ts"],"sourcesContent":null,"names":["Tooltip","define"],"mappings":"oFAEAA,EAAQC"}
|
package/typewriter.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import e from"./components/typewriter.js";e.define();export{e as default};
|
1
|
+
import e from"./components/typewriter.js";export{Typewriter}from"./components/typewriter.js";e.define();export{e as default};
|
2
2
|
//# sourceMappingURL=typewriter.js.map
|
package/typewriter.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"typewriter.js","sources":["src/typewriter.ts"],"sourcesContent":null,"names":["Typewriter","define"],"mappings":"
|
1
|
+
{"version":3,"file":"typewriter.js","sources":["src/typewriter.ts"],"sourcesContent":null,"names":["Typewriter","define"],"mappings":"6FAEAA,EAAWC"}
|