godown 3.0.0-canary.12 → 3.0.0-canary.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/alert.js +1 -5
- package/alert.js.map +1 -1
- package/avatar.js +1 -5
- package/avatar.js.map +1 -1
- package/breath.js +1 -5
- package/breath.js.map +1 -1
- package/button.js +1 -5
- package/button.js.map +1 -1
- package/card.js +1 -5
- package/card.js.map +1 -1
- package/carousel.js +1 -5
- package/carousel.js.map +1 -1
- package/components/alert.js +1 -174
- package/components/alert.js.map +1 -1
- package/components/avatar.js +1 -68
- package/components/avatar.js.map +1 -1
- package/components/breath.js +1 -81
- package/components/breath.js.map +1 -1
- package/components/button.js +1 -185
- package/components/button.js.map +1 -1
- package/components/card.js +1 -49
- package/components/card.js.map +1 -1
- package/components/carousel.js +1 -119
- package/components/carousel.js.map +1 -1
- package/components/details.js +1 -53
- package/components/details.js.map +1 -1
- package/components/dialog.js +1 -98
- package/components/dialog.js.map +1 -1
- package/components/divider.js +1 -35
- package/components/divider.js.map +1 -1
- package/components/dragbox.js +1 -111
- package/components/dragbox.js.map +1 -1
- package/components/flex.js +1 -63
- package/components/flex.js.map +1 -1
- package/components/form.js +1 -75
- package/components/form.js.map +1 -1
- package/components/grid.js +1 -57
- package/components/grid.js.map +1 -1
- package/components/input.js +1 -51
- package/components/input.js.map +1 -1
- package/components/layout.js +1 -58
- package/components/layout.js.map +1 -1
- package/components/link.js +1 -53
- package/components/link.js.map +1 -1
- package/components/progress.js +1 -59
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +1 -0
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -267
- package/components/range.js.map +1 -1
- package/components/rotate.js +1 -56
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +1 -2
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -250
- package/components/router.js.map +1 -1
- package/components/select.js +1 -217
- package/components/select.js.map +1 -1
- package/components/skeleton.js +1 -55
- package/components/skeleton.js.map +1 -1
- package/components/split.js +1 -154
- package/components/split.js.map +1 -1
- package/components/switch.js +1 -93
- package/components/switch.js.map +1 -1
- package/components/text.js +1 -46
- package/components/text.js.map +1 -1
- package/components/time.js +1 -78
- package/components/time.js.map +1 -1
- package/components/tooltip.js +1 -85
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.js +1 -128
- package/components/typewriter.js.map +1 -1
- package/core/global-style.js +1 -52
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.js +1 -39
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.js +1 -117
- package/core/super-input.js.map +1 -1
- package/core/super-openable.js +1 -37
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/details.js +1 -5
- package/details.js.map +1 -1
- package/dev/components/range.d.ts +1 -0
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +8 -3
- package/dev/components/range.js.map +1 -1
- package/dev/components/router.d.ts +1 -2
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +4 -7
- package/dev/components/router.js.map +1 -1
- package/dialog.js +1 -5
- package/dialog.js.map +1 -1
- package/divider.js +1 -5
- package/divider.js.map +1 -1
- package/dragbox.js +1 -5
- package/dragbox.js.map +1 -1
- package/flex.js +1 -5
- package/flex.js.map +1 -1
- package/form.js +1 -5
- package/form.js.map +1 -1
- package/grid.js +1 -5
- package/grid.js.map +1 -1
- package/index.js +1 -56
- package/index.js.map +1 -1
- package/input.js +1 -5
- package/input.js.map +1 -1
- package/layout.js +1 -5
- package/layout.js.map +1 -1
- package/link.js +1 -5
- package/link.js.map +1 -1
- package/package.json +2 -2
- package/progress.js +1 -5
- package/progress.js.map +1 -1
- package/range.js +1 -5
- package/range.js.map +1 -1
- package/rotate.js +1 -5
- package/rotate.js.map +1 -1
- package/router.js +1 -5
- package/router.js.map +1 -1
- package/select.js +1 -5
- package/select.js.map +1 -1
- package/skeleton.js +1 -5
- package/skeleton.js.map +1 -1
- package/split.js +1 -5
- package/split.js.map +1 -1
- package/src/components/range.ts +9 -3
- package/src/components/router.ts +4 -8
- package/switch.js +1 -5
- package/switch.js.map +1 -1
- package/text.js +1 -5
- package/text.js.map +1 -1
- package/time.js +1 -5
- package/time.js.map +1 -1
- package/tooltip.js +1 -5
- package/tooltip.js.map +1 -1
- package/typewriter.js +1 -5
- package/typewriter.js.map +1 -1
- package/web-types.json +1 -1
package/components/select.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../src/components/select.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"select.js","sources":["../src/components/select.ts"],"sourcesContent":null,"names":["contain","a","b","toLowerCase","includes","updateChecked","element","operation","name","setAttribute","removeAttribute","Select","Input","constructor","this","multiple","visible","autoDirection","_store","render","html","attr","observedRecord","direction","_renderPrefix","ifDefined","dir","makeId","text","type","placeholder","nothing","autofocus","autocapitalize","autocomplete","disabled","_handleFocus","_handleInput","svgCaretDown","htmlSlot","top","bottom","getBoundingClientRect","window","innerHeight","_content","clientHeight","firstUpdated","events","add","e","preventDefault","stopPropagation","target","value","optionValue","select","textContent","lastChecked","_input","focus","document","composed1","composedPath","shadowRoot","contains","blur","_connectedInit","checked","querySelectorAll","length","forEach","default","defaultText","defaultChecked","reset","i","findIndex","s","splice","push","map","join","dispatchEvent","CustomEvent","detail","namevalue","filter","query","trim","children","filterCallback","match","style","display","compositing","c","start","slice","lastIndexOf","end","indexOf","betweenAt","selectionStart","options","super","option","getAttribute","__decorate","property","prototype","part","Boolean","state","godown","styles","css","Select$1"],"mappings":"ukBAaA,SAASA,EAAQC,EAAWC,GAC1B,OAAOD,GAAKC,GAAKD,EAAEE,cAAcC,SAASF,EAAEC,cAC9C,CAQA,SAASE,EAAcC,EAA6BC,GAClD,GAAID,EAAS,CACX,MAAME,EAAO,UACTD,EACFD,EAAQG,aAAaD,EAAM,IAE3BF,EAAQI,gBAAgBF,GAG9B,CAsBA,IAAMG,EAAN,MAAM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,KAAMmF,WACHrG,EAAAmG,UAAA,eAAA,GAGLF,EAAA,CADTK,KACmDtG,EAAAmG,UAAA,qBAAA,GAvBhDnG,EAAMiG,EAAA,CAJXM,EAhBiB,UAiBjBC,EACCC,CAAG,yOAECzG,GA0MN,IAAA0G,EAAe1G"}
|
package/components/skeleton.js
CHANGED
@@ -1,56 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
import { godown } from '@godown/element/decorators/godown.js';
|
3
|
-
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import { attr } from '@godown/element/directives/attr.js';
|
5
|
-
import { htmlSlot } from '@godown/element/directives/html-slot.js';
|
6
|
-
import iconPhoto from '@godown/f7-icon/icons/photo.js';
|
7
|
-
import { css, html } from 'lit';
|
8
|
-
import { property, state } from 'lit/decorators.js';
|
9
|
-
import { scopePrefix, cssGlobalVars, GlobalStyle } from '../core/global-style.js';
|
10
|
-
|
11
|
-
const protoName = "skeleton";
|
12
|
-
const cssScope = scopePrefix(protoName);
|
13
|
-
/**
|
14
|
-
* {@linkcode Skeleton} renders a skeleton screen.
|
15
|
-
*
|
16
|
-
* @slot loading - The content if loading is true.
|
17
|
-
* @slot - The content if loading is false.
|
18
|
-
* @category feedback
|
19
|
-
*/
|
20
|
-
let Skeleton = class Skeleton extends GlobalStyle {
|
21
|
-
constructor() {
|
22
|
-
super(...arguments);
|
23
|
-
/**
|
24
|
-
* Animation type.
|
25
|
-
* opacity animation only effect on slotted element and image icon.
|
26
|
-
*/
|
27
|
-
this.animation = "position";
|
28
|
-
/**
|
29
|
-
* If false, render slot only.
|
30
|
-
*/
|
31
|
-
this.loading = true;
|
32
|
-
}
|
33
|
-
render() {
|
34
|
-
if (!this.loading) {
|
35
|
-
return htmlSlot();
|
36
|
-
}
|
37
|
-
return html `<div part="root" ${attr(this.observedRecord)}>${this.type === "image" ? iconPhoto() : ""} ${htmlSlot("loading")}</div>`;
|
38
|
-
}
|
39
|
-
};
|
40
|
-
__decorate([
|
41
|
-
property()
|
42
|
-
], Skeleton.prototype, "type", void 0);
|
43
|
-
__decorate([
|
44
|
-
property()
|
45
|
-
], Skeleton.prototype, "animation", void 0);
|
46
|
-
__decorate([
|
47
|
-
state()
|
48
|
-
], Skeleton.prototype, "loading", void 0);
|
49
|
-
Skeleton = __decorate([
|
50
|
-
godown(protoName),
|
51
|
-
styles(css `:host{${cssScope}--from:var(${cssGlobalVars._colors.darkgray[9]});${cssScope}--to:var(${cssGlobalVars._colors.darkgray[7]});${cssScope}--deg:95deg;${cssScope}--duration:1.5s;${cssScope}--icon-size:5em;${cssScope}--icon-margin:.25em;color:var(${cssGlobalVars._colors.darkgray[5]});background:var(${cssScope}--from);min-height:1.5em;width:100%;flex-shrink:0;display:block;overflow:hidden}[part=root]{height:100%;min-height:inherit;text-align:center;animation:var(${cssScope}--duration) ease-in-out 0s infinite none running}svg{--size:var(${cssScope}--icon-size);font-size:var(--size);margin:calc(var(--size) * .05)}[animation=position]{background-image:linear-gradient(var(${cssScope}--deg),var(${cssScope}--from) 36%,var(${cssScope}--to) 50%,var(${cssScope}--from) 64%);background-color:transparent;background-size:200% 100%;animation-name:po}@keyframes po{from{background-position:150% center}to{background-position:-50% center}}[animation=opacity]{animation-name:op;animation-direction:alternate}@keyframes op{50%{opacity:.25}to{opacity:1}}`)
|
52
|
-
], Skeleton);
|
53
|
-
var Skeleton$1 = Skeleton;
|
54
|
-
|
55
|
-
export { Skeleton$1 as default };
|
1
|
+
import{__decorate as o}from"tslib";import{godown as r}from"@godown/element/decorators/godown.js";import{styles as i}from"@godown/element/decorators/styles.js";import{attr as t}from"@godown/element/directives/attr.js";import{htmlSlot as e}from"@godown/element/directives/html-slot.js";import n from"@godown/f7-icon/icons/photo.js";import{css as a,html as s}from"lit";import{property as m,state as d}from"lit/decorators.js";import{scopePrefix as c,cssGlobalVars as l,GlobalStyle as p}from"../core/global-style.js";const g="skeleton",v=c(g);let f=class Skeleton extends p{constructor(){super(...arguments),this.animation="position",this.loading=!0}render(){return this.loading?s`<div part="root" ${t(this.observedRecord)}>${"image"===this.type?n():""} ${e("loading")}</div>`:e()}};o([m()],f.prototype,"type",void 0),o([m()],f.prototype,"animation",void 0),o([d()],f.prototype,"loading",void 0),f=o([r(g),i(a`:host{${v}--from:var(${l._colors.darkgray[9]});${v}--to:var(${l._colors.darkgray[7]});${v}--deg:95deg;${v}--duration:1.5s;${v}--icon-size:5em;${v}--icon-margin:.25em;color:var(${l._colors.darkgray[5]});background:var(${v}--from);min-height:1.5em;width:100%;flex-shrink:0;display:block;overflow:hidden}[part=root]{height:100%;min-height:inherit;text-align:center;animation:var(${v}--duration) ease-in-out 0s infinite none running}svg{--size:var(${v}--icon-size);font-size:var(--size);margin:calc(var(--size) * .05)}[animation=position]{background-image:linear-gradient(var(${v}--deg),var(${v}--from) 36%,var(${v}--to) 50%,var(${v}--from) 64%);background-color:transparent;background-size:200% 100%;animation-name:po}@keyframes po{from{background-position:150% center}to{background-position:-50% center}}[animation=opacity]{animation-name:op;animation-direction:alternate}@keyframes op{50%{opacity:.25}to{opacity:1}}`)],f);var $=f;export{$ as default};
|
56
2
|
//# sourceMappingURL=skeleton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"skeleton.js","sources":["../src/components/skeleton.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"skeleton.js","sources":["../src/components/skeleton.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Skeleton","GlobalStyle","constructor","this","animation","loading","render","html","attr","observedRecord","type","iconPhoto","htmlSlot","__decorate","property","prototype","state","godown","styles","css","cssGlobalVars","_colors","darkgray","Skeleton$1"],"mappings":"ggBAUA,MAAMA,EAAY,WACZC,EAAWC,EAAYF,GAa7B,IAAMG,EAAN,MAAMA,iBAAiBC,EAAvB,WAAAC,uBAYEC,KAASC,UAA2B,WAMpCD,KAAOE,SAAG,EAEA,MAAAC,GACR,OAAKH,KAAKE,QAGHE,CAAI,oBAAoBC,EAAKL,KAAKM,mBACzB,UAAdN,KAAKO,KAAmBC,IAAc,MACtCC,EAAS,mBAJFA,MAjBXC,EAAA,CADCC,KACqBd,EAAAe,UAAA,YAAA,GAOtBF,EAAA,CADCC,KAC6Cd,EAAAe,UAAA,iBAAA,GAM9CF,EAAA,CADCG,KACahB,EAAAe,UAAA,eAAA,GAlBVf,EAAQa,EAAA,CAJbI,EAAOpB,GACPqB,EACCC,CAAG,SAASrB,eAAsBsB,EAAcC,QAAQC,SAAS,OAAOxB,aAAoBsB,EAAcC,QAAQC,SAAS,OAAOxB,gBAAuBA,oBAA2BA,oBAA2BA,kCAAyCsB,EAAcC,QAAQC,SAAS,sBAAsBxB,+JAAsKA,oEAA2EA,gIAAwIA,eAAsBA,oBAA2BA,kBAAyBA,mSAE5uBE,GA8BN,IAAAuB,EAAevB"}
|
package/components/split.js
CHANGED
@@ -1,155 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
import { godown } from '@godown/element/decorators/godown.js';
|
3
|
-
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import { attr } from '@godown/element/directives/attr.js';
|
5
|
-
import { classList } from '@godown/element/directives/class-list.js';
|
6
|
-
import { css, html, nothing } from 'lit';
|
7
|
-
import { property, state } from 'lit/decorators.js';
|
8
|
-
import { scopePrefix, cssGlobalVars } from '../core/global-style.js';
|
9
|
-
import SuperInput from '../core/super-input.js';
|
10
|
-
|
11
|
-
const protoName = "split";
|
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
|
-
};
|
20
|
-
/**
|
21
|
-
* {@linkcode Split} renders multiple input boxes.
|
22
|
-
*
|
23
|
-
* Input: will move the focus box backward until the complete input from start to end.
|
24
|
-
*
|
25
|
-
* Delete: will move the focus box forward until the first and no inputs for each.
|
26
|
-
*
|
27
|
-
* @category input
|
28
|
-
*/
|
29
|
-
let Split = class Split extends SuperInput {
|
30
|
-
constructor() {
|
31
|
-
super(...arguments);
|
32
|
-
/**
|
33
|
-
* The number of input boxes.
|
34
|
-
*/
|
35
|
-
this.len = 6;
|
36
|
-
/**
|
37
|
-
* Focus index.
|
38
|
-
*/
|
39
|
-
this.index = -1;
|
40
|
-
this.current = -1;
|
41
|
-
this.currentValue = [];
|
42
|
-
}
|
43
|
-
render() {
|
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="${
|
45
|
-
/* Ensure that input always has a value of length this.len */
|
46
|
-
this.value.padStart(this.len, " ")}"></div>`;
|
47
|
-
}
|
48
|
-
connectedCallback() {
|
49
|
-
super.connectedCallback();
|
50
|
-
this.reset();
|
51
|
-
}
|
52
|
-
_handleInput(e) {
|
53
|
-
e.stopPropagation();
|
54
|
-
if (this.compositing) {
|
55
|
-
return;
|
56
|
-
}
|
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) {
|
80
|
-
// delete
|
81
|
-
if (this.currentValue[this.current] !== null) {
|
82
|
-
// delete exist value
|
83
|
-
this.currentValue[this.current] = null;
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
// go to before
|
87
|
-
this.currentValue[this.current - 1] = null;
|
88
|
-
const lastNotNull = this.currentValue.findLastIndex(a => a !== null);
|
89
|
-
this.current = this.current - 1 < 0 ? lastNotNull < 0 ? 0 : lastNotNull : this.current - 1;
|
90
|
-
}
|
91
|
-
return;
|
92
|
-
}
|
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();
|
101
|
-
}
|
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);
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
focus() {
|
115
|
-
this.focusAt(this.current);
|
116
|
-
super.focus();
|
117
|
-
}
|
118
|
-
focusAt(i) {
|
119
|
-
this.current = i;
|
120
|
-
this._input.focus();
|
121
|
-
}
|
122
|
-
blur() {
|
123
|
-
this._input.blur();
|
124
|
-
this.current = -1;
|
125
|
-
super.blur();
|
126
|
-
}
|
127
|
-
reset() {
|
128
|
-
this.current = -1;
|
129
|
-
this.value = this.default;
|
130
|
-
this.currentValue = this.value.split("").concat(Array(this.len - this.value.length).fill(null));
|
131
|
-
if (this.index > -1) {
|
132
|
-
this.current = this.index;
|
133
|
-
}
|
134
|
-
}
|
135
|
-
};
|
136
|
-
__decorate([
|
137
|
-
property({ type: Number })
|
138
|
-
], Split.prototype, "len", void 0);
|
139
|
-
__decorate([
|
140
|
-
property({ type: Number })
|
141
|
-
], Split.prototype, "index", void 0);
|
142
|
-
__decorate([
|
143
|
-
state()
|
144
|
-
], Split.prototype, "current", void 0);
|
145
|
-
__decorate([
|
146
|
-
state()
|
147
|
-
], Split.prototype, "currentValue", void 0);
|
148
|
-
Split = __decorate([
|
149
|
-
godown(protoName),
|
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: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)}`)
|
151
|
-
], Split);
|
152
|
-
var Split$1 = Split;
|
153
|
-
|
154
|
-
export { Split$1 as default };
|
1
|
+
import{__decorate as t}from"tslib";import{godown as e}from"@godown/element/decorators/godown.js";import{styles as r}from"@godown/element/decorators/styles.js";import{attr as i}from"@godown/element/directives/attr.js";import{classList as s}from"@godown/element/directives/class-list.js";import{css as n,html as o,nothing as u}from"lit";import{property as l,state as a}from"lit/decorators.js";import{scopePrefix as c,cssGlobalVars as h}from"../core/global-style.js";import p from"../core/super-input.js";const d="split",f=c(d);let m=class Split extends p{constructor(){super(...arguments),this.len=6,this.index=-1,this.current=-1,this.currentValue=[]}render(){return o`<div part="root" ${i(this.observedRecord)}>${((t,e)=>{const r=new Array(t);for(let i=0;i<t;i++)r[i]=e(i);return r})(this.len,(t=>o`<span part="input-box" @click="${this.disabled?null:()=>this.focusAt(t)}" class="${s({focus:this.current===t})||u}">${this.currentValue[t]}</span>`))} <input part="input" id="${this.makeId}" @blur="${this.blur}" @input="${this._handleInput}" .value="${this.value.padStart(this.len," ")}"></div>`}connectedCallback(){super.connectedCallback(),this.reset()}_handleInput(t){t.stopPropagation(),this.compositing||(this.fillInput(t.data),this.value=this.currentValue.join(""),this.dispatchEvent(new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:this.value,composed:!0})))}fillInput(t){if(null===t){if(null!==this.currentValue[this.current])this.currentValue[this.current]=null;else{this.currentValue[this.current-1]=null;const t=this.currentValue.findLastIndex((t=>null!==t));this.current=this.current-1<0?t<0?0:t:this.current-1}return}const e=t.length>1;if(this.currentValue[this.current]=t[0],this.current+1>=this.len?(this.current=this.currentValue.indexOf(null),-1===this.current&&this.blur()):this.current+=1,e){const e=t.slice(1);e&&this.fillInput(e)}}focus(){this.focusAt(this.current),super.focus()}focusAt(t){this.current=t,this._input.focus()}blur(){this._input.blur(),this.current=-1,super.blur()}reset(){this.current=-1,this.value=this.default,this.currentValue=this.value.split("").concat(Array(this.len-this.value.length).fill(null)),this.index>-1&&(this.current=this.index)}};t([l({type:Number})],m.prototype,"len",void 0),t([l({type:Number})],m.prototype,"index",void 0),t([a()],m.prototype,"current",void 0),t([a()],m.prototype,"currentValue",void 0),m=t([e(d),r(n`:host{color:var(${h.foreground});display:block;border-radius:1px;width:-moz-fit-content;width:fit-content;${f}--size:1.45em;${f}--gap:.25em}:host([contents]) [part=root]{width:-moz-fit-content;width:fit-content}[part=root]{gap:var(${f}--gap);width:100%;position:relative;vertical-align:top;display:flex;justify-content:space-between;border-radius:inherit}[part=input-box]{width:var(${f}--size);height:var(${f}--size);vertical-align:top;text-align:center;background-color:var(${h.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(${h.input}-box-shadow)}`)],m);var v=m;export{v as default};
|
155
2
|
//# sourceMappingURL=split.js.map
|
package/components/split.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"split.js","sources":["../src/components/split.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"split.js","sources":["../src/components/split.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Split","SuperInput","constructor","this","len","index","current","currentValue","render","html","attr","observedRecord","fn","result","Array","loop","disabled","focusAt","classList","focus","nothing","makeId","blur","_handleInput","value","padStart","connectedCallback","super","reset","e","stopPropagation","compositing","fillInput","data","join","dispatchEvent","CustomEvent","detail","bubbles","composed","lastNotNull","findLastIndex","a","multiple","length","indexOf","after","slice","i","_input","default","split","concat","fill","__decorate","property","type","Number","prototype","state","godown","styles","css","cssGlobalVars","foreground","input","Split$1"],"mappings":"sfAWA,MAAMA,EAAY,QACZC,EAAWC,EAAYF,GAuB7B,IAAMG,EAAN,MAAMA,cAAcC,EAApB,WAAAC,uBAKEC,KAAGC,IAAG,EAMND,KAAKE,OAAI,EAGTF,KAAOG,SAAI,EAGXH,KAAYI,aAAsB,GAExB,MAAAC,GACR,OAAOC,CAAI,oBAAoBC,EAAKP,KAAKQ,mBAzChC,EAAIP,EAAaQ,KAC5B,MAAMC,EAAc,IAAIC,MAAMV,GAC9B,IAAK,IAAIC,EAAQ,EAAGA,EAAQD,EAAKC,IAC/BQ,EAAOR,GAASO,EAAGP,GAErB,OAAOQ,CAAM,EAsCTE,CAAKZ,KAAKC,KAAMC,GACdI,CAAI,kCACQN,KAAKa,SAAW,KAAO,IAAMb,KAAKc,QAAQZ,cAC3Ca,EAAU,CAAEC,MAAOhB,KAAKG,UAAYD,KAAYe,MACxDjB,KAAKI,aAAaF,yCAIfF,KAAKkB,kBACHlB,KAAKmB,iBACHnB,KAAKoB,yBAGjBpB,KAAKqB,MAAMC,SAAStB,KAAKC,IAAK,eAMlC,iBAAAsB,GACEC,MAAMD,oBACNvB,KAAKyB,QAGG,YAAAL,CAAaM,GACrBA,EAAEC,kBACE3B,KAAK4B,cAIT5B,KAAK6B,UAAUH,EAAEI,MACjB9B,KAAKqB,MAAQrB,KAAKI,aAAa2B,KAAK,IAEpC/B,KAAKgC,c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tIxBiD,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACXzD,EAAA0D,UAAA,WAAA,GAMPJ,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACRzD,EAAA0D,UAAA,aAAA,GAGVJ,EAAA,CADCK,KACW3D,EAAA0D,UAAA,eAAA,GAGZJ,EAAA,CADCK,KACmC3D,EAAA0D,UAAA,oBAAA,GAjBhC1D,EAAKsD,EAAA,CAJVM,EAAO/D,GACPgE,EACCC,CAAG,mBAAmBC,EAAcC,wFAAwFlE,kBAAyBA,2GAAkHA,uJAA8JA,uBAA8BA,sEAA6EiE,EAAcE,2JAA4JF,EAAcE,uBAEpsBjE,GAgJN,IAAAkE,EAAelE"}
|
package/components/switch.js
CHANGED
@@ -1,94 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
import { godown } from '@godown/element/decorators/godown.js';
|
3
|
-
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import { attr } from '@godown/element/directives/attr.js';
|
5
|
-
import { css, html } from 'lit';
|
6
|
-
import { property, query } from 'lit/decorators.js';
|
7
|
-
import { scopePrefix, cssGlobalVars } from '../core/global-style.js';
|
8
|
-
import SuperInput from '../core/super-input.js';
|
9
|
-
|
10
|
-
const protoName = "switch";
|
11
|
-
const cssScope = scopePrefix(protoName);
|
12
|
-
/**
|
13
|
-
* {@linkcode Switch} renders a switch.
|
14
|
-
*
|
15
|
-
* The switch is rectangular by default,
|
16
|
-
* set the round property to rounded switch.
|
17
|
-
*
|
18
|
-
* @category input
|
19
|
-
*/
|
20
|
-
let Switch = class Switch extends SuperInput {
|
21
|
-
constructor() {
|
22
|
-
super(...arguments);
|
23
|
-
/**
|
24
|
-
* Display rounded.
|
25
|
-
*/
|
26
|
-
this.round = false;
|
27
|
-
/**
|
28
|
-
* Whether this element is selected or not.
|
29
|
-
*/
|
30
|
-
this.checked = false;
|
31
|
-
/**
|
32
|
-
* Disable this element.
|
33
|
-
*/
|
34
|
-
this.disabled = false;
|
35
|
-
/**
|
36
|
-
* Default checked state.
|
37
|
-
*/
|
38
|
-
this.default = "false";
|
39
|
-
/**
|
40
|
-
* Input value.
|
41
|
-
*/
|
42
|
-
this.value = "on";
|
43
|
-
}
|
44
|
-
render() {
|
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>`;
|
46
|
-
}
|
47
|
-
reset() {
|
48
|
-
this.checked = this.default === "true";
|
49
|
-
this._input.checked = this.checked;
|
50
|
-
}
|
51
|
-
connectedCallback() {
|
52
|
-
super.connectedCallback();
|
53
|
-
if (this.checked) {
|
54
|
-
this.default = "true";
|
55
|
-
}
|
56
|
-
if (this.default === "true") {
|
57
|
-
this.checked = true;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
_handleChange() {
|
61
|
-
this.checked = this._input.checked;
|
62
|
-
this.dispatchEvent(new CustomEvent("input", { detail: this.checked, bubbles: true, composed: true }));
|
63
|
-
this.dispatchEvent(new CustomEvent("change", { detail: this.checked, composed: true }));
|
64
|
-
}
|
65
|
-
namevalue() {
|
66
|
-
return [this.name, this.checked];
|
67
|
-
}
|
68
|
-
};
|
69
|
-
__decorate([
|
70
|
-
property({ type: Boolean, reflect: true })
|
71
|
-
], Switch.prototype, "round", void 0);
|
72
|
-
__decorate([
|
73
|
-
property({ type: Boolean, reflect: true })
|
74
|
-
], Switch.prototype, "checked", void 0);
|
75
|
-
__decorate([
|
76
|
-
property({ type: Boolean, reflect: true })
|
77
|
-
], Switch.prototype, "disabled", void 0);
|
78
|
-
__decorate([
|
79
|
-
property()
|
80
|
-
], Switch.prototype, "default", void 0);
|
81
|
-
__decorate([
|
82
|
-
property()
|
83
|
-
], Switch.prototype, "value", void 0);
|
84
|
-
__decorate([
|
85
|
-
query("input")
|
86
|
-
], Switch.prototype, "_input", void 0);
|
87
|
-
Switch = __decorate([
|
88
|
-
godown(protoName),
|
89
|
-
styles(css `:host,:host([contents]) [part=root]{width:var(${cssScope}-width);height:var(${cssScope}-height);display:inline-block}: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);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);background:var(${cssGlobalVars.passive})}: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)}:host([checked]) .round{background:var(${cssGlobalVars.active})}`)
|
90
|
-
], Switch);
|
91
|
-
var Switch$1 = Switch;
|
92
|
-
|
93
|
-
export { Switch$1 as default };
|
1
|
+
import{__decorate as e}from"tslib";import{godown as t}from"@godown/element/decorators/godown.js";import{styles as i}from"@godown/element/decorators/styles.js";import{attr as o}from"@godown/element/directives/attr.js";import{css as r,html as a}from"lit";import{property as s,query as n}from"lit/decorators.js";import{scopePrefix as d,cssGlobalVars as c}from"../core/global-style.js";import h from"../core/super-input.js";const p="switch",l=d(p);let u=class Switch extends h{constructor(){super(...arguments),this.round=!1,this.checked=!1,this.disabled=!1,this.default="false",this.value="on"}render(){return a`<div part="root" ${o(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>`}reset(){this.checked="true"===this.default,this._input.checked=this.checked}connectedCallback(){super.connectedCallback(),this.checked&&(this.default="true"),"true"===this.default&&(this.checked=!0)}_handleChange(){this.checked=this._input.checked,this.dispatchEvent(new CustomEvent("input",{detail:this.checked,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:this.checked,composed:!0}))}namevalue(){return[this.name,this.checked]}};e([s({type:Boolean,reflect:!0})],u.prototype,"round",void 0),e([s({type:Boolean,reflect:!0})],u.prototype,"checked",void 0),e([s({type:Boolean,reflect:!0})],u.prototype,"disabled",void 0),e([s()],u.prototype,"default",void 0),e([s()],u.prototype,"value",void 0),e([n("input")],u.prototype,"_input",void 0),u=e([t(p),i(r`:host,:host([contents]) [part=root]{width:var(${l}-width);height:var(${l}-height);display:inline-block}:host{${l}-width:3em;${l}-height:calc(var(${l}-width)/ 2);${l}-handle-size:1.25em;${l}-handle-space:.125em;${l}-transition:.2s ease-in-out;background:var(${c.input}-background);vertical-align:bottom;border-radius:0}[part=root],span{transition:var(${l}-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(${l}-height)/ 2);background:var(${c.passive})}:host([checked]) span{left:50%}.rect .true{background:var(${c.active})}.rect .false{background:var(${c.passive})}.round span{--size:var(${l}-handle-size);border-radius:100%;background:var(--godown--input-control);width:var(--size);height:var(--size);margin:var(${l}-handle-space)}:host([checked]) .round{background:var(${c.active})}`)],u);var v=u;export{v as default};
|
94
2
|
//# sourceMappingURL=switch.js.map
|
package/components/switch.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"switch.js","sources":["../src/components/switch.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"switch.js","sources":["../src/components/switch.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Switch","SuperInput","constructor","this","round","checked","disabled","default","value","render","html","attr","observedRecord","_handleChange","name","makeId","reset","_input","connectedCallback","super","dispatchEvent","CustomEvent","detail","bubbles","composed","namevalue","__decorate","property","type","Boolean","reflect","prototype","query","godown","styles","css","cssGlobalVars","input","passive","active","Switch$1"],"mappings":"oaASA,MAAMA,EAAY,SACZC,EAAWC,EAAYF,GAc7B,IAAMG,EAAN,MAAMA,eAAeC,EAArB,WAAAC,uBAKEC,KAAKC,OAAG,EAMRD,KAAOE,SAAG,EAMVF,KAAQG,UAAG,EAMXH,KAAOI,QAAG,QAMVJ,KAAKK,MAAG,KAKE,MAAAC,GACR,OAAOC,CAAI,oBACPC,EAAKR,KAAKS,0BACHT,KAAKC,MAAQ,QAAU,wCAInBD,KAAKU,6BACHV,KAAKG,uBACNH,KAAKE,kBACTF,KAAKW,aACPX,KAAKY,uDAGgBZ,KAAKE,yBAItC,KAAAW,GACEb,KAAKE,QAA2B,SAAjBF,KAAKI,QACpBJ,KAAKc,OAAOZ,QAAUF,KAAKE,QAG7B,iBAAAa,GACEC,MAAMD,oBACFf,KAAKE,UACPF,KAAKI,QAAU,QAEI,SAAjBJ,KAAKI,UACPJ,KAAKE,SAAU,GAIT,aAAAQ,GACRV,KAAKE,QAAUF,KAAKc,OAAOZ,QAC3BF,KAAKiB,cAAc,IAAIC,YAAY,QAAS,CAAEC,OAAQnB,KAAKE,QAASkB,SAAS,EAAMC,UAAU,KAC7FrB,KAAKiB,cAAc,IAAIC,YAAY,SAAU,CAAEC,OAAQnB,KAAKE,QAASmB,UAAU,KAGjF,SAAAC,GACE,MAAO,CAACtB,KAAKW,KAAMX,KAAKE,WArE1BqB,EAAA,CADCC,EAAS,CAAEC,KAAMC,QAASC,SAAS,KACvB9B,EAAA+B,UAAA,aAAA,GAMbL,EAAA,CADCC,EAAS,CAAEC,KAAMC,QAASC,SAAS,KACrB9B,EAAA+B,UAAA,eAAA,GAMfL,EAAA,CADCC,EAAS,CAAEC,KAAMC,QAASC,SAAS,KACpB9B,EAAA+B,UAAA,gBAAA,GAMhBL,EAAA,CADCC,KACgB3B,EAAA+B,UAAA,eAAA,GAMjBL,EAAA,CADCC,KACW3B,EAAA+B,UAAA,aAAA,GAGFL,EAAA,CADTM,EAAM,UAC2BhC,EAAA+B,UAAA,cAAA,GAhC9B/B,EAAM0B,EAAA,CAJXO,EAAOpC,GACPqC,EACCC,CAAG,iDAAiDrC,uBAA8BA,wCAA+CA,eAAsBA,qBAA4BA,gBAAwBA,wBAA+BA,yBAAgCA,+CAAsDsC,EAAcC,2FAA2FvC,qWAA4WA,gCAAwCsC,EAAcE,sEAAsEF,EAAcG,uCAAuCH,EAAcE,mCAAmCxC,6HAAoIA,0DAAiEsC,EAAcG,aAEtsCvC,GA8EN,IAAAwC,EAAexC"}
|
package/components/text.js
CHANGED
@@ -1,47 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
import { godown } from '@godown/element/decorators/godown.js';
|
3
|
-
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import { attr } from '@godown/element/directives/attr.js';
|
5
|
-
import { classList } from '@godown/element/directives/class-list.js';
|
6
|
-
import { htmlSlot } from '@godown/element/directives/html-slot.js';
|
7
|
-
import { css, html } from 'lit';
|
8
|
-
import { property } from 'lit/decorators.js';
|
9
|
-
import { scopePrefix, cssGlobalVars, GlobalStyle } from '../core/global-style.js';
|
10
|
-
|
11
|
-
const protoName = "text";
|
12
|
-
const cssScope = scopePrefix(protoName);
|
13
|
-
/**
|
14
|
-
* {@linkcode Text} renders nowrap text.
|
15
|
-
*
|
16
|
-
* @category display
|
17
|
-
*/
|
18
|
-
let Text = class Text extends GlobalStyle {
|
19
|
-
constructor() {
|
20
|
-
super(...arguments);
|
21
|
-
/**
|
22
|
-
* Underline behavior.
|
23
|
-
*/
|
24
|
-
this.underline = "none";
|
25
|
-
/**
|
26
|
-
* Set background-clip to text.
|
27
|
-
*/
|
28
|
-
this.clip = false;
|
29
|
-
}
|
30
|
-
render() {
|
31
|
-
return html `<span part="root" ${attr(this.observedRecord)} class="${classList(this.underline)}">${htmlSlot()}</span>`;
|
32
|
-
}
|
33
|
-
};
|
34
|
-
__decorate([
|
35
|
-
property()
|
36
|
-
], Text.prototype, "underline", void 0);
|
37
|
-
__decorate([
|
38
|
-
property({ type: Boolean })
|
39
|
-
], Text.prototype, "clip", void 0);
|
40
|
-
Text = __decorate([
|
41
|
-
godown(protoName),
|
42
|
-
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}`)
|
43
|
-
], Text);
|
44
|
-
var Text$1 = Text;
|
45
|
-
|
46
|
-
export { Text$1 as default };
|
1
|
+
import{__decorate as o}from"tslib";import{godown as r}from"@godown/element/decorators/godown.js";import{styles as e}from"@godown/element/decorators/styles.js";import{attr as t}from"@godown/element/directives/attr.js";import{classList as l}from"@godown/element/directives/class-list.js";import{htmlSlot as i}from"@godown/element/directives/html-slot.js";import{css as n,html as c}from"lit";import{property as a}from"lit/decorators.js";import{scopePrefix as s,cssGlobalVars as p,GlobalStyle as d}from"../core/global-style.js";const v="text",m=s(v);let w=class Text extends d{constructor(){super(...arguments),this.underline="none",this.clip=!1}render(){return c`<span part="root" ${t(this.observedRecord)} class="${l(this.underline)}">${i()}</span>`}};o([a()],w.prototype,"underline",void 0),o([a({type:Boolean})],w.prototype,"clip",void 0),w=o([r(v),e(n`:host{${m}--color:currentColor;${m}--color-hover:currentColor;${m}--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(${m}--color)}[part=root]:hover{color:var(${m}--color-hover,var(${m}--color))}[part=root]:active{color:var(${m}--color-active,var(${m}--color))}.active:active,.always,.hover:hover{text-decoration:underline}.none{text-decoration:none}[clip]{background:var(${p.clipBackground});display:inline-block;color:transparent;-webkit-text-fill-color:transparent;background-clip:text;-webkit-background-clip:text}`)],w);var f=w;export{f as default};
|
47
2
|
//# sourceMappingURL=text.js.map
|
package/components/text.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"text.js","sources":["../src/components/text.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"text.js","sources":["../src/components/text.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Text","GlobalStyle","constructor","this","underline","clip","render","html","attr","observedRecord","classList","htmlSlot","__decorate","property","prototype","type","Boolean","godown","styles","css","cssGlobalVars","clipBackground","Text$1"],"mappings":"4gBAUA,MAAMA,EAAY,OAEZC,EAAWC,EAAYF,GAS7B,IAAMG,EAAN,MAAMA,aAAaC,EAAnB,WAAAC,uBAKEC,KAASC,UAA2C,OAMpDD,KAAIE,MAAG,EAEG,MAAAC,GACR,OAAOC,CAAI,qBAEPC,EAAKL,KAAKM,0BACHC,EAAUP,KAAKC,eAEtBO,eAdNC,EAAA,CADCC,KACyDb,EAAAc,UAAA,iBAAA,GAM1DF,EAAA,CADCC,EAAS,CAAEE,KAAMC,WACNhB,EAAAc,UAAA,YAAA,GAXRd,EAAIY,EAAA,CAFTK,EAAOpB,GACPqB,EAAOC,CAAG,SAASrB,yBAAgCA,+BAAsCA,gQAAuQA,yCAAgDA,sBAA6BA,2CAAkDA,uBAA8BA,6HAAoIsB,EAAcC,kJAC1oBrB,GAwBN,IAAAsB,EAAetB"}
|
package/components/time.js
CHANGED
@@ -1,79 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
import { godown } from '@godown/element/decorators/godown.js';
|
3
|
-
import { styles } from '@godown/element/decorators/styles.js';
|
4
|
-
import { attr } from '@godown/element/directives/attr.js';
|
5
|
-
import fmtime from 'fmtime';
|
6
|
-
import { css, html } from 'lit';
|
7
|
-
import { property } from 'lit/decorators.js';
|
8
|
-
import { GlobalStyle } from '../core/global-style.js';
|
9
|
-
|
10
|
-
const protoName = "time";
|
11
|
-
/**
|
12
|
-
* {@linkcode Time} renders a formatting time.
|
13
|
-
*
|
14
|
-
* @category display
|
15
|
-
*/
|
16
|
-
let Time = class Time extends GlobalStyle {
|
17
|
-
constructor() {
|
18
|
-
super(...arguments);
|
19
|
-
/**
|
20
|
-
* Escape symbol.
|
21
|
-
*/
|
22
|
-
this.escape = "%";
|
23
|
-
/**
|
24
|
-
* Format strings.
|
25
|
-
*/
|
26
|
-
this.format = "YYYY-MM-DD hh:mm:ss UTFZ";
|
27
|
-
/**
|
28
|
-
* Time.
|
29
|
-
*/
|
30
|
-
this.time = new Date();
|
31
|
-
}
|
32
|
-
render() {
|
33
|
-
return html `<span part="root" ${attr(this.observedRecord)}>${fmtime(this.format, this.time, this.escape)}</span>`;
|
34
|
-
}
|
35
|
-
firstUpdated() {
|
36
|
-
if (this.timeout) {
|
37
|
-
this.timeoutId = this.startTimeout();
|
38
|
-
}
|
39
|
-
}
|
40
|
-
updated(changedProperties) {
|
41
|
-
if (changedProperties.has("timeout")) {
|
42
|
-
clearInterval(this.timeoutId);
|
43
|
-
if (this.timeout) {
|
44
|
-
this.timeoutId = this.startTimeout();
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
48
|
-
disconnectedCallback() {
|
49
|
-
clearInterval(this.timeoutId);
|
50
|
-
}
|
51
|
-
startTimeout() {
|
52
|
-
return window.setInterval(() => {
|
53
|
-
this.time = new Date(this.time.getTime() + (this.gap || this.timeout));
|
54
|
-
}, Math.abs(this.timeout));
|
55
|
-
}
|
56
|
-
};
|
57
|
-
__decorate([
|
58
|
-
property()
|
59
|
-
], Time.prototype, "escape", void 0);
|
60
|
-
__decorate([
|
61
|
-
property()
|
62
|
-
], Time.prototype, "format", void 0);
|
63
|
-
__decorate([
|
64
|
-
property({ type: Object })
|
65
|
-
], Time.prototype, "time", void 0);
|
66
|
-
__decorate([
|
67
|
-
property({ type: Number })
|
68
|
-
], Time.prototype, "timeout", void 0);
|
69
|
-
__decorate([
|
70
|
-
property({ type: Number })
|
71
|
-
], Time.prototype, "gap", void 0);
|
72
|
-
Time = __decorate([
|
73
|
-
godown(protoName),
|
74
|
-
styles(css `:host{text-align:center}`)
|
75
|
-
], Time);
|
76
|
-
var Time$1 = Time;
|
77
|
-
|
78
|
-
export { Time$1 as default };
|
1
|
+
import{__decorate as t}from"tslib";import{godown as e}from"@godown/element/decorators/godown.js";import{styles as o}from"@godown/element/decorators/styles.js";import{attr as i}from"@godown/element/directives/attr.js";import r from"fmtime";import{css as s,html as m}from"lit";import{property as a}from"lit/decorators.js";import{GlobalStyle as p}from"../core/global-style.js";let d=class Time extends p{constructor(){super(...arguments),this.escape="%",this.format="YYYY-MM-DD hh:mm:ss UTFZ",this.time=new Date}render(){return m`<span part="root" ${i(this.observedRecord)}>${r(this.format,this.time,this.escape)}</span>`}firstUpdated(){this.timeout&&(this.timeoutId=this.startTimeout())}updated(t){t.has("timeout")&&(clearInterval(this.timeoutId),this.timeout&&(this.timeoutId=this.startTimeout()))}disconnectedCallback(){clearInterval(this.timeoutId)}startTimeout(){return window.setInterval((()=>{this.time=new Date(this.time.getTime()+(this.gap||this.timeout))}),Math.abs(this.timeout))}};t([a()],d.prototype,"escape",void 0),t([a()],d.prototype,"format",void 0),t([a({type:Object})],d.prototype,"time",void 0),t([a({type:Number})],d.prototype,"timeout",void 0),t([a({type:Number})],d.prototype,"gap",void 0),d=t([e("time"),o(s`:host{text-align:center}`)],d);var h=d;export{h as default};
|
79
2
|
//# sourceMappingURL=time.js.map
|