godown 3.0.0-canary.13 → 3.0.0-canary.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/alert.js +1 -5
- package/alert.js.map +1 -1
- package/avatar.js +1 -5
- package/avatar.js.map +1 -1
- package/breath.js +1 -5
- package/breath.js.map +1 -1
- package/button.js +1 -5
- package/button.js.map +1 -1
- package/card.js +1 -5
- package/card.js.map +1 -1
- package/carousel.js +1 -5
- package/carousel.js.map +1 -1
- package/components/alert.js +1 -174
- package/components/alert.js.map +1 -1
- package/components/avatar.js +1 -68
- package/components/avatar.js.map +1 -1
- package/components/breath.d.ts +2 -2
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -81
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +1 -1
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -185
- package/components/button.js.map +1 -1
- package/components/card.d.ts.map +1 -1
- package/components/card.js +1 -49
- package/components/card.js.map +1 -1
- package/components/carousel.js +1 -119
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +0 -1
- package/components/details.d.ts.map +1 -1
- package/components/details.js +1 -53
- package/components/details.js.map +1 -1
- package/components/dialog.d.ts +1 -1
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -98
- package/components/dialog.js.map +1 -1
- package/components/divider.js +1 -35
- package/components/divider.js.map +1 -1
- package/components/dragbox.d.ts +1 -1
- package/components/dragbox.d.ts.map +1 -1
- package/components/dragbox.js +1 -111
- package/components/dragbox.js.map +1 -1
- package/components/flex.d.ts.map +1 -1
- package/components/flex.js +1 -63
- package/components/flex.js.map +1 -1
- package/components/form.js +1 -75
- package/components/form.js.map +1 -1
- package/components/grid.d.ts.map +1 -1
- package/components/grid.js +1 -57
- package/components/grid.js.map +1 -1
- package/components/input.js +1 -51
- package/components/input.js.map +1 -1
- package/components/layout.d.ts.map +1 -1
- package/components/layout.js +1 -58
- package/components/layout.js.map +1 -1
- package/components/link.js +1 -53
- package/components/link.js.map +1 -1
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -59
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +1 -0
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -267
- package/components/range.js.map +1 -1
- package/components/rotate.js +1 -56
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts +3 -5
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -247
- package/components/router.js.map +1 -1
- package/components/select.d.ts +1 -1
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -217
- package/components/select.js.map +1 -1
- package/components/skeleton.js +1 -55
- package/components/skeleton.js.map +1 -1
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -154
- package/components/split.js.map +1 -1
- package/components/switch.js +1 -93
- package/components/switch.js.map +1 -1
- package/components/text.d.ts.map +1 -1
- package/components/text.js +1 -46
- package/components/text.js.map +1 -1
- package/components/time.d.ts +1 -1
- package/components/time.d.ts.map +1 -1
- package/components/time.js +1 -78
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +1 -85
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts +1 -1
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +1 -128
- package/components/typewriter.js.map +1 -1
- package/core/global-style.d.ts +1 -1
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +1 -52
- package/core/global-style.js.map +1 -1
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +1 -39
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +1 -1
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -117
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts +1 -1
- package/core/super-openable.d.ts.map +1 -1
- package/core/super-openable.js +1 -37
- package/core/super-openable.js.map +1 -1
- package/custom-elements.json +1 -1
- package/details.js +1 -5
- package/details.js.map +1 -1
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +5 -7
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +3 -5
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/breath.d.ts +2 -2
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +13 -20
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +1 -1
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +1 -1
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +1 -5
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +4 -10
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +0 -1
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +14 -23
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +1 -1
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/divider.js +22 -22
- package/dev/components/divider.js.map +1 -1
- package/dev/components/dragbox.d.ts +1 -1
- package/dev/components/dragbox.d.ts.map +1 -1
- package/dev/components/dragbox.js +2 -1
- package/dev/components/dragbox.js.map +1 -1
- package/dev/components/flex.d.ts.map +1 -1
- package/dev/components/flex.js +1 -1
- package/dev/components/flex.js.map +1 -1
- package/dev/components/grid.d.ts.map +1 -1
- package/dev/components/grid.js +2 -2
- package/dev/components/grid.js.map +1 -1
- package/dev/components/input.js +12 -12
- package/dev/components/input.js.map +1 -1
- package/dev/components/layout.d.ts.map +1 -1
- package/dev/components/layout.js +3 -7
- package/dev/components/layout.js.map +1 -1
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +38 -38
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +1 -0
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +14 -12
- package/dev/components/range.js.map +1 -1
- package/dev/components/router.d.ts +3 -5
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +10 -18
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +1 -1
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +23 -21
- package/dev/components/select.js.map +1 -1
- package/dev/components/skeleton.d.ts.map +1 -1
- package/dev/components/skeleton.js +3 -2
- package/dev/components/skeleton.js.map +1 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +7 -6
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +6 -9
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.d.ts.map +1 -1
- package/dev/components/text.js +2 -6
- package/dev/components/text.js.map +1 -1
- package/dev/components/time.d.ts +1 -1
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +1 -3
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +8 -11
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts +1 -1
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/global-style.d.ts +1 -1
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +1 -1
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +20 -18
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +1 -1
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +34 -34
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts +1 -1
- package/dev/core/super-openable.d.ts.map +1 -1
- package/dialog.js +1 -5
- package/dialog.js.map +1 -1
- package/divider.js +1 -5
- package/divider.js.map +1 -1
- package/dragbox.js +1 -5
- package/dragbox.js.map +1 -1
- package/flex.js +1 -5
- package/flex.js.map +1 -1
- package/form.js +1 -5
- package/form.js.map +1 -1
- package/grid.js +1 -5
- package/grid.js.map +1 -1
- package/index.js +1 -56
- package/index.js.map +1 -1
- package/input.js +1 -5
- package/input.js.map +1 -1
- package/layout.js +1 -5
- package/layout.js.map +1 -1
- package/link.js +1 -5
- package/link.js.map +1 -1
- package/package.json +3 -3
- package/progress.js +1 -5
- package/progress.js.map +1 -1
- package/range.js +1 -5
- package/range.js.map +1 -1
- package/rotate.js +1 -5
- package/rotate.js.map +1 -1
- package/router.js +1 -5
- package/router.js.map +1 -1
- package/select.js +1 -5
- package/select.js.map +1 -1
- package/skeleton.js +1 -5
- package/skeleton.js.map +1 -1
- package/split.js +1 -5
- package/split.js.map +1 -1
- package/src/components/alert.ts +5 -7
- package/src/components/avatar.ts +3 -5
- package/src/components/breath.ts +17 -22
- package/src/components/button.ts +2 -2
- package/src/components/card.ts +1 -5
- package/src/components/carousel.ts +4 -10
- package/src/components/details.ts +14 -23
- package/src/components/dialog.ts +1 -1
- package/src/components/divider.ts +25 -25
- package/src/components/dragbox.ts +3 -2
- package/src/components/flex.ts +4 -2
- package/src/components/grid.ts +5 -3
- package/src/components/input.ts +12 -12
- package/src/components/layout.ts +3 -11
- package/src/components/progress.ts +41 -39
- package/src/components/range.ts +15 -14
- package/src/components/router.ts +14 -14
- package/src/components/select.ts +24 -22
- package/src/components/skeleton.ts +3 -2
- package/src/components/split.ts +12 -8
- package/src/components/switch.ts +6 -9
- package/src/components/text.ts +5 -7
- package/src/components/time.ts +2 -4
- package/src/components/tooltip.ts +8 -13
- package/src/components/typewriter.ts +5 -3
- package/src/core/global-style.ts +2 -2
- package/src/core/super-anchor.ts +23 -19
- package/src/core/super-input.ts +35 -35
- package/src/core/super-openable.ts +1 -1
- package/switch.js +1 -5
- package/switch.js.map +1 -1
- package/text.js +1 -5
- package/text.js.map +1 -1
- package/time.js +1 -5
- package/time.js.map +1 -1
- package/tooltip.js +1 -5
- package/tooltip.js.map +1 -1
- package/typewriter.js +1 -5
- package/typewriter.js.map +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
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 r}from"@godown/element/directives/attr.js";import{css as o,html as a}from"lit";import{property as n,query as s}from"lit/decorators.js";import{scopePrefix as d,cssGlobalVars as h}from"../core/global-style.js";import c from"../core/super-input.js";const p="switch",l=d(p);let u=class Switch extends c{constructor(){super(...arguments),this.round=!1,this.checked=!1,this.disabled=!1,this.default="false",this.value="on"}render(){return a`<div part="root" ${r(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([n({type:Boolean,reflect:!0})],u.prototype,"round",void 0),e([n({type:Boolean,reflect:!0})],u.prototype,"checked",void 0),e([n({type:Boolean,reflect:!0})],u.prototype,"disabled",void 0),e([n()],u.prototype,"default",void 0),e([n()],u.prototype,"value",void 0),e([s("input")],u.prototype,"_input",void 0),u=e([t(p),i(o`: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(${h.input}-background);vertical-align:bottom;border-radius:0}[part=handle],[part=root]{transition:var(${l}-transition)}[part=root]{border-radius:inherit;position:relative;height:inherit}[part=input]{opacity:0;width:100%;height:100%;-webkit-appearance:none;appearance:none}[part=handle]{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(${h.passive})}:host([checked]) [part=handle]{left:50%}.rect .true{background:var(${h.active})}.rect .false{background:var(${h.passive})}.round [part=handle]{--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(${h.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,oBAAoBC,EAAKR,KAAKS,0BAA0BT,KAAKC,MAAQ,QAAU,wCAG3ED,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,WAlE1BqB,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,oGAAoGvC,qXAA4XA,gCAAwCsC,EAAcE,+EAA+EF,EAAcG,uCAAuCH,EAAcE,4CAA4CxC,6HAAoIA,0DAAiEsC,EAAcG,aAEjvCvC,GA2EN,IAAAwC,EAAexC"}
|
package/components/text.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
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,
|
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,cAIM,IAAK,SAAQ,WAAW;IAC5B;;OAEG;IAEH,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAU;IAE3D;;OAEG;IAEH,IAAI,UAAS;IAEb,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAGtC;AAED,eAAe,IAAI,CAAC"}
|
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,GAW7B,IAAMG,EAAN,MAAMA,aAAaC,EAAnB,WAAAC,uBAKEC,KAASC,UAA2C,OAMpDD,KAAIE,MAAG,EAEG,MAAAC,GACR,OAAOC,CAAI,qBAAqBC,EAAKL,KAAKM,0BAA0BC,EAAUP,KAAKC,eAC/EO,eAVNC,EAAA,CADCC,KACyDb,EAAAc,UAAA,iBAAA,GAM1DF,EAAA,CADCC,EAAS,CAAEE,KAAMC,WACNhB,EAAAc,UAAA,YAAA,GAXRd,EAAIY,EAAA,CAJTK,EAAOpB,GACPqB,EACCC,CAAG,SAASrB,yBAAgCA,+BAAsCA,gQAAuQA,yCAAgDA,sBAA6BA,2CAAkDA,uBAA8BA,6HAAoIsB,EAAcC,kJAEpoBrB,GAoBN,IAAAsB,EAAetB"}
|
package/components/time.d.ts
CHANGED
package/components/time.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
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;
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/components/time.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG1E,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,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
|
package/components/time.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"time.js","sources":["../src/components/time.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"time.js","sources":["../src/components/time.ts"],"sourcesContent":null,"names":["Time","GlobalStyle","constructor","this","escape","format","time","Date","render","html","attr","observedRecord","fmtime","firstUpdated","timeout","timeoutId","startTimeout","updated","changedProperties","has","clearInterval","disconnectedCallback","window","setInterval","getTime","gap","Math","abs","__decorate","property","prototype","type","Object","Number","godown","styles","css","Time$1"],"mappings":"sXAkBA,IAAMA,EAAN,MAAMA,aAAaC,EAAnB,WAAAC,uBAKEC,KAAMC,OAAG,IAMTD,KAAME,OAAG,2BAMTF,KAAAG,KAAa,IAAIC,KAgBP,MAAAC,GACR,OAAOC,CAAI,qBAAqBC,EAAKP,KAAKQ,mBAAoBC,EAAOT,KAAKE,OAAQF,KAAKG,KAAMH,KAAKC,iBAG1F,YAAAS,GACJV,KAAKW,UACPX,KAAKY,UAAYZ,KAAKa,gBAIhB,OAAAC,CAAQC,GACZA,EAAkBC,IAAI,aACxBC,cAAcjB,KAAKY,WACfZ,KAAKW,UACPX,KAAKY,UAAYZ,KAAKa,iBAK5B,oBAAAK,GACED,cAAcjB,KAAKY,WAGrB,YAAAC,GACE,OAAOM,OAAOC,aAAY,KACxBpB,KAAKG,KAAO,IAAIC,KAAKJ,KAAKG,KAAKkB,WAAarB,KAAKsB,KAAOtB,KAAKW,SAAS,GACrEY,KAAKC,IAAIxB,KAAKW,YAtDnBc,EAAA,CADCC,KACW7B,EAAA8B,UAAA,cAAA,GAMZF,EAAA,CADCC,KACkC7B,EAAA8B,UAAA,cAAA,GAMnCF,EAAA,CADCC,EAAS,CAAEE,KAAMC,UACKhC,EAAA8B,UAAA,YAAA,GAMvBF,EAAA,CADCC,EAAS,CAAEE,KAAME,UACNjC,EAAA8B,UAAA,eAAA,GAMZF,EAAA,CADCC,EAAS,CAAEE,KAAME,UACVjC,EAAA8B,UAAA,WAAA,GA7BJ9B,EAAI4B,EAAA,CAFTM,EAPiB,QAQjBC,EAAOC,CAAG,6BACLpC,GA+DN,IAAAqC,EAAerC"}
|
@@ -1 +1 @@
|
|
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;
|
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;CAKtC;AAED,eAAe,OAAO,CAAC"}
|
package/components/tooltip.js
CHANGED
@@ -1,86 +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 { css, html } from 'lit';
|
7
|
-
import { property } from 'lit/decorators.js';
|
8
|
-
import { scopePrefix } from '../core/global-style.js';
|
9
|
-
import SuperOpenable from '../core/super-openable.js';
|
10
|
-
|
11
|
-
var Tooltip_1;
|
12
|
-
const protoName = "tooltip";
|
13
|
-
const cssScope = scopePrefix(protoName);
|
14
|
-
/**
|
15
|
-
* {@linkcode Tooltip} provide tooltip for slot elements.
|
16
|
-
*
|
17
|
-
* If it has the tip property, ignore the slot tip.
|
18
|
-
*
|
19
|
-
* @slot tip - Tip element if no `tip` provided.
|
20
|
-
* @slot - Content.
|
21
|
-
* @category feedback
|
22
|
-
*/
|
23
|
-
let Tooltip = Tooltip_1 = class Tooltip extends SuperOpenable {
|
24
|
-
constructor() {
|
25
|
-
super(...arguments);
|
26
|
-
/**
|
27
|
-
* Direction of opening the tip.
|
28
|
-
*/
|
29
|
-
this.direction = "top";
|
30
|
-
/**
|
31
|
-
* Content alignment.
|
32
|
-
*/
|
33
|
-
this.align = "center";
|
34
|
-
/**
|
35
|
-
* If true, allow penetration of the tip.
|
36
|
-
*/
|
37
|
-
this.propagation = false;
|
38
|
-
/**
|
39
|
-
* How can tips be triggered.
|
40
|
-
*
|
41
|
-
* If `focus`, element will be focusable, open tip when focused.
|
42
|
-
*
|
43
|
-
* If `hover`, element will open tip when hovered.
|
44
|
-
*
|
45
|
-
* @default "hover"
|
46
|
-
*/
|
47
|
-
this.type = "hover";
|
48
|
-
}
|
49
|
-
render() {
|
50
|
-
const align = Tooltip_1.aligns[this.align] || "inherit";
|
51
|
-
const isFocusable = this.type === "focus";
|
52
|
-
return html `<div part="root" ${attr(this.observedRecord)} tabindex="${isFocusable ? 0 : -1}" @focus="${isFocusable ? () => this.open = true : null}" @blur="${isFocusable ? () => this.open = false : null}" @mouseenter="${isFocusable ? null : () => this.open = true}" @mouseleave="${isFocusable ? null : () => this.open = false}" style="justify-content:${align};align-items:${align}">${htmlSlot()}<div part="tip">${this.tip
|
53
|
-
? html `<span class="passive">${this.tip}</span>`
|
54
|
-
: htmlSlot("tip")}</div></div>`;
|
55
|
-
}
|
56
|
-
};
|
57
|
-
Tooltip.aligns = {
|
58
|
-
start: "flex-start",
|
59
|
-
end: "flex-end",
|
60
|
-
center: "center",
|
61
|
-
"flex-start": "flex-start",
|
62
|
-
"flex-end": "flex-end",
|
63
|
-
};
|
64
|
-
__decorate([
|
65
|
-
property()
|
66
|
-
], Tooltip.prototype, "tip", void 0);
|
67
|
-
__decorate([
|
68
|
-
property()
|
69
|
-
], Tooltip.prototype, "direction", void 0);
|
70
|
-
__decorate([
|
71
|
-
property()
|
72
|
-
], Tooltip.prototype, "align", void 0);
|
73
|
-
__decorate([
|
74
|
-
property({ type: Boolean })
|
75
|
-
], Tooltip.prototype, "propagation", void 0);
|
76
|
-
__decorate([
|
77
|
-
property()
|
78
|
-
], Tooltip.prototype, "type", void 0);
|
79
|
-
Tooltip = Tooltip_1 = __decorate([
|
80
|
-
godown(protoName),
|
81
|
-
styles(css `:host{${cssScope}--tip-background:inherit;width:-moz-fit-content;width:fit-content}:host,[part=root]{display:inline-flex}[part=root]{position:relative;transition:inherit;border-radius:inherit}[part=tip]{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content;position:absolute;visibility:hidden;transition:inherit;-webkit-user-select:none;user-select:none}:host([open]) [part=tip]{visibility:visible}.passive{background:var(${cssScope}--tip-background)}[propagation] [part=tip]{pointer-events:none}`, css `[direction^=top] [part=tip]{bottom:100%}[direction^=bottom] [part=tip]{top:100%}[direction$=right] [part=tip]{left:100%}[direction$=left] [part=tip]{right:100%}`)
|
82
|
-
], Tooltip);
|
83
|
-
var Tooltip$1 = Tooltip;
|
84
|
-
|
85
|
-
export { Tooltip$1 as default };
|
1
|
+
import{__decorate as t}from"tslib";import{godown as i}from"@godown/element/decorators/godown.js";import{styles as o}from"@godown/element/decorators/styles.js";import{attr as e}from"@godown/element/directives/attr.js";import{htmlSlot as r}from"@godown/element/directives/html-slot.js";import{css as n,html as s}from"lit";import{property as p}from"lit/decorators.js";import{scopePrefix as a}from"../core/global-style.js";import l from"../core/super-openable.js";var d;const c="tooltip",h=a(c);let m=d=class Tooltip extends l{constructor(){super(...arguments),this.direction="top",this.align="center",this.propagation=!1,this.type="hover"}render(){const t=d.aligns[this.align]||"inherit",i="focus"===this.type;return s`<div part="root" ${e(this.observedRecord)} tabindex="${i?0:-1}" @focus="${i?()=>this.open=!0:null}" @blur="${i?()=>this.open=!1:null}" @mouseenter="${i?null:()=>this.open=!0}" @mouseleave="${i?null:()=>this.open=!1}" style="justify-content:${t};align-items:${t}">${r()}<div part="tip">${this.tip?s`<span class="passive">${this.tip}</span>`:r("tip")}</div></div>`}};m.aligns={start:"flex-start",end:"flex-end",center:"center","flex-start":"flex-start","flex-end":"flex-end"},t([p()],m.prototype,"tip",void 0),t([p()],m.prototype,"direction",void 0),t([p()],m.prototype,"align",void 0),t([p({type:Boolean})],m.prototype,"propagation",void 0),t([p()],m.prototype,"type",void 0),m=d=t([i(c),o(n`:host{${h}--tip-background:inherit;width:-moz-fit-content;width:fit-content}:host,[part=root]{display:inline-flex}[part=root]{position:relative;transition:inherit;border-radius:inherit}[part=tip]{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content;position:absolute;visibility:hidden;transition:inherit;-webkit-user-select:none;user-select:none}:host([open]) [part=tip]{visibility:visible}.passive{background:var(${h}--tip-background)}[propagation] [part=tip]{pointer-events:none}`,n`[direction^=top] [part=tip]{bottom:100%}[direction^=bottom] [part=tip]{top:100%}[direction$=right] [part=tip]{left:100%}[direction$=left] [part=tip]{right:100%}`)],m);var f=m;export{f as default};
|
86
2
|
//# sourceMappingURL=tooltip.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["../src/components/tooltip.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["../src/components/tooltip.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Tooltip","Tooltip_1","SuperOpenable","constructor","this","direction","align","propagation","type","render","aligns","isFocusable","html","attr","observedRecord","open","htmlSlot","tip","start","end","center","__decorate","property","prototype","Boolean","godown","styles","css","Tooltip$1"],"mappings":"kdAUA,MAAMA,EAAY,UACZC,EAAWC,EAAYF,GAgB7B,IAAMG,EAAOC,EAAb,MAAMD,gBAAgBE,EAAtB,WAAAC,uBAWEC,KAASC,UAAe,MAMxBD,KAAKE,MAA2D,SAMhEF,KAAWG,aAAG,EAYdH,KAAII,KAAsB,QAUhB,MAAAC,GACR,MAAMH,EAAQL,EAAQS,OAAON,KAAKE,QAAU,UACtCK,EAA4B,UAAdP,KAAKI,KACzB,OAAOI,CAAI,oBAEPC,EAAKT,KAAKU,6BACAH,EAAc,GAAK,cACrBA,EAAc,IAAOP,KAAKW,MAAO,EAAQ,gBAC1CJ,EAAc,IAAOP,KAAKW,MAAO,EAAS,sBACpCJ,EAAc,KAAO,IAAOP,KAAKW,MAAO,mBACxCJ,EAAc,KAAO,IAAOP,KAAKW,MAAO,6BAC9BT,iBAAqBA,MAE5CU,sBACgBZ,KAAKa,IAAML,CAAI,yBAAyBR,KAAKa,aAAeD,EAAS,uBAtBpFhB,EAAAU,OAAS,CACdQ,MAAO,aACPC,IAAK,WACLC,OAAQ,SACR,aAAc,aACd,WAAY,YArCdC,EAAA,CADCC,KACUtB,EAAAuB,UAAA,WAAA,GAMXF,EAAA,CADCC,KAC4BtB,EAAAuB,UAAA,iBAAA,GAM7BF,EAAA,CADCC,KACuEtB,EAAAuB,UAAA,aAAA,GAMxEF,EAAA,CADCC,EAAS,CAAEd,KAAMgB,WACCxB,EAAAuB,UAAA,mBAAA,GAYnBF,EAAA,CADCC,KACgCtB,EAAAuB,UAAA,YAAA,GAnC7BvB,EAAOC,EAAAoB,EAAA,CALZI,EAAO5B,GACP6B,EACCC,CAAG,SAAS7B,ubAA8bA,mEAC1c6B,CAAG,qKAEC3B,GAgEN,IAAA4B,EAAe5B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"typewriter.d.ts","sourceRoot":"","sources":["../src/components/typewriter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAa,KAAK,gBAAgB,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"typewriter.d.ts","sourceRoot":"","sources":["../src/components/typewriter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAa,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5E,OAAO,EAAE,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAKnE;;;;GAIG;AACH,cAIM,UAAW,SAAQ,WAAW;IAClC;;OAEG;IAEH,IAAI,SAAM;IAEV;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,UAAS;IAEd;;OAEG;IAEH,GAAG,SAAO;IAEV;;OAEG;IAEH,GAAG,SAAM;IAET;;OAEG;IAEH,KAAK,SAAK;IAEV;;OAEG;IAEH,KAAK,SAAK;IAEV;;OAEG;IAEH,OAAO,SAAM;IAEb,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAG5B,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAIrC,SAAS,CAAC,YAAY,IAAI,IAAI;IAS9B,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;IAMlE,KAAK,CAAC,EAAE,GAAE,MAAmB,GAAG,IAAI;IAYpC,IAAI,IAAI,IAAI;IAIZ,GAAG,IAAI,IAAI;CAGZ;AAED,eAAe,UAAU,CAAC"}
|
package/components/typewriter.js
CHANGED
@@ -1,129 +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 { random } from '@godown/element/tools/lib.js';
|
8
|
-
import { css, html } from 'lit';
|
9
|
-
import { property, state, query } from 'lit/decorators.js';
|
10
|
-
import { scopePrefix, GlobalStyle } from '../core/global-style.js';
|
11
|
-
|
12
|
-
const protoName = "typewriter";
|
13
|
-
const cssScope = scopePrefix(protoName);
|
14
|
-
/**
|
15
|
-
* {@linkcode Typewriter} renders a typewriter effect to text.
|
16
|
-
*
|
17
|
-
* @category effect
|
18
|
-
*/
|
19
|
-
let Typewriter = class Typewriter extends GlobalStyle {
|
20
|
-
constructor() {
|
21
|
-
super(...arguments);
|
22
|
-
/**
|
23
|
-
* Raw text.
|
24
|
-
*/
|
25
|
-
this.text = "";
|
26
|
-
/**
|
27
|
-
* Start immediately after {@linkcode Typewriter.firstUpdated}.
|
28
|
-
*/
|
29
|
-
this.stopped = false;
|
30
|
-
/**
|
31
|
-
* If true, hide the cursor
|
32
|
-
*/
|
33
|
-
this.ended = false;
|
34
|
-
/**
|
35
|
-
* Maximum random time.
|
36
|
-
*/
|
37
|
-
this.max = 100;
|
38
|
-
/**
|
39
|
-
* Minimum random time.
|
40
|
-
*/
|
41
|
-
this.min = 50;
|
42
|
-
/**
|
43
|
-
* Fixed time.
|
44
|
-
*/
|
45
|
-
this.delay = 0;
|
46
|
-
/**
|
47
|
-
* The index at the beginning.
|
48
|
-
*/
|
49
|
-
this.index = 0;
|
50
|
-
/**
|
51
|
-
* Internal text.
|
52
|
-
*/
|
53
|
-
this.content = "";
|
54
|
-
}
|
55
|
-
/**
|
56
|
-
* {@linkcode Typewriter.text} length.
|
57
|
-
*/
|
58
|
-
get len() {
|
59
|
-
return this.text.length;
|
60
|
-
}
|
61
|
-
render() {
|
62
|
-
return html `<div part="root" ${attr(this.observedRecord)}>${htmlSlot()} ${this.content} <i part="cursor" class="${classList({ hidden: this.ended })}"></i></div>`;
|
63
|
-
}
|
64
|
-
firstUpdated() {
|
65
|
-
if (!this.text) {
|
66
|
-
this.text = this._slot?.assignedNodes()[0]?.textContent.trim() || "";
|
67
|
-
}
|
68
|
-
if (!this.stopped && this.len) {
|
69
|
-
this.write();
|
70
|
-
}
|
71
|
-
}
|
72
|
-
updated(changedProperties) {
|
73
|
-
if (changedProperties.has("index")) {
|
74
|
-
this.dispatchEvent(new CustomEvent(this.index === this.len ? "done" : "write", { detail: this.content }));
|
75
|
-
}
|
76
|
-
}
|
77
|
-
write(at = this.index) {
|
78
|
-
this.content = this.text.slice(0, at + 1);
|
79
|
-
const timeout = this.delay || random(this.max, this.min);
|
80
|
-
this.timeoutID = window.setTimeout(() => {
|
81
|
-
const nx = at + 1;
|
82
|
-
if (nx <= this.len) {
|
83
|
-
this.index = nx;
|
84
|
-
this.write();
|
85
|
-
}
|
86
|
-
}, timeout);
|
87
|
-
}
|
88
|
-
stop() {
|
89
|
-
clearTimeout(this.timeoutID);
|
90
|
-
}
|
91
|
-
end() {
|
92
|
-
this.ended = true;
|
93
|
-
}
|
94
|
-
};
|
95
|
-
__decorate([
|
96
|
-
property()
|
97
|
-
], Typewriter.prototype, "text", void 0);
|
98
|
-
__decorate([
|
99
|
-
property({ type: Boolean })
|
100
|
-
], Typewriter.prototype, "stopped", void 0);
|
101
|
-
__decorate([
|
102
|
-
property({ type: Boolean })
|
103
|
-
], Typewriter.prototype, "ended", void 0);
|
104
|
-
__decorate([
|
105
|
-
property({ type: Number })
|
106
|
-
], Typewriter.prototype, "max", void 0);
|
107
|
-
__decorate([
|
108
|
-
property({ type: Number })
|
109
|
-
], Typewriter.prototype, "min", void 0);
|
110
|
-
__decorate([
|
111
|
-
property({ type: Number })
|
112
|
-
], Typewriter.prototype, "delay", void 0);
|
113
|
-
__decorate([
|
114
|
-
property({ type: Number })
|
115
|
-
], Typewriter.prototype, "index", void 0);
|
116
|
-
__decorate([
|
117
|
-
state()
|
118
|
-
], Typewriter.prototype, "content", void 0);
|
119
|
-
__decorate([
|
120
|
-
query("i")
|
121
|
-
], Typewriter.prototype, "_i", void 0);
|
122
|
-
Typewriter = __decorate([
|
123
|
-
godown(protoName),
|
124
|
-
styles(css `:host{${cssScope}--cursor-width:.05em}:host,:host([contents]) [part=root]{display:inline-block}i{border-right:var(${cssScope}--cursor-width) solid;margin-left:.02em;animation:s 1.5s steps(1) infinite}@keyframes s{0%{border-color:currentColor}50%{border-color:transparent}}slot{display:none}.hidden{visibility:hidden}`)
|
125
|
-
], Typewriter);
|
126
|
-
var Typewriter$1 = Typewriter;
|
127
|
-
|
128
|
-
export { Typewriter$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{classList as s}from"@godown/element/directives/class-list.js";import{htmlSlot as r}from"@godown/element/directives/html-slot.js";import{random as n}from"@godown/element/tools/lib.js";import{css as d,html as p}from"lit";import{property as l,state as m,query as h}from"lit/decorators.js";import{scopePrefix as a,GlobalStyle as c}from"../core/global-style.js";const y="typewriter",v=a(y);let u=class Typewriter extends c{constructor(){super(...arguments),this.text="",this.stopped=!1,this.ended=!1,this.max=100,this.min=50,this.delay=0,this.index=0,this.content=""}get len(){return this.text.length}render(){return p`<div part="root" ${i(this.observedRecord)}>${r()} ${this.content} <i part="cursor" class="${s({hidden:this.ended})}"></i></div>`}firstUpdated(){this.text||(this.text=this._slot?.assignedNodes()[0]?.textContent.trim()||""),!this.stopped&&this.len&&this.write()}updated(t){t.has("index")&&this.dispatchEvent(new CustomEvent(this.index===this.len?"done":"write",{detail:this.content}))}write(t=this.index){this.content=this.text.slice(0,t+1);const e=this.delay||n(this.max,this.min);this.timeoutID=window.setTimeout((()=>{const e=t+1;e<=this.len&&(this.index=e,this.write())}),e)}stop(){clearTimeout(this.timeoutID)}end(){this.ended=!0}};t([l()],u.prototype,"text",void 0),t([l({type:Boolean})],u.prototype,"stopped",void 0),t([l({type:Boolean})],u.prototype,"ended",void 0),t([l({type:Number})],u.prototype,"max",void 0),t([l({type:Number})],u.prototype,"min",void 0),t([l({type:Number})],u.prototype,"delay",void 0),t([l({type:Number})],u.prototype,"index",void 0),t([m()],u.prototype,"content",void 0),t([h("i")],u.prototype,"_i",void 0),u=t([e(y),o(d`:host{${v}--cursor-width:.05em}:host,:host([contents]) [part=root]{display:inline-block}i{border-right:var(${v}--cursor-width) solid;margin-left:.02em;animation:s 1.5s steps(1) infinite}@keyframes s{0%{border-color:currentColor}50%{border-color:transparent}}slot{display:none}.hidden{visibility:hidden}`)],u);var w=u;export{w as default};
|
129
2
|
//# sourceMappingURL=typewriter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"typewriter.js","sources":["../src/components/typewriter.ts"],"sourcesContent":null,"names":[
|
1
|
+
{"version":3,"file":"typewriter.js","sources":["../src/components/typewriter.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Typewriter","GlobalStyle","constructor","this","text","stopped","ended","max","min","delay","index","content","len","length","render","html","attr","observedRecord","htmlSlot","classList","hidden","firstUpdated","_slot","assignedNodes","textContent","trim","write","updated","changedProperties","has","dispatchEvent","CustomEvent","detail","at","slice","timeout","random","timeoutID","window","setTimeout","nx","stop","clearTimeout","end","__decorate","property","prototype","type","Boolean","Number","state","query","godown","styles","css","Typewriter$1"],"mappings":"qkBAWA,MAAMA,EAAY,aACZC,EAAWC,EAAYF,GAW7B,IAAMG,EAAN,MAAMA,mBAAmBC,EAAzB,WAAAC,uBAKEC,KAAIC,KAAG,GAMPD,KAAOE,SAAG,EAMVF,KAAKG,OAAG,EAMRH,KAAGI,IAAG,IAMNJ,KAAGK,IAAG,GAMNL,KAAKM,MAAG,EAMRN,KAAKO,MAAG,EAMRP,KAAOQ,QAAG,GAUV,OAAIC,GACF,OAAOT,KAAKC,KAAKS,OAGT,MAAAC,GACR,OAAOC,CAAI,oBAAoBC,EAAKb,KAAKc,mBACrCC,OACAf,KAAKQ,mCACmBQ,EAAU,CAAEC,OAAQjB,KAAKG,sBAI7C,YAAAe,GACHlB,KAAKC,OACRD,KAAKC,KAAOD,KAAKmB,OAAOC,gBAAgB,IAAIC,YAAYC,QAAU,KAE/DtB,KAAKE,SAAWF,KAAKS,KACxBT,KAAKuB,QAIC,OAAAC,CAAQC,GACZA,EAAkBC,IAAI,UACxB1B,KAAK2B,cAAc,IAAIC,YAAY5B,KAAKO,QAAUP,KAAKS,IAAM,OAAS,QAAS,CAAEoB,OAAQ7B,KAAKQ,WAIlG,KAAAe,CAAMO,EAAa9B,KAAKO,OACtBP,KAAKQ,QAAUR,KAAKC,KAAK8B,MAAM,EAAGD,EAAK,GACvC,MAAME,EAAUhC,KAAKM,OAAS2B,EAAOjC,KAAKI,IAAKJ,KAAKK,KACpDL,KAAKkC,UAAYC,OAAOC,YAAW,KACjC,MAAMC,EAAKP,EAAK,EACZO,GAAMrC,KAAKS,MACbT,KAAKO,MAAQ8B,EACbrC,KAAKuB,WAENS,GAGL,IAAAM,GACEC,aAAavC,KAAKkC,WAGpB,GAAAM,GACExC,KAAKG,OAAQ,IAhGfsC,EAAA,CADCC,KACQ7C,EAAA8C,UAAA,YAAA,GAMTF,EAAA,CADCC,EAAS,CAAEE,KAAMC,WACHhD,EAAA8C,UAAA,eAAA,GAMfF,EAAA,CADCC,EAAS,CAAEE,KAAMC,WACLhD,EAAA8C,UAAA,aAAA,GAMbF,EAAA,CADCC,EAAS,CAAEE,KAAME,UACTjD,EAAA8C,UAAA,WAAA,GAMTF,EAAA,CADCC,EAAS,CAAEE,KAAME,UACVjD,EAAA8C,UAAA,WAAA,GAMRF,EAAA,CADCC,EAAS,CAAEE,KAAME,UACTjD,EAAA8C,UAAA,aAAA,GAMTF,EAAA,CADCC,EAAS,CAAEE,KAAME,UACTjD,EAAA8C,UAAA,aAAA,GAMTF,EAAA,CADCM,KACWlD,EAAA8C,UAAA,eAAA,GAKFF,EAAA,CADTO,EAAM,MACkBnD,EAAA8C,UAAA,UAAA,GApDrB9C,EAAU4C,EAAA,CAJfQ,EAAOvD,GACPwD,EACCC,CAAG,SAASxD,qGAA4GA,qMAEpHE,GAyGN,IAAAuD,EAAevD"}
|
package/core/global-style.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type Gradients, presetsRGB } from "@godown/colors/presets-rgb.js";
|
2
2
|
import GodownElement from "@godown/element";
|
3
|
-
import { CSSResult } from "lit";
|
3
|
+
import { type CSSResult } from "lit";
|
4
4
|
export declare class GlobalStyle extends GodownElement {
|
5
5
|
}
|
6
6
|
export declare function scopePrefix(scope: string, len?: number): CSSResult;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"global-style.d.ts","sourceRoot":"","sources":["../src/core/global-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EAAO,SAAS,EAAa,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"global-style.d.ts","sourceRoot":"","sources":["../src/core/global-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAI5C,OAAO,EAAO,KAAK,SAAS,EAAa,MAAM,KAAK,CAAC;AAIrD,qBAAa,WAAY,SAAQ,aAAa;CAC7C;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAI,GAAG,SAAS,CAE7D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAE1D;AAED,eAAO,MAAM,aAAa,EAAE;IAC1B,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,SAAS,CAAC;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,yBAAyB,CAAC;IACnC,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;CAWlB,CAAC;AAEF,KAAK,yBAAyB,GAAG,MAAM,CAAC,MAAM,OAAO,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC"}
|