godown 3.0.0-canary.1 → 3.0.0-canary.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -9
- package/components/alert.d.ts +6 -3
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +22 -14
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts +7 -2
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +13 -6
- package/components/avatar.js.map +1 -1
- package/components/breath.d.ts +4 -2
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +8 -6
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +20 -11
- package/components/button.d.ts.map +1 -1
- package/components/button.js +23 -20
- package/components/button.js.map +1 -1
- package/components/card.d.ts +2 -2
- package/components/card.d.ts.map +1 -1
- package/components/card.js +8 -13
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +8 -5
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +18 -11
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +7 -3
- package/components/details.d.ts.map +1 -1
- package/components/details.js +7 -3
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +9 -5
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +20 -14
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts +3 -4
- package/components/divider.d.ts.map +1 -1
- package/components/divider.js +6 -7
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts +9 -8
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +3 -2
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts +3 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +13 -4
- package/components/flex.js.map +1 -1
- package/components/form.d.ts +2 -3
- package/components/form.d.ts.map +1 -1
- package/components/form.js +0 -2
- package/components/form.js.map +1 -1
- package/components/grid.d.ts +9 -3
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +6 -4
- package/components/grid.js.map +1 -1
- package/components/input.d.ts +4 -4
- package/components/input.d.ts.map +1 -1
- package/components/input.js +5 -7
- package/components/input.js.map +1 -1
- package/components/layout.d.ts +4 -6
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +23 -12
- package/components/layout.js.map +1 -1
- package/components/link.d.ts +3 -1
- package/components/link.d.ts.map +1 -1
- package/components/link.js +3 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts +4 -12
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +9 -17
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +45 -18
- package/components/range.d.ts.map +1 -1
- package/components/range.js +133 -62
- package/components/range.js.map +1 -1
- package/components/rotate.d.ts +3 -2
- 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 +15 -17
- package/components/router.d.ts.map +1 -1
- package/components/router.js +10 -10
- package/components/router.js.map +1 -1
- package/components/select.d.ts +6 -9
- package/components/select.d.ts.map +1 -1
- package/components/select.js +48 -43
- package/components/select.js.map +1 -1
- package/components/skeleton.d.ts +2 -1
- package/components/skeleton.d.ts.map +1 -1
- package/components/skeleton.js +5 -5
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts +20 -2
- package/components/split.d.ts.map +1 -1
- package/components/split.js +54 -20
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +6 -5
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +7 -6
- package/components/switch.js.map +1 -1
- package/components/text.d.ts +2 -1
- package/components/text.d.ts.map +1 -1
- package/components/text.js +5 -6
- package/components/text.js.map +1 -1
- package/components/time.d.ts +6 -22
- package/components/time.d.ts.map +1 -1
- package/components/time.js +7 -67
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +13 -2
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +24 -5
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +4 -4
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +4 -5
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +9 -2
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.d.ts +2 -1
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +4 -3
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +5 -5
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +3 -6
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js +1 -1
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/dev/components/alert.d.ts +6 -3
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +38 -25
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +7 -2
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +28 -13
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/breath.d.ts +4 -2
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +20 -6
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +20 -11
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +34 -25
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts +2 -2
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +25 -30
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts +8 -5
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +35 -20
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +7 -3
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +12 -4
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +9 -5
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +30 -24
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts +3 -4
- package/dev/components/divider.d.ts.map +1 -1
- package/dev/components/divider.js +20 -8
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +9 -8
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +8 -1
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts +3 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +24 -4
- package/dev/components/flex.js.map +1 -1
- package/dev/components/form.d.ts +2 -3
- package/dev/components/form.d.ts.map +1 -1
- package/dev/components/form.js +0 -2
- package/dev/components/form.js.map +1 -1
- package/dev/components/grid.d.ts +9 -3
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +17 -4
- package/dev/components/grid.js.map +1 -1
- package/dev/components/input.d.ts +4 -4
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +3 -21
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts +4 -6
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +33 -13
- package/dev/components/layout.js.map +1 -1
- package/dev/components/link.d.ts +3 -1
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +3 -1
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts +4 -12
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +14 -18
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +45 -18
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +164 -109
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +3 -2
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +1 -1
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts +15 -17
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +10 -10
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +6 -9
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +58 -45
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts +2 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +6 -6
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts +20 -2
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +69 -32
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts +6 -5
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +23 -20
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts +2 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +7 -7
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +6 -22
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +9 -67
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts +13 -2
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +55 -20
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +4 -4
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +11 -5
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +18 -10
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/super-anchor.d.ts +2 -1
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +8 -5
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +5 -5
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +21 -20
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts.map +1 -1
- package/dev/core/super-openable.js +1 -1
- package/dev/core/super-openable.js.map +1 -1
- package/dev/range.d.ts +1 -1
- package/dev/range.d.ts.map +1 -1
- package/index.js +13 -13
- package/package.json +11 -8
- package/range.d.ts +1 -1
- package/range.d.ts.map +1 -1
- package/src/alert.ts +11 -0
- package/src/avatar.ts +11 -0
- package/src/breath.ts +13 -0
- package/src/button.ts +11 -0
- package/src/card.ts +11 -0
- package/src/carousel.ts +11 -0
- package/src/components/alert.ts +284 -0
- package/src/components/avatar.ts +109 -0
- package/src/components/breath.ts +165 -0
- package/src/components/button.ts +292 -0
- package/src/components/card.ts +83 -0
- package/src/components/carousel.ts +183 -0
- package/src/components/details.ts +121 -0
- package/src/components/dialog.ts +166 -0
- package/src/components/divider.ts +56 -0
- package/src/components/dragbox.ts +134 -0
- package/src/components/flex.ts +82 -0
- package/src/components/form.ts +82 -0
- package/src/components/grid.ts +87 -0
- package/src/components/input.ts +73 -0
- package/src/components/layout.ts +89 -0
- package/src/components/link.ts +38 -0
- package/src/components/progress.ts +100 -0
- package/src/components/range.ts +399 -0
- package/src/components/rotate.ts +95 -0
- package/src/components/router.ts +281 -0
- package/src/components/select.ts +281 -0
- package/src/components/skeleton.ts +119 -0
- package/src/components/split.ts +225 -0
- package/src/components/switch.ts +184 -0
- package/src/components/text.ts +93 -0
- package/src/components/time.ts +84 -0
- package/src/components/tooltip.ts +150 -0
- package/src/components/typewriter.ts +159 -0
- package/src/core/global-style.ts +105 -0
- package/src/core/super-anchor.ts +55 -0
- package/src/core/super-input.ts +230 -0
- package/src/core/super-openable.ts +51 -0
- package/src/details.ts +11 -0
- package/src/dialog.ts +11 -0
- package/src/divider.ts +11 -0
- package/src/dragbox.ts +11 -0
- package/src/flex.ts +11 -0
- package/src/form.ts +11 -0
- package/src/grid.ts +11 -0
- package/src/index.ts +28 -0
- package/src/input.ts +13 -0
- package/src/layout.ts +12 -0
- package/src/link.ts +13 -0
- package/src/progress.ts +12 -0
- package/src/range.ts +13 -0
- package/src/rotate.ts +13 -0
- package/src/router.ts +12 -0
- package/src/select.ts +13 -0
- package/src/skeleton.ts +13 -0
- package/src/split.ts +13 -0
- package/src/switch.ts +13 -0
- package/src/text.ts +13 -0
- package/src/time.ts +13 -0
- package/src/tooltip.ts +13 -0
- package/src/typewriter.ts +11 -0
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/components/split.js
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
import { __decorate } from 'tslib';
|
2
2
|
import { godown } from '@godown/element/decorators/godown.js';
|
3
3
|
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
+
import { attr } from '@godown/element/directives/attr.js';
|
4
5
|
import { classList } from '@godown/element/directives/class-list.js';
|
5
|
-
import {
|
6
|
+
import { html, nothing, css } from 'lit';
|
6
7
|
import { property, state } from 'lit/decorators.js';
|
7
8
|
import { scopePrefix, cssGlobalVars } from '../core/global-style.js';
|
8
9
|
import SuperInput from '../core/super-input.js';
|
9
10
|
|
10
11
|
const protoName = "split";
|
11
12
|
const cssScope = scopePrefix(protoName);
|
13
|
+
const loop = (len, fn) => {
|
14
|
+
const result = new Array(len);
|
15
|
+
for (let index = 0; index < len; index++) {
|
16
|
+
result[index] = fn(index);
|
17
|
+
}
|
18
|
+
return result;
|
19
|
+
};
|
12
20
|
/**
|
13
21
|
* {@linkcode Split} renders multiple input boxes.
|
14
22
|
*
|
@@ -33,8 +41,7 @@ let Split = class Split extends SuperInput {
|
|
33
41
|
this.currentValue = [];
|
34
42
|
}
|
35
43
|
render() {
|
36
|
-
return html `<div part="root">${this.currentValue
|
37
|
-
.map((value, index) => html `<span part="input-box" @click="${this.disabled ? null : () => this.focusAt(index)}" class="${classList({ focus: this.current === index }) || nothing}">${value}</span>`)} <input part="input" id="${this.makeId}" @blur="${this.blur}" @input="${this._handleInput}" .value="${
|
44
|
+
return html `<div part="root" ${attr(this.observedRecord)}>${loop(this.len, (index) => html `<span part="input-box" @click="${this.disabled ? null : () => this.focusAt(index)}" class="${classList({ focus: this.current === index }) || nothing}">${this.currentValue[index]}</span>`)} <input part="input" id="${this.makeId}" @blur="${this.blur}" @input="${this._handleInput}" .value="${
|
38
45
|
/* Ensure that input always has a value of length this.len */
|
39
46
|
this.value.padStart(this.len, " ")}"></div>`;
|
40
47
|
}
|
@@ -47,7 +54,29 @@ let Split = class Split extends SuperInput {
|
|
47
54
|
if (this.compositing) {
|
48
55
|
return;
|
49
56
|
}
|
50
|
-
|
57
|
+
this.fillInput(e.data);
|
58
|
+
this.value = this.currentValue.join("");
|
59
|
+
this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true, composed: true }));
|
60
|
+
this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
|
61
|
+
}
|
62
|
+
/**
|
63
|
+
* Fill input with data.
|
64
|
+
*
|
65
|
+
* If data is null
|
66
|
+
* - If current value is null, move to before.
|
67
|
+
* - If current value is not null, delete it.
|
68
|
+
*
|
69
|
+
* If data is not null
|
70
|
+
* - If current value is null, input data.
|
71
|
+
* - If current value is not null, input data and move to after.
|
72
|
+
*
|
73
|
+
* If data is multiple characters,
|
74
|
+
* Fill input with data[0] and call fillInput with data.slice(1).
|
75
|
+
*
|
76
|
+
* @param data Input event data.
|
77
|
+
*/
|
78
|
+
fillInput(data) {
|
79
|
+
if (data === null) {
|
51
80
|
// delete
|
52
81
|
if (this.currentValue[this.current] !== null) {
|
53
82
|
// delete exist value
|
@@ -59,28 +88,32 @@ let Split = class Split extends SuperInput {
|
|
59
88
|
const lastNotNull = this.currentValue.findLastIndex(a => a !== null);
|
60
89
|
this.current = this.current - 1 < 0 ? lastNotNull < 0 ? 0 : lastNotNull : this.current - 1;
|
61
90
|
}
|
91
|
+
return;
|
62
92
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
}
|
93
|
+
const multiple = data.length > 1;
|
94
|
+
// input
|
95
|
+
this.currentValue[this.current] = data[0];
|
96
|
+
if (this.current + 1 >= this.len) {
|
97
|
+
// index overflow
|
98
|
+
this.current = this.currentValue.indexOf(null);
|
99
|
+
if (this.current === -1) {
|
100
|
+
this.blur();
|
72
101
|
}
|
73
|
-
|
74
|
-
|
75
|
-
|
102
|
+
}
|
103
|
+
else {
|
104
|
+
// go to after
|
105
|
+
this.current += 1;
|
106
|
+
}
|
107
|
+
if (multiple) {
|
108
|
+
const after = data.slice(1);
|
109
|
+
if (after) {
|
110
|
+
this.fillInput(after);
|
76
111
|
}
|
77
112
|
}
|
78
|
-
this.value = this.currentValue.join("");
|
79
|
-
this.dispatchEvent(new CustomEvent("input", { detail: this.value, bubbles: true, composed: true }));
|
80
|
-
this.dispatchEvent(new CustomEvent("change", { detail: this.value, composed: true }));
|
81
113
|
}
|
82
114
|
focus() {
|
83
115
|
this.focusAt(this.current);
|
116
|
+
super.focus();
|
84
117
|
}
|
85
118
|
focusAt(i) {
|
86
119
|
this.current = i;
|
@@ -89,6 +122,7 @@ let Split = class Split extends SuperInput {
|
|
89
122
|
blur() {
|
90
123
|
this._input.blur();
|
91
124
|
this.current = -1;
|
125
|
+
super.blur();
|
92
126
|
}
|
93
127
|
reset() {
|
94
128
|
this.current = -1;
|
@@ -113,7 +147,7 @@ __decorate([
|
|
113
147
|
], Split.prototype, "currentValue", void 0);
|
114
148
|
Split = __decorate([
|
115
149
|
godown(protoName),
|
116
|
-
styles(css `:host{color:var(${cssGlobalVars.foreground});display:block;border-radius:1px;width:-moz-fit-content;width:fit-content;${cssScope}--size:1.45em;${cssScope}--gap:.25em}[part=root]{gap:var(${cssScope}--gap);width:100%;position:relative;vertical-align:top;display:inline-flex;justify-content:space-between;border-radius:inherit}[part=input-box]{width:var(${cssScope}--size);height:var(${cssScope}--size);vertical-align:top;text-align:center;background-color:var(${cssGlobalVars.input}-background);border-radius:inherit}[part=input]{width:100%;height:100%;opacity:0;background:0 0;position:absolute;z-index:-1}.focus{box-shadow:var(${cssGlobalVars.input}-box-shadow)}`)
|
150
|
+
styles(css `:host{color:var(${cssGlobalVars.foreground});display:block;border-radius:1px;width:-moz-fit-content;width:fit-content;${cssScope}--size:1.45em;${cssScope}--gap:.25em}:host([contents]) [part=root]{width:-moz-fit-content;width:fit-content}[part=root]{gap:var(${cssScope}--gap);width:100%;position:relative;vertical-align:top;display:inline-flex;justify-content:space-between;border-radius:inherit}[part=input-box]{width:var(${cssScope}--size);height:var(${cssScope}--size);vertical-align:top;text-align:center;background-color:var(${cssGlobalVars.input}-background);border-radius:inherit}[part=input]{width:100%;height:100%;opacity:0;background:0 0;position:absolute;z-index:-1}.focus{box-shadow:var(${cssGlobalVars.input}-box-shadow)}`)
|
117
151
|
], Split);
|
118
152
|
var Split$1 = Split;
|
119
153
|
|
package/components/split.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"split.js","sources":["../src/components/split.ts"],"sourcesContent":null,"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"split.js","sources":["../src/components/split.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;AAWA,MAAM,SAAS,GAAG,OAAO;AACzB,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;AAEvC,MAAM,IAAI,GAAG,CAAI,GAAW,EAAE,EAAyB,KAAI;AACzD,IAAA,MAAM,MAAM,GAAQ,IAAI,KAAK,CAAC,GAAG,CAAC;AAClC,IAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,KAAK,EAAE,EAAE;QACxC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;;AAE3B,IAAA,OAAO,MAAM;AACf,CAAC;AAED;;;;;;;;AAQE;AAKF,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,UAAU,CAAA;AAA9B,IAAA,WAAA,GAAA;;AACE;;AAEE;QAEF,IAAG,CAAA,GAAA,GAAG,CAAC;AAEP;;AAEE;QAEF,IAAK,CAAA,KAAA,GAAG,CAAC,CAAC;QAGV,IAAO,CAAA,OAAA,GAAG,CAAC,CAAC;QAGZ,IAAY,CAAA,YAAA,GAAsB,EAAE;;IAE1B,MAAM,GAAA;AACd,QAAA,OAAO,IAAI,CAAA,CAAA,iBAAA,EAAoB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA,CAAA,EAEtD,IAAI,CAAC,IAAI,CAAC,GA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AA,KAAA,CAAA,SAAA,EAAA,cAAA,EAAA,KAAA,CAAA,CAAA;AAjBhC,KAAK,GAAA,UAAA,CAAA;IAJV,MAAM,CAAC,SAAS,CAAA;IAChB,MAAM,CACL,GAAG,CAAA,CAAmB,gBAAA,EAAA,aAAa,CAAC,UAAU,CAA8E,2EAAA,EAAA,QAAQ,CAAiB,cAAA,EAAA,QAAQ,CAA0G,uGAAA,EAAA,QAAQ,6JAA6J,QAAQ,CAAA,mBAAA,EAAsB,QAAQ,CAAA,kEAAA,EAAqE,aAAa,CAAC,KAAK,CAAA,mJAAA,EAAuJ,aAAa,CAAC,KAAK,CAAA,aAAA,CAAe;AAE/tB,CAAA,EAAA,KAAK,CA8IX;AAEA,cAAe,KAAK;;;;"}
|
package/components/switch.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type TemplateResult } from "lit";
|
1
2
|
import SuperInput from "../core/super-input.js";
|
2
3
|
/**
|
3
4
|
* {@linkcode Switch} renders a switch.
|
@@ -9,7 +10,7 @@ import SuperInput from "../core/super-input.js";
|
|
9
10
|
*/
|
10
11
|
declare class Switch extends SuperInput {
|
11
12
|
/**
|
12
|
-
*
|
13
|
+
* Display rounded.
|
13
14
|
*/
|
14
15
|
round: boolean;
|
15
16
|
/**
|
@@ -17,19 +18,19 @@ declare class Switch extends SuperInput {
|
|
17
18
|
*/
|
18
19
|
checked: boolean;
|
19
20
|
/**
|
20
|
-
*
|
21
|
+
* Disable this element.
|
21
22
|
*/
|
22
23
|
disabled: boolean;
|
23
24
|
/**
|
24
|
-
*
|
25
|
+
* Default checked state.
|
25
26
|
*/
|
26
27
|
default: string;
|
27
28
|
/**
|
28
29
|
* Input value.
|
29
30
|
*/
|
30
31
|
value: string;
|
31
|
-
_input: HTMLInputElement;
|
32
|
-
protected render():
|
32
|
+
protected _input: HTMLInputElement;
|
33
|
+
protected render(): TemplateResult<1>;
|
33
34
|
reset(): void;
|
34
35
|
connectedCallback(): void;
|
35
36
|
protected _handleChange(): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../src/components/switch.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../src/components/switch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIrD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAKhD;;;;;;;GAOG;AACH,cAIM,MAAO,SAAQ,UAAU;IAC7B;;OAEG;IAEH,KAAK,UAAS;IAEd;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,SAAW;IAElB;;OAEG;IAEH,KAAK,SAAQ;IAGb,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAEnC,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAIrC,KAAK,IAAI,IAAI;IAKb,iBAAiB,IAAI,IAAI;IAUzB,SAAS,CAAC,aAAa,IAAI,IAAI;IAM/B,SAAS,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;CAG/B;AAED,eAAe,MAAM,CAAC"}
|
package/components/switch.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import { __decorate } from 'tslib';
|
2
2
|
import { godown } from '@godown/element/decorators/godown.js';
|
3
3
|
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import {
|
4
|
+
import { attr } from '@godown/element/directives/attr.js';
|
5
|
+
import { html, css } from 'lit';
|
5
6
|
import { property, query } from 'lit/decorators.js';
|
6
7
|
import { scopePrefix, cssGlobalVars } from '../core/global-style.js';
|
7
8
|
import SuperInput from '../core/super-input.js';
|
@@ -20,7 +21,7 @@ let Switch = class Switch extends SuperInput {
|
|
20
21
|
constructor() {
|
21
22
|
super(...arguments);
|
22
23
|
/**
|
23
|
-
*
|
24
|
+
* Display rounded.
|
24
25
|
*/
|
25
26
|
this.round = false;
|
26
27
|
/**
|
@@ -28,11 +29,11 @@ let Switch = class Switch extends SuperInput {
|
|
28
29
|
*/
|
29
30
|
this.checked = false;
|
30
31
|
/**
|
31
|
-
*
|
32
|
+
* Disable this element.
|
32
33
|
*/
|
33
34
|
this.disabled = false;
|
34
35
|
/**
|
35
|
-
*
|
36
|
+
* Default checked state.
|
36
37
|
*/
|
37
38
|
this.default = "false";
|
38
39
|
/**
|
@@ -41,7 +42,7 @@ let Switch = class Switch extends SuperInput {
|
|
41
42
|
this.value = "on";
|
42
43
|
}
|
43
44
|
render() {
|
44
|
-
return html `<div part="root" class="${this.round ? "round" : "rect"}"><input part="input" @change="${this._handleChange}" ?disabled="${this.disabled}" ?checked="${this.checked}" name="${this.name}" id="${this.makeId}" type="checkbox"> <span class="${this.checked}"></span></div>`;
|
45
|
+
return html `<div part="root" ${attr(this.observedRecord)} class="${this.round ? "round" : "rect"}"><input part="input" @change="${this._handleChange}" ?disabled="${this.disabled}" ?checked="${this.checked}" name="${this.name}" id="${this.makeId}" type="checkbox"> <span part="handle" class="${this.checked}"></span></div>`;
|
45
46
|
}
|
46
47
|
reset() {
|
47
48
|
this.checked = this.default === "true";
|
@@ -85,7 +86,7 @@ __decorate([
|
|
85
86
|
], Switch.prototype, "_input", void 0);
|
86
87
|
Switch = __decorate([
|
87
88
|
godown(protoName),
|
88
|
-
styles(css `:host{${cssScope}-width:3em;${cssScope}-height:calc(var(${cssScope}-width)/ 2);${cssScope}-handle-size:1.25em;${cssScope}-transition:.2s ease-in-out;background:var(${cssGlobalVars.input}-background);
|
89
|
+
styles(css `:host,:host([contents]) [part=root]{width:var(${cssScope}-width);height:var(${cssScope}-height)}:host{${cssScope}-width:3em;${cssScope}-height:calc(var(${cssScope}-width)/ 2);${cssScope}-handle-size:1.25em;${cssScope}-handle-space:.125em;${cssScope}-transition:.2s ease-in-out;background:var(${cssGlobalVars.input}-background);display:inline-block;vertical-align:bottom;border-radius:0}[part=root],span{transition:var(${cssScope}-transition)}[part=root]{border-radius:inherit;position:relative;height:inherit}input{opacity:0;width:100%;height:100%;-webkit-appearance:none;appearance:none}span{height:100%;display:inline-flex;align-items:center;justify-content:center;position:absolute;left:0;width:50%;pointer-events:none;border-radius:inherit}:host([round]){border-radius:calc(var(${cssScope}-height)/ 2)}:host([checked]) span{left:50%}.rect .true{background:var(${cssGlobalVars.active})}.rect .false{background:var(${cssGlobalVars.passive})}.round span{--size:var(${cssScope}-handle-size);border-radius:100%;background:var(--godown--input-control);width:var(--size);height:var(--size);margin:var(${cssScope}-handle-space)}.round{background:var(${cssGlobalVars.passive})}:host([checked]) .round{background:var(${cssGlobalVars.active})}`)
|
89
90
|
], Switch);
|
90
91
|
var Switch$1 = Switch;
|
91
92
|
|
package/components/switch.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"switch.js","sources":["../src/components/switch.ts"],"sourcesContent":null,"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"switch.js","sources":["../src/components/switch.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;AASA,MAAM,SAAS,GAAG,QAAQ;AAC1B,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;AAEvC;;;;;;;AAOE;AAKF,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU,CAAA;AAA/B,IAAA,WAAA,GAAA;;AACE;;AAEE;QAEF,IAAK,CAAA,KAAA,GAAG,KAAK;AAEb;;AAEE;QAEF,IAAO,CAAA,OAAA,GAAG,KAAK;AAEf;;AAEE;QAEF,IAAQ,CAAA,QAAA,GAAG,KAAK;AAEhB;;AAEE;QAEF,IAAO,CAAA,OAAA,GAAG,OAAO;AAEjB;;AAEE;QAEF,IAAK,CAAA,KAAA,GAAG,IAAI;;IAKF,MAAM,GAAA;QACd,OAAO,IAAI,CAAA,CACP,iBAAA,EAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA,QAAA,EAClB,IAAI,CAAC,KAAK,GAAG,OA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EAAA,CAAI;AAEvtC,CAAA,EAAA,MAAM,CA4EZ;AAEA,eAAe,MAAM;;;;"}
|
package/components/text.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { type TemplateResult } from "lit";
|
1
2
|
import { GlobalStyle } from "../core/global-style.js";
|
2
3
|
/**
|
3
4
|
* {@linkcode Text} renders nowrap text.
|
@@ -13,7 +14,7 @@ declare class Text extends GlobalStyle {
|
|
13
14
|
* Set background-clip to text.
|
14
15
|
*/
|
15
16
|
clip: boolean;
|
16
|
-
protected render():
|
17
|
+
protected render(): TemplateResult<1>;
|
17
18
|
}
|
18
19
|
export default Text;
|
19
20
|
//# sourceMappingURL=text.d.ts.map
|
package/components/text.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/components/text.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/components/text.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAiB,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAMlF;;;;GAIG;AACH,cAEM,IAAK,SAAQ,WAAW;IAC5B;;OAEG;IAEH,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAU;IAE3D;;OAEG;IAEH,IAAI,EAAE,OAAO,CAAC;IAEd,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAGtC;AAED,eAAe,IAAI,CAAC"}
|
package/components/text.js
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
import { __decorate } from 'tslib';
|
2
2
|
import { godown } from '@godown/element/decorators/godown.js';
|
3
3
|
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
+
import { attr } from '@godown/element/directives/attr.js';
|
4
5
|
import { classList } from '@godown/element/directives/class-list.js';
|
5
6
|
import { htmlSlot } from '@godown/element/directives/html-slot.js';
|
6
|
-
import {
|
7
|
+
import { html, css } from 'lit';
|
7
8
|
import { property } from 'lit/decorators.js';
|
8
|
-
import { scopePrefix,
|
9
|
+
import { scopePrefix, GlobalStyle, cssGlobalVars } from '../core/global-style.js';
|
9
10
|
|
10
11
|
const protoName = "text";
|
11
12
|
const cssScope = scopePrefix(protoName);
|
@@ -23,9 +24,7 @@ let Text = class Text extends GlobalStyle {
|
|
23
24
|
this.underline = "none";
|
24
25
|
}
|
25
26
|
render() {
|
26
|
-
return html `<span part="root" class="${classList(this.underline
|
27
|
-
clip: this.clip,
|
28
|
-
})}">${htmlSlot()}</span>`;
|
27
|
+
return html `<span part="root" ${attr(this.observedRecord)} class="${classList(this.underline)}">${htmlSlot()}</span>`;
|
29
28
|
}
|
30
29
|
};
|
31
30
|
__decorate([
|
@@ -36,7 +35,7 @@ __decorate([
|
|
36
35
|
], Text.prototype, "clip", void 0);
|
37
36
|
Text = __decorate([
|
38
37
|
godown(protoName),
|
39
|
-
styles(css `:host{${cssScope}--color:currentColor;${cssScope}--color-hover:currentColor;${cssScope}--color-active:currentColor;display:inline-block;text-overflow:ellipsis;overflow-wrap:break-word}
|
38
|
+
styles(css `:host{${cssScope}--color:currentColor;${cssScope}--color-hover:currentColor;${cssScope}--color-active:currentColor;display:inline-block;text-overflow:ellipsis;overflow-wrap:break-word}[part=root]{white-space:nowrap;width:100%;vertical-align:bottom;display:inline-block;text-overflow:inherit;overflow-wrap:inherit;overflow:hidden;color:var(${cssScope}--color)}[part=root]:hover{color:var(${cssScope}--color-hover,var(${cssScope}--color))}[part=root]:active{color:var(${cssScope}--color-active,var(${cssScope}--color))}.active:active,.always,.hover:hover{text-decoration:underline}.none{text-decoration:none}[clip]{background:var(${cssGlobalVars.clipBackground});display:inline-block;color:transparent;-webkit-text-fill-color:transparent;background-clip:text;-webkit-background-clip:text}`)
|
40
39
|
], Text);
|
41
40
|
var Text$1 = Text;
|
42
41
|
|
package/components/text.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"text.js","sources":["../src/components/text.ts"],"sourcesContent":null,"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"text.js","sources":["../src/components/text.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,SAAS,GAAG,MAAM;AAExB,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC;AAEvC;;;;AAIE;AAGF,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,WAAW,CAAA;AAA9B,IAAA,WAAA,GAAA;;AACE;;AAEE;QAEF,IAAS,CAAA,SAAA,GAA2C,MAAM;;IAQhD,MAAM,GAAA;QACd,OAAO,IAAI,CAAA,CAEP,kBAAA,EAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA,QAAA,EAClB,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAEhC,QAAQ,EAAE,SACN;;CAEZ;AAjBE,UAAA,CAAA;AADC,IAAA,QAAQ;AACiD,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA;AAM1D,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;AACd,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAXT,IAAI,GAAA,UAAA,CAAA;IAFT,MAAM,CAAC,SAAS,CAAA;IAChB,MAAM,CAAC,GAAG,CAAA,CAAS,MAAA,EAAA,QAAQ,wBAAwB,QAAQ,CAAA,2BAAA,EAA8B,QAAQ,CAAA,4PAAA,EAA+P,QAAQ,CAAA,qCAAA,EAAwC,QAAQ,CAAqB,kBAAA,EAAA,QAAQ,CAA0C,uCAAA,EAAA,QAAQ,CAAsB,mBAAA,EAAA,QAAQ,4HAA4H,aAAa,CAAC,cAAc,CAAA,+HAAA,CAAiI;AACzxB,CAAA,EAAA,IAAI,CAsBV;AAEA,aAAe,IAAI;;;;"}
|
package/components/time.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type PropertyValues } from "lit";
|
1
|
+
import { type PropertyValues, TemplateResult } from "lit";
|
2
2
|
import { GlobalStyle } from "../core/global-style.js";
|
3
3
|
/**
|
4
4
|
* {@linkcode Time} renders a formatting time.
|
@@ -7,12 +7,11 @@ import { GlobalStyle } from "../core/global-style.js";
|
|
7
7
|
*/
|
8
8
|
declare class Time extends GlobalStyle {
|
9
9
|
/**
|
10
|
-
*
|
10
|
+
* Escape symbol.
|
11
11
|
*/
|
12
12
|
escape: string;
|
13
13
|
/**
|
14
14
|
* Format strings.
|
15
|
-
* {@linkcode Time.fmt}
|
16
15
|
*/
|
17
16
|
format: string;
|
18
17
|
/**
|
@@ -22,32 +21,17 @@ declare class Time extends GlobalStyle {
|
|
22
21
|
/**
|
23
22
|
* If there is a value, update every gap or timeout.
|
24
23
|
*/
|
25
|
-
timeout:
|
24
|
+
timeout: any;
|
26
25
|
/**
|
27
26
|
* The number of milliseconds that change with each update.
|
28
27
|
*/
|
29
|
-
gap:
|
30
|
-
timeoutId: number;
|
31
|
-
protected render():
|
28
|
+
gap: any;
|
29
|
+
protected timeoutId: number;
|
30
|
+
protected render(): TemplateResult<1>;
|
32
31
|
protected firstUpdated(): void;
|
33
32
|
protected updated(changedProperties: PropertyValues): void;
|
34
33
|
disconnectedCallback(): void;
|
35
34
|
startTimeout(): number;
|
36
|
-
/**
|
37
|
-
* Y for year\
|
38
|
-
* M for month\
|
39
|
-
* D for day\
|
40
|
-
* h for hour\
|
41
|
-
* m for minute\
|
42
|
-
* s for second\
|
43
|
-
* S for milli second\
|
44
|
-
* Z for time zone.
|
45
|
-
*
|
46
|
-
* @param fm Format string.
|
47
|
-
* @param tm Time.
|
48
|
-
* @returns Format result
|
49
|
-
*/
|
50
|
-
static fmt(fm: string, tm: Date, em: string): string;
|
51
35
|
}
|
52
36
|
export default Time;
|
53
37
|
//# sourceMappingURL=time.d.ts.map
|
package/components/time.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/components/time.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/components/time.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;;GAIG;AACH,cAEM,IAAK,SAAQ,WAAW;IAC5B;;OAEG;IAEH,MAAM,SAAO;IAEb;;OAEG;IAEH,MAAM,SAA8B;IAEpC;;OAEG;IAEH,IAAI,EAAE,IAAI,CAAc;IAExB;;OAEG;IAEH,OAAO,EAAE,GAAG,CAAC;IAEb;;OAEG;IAEH,GAAG,EAAE,GAAG,CAAC;IAET,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAE5B,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAIrC,SAAS,CAAC,YAAY,IAAI,IAAI;IAM9B,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAS1D,oBAAoB,IAAI,IAAI;IAI5B,YAAY,IAAI,MAAM;CAKvB;AAED,eAAe,IAAI,CAAC"}
|
package/components/time.js
CHANGED
@@ -1,44 +1,36 @@
|
|
1
1
|
import { __decorate } from 'tslib';
|
2
2
|
import { godown } from '@godown/element/decorators/godown.js';
|
3
3
|
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import {
|
4
|
+
import { attr } from '@godown/element/directives/attr.js';
|
5
|
+
import fmtime from 'fmtime';
|
6
|
+
import { html, css } from 'lit';
|
5
7
|
import { property } from 'lit/decorators.js';
|
6
8
|
import { GlobalStyle } from '../core/global-style.js';
|
7
9
|
|
8
|
-
var Time_1;
|
9
10
|
const protoName = "time";
|
10
11
|
/**
|
11
12
|
* {@linkcode Time} renders a formatting time.
|
12
13
|
*
|
13
14
|
* @category display
|
14
15
|
*/
|
15
|
-
let Time =
|
16
|
+
let Time = class Time extends GlobalStyle {
|
16
17
|
constructor() {
|
17
18
|
super(...arguments);
|
18
19
|
/**
|
19
|
-
*
|
20
|
+
* Escape symbol.
|
20
21
|
*/
|
21
22
|
this.escape = "%";
|
22
23
|
/**
|
23
24
|
* Format strings.
|
24
|
-
* {@linkcode Time.fmt}
|
25
25
|
*/
|
26
26
|
this.format = "YYYY-MM-DD hh:mm:ss UTFZ";
|
27
27
|
/**
|
28
28
|
* Time.
|
29
29
|
*/
|
30
30
|
this.time = new Date();
|
31
|
-
/**
|
32
|
-
* If there is a value, update every gap or timeout.
|
33
|
-
*/
|
34
|
-
this.timeout = 0;
|
35
|
-
/**
|
36
|
-
* The number of milliseconds that change with each update.
|
37
|
-
*/
|
38
|
-
this.gap = 0;
|
39
31
|
}
|
40
32
|
render() {
|
41
|
-
return
|
33
|
+
return html `<span part="root" ${attr(this.observedRecord)}>${fmtime(this.format, this.time, this.escape)}</span>`;
|
42
34
|
}
|
43
35
|
firstUpdated() {
|
44
36
|
if (this.timeout) {
|
@@ -61,58 +53,6 @@ let Time = Time_1 = class Time extends GlobalStyle {
|
|
61
53
|
this.time = new Date(this.time.getTime() + (this.gap || this.timeout));
|
62
54
|
}, Math.abs(this.timeout));
|
63
55
|
}
|
64
|
-
/**
|
65
|
-
* Y for year\
|
66
|
-
* M for month\
|
67
|
-
* D for day\
|
68
|
-
* h for hour\
|
69
|
-
* m for minute\
|
70
|
-
* s for second\
|
71
|
-
* S for milli second\
|
72
|
-
* Z for time zone.
|
73
|
-
*
|
74
|
-
* @param fm Format string.
|
75
|
-
* @param tm Time.
|
76
|
-
* @returns Format result
|
77
|
-
*/
|
78
|
-
static fmt(fm, tm, em) {
|
79
|
-
if (!fm) {
|
80
|
-
return fm;
|
81
|
-
}
|
82
|
-
tm = typeof tm === "string" ? new Date(tm) : tm;
|
83
|
-
if (isNaN(tm.getTime())) {
|
84
|
-
return fm;
|
85
|
-
}
|
86
|
-
const rest = [];
|
87
|
-
const replaced = `${em}${em}`;
|
88
|
-
fm = fm.replace(new RegExp(`${em}([ZYMDhmsS${em}])`, "g"), (_, p1) => {
|
89
|
-
rest.push(p1);
|
90
|
-
return replaced;
|
91
|
-
});
|
92
|
-
function formatNumber(n, max = 2) {
|
93
|
-
return n.toString().padStart(max, "0").split("");
|
94
|
-
}
|
95
|
-
const z = tm.getTimezoneOffset() / -60;
|
96
|
-
const switcher = {
|
97
|
-
Z: [z >= 0 ? "+" + z.toString() : z.toString()],
|
98
|
-
Y: tm.getFullYear().toString().split(""),
|
99
|
-
M: formatNumber(tm.getMonth() + 1),
|
100
|
-
D: formatNumber(tm.getDate()),
|
101
|
-
h: formatNumber(tm.getHours()),
|
102
|
-
m: formatNumber(tm.getMinutes()),
|
103
|
-
s: formatNumber(tm.getSeconds()),
|
104
|
-
S: formatNumber(tm.getMilliseconds(), 3),
|
105
|
-
};
|
106
|
-
const result = [];
|
107
|
-
for (const f of fm.split("").reverse()) {
|
108
|
-
const s = switcher[f]?.pop();
|
109
|
-
result.push(s ? s : f);
|
110
|
-
}
|
111
|
-
return result
|
112
|
-
.reverse()
|
113
|
-
.join("")
|
114
|
-
.replace(new RegExp(replaced, "g"), () => rest.shift());
|
115
|
-
}
|
116
56
|
};
|
117
57
|
__decorate([
|
118
58
|
property()
|
@@ -129,7 +69,7 @@ __decorate([
|
|
129
69
|
__decorate([
|
130
70
|
property({ type: Number })
|
131
71
|
], Time.prototype, "gap", void 0);
|
132
|
-
Time =
|
72
|
+
Time = __decorate([
|
133
73
|
godown(protoName),
|
134
74
|
styles(css `:host{text-align:center}`)
|
135
75
|
], Time);
|
package/components/time.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"time.js","sources":["../src/components/time.ts"],"sourcesContent":null,"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"time.js","sources":["../src/components/time.ts"],"sourcesContent":null,"names":[],"mappings":";;;;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AC,OAAO,CAAC,CAAC;;CAE9B;AA1DE,UAAA,CAAA;AADC,IAAA,QAAQ;AACG,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;AAMZ,UAAA,CAAA;AADC,IAAA,QAAQ;AAC0B,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;AAMnC,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AACH,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAMvB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AACd,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA;AAMZ,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAClB,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AA7BJ,IAAI,GAAA,UAAA,CAAA;IAFT,MAAM,CAAC,SAAS,CAAA;AAChB,IAAA,MAAM,CAAC,GAAG,CAAA,CAAA,wBAAA,CAA0B;AAC/B,CAAA,EAAA,IAAI,CA+DV;AAEA,aAAe,IAAI;;;;"}
|
package/components/tooltip.d.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
import { type TemplateResult } from "lit";
|
1
2
|
import SuperOpenable, { type Direction8 } from "../core/super-openable.js";
|
2
3
|
/**
|
3
4
|
* {@linkcode Tooltip} provide tooltip for slot elements.
|
4
5
|
*
|
5
6
|
* If it has the tip property, ignore the slot tip.
|
6
7
|
*
|
7
|
-
* @slot tip - Tip element.
|
8
|
+
* @slot tip - Tip element if no `tip` provided.
|
8
9
|
* @slot - Content.
|
9
10
|
* @category feedback
|
10
11
|
*/
|
@@ -25,6 +26,16 @@ declare class Tooltip extends SuperOpenable {
|
|
25
26
|
* If true, allow penetration of the tip.
|
26
27
|
*/
|
27
28
|
propagation: boolean;
|
29
|
+
/**
|
30
|
+
* How can tips be triggered.
|
31
|
+
*
|
32
|
+
* If `focus`, element will be focusable, open tip when focused.
|
33
|
+
*
|
34
|
+
* If `hover`, element will open tip when hovered.
|
35
|
+
*
|
36
|
+
* @default "hover"
|
37
|
+
*/
|
38
|
+
type: "hover" | "focus";
|
28
39
|
static aligns: {
|
29
40
|
start: string;
|
30
41
|
end: string;
|
@@ -32,7 +43,7 @@ declare class Tooltip extends SuperOpenable {
|
|
32
43
|
"flex-start": string;
|
33
44
|
"flex-end": string;
|
34
45
|
};
|
35
|
-
protected render():
|
46
|
+
protected render(): TemplateResult<1>;
|
36
47
|
}
|
37
48
|
export default Tooltip;
|
38
49
|
//# sourceMappingURL=tooltip.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../src/components/tooltip.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../src/components/tooltip.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIrD,OAAO,aAAa,EAAE,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAK3E;;;;;;;;GAQG;AACH,cAKM,OAAQ,SAAQ,aAAa;IACjC;;OAEG;IAEH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IAEH,SAAS,EAAE,UAAU,CAAS;IAE9B;;OAEG;IAEH,KAAK,EAAE,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAY;IAEzE;;OAEG;IAEH,WAAW,UAAS;IAEpB;;;;;;;;OAQG;IAEH,IAAI,EAAE,OAAO,GAAG,OAAO,CAAW;IAElC,MAAM,CAAC,MAAM;;;;;;MAMX;IAEF,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAStC;AAED,eAAe,OAAO,CAAC"}
|