godown 3.2.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/godown+lit.iife.js +12 -12
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +12 -12
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +12 -12
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +10 -10
- package/build/godown.js +10 -10
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +10 -10
- package/build/godown.umd.js.map +1 -1
- package/components/alert.d.ts +1 -3
- package/components/alert.d.ts.map +1 -1
- package/components/alert.js +1 -1
- package/components/alert.js.map +1 -1
- package/components/avatar.d.ts +5 -4
- package/components/avatar.d.ts.map +1 -1
- package/components/avatar.js +1 -1
- package/components/avatar.js.map +1 -1
- package/components/badge.d.ts +10 -2
- package/components/badge.d.ts.map +1 -1
- package/components/badge.js.map +1 -1
- package/components/breath.d.ts +2 -3
- package/components/breath.d.ts.map +1 -1
- package/components/breath.js +1 -1
- package/components/breath.js.map +1 -1
- package/components/button.d.ts +8 -3
- package/components/button.d.ts.map +1 -1
- package/components/button.js +1 -1
- package/components/button.js.map +1 -1
- package/components/card.d.ts +6 -0
- package/components/card.d.ts.map +1 -1
- package/components/card.js +1 -1
- package/components/card.js.map +1 -1
- package/components/carousel.d.ts +7 -13
- package/components/carousel.d.ts.map +1 -1
- package/components/carousel.js +1 -1
- package/components/carousel.js.map +1 -1
- package/components/details.d.ts +3 -3
- package/components/details.d.ts.map +1 -1
- package/components/dialog.d.ts +9 -6
- package/components/dialog.d.ts.map +1 -1
- package/components/dialog.js +1 -1
- package/components/dialog.js.map +1 -1
- package/components/divider.d.ts +1 -1
- package/components/heading.d.ts +2 -0
- package/components/heading.d.ts.map +1 -1
- package/components/heading.js.map +1 -1
- package/components/input.d.ts +2 -2
- package/components/input.d.ts.map +1 -1
- package/components/input.js +1 -1
- package/components/input.js.map +1 -1
- package/components/link.d.ts +1 -1
- package/components/link.d.ts.map +1 -1
- package/components/link.js +1 -1
- package/components/link.js.map +1 -1
- package/components/progress.d.ts +0 -7
- package/components/progress.d.ts.map +1 -1
- package/components/progress.js +1 -1
- package/components/progress.js.map +1 -1
- package/components/range.d.ts +48 -19
- package/components/range.d.ts.map +1 -1
- package/components/range.js +1 -1
- package/components/range.js.map +1 -1
- package/components/rotate.d.ts +6 -4
- package/components/rotate.d.ts.map +1 -1
- package/components/rotate.js.map +1 -1
- package/components/router.d.ts.map +1 -1
- package/components/router.js +1 -1
- package/components/router.js.map +1 -1
- package/components/select.d.ts +4 -2
- package/components/select.d.ts.map +1 -1
- package/components/select.js +1 -1
- package/components/select.js.map +1 -1
- package/components/split.d.ts +2 -1
- package/components/split.d.ts.map +1 -1
- package/components/split.js +1 -1
- package/components/split.js.map +1 -1
- package/components/switch.d.ts +5 -7
- package/components/switch.d.ts.map +1 -1
- package/components/switch.js +1 -1
- package/components/switch.js.map +1 -1
- package/components/text.js +1 -1
- package/components/text.js.map +1 -1
- package/components/time.d.ts +2 -5
- package/components/time.d.ts.map +1 -1
- package/components/time.js +1 -1
- package/components/time.js.map +1 -1
- package/components/tooltip.d.ts +3 -2
- package/components/tooltip.d.ts.map +1 -1
- package/components/tooltip.js +1 -1
- package/components/tooltip.js.map +1 -1
- package/components/typewriter.d.ts.map +1 -1
- package/components/typewriter.js +1 -1
- package/components/typewriter.js.map +1 -1
- package/core/direction.d.ts +27 -0
- package/core/direction.d.ts.map +1 -0
- package/core/direction.js +2 -0
- package/core/direction.js.map +1 -0
- package/core/global-style.d.ts +1 -2
- package/core/global-style.d.ts.map +1 -1
- package/core/global-style.js +1 -1
- package/core/global-style.js.map +1 -1
- package/core/outline.d.ts +20 -0
- package/core/outline.d.ts.map +1 -0
- package/core/outline.js +2 -0
- package/core/outline.js.map +1 -0
- package/core/super-anchor.d.ts +2 -2
- package/core/super-anchor.d.ts.map +1 -1
- package/core/super-anchor.js +1 -1
- package/core/super-anchor.js.map +1 -1
- package/core/super-input.d.ts +2 -0
- package/core/super-input.d.ts.map +1 -1
- package/core/super-input.js +1 -1
- package/core/super-input.js.map +1 -1
- package/core/super-openable.d.ts +0 -4
- package/core/super-openable.d.ts.map +1 -1
- package/custom-elements.json +1 -1
- package/dev/components/alert.d.ts +1 -3
- package/dev/components/alert.d.ts.map +1 -1
- package/dev/components/alert.js +33 -57
- package/dev/components/alert.js.map +1 -1
- package/dev/components/avatar.d.ts +5 -4
- package/dev/components/avatar.d.ts.map +1 -1
- package/dev/components/avatar.js +5 -4
- package/dev/components/avatar.js.map +1 -1
- package/dev/components/badge.d.ts +10 -2
- package/dev/components/badge.d.ts.map +1 -1
- package/dev/components/badge.js +8 -0
- package/dev/components/badge.js.map +1 -1
- package/dev/components/breath.d.ts +2 -3
- package/dev/components/breath.d.ts.map +1 -1
- package/dev/components/breath.js +3 -14
- package/dev/components/breath.js.map +1 -1
- package/dev/components/button.d.ts +8 -3
- package/dev/components/button.d.ts.map +1 -1
- package/dev/components/button.js +19 -5
- package/dev/components/button.js.map +1 -1
- package/dev/components/card.d.ts +6 -0
- package/dev/components/card.d.ts.map +1 -1
- package/dev/components/card.js +11 -11
- package/dev/components/card.js.map +1 -1
- package/dev/components/carousel.d.ts +7 -13
- package/dev/components/carousel.d.ts.map +1 -1
- package/dev/components/carousel.js +40 -39
- package/dev/components/carousel.js.map +1 -1
- package/dev/components/details.d.ts +3 -3
- package/dev/components/details.d.ts.map +1 -1
- package/dev/components/details.js +3 -3
- package/dev/components/details.js.map +1 -1
- package/dev/components/dialog.d.ts +9 -6
- package/dev/components/dialog.d.ts.map +1 -1
- package/dev/components/dialog.js +58 -62
- package/dev/components/dialog.js.map +1 -1
- package/dev/components/divider.d.ts +1 -1
- package/dev/components/divider.js +1 -1
- package/dev/components/heading.d.ts +2 -0
- package/dev/components/heading.d.ts.map +1 -1
- package/dev/components/heading.js +2 -0
- package/dev/components/heading.js.map +1 -1
- package/dev/components/input.d.ts +2 -2
- package/dev/components/input.d.ts.map +1 -1
- package/dev/components/input.js +30 -9
- package/dev/components/input.js.map +1 -1
- package/dev/components/link.d.ts +1 -1
- package/dev/components/link.d.ts.map +1 -1
- package/dev/components/link.js +2 -2
- package/dev/components/link.js.map +1 -1
- package/dev/components/progress.d.ts +0 -7
- package/dev/components/progress.d.ts.map +1 -1
- package/dev/components/progress.js +4 -25
- package/dev/components/progress.js.map +1 -1
- package/dev/components/range.d.ts +48 -19
- package/dev/components/range.d.ts.map +1 -1
- package/dev/components/range.js +83 -61
- package/dev/components/range.js.map +1 -1
- package/dev/components/rotate.d.ts +6 -4
- package/dev/components/rotate.d.ts.map +1 -1
- package/dev/components/rotate.js +6 -4
- package/dev/components/rotate.js.map +1 -1
- package/dev/components/router.d.ts.map +1 -1
- package/dev/components/router.js +2 -3
- package/dev/components/router.js.map +1 -1
- package/dev/components/select.d.ts +4 -2
- package/dev/components/select.d.ts.map +1 -1
- package/dev/components/select.js +27 -24
- package/dev/components/select.js.map +1 -1
- package/dev/components/split.d.ts +2 -1
- package/dev/components/split.d.ts.map +1 -1
- package/dev/components/split.js +11 -7
- package/dev/components/split.js.map +1 -1
- package/dev/components/switch.d.ts +5 -7
- package/dev/components/switch.d.ts.map +1 -1
- package/dev/components/switch.js +23 -45
- package/dev/components/switch.js.map +1 -1
- package/dev/components/text.js +2 -2
- package/dev/components/time.d.ts +2 -5
- package/dev/components/time.d.ts.map +1 -1
- package/dev/components/time.js +6 -20
- package/dev/components/time.js.map +1 -1
- package/dev/components/tooltip.d.ts +3 -2
- package/dev/components/tooltip.d.ts.map +1 -1
- package/dev/components/tooltip.js +7 -19
- package/dev/components/tooltip.js.map +1 -1
- package/dev/components/typewriter.d.ts.map +1 -1
- package/dev/components/typewriter.js +2 -2
- package/dev/components/typewriter.js.map +1 -1
- package/dev/core/direction.d.ts +27 -0
- package/dev/core/direction.d.ts.map +1 -0
- package/dev/core/direction.js +56 -0
- package/dev/core/direction.js.map +1 -0
- package/dev/core/global-style.d.ts +1 -2
- package/dev/core/global-style.d.ts.map +1 -1
- package/dev/core/global-style.js +11 -11
- package/dev/core/global-style.js.map +1 -1
- package/dev/core/outline.d.ts +20 -0
- package/dev/core/outline.d.ts.map +1 -0
- package/dev/core/outline.js +44 -0
- package/dev/core/outline.js.map +1 -0
- package/dev/core/super-anchor.d.ts +2 -2
- package/dev/core/super-anchor.d.ts.map +1 -1
- package/dev/core/super-anchor.js +0 -1
- package/dev/core/super-anchor.js.map +1 -1
- package/dev/core/super-input.d.ts +2 -0
- package/dev/core/super-input.d.ts.map +1 -1
- package/dev/core/super-input.js +19 -30
- package/dev/core/super-input.js.map +1 -1
- package/dev/core/super-openable.d.ts +0 -4
- package/dev/core/super-openable.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/alert.ts +34 -65
- package/src/components/avatar.ts +7 -5
- package/src/components/badge.ts +10 -3
- package/src/components/breath.ts +5 -17
- package/src/components/button.ts +19 -6
- package/src/components/card.ts +11 -11
- package/src/components/carousel.ts +45 -44
- package/src/components/details.ts +3 -3
- package/src/components/dialog.ts +66 -65
- package/src/components/divider.ts +1 -1
- package/src/components/heading.ts +2 -0
- package/src/components/input.ts +30 -9
- package/src/components/link.ts +2 -2
- package/src/components/progress.ts +4 -25
- package/src/components/range.ts +92 -70
- package/src/components/rotate.ts +6 -4
- package/src/components/router.ts +2 -3
- package/src/components/select.ts +33 -26
- package/src/components/split.ts +12 -7
- package/src/components/switch.ts +26 -41
- package/src/components/text.ts +2 -2
- package/src/components/time.ts +10 -25
- package/src/components/tooltip.ts +8 -20
- package/src/components/typewriter.ts +9 -7
- package/src/core/direction.ts +65 -0
- package/src/core/global-style.ts +12 -14
- package/src/core/outline.ts +54 -0
- package/src/core/super-anchor.ts +3 -2
- package/src/core/super-input.ts +22 -30
- package/src/core/super-openable.ts +0 -8
- package/vscode.html-custom-data.json +1 -1
- package/web-types.json +1 -1
package/components/heading.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../src/components/heading.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,KAAK,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;;;;;GAOG;AACH,cAEM,OAAQ,SAAQ,WAAW;IAC/B;;OAEG;IAEH,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEnD
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../src/components/heading.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,KAAK,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAItD;;;;;;;GAOG;AACH,cAEM,OAAQ,SAAQ,WAAW;IAC/B;;OAEG;IAEH,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEnD;;;;OAIG;IAEH,MAAM,SAAO;IAEb;;OAEG;IAEH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAU;IAEhC,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IASrC,SAAS,CAAC,WAAW,CAAC,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC;CAgB7D;AAED,eAAe,OAAO,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"heading.js","sources":["../src/components/heading.ts"],"sourcesContent":null,"names":["Heading","GlobalStyle","constructor","this","as","anchor","side","render","html","id","nothing","attr","observedRecord","wrapHeading","htmlSlot","children","__decorate","property","prototype","undefined","godown","styles","css","Heading$1"],"mappings":"oQAkBA,IAAMA,EAAN,MAAMA,gBAAgBC,EAAtB,WAAAC,uBAKEC,KAAEC,GAA4C,
|
1
|
+
{"version":3,"file":"heading.js","sources":["../src/components/heading.ts"],"sourcesContent":null,"names":["Heading","GlobalStyle","constructor","this","as","anchor","side","render","html","id","nothing","attr","observedRecord","wrapHeading","htmlSlot","children","__decorate","property","prototype","undefined","godown","styles","css","Heading$1"],"mappings":"oQAkBA,IAAMA,EAAN,MAAMA,gBAAgBC,EAAtB,WAAAC,uBAKEC,KAAEC,GAA4C,KAQ9CD,KAAME,OAAG,IAMTF,KAAIG,KAAqB,OAEf,MAAAC,GACR,OAAOC,CAAI,wBAGCL,KAAKM,GAAK,IAAMN,KAAKM,GAAKC,MAChCC,EAAKR,KAAKS,mBAEVT,KAAKU,YACLC,IACAX,KAAKM,GACDD,CAAI,oBACiBL,KAAKE,aAE1B,UAMF,WAAAQ,IAAeE,GACvB,OAAQZ,KAAKC,IACX,IAAK,KACH,OAAOI,CAAI,OACHO,SAEV,IAAK,KACH,OAAOP,CAAI,OACHO,SAEV,IAAK,KACH,OAAOP,CAAI,OACHO,SAEV,IAAK,KACH,OAAOP,CAAI,OACHO,SAEV,IAAK,KACH,OAAOP,CAAI,OACHO,SAEV,QACE,OAAOP,CAAI,OACHO,YA3DdC,EAAA,CADCC,KACiDjB,EAAAkB,UAAA,UAAAC,GAQlDH,EAAA,CADCC,KACWjB,EAAAkB,UAAA,cAAAC,GAMZH,EAAA,CADCC,KAC8BjB,EAAAkB,UAAA,YAAAC,GAnB3BnB,EAAOgB,EAAA,CAFZI,EAViB,WAWjBC,EAAOC,CAAG,8TACLtB,GAsEN,IAAAuB,EAAevB"}
|
package/components/input.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type TemplateResult } from "lit";
|
2
|
-
import SuperInput from "../core/super-input.js";
|
2
|
+
import { SuperInput } from "../core/super-input.js";
|
3
3
|
/**
|
4
4
|
* {@linkcode Input} renders a text input.
|
5
5
|
*
|
@@ -16,7 +16,7 @@ declare class Input extends SuperInput {
|
|
16
16
|
variant: "default" | "outline";
|
17
17
|
protected _input: HTMLInputElement;
|
18
18
|
protected render(): TemplateResult<1>;
|
19
|
-
|
19
|
+
protected _renderSuffix(): TemplateResult<1>;
|
20
20
|
}
|
21
21
|
export default Input;
|
22
22
|
export { Input };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/components/input.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/components/input.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,KAAK,CAAC;AAI9D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD;;;;;;GAMG;AACH,cAEM,KAAM,SAAQ,UAAU;IAC5B,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,CAAU;IAExE,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,OAAO,EAAE,SAAS,GAAG,SAAS,CAAa;IAG3C,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAEnC,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAQrC,SAAS,CAAC,aAAa,IAAI,cAAc,CAAC,CAAC,CAAC;CAM7C;AAED,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/components/input.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{part as i,godown as e,styles as
|
1
|
+
import{__decorate as t}from"tslib";import{part as i,godown as e,styles as o,attr as r,tokenList as s,htmlSlot as a}from"@godown/element";import p from"@godown/f7-icon/icons/eye-slash-fill.js";import{css as u,html as n,nothing as l}from"lit";import{property as h}from"lit/decorators.js";import{cssGlobalVars as d}from"../core/global-style.js";import{SuperInput as c}from"../core/super-input.js";let f=class Input extends c{constructor(){super(...arguments),this.type="text",this.variant="default"}render(){return n`<div part="root" ${r(this.observedRecord)} class="${s("input-field",this.variant)}">${[this._renderPrefix(),n`<input part="input" type="${this.type}" .value="${this.value}" ?autofocus="${this.autofocus}" ?disabled="${this.disabled}" autocapitalize="${this.autocapitalize||l}" autocomplete="${this.autocomplete||l}" placeholder="${this.placeholder||l}" id="${this.makeId}" @input="${this._handleInput}">`,this._renderSuffix()]}</div>`}_renderSuffix(){const t="password";return n`<label for="${this.makeId}" part="suffix">${this.type===t?n`<i part="icon" @mousedown="${()=>this._changeInputType("text")}" @mouseup="${()=>this._changeInputType(t)}" @mouseleave="${()=>this._changeInputType(t)}">${p()}</i>`:a("suffix")}</label>`}};t([h()],f.prototype,"variant",void 0),t([i("input")],f.prototype,"_input",void 0),f=t([e("input"),o(u`:host{display:block;height:var(${d.input}-height);width:var(${d.input}-width)}.outline,:host(:focus-within){${d.input}-outline-color:var(${d.active})}`)],f);var m=f;export{f as Input,m as default};
|
2
2
|
//# sourceMappingURL=input.js.map
|
package/components/input.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../src/components/input.ts"],"sourcesContent":null,"names":["Input","SuperInput","constructor","this","type","variant","render","html","attr","observedRecord","
|
1
|
+
{"version":3,"file":"input.js","sources":["../src/components/input.ts"],"sourcesContent":null,"names":["Input","SuperInput","constructor","this","type","variant","render","html","attr","observedRecord","tokenList","_renderPrefix","value","autofocus","disabled","autocapitalize","nothing","autocomplete","placeholder","makeId","_handleInput","_renderSuffix","PASSWORD","_changeInputType","iconEyeSlashFill","htmlSlot","__decorate","property","prototype","undefined","part","godown","styles","css","cssGlobalVars","input","active","Input$1"],"mappings":"0YAmBA,IAAMA,EAAN,MAAMA,cAAcC,EAApB,WAAAC,uBACEC,KAAIC,KAA6D,OAQjED,KAAOE,QAA0B,UAKvB,MAAAC,GACR,OAAOC,CAAI,oBAGLC,EAAKL,KAAKM,0BACHC,EAAU,cAAeP,KAAKE,aAErC,CACAF,KAAKQ,gBACLJ,CAAI,6BAGQJ,KAAKC,iBACHD,KAAKS,sBACDT,KAAKU,yBACNV,KAAKW,6BACAX,KAAKY,gBAAkBC,oBACzBb,KAAKc,cAAgBD,mBACtBb,KAAKe,aAAeF,UAC7Bb,KAAKgB,mBACDhB,KAAKiB,iBAGnBjB,KAAKkB,yBAMH,aAAAA,GACR,MAAMC,EAAW,WACjB,OAAOf,CAAI,eAEDJ,KAAKgB,yBAGThB,KAAKC,OAASkB,EACZf,CAAI,8BAGc,IAAMJ,KAAKoB,iBAAiB,sBAC9B,IAAMpB,KAAKoB,iBAAiBD,oBACzB,IAAMnB,KAAKoB,iBAAiBD,OAEzCE,UAGNC,EAAS,sBApDnBC,EAAA,CADCC,KACyC3B,EAAA4B,UAAA,eAAAC,GAGhCH,EAAA,CADTI,EAAK,UAC4B9B,EAAA4B,UAAA,cAAAC,GAZ9B7B,EAAK0B,EAAA,CAFVK,EATiB,SAUjBC,EAAOC,CAAG,kCAAkCC,EAAcC,2BAA2BD,EAAcC,8CAA8CD,EAAcC,2BAA2BD,EAAcE,aACnMpC,GAmEN,IAAAqC,EAAerC"}
|
package/components/link.d.ts
CHANGED
package/components/link.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/components/link.ts"],"names":[],"mappings":"AAGA,OAAO,WAAW,MAAM,yBAAyB,CAAC;
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/components/link.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAKtD,QAAA,MAAM,SAAS;;;;;CAKL,CAAC;AAEX,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,cACM,IAAK,SAAQ,WAAW;IAC5B;;;;;;OAMG;IAEH,IAAI,EAAE,QAAQ,CAAkB;IAEhC;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IACH,KAAK,KAAM;IAEX,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IA0B3C,WAAW,EAAE,MAAM,IAAI,CAcrB;CACH;AAED,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/components/link.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as e}from"@godown/element";import{property as s}from"lit/decorators.js";import r
|
1
|
+
import{__decorate as t}from"tslib";import{godown as e}from"@godown/element";import{property as s}from"lit/decorators.js";import{SuperAnchor as r}from"../core/super-anchor.js";import o from"./router.js";const a="push",p="replace",i="normal",h="auto";let n=class Link extends r{constructor(){super(...arguments),this.type=h,this.suppress=!1,this.replace=!1,this.state={},this.handleState=()=>{switch(this.type){case h:case a:if(!this.replace){history.pushState(this.state,"",this.href);break}case p:history.replaceState(this.state,"",this.href)}}}_handleClick(t){const{state:e,type:s,href:r,pathname:a,suppress:p}=this;if(this.dispatchCustomEvent("navigate",{...this.observedRecord,pathname:a,state:e}),r.startsWith("#")||s===i)return;this.handleState();const n=[...o.routerInstances];p||s===h&&!n.some((t=>t.search(location.pathname)))||(t.preventDefault(),o.routerInstances.forEach((t=>{t.handlePopstate()})))}};t([s()],n.prototype,"type",void 0),t([s({type:Boolean})],n.prototype,"suppress",void 0),t([s({type:Boolean})],n.prototype,"replace",void 0),n=t([e("link")],n);var c=n;export{n as Link,c as default};
|
2
2
|
//# sourceMappingURL=link.js.map
|
package/components/link.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"link.js","sources":["../src/components/link.ts"],"sourcesContent":null,"names":["linkTypes","Link","SuperAnchor","constructor","this","type","suppress","replace","state","handleState","history","pushState","href","replaceState","_handleClick","e","pathname","dispatchCustomEvent","observedRecord","startsWith","routers","Router","routerInstances","some","i","search","location","preventDefault","forEach","handlePopstate","__decorate","property","prototype","undefined","Boolean","godown","Link$1"],"mappings":"
|
1
|
+
{"version":3,"file":"link.js","sources":["../src/components/link.ts"],"sourcesContent":null,"names":["linkTypes","Link","SuperAnchor","constructor","this","type","suppress","replace","state","handleState","history","pushState","href","replaceState","_handleClick","e","pathname","dispatchCustomEvent","observedRecord","startsWith","routers","Router","routerInstances","some","i","search","location","preventDefault","forEach","handlePopstate","__decorate","property","prototype","undefined","Boolean","godown","Link$1"],"mappings":"0MAMA,MAEMA,EACE,OADFA,EAEK,UAFLA,EAGI,SAHJA,EAIE,OAyBR,IAAMC,EAAN,MAAMA,aAAaC,EAAnB,WAAAC,uBASEC,KAAAC,KAAiBL,EAMjBI,KAAQE,UAAG,EAMXF,KAAOG,SAAG,EAKVH,KAAKI,MAAG,CAAE,EA4BVJ,KAAWK,YAAe,KACxB,OAAQL,KAAKC,MACX,KAAKL,EACL,KAAKA,EACH,IAAKI,KAAKG,QAAS,CAEjBG,QAAQC,UAAUP,KAAKI,MAAO,GAAIJ,KAAKQ,MACvC,MAGJ,KAAKZ,EACHU,QAAQG,aAAaT,KAAKI,MAAO,GAAIJ,KAAKQ,QArCtC,YAAAE,CAAaC,GACrB,MAAMP,MAAEA,EAAKH,KAAEA,EAAIO,KAAEA,EAAII,SAAEA,EAAQV,SAAEA,GAAaF,KAMlD,GALAA,KAAKa,oBAAoB,WAAY,IAChCb,KAAKc,eACRF,WACAR,UAEEI,EAAKO,WAAW,MAAQd,IAASL,EACnC,OAEFI,KAAKK,cACL,MAAMW,EAAU,IAAIC,EAAOC,iBAGxBhB,GACAD,IAASL,IAERoB,EAAQG,MAAMC,GAAMA,EAAEC,OAAOC,SAASV,cAExCD,EAAEY,iBACFN,EAAOC,gBAAgBM,SAASJ,IAC9BA,EAAEK,gBAAgB,OAxCxBC,EAAA,CADCC,KAC8B9B,EAAA+B,UAAA,YAAAC,GAM/BH,EAAA,CADCC,EAAS,CAAE1B,KAAM6B,WACFjC,EAAA+B,UAAA,gBAAAC,GAMhBH,EAAA,CADCC,EAAS,CAAE1B,KAAM6B,WACHjC,EAAA+B,UAAA,eAAAC,GArBXhC,EAAI6B,EAAA,CADTK,EA9BiB,SA+BZlC,GAuEN,IAAAmC,EAAenC"}
|
package/components/progress.d.ts
CHANGED
@@ -10,13 +10,6 @@ declare class Progress extends GlobalStyle {
|
|
10
10
|
min: number;
|
11
11
|
value: number;
|
12
12
|
protected render(): TemplateResult<1>;
|
13
|
-
/**
|
14
|
-
* Convert s to a percentage without a percent sign.
|
15
|
-
*
|
16
|
-
* @param s String or number to convert.
|
17
|
-
* @returns Percentage without a percent sign.
|
18
|
-
*/
|
19
|
-
parsePercent(s?: string | number): number;
|
20
13
|
}
|
21
14
|
export default Progress;
|
22
15
|
export { Progress };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../src/components/progress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAiB,MAAM,yBAAyB,CAAC;AAIrE;;;;GAIG;AACH,cAEM,QAAS,SAAQ,WAAW;IAEhC,GAAG,SAAK;IAGR,GAAG,SAAK;IAGR,KAAK,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../src/components/progress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAiB,MAAM,yBAAyB,CAAC;AAIrE;;;;GAIG;AACH,cAEM,QAAS,SAAQ,WAAW;IAEhC,GAAG,SAAK;IAGR,GAAG,SAAK;IAGR,KAAK,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAUtC;AAED,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/components/progress.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as r,styles as e,isNil as o,attr as
|
1
|
+
import{__decorate as t}from"tslib";import{godown as r,styles as e,isNil as o,Ranger as i,attr as s}from"@godown/element";import{css as a,html as n}from"lit";import{property as l}from"lit/decorators.js";import{cssGlobalVars as p,GlobalStyle as d}from"../core/global-style.js";let m=class Progress extends d{constructor(){super(...arguments),this.max=1,this.min=0}render(){let t,r=20;if(!o(this.value)){const e=new i(this.min,this.max);r=100*e.restrict(this.value/e.diff),t="static"}return n`<div part="root" ${s(this.observedRecord)} class="${t}"><i part="value" style="width:${r}%;"></i></div>`}};t([l({type:Number})],m.prototype,"max",void 0),t([l({type:Number})],m.prototype,"min",void 0),t([l({type:Number})],m.prototype,"value",void 0),m=t([r("progress"),e(a`:host{background:var(${p.passive});border-radius:.25em;color:var(${p.active});height:.5em;width:100%}:host,[part=root]{display:block}[part=root]{border-radius:inherit;height:inherit;overflow:hidden;position:relative;z-index:1}[part=value]{animation:progress 1.8s ease-in-out infinite alternate;background:currentColor;border-radius:inherit;height:100%;left:0;position:absolute;top:0;transition:all .3s;z-index:2}@keyframes progress{0%{left:0}to{left:80%}}.static [part=value]{animation:none}`)],m);var h=m;export{m as Progress,h as default};
|
2
2
|
//# sourceMappingURL=progress.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"progress.js","sources":["../src/components/progress.ts"],"sourcesContent":null,"names":["Progress","GlobalStyle","constructor","this","max","min","render","className","width","isNil","value","
|
1
|
+
{"version":3,"file":"progress.js","sources":["../src/components/progress.ts"],"sourcesContent":null,"names":["Progress","GlobalStyle","constructor","this","max","min","render","className","width","isNil","value","ranger","Ranger","restrict","diff","html","attr","observedRecord","__decorate","property","type","Number","prototype","undefined","godown","styles","css","cssGlobalVars","passive","active","Progress$1"],"mappings":"mRAeA,IAAMA,EAAN,MAAMA,iBAAiBC,EAAvB,WAAAC,uBAEEC,KAAGC,IAAG,EAGND,KAAGE,IAAG,EAKI,MAAAC,GACR,IACIC,EADAC,EAAQ,GAEZ,IAAKC,EAAMN,KAAKO,OAAQ,CACtB,MAAMC,EAAS,IAAIC,EAAOT,KAAKE,IAAKF,KAAKC,KACzCI,EAAoD,IAA5CG,EAAOE,SAASV,KAAKO,MAAQC,EAAOG,MAC5CP,EAAY,SAEd,OAAOQ,CAAI,oBAGLC,EAAKb,KAAKc,0BACHV,mCAIQC,oBAxBvBU,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACXrB,EAAAsB,UAAA,WAAAC,GAGPL,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACXrB,EAAAsB,UAAA,WAAAC,GAGPL,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACLrB,EAAAsB,UAAA,aAAAC,GARTvB,EAAQkB,EAAA,CAFbM,EAPiB,YAQjBC,EAAOC,CAAG,wBAAwBC,EAAcC,0CAA0CD,EAAcE,0aACnG7B,GAiCN,IAAA8B,EAAe9B"}
|
package/components/range.d.ts
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
import { Ranger } from "@godown/element";
|
1
2
|
import { type TemplateResult } from "lit";
|
2
|
-
import SuperInput from "../core/super-input.js";
|
3
|
+
import { SuperInput } from "../core/super-input.js";
|
3
4
|
/**
|
4
5
|
* {@linkcode Range} is similar to `<input type="range">`.
|
5
6
|
*
|
6
7
|
* Value accepts number, or array.
|
7
8
|
*
|
8
|
-
* Number has 1 handle, the array has the number of its elements
|
9
|
+
* Number has 1 handle, the array has the number of its elements.
|
9
10
|
*
|
10
11
|
* @fires input - Fires when the input value changes.
|
11
12
|
* @fires change - Fires when the input value changes.
|
@@ -28,7 +29,7 @@ declare class Range extends SuperInput {
|
|
28
29
|
*/
|
29
30
|
step: number;
|
30
31
|
/**
|
31
|
-
*
|
32
|
+
* Whether to display the range vertically.
|
32
33
|
*/
|
33
34
|
vertical: boolean;
|
34
35
|
/**
|
@@ -44,44 +45,72 @@ declare class Range extends SuperInput {
|
|
44
45
|
protected _root: HTMLElement;
|
45
46
|
protected _handles: NodeListOf<HTMLElement>;
|
46
47
|
lastFocus?: number;
|
48
|
+
protected _ranger: Ranger;
|
47
49
|
private __focusStack;
|
48
|
-
/**
|
49
|
-
* Returns true when the second number is greater than the first number.
|
50
|
-
*/
|
51
|
-
get reverse(): boolean;
|
52
|
-
/**
|
53
|
-
* If value is array.
|
54
|
-
*/
|
55
50
|
get range(): boolean;
|
56
51
|
/**
|
57
52
|
* Return values in the form of an array.
|
58
53
|
*/
|
59
54
|
get rangeValue(): number[];
|
60
55
|
/**
|
61
|
-
*
|
62
|
-
* @param value Fill value.
|
63
|
-
* @returns Array with length of len.
|
56
|
+
* Pad the value to the specified length.
|
64
57
|
*/
|
65
58
|
padValue(len: number, value?: number): number[];
|
59
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
60
|
+
get observedRecord(): Record<string, any>;
|
66
61
|
protected render(): TemplateResult<1>;
|
67
62
|
protected _renderHandle(index: number): TemplateResult<1>;
|
68
63
|
private __keydownEvent;
|
64
|
+
/**
|
65
|
+
* Focuses the handle at the given index, updates the focus stack, and dispatches a "focus" event.
|
66
|
+
* @param index - The index of the handle to focus.
|
67
|
+
*/
|
69
68
|
focusHandle(index: number): void;
|
69
|
+
/**
|
70
|
+
* Removes the focus from the currently focused handle and dispatches a "blur" event.
|
71
|
+
*/
|
70
72
|
blurHandle(): void;
|
73
|
+
/**
|
74
|
+
* Creates a keydown event handler that updates the value of the range based on arrow key presses.
|
75
|
+
* @param index - The index of the handle to update.
|
76
|
+
* @returns A function that handles the keydown event and updates the range value.
|
77
|
+
*/
|
71
78
|
protected createKeydownEvent(index: number): (e: KeyboardEvent) => void;
|
72
|
-
|
73
|
-
|
79
|
+
/**
|
80
|
+
* Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
|
81
|
+
* @param index - The index of the handle to focus.
|
82
|
+
* @returns A function that handles the mouse down event and updates the range value.
|
83
|
+
*/
|
84
|
+
protected createMouseDown(index: number): (e: MouseEvent) => void;
|
85
|
+
/**
|
86
|
+
* Creates a function that sets the value of the range at the given index.
|
87
|
+
* @param index - The index of the value to set.
|
88
|
+
* @returns A function that sets the value of the range.
|
89
|
+
*/
|
90
|
+
protected createSetValue(index: number): (value: number) => void;
|
74
91
|
/**
|
75
92
|
* Compute value from event.
|
93
|
+
* @returns The value closest to the event client position.
|
76
94
|
*/
|
77
|
-
protected _computeValue(
|
95
|
+
protected _computeValue({ clientX, clientY }: MouseEvent): number;
|
78
96
|
/**
|
79
|
-
*
|
97
|
+
* Handles the mouse down event on the root element of the range component.
|
98
|
+
* Computes the closest value to the mouse position, sets the value, and focuses the corresponding handle.
|
99
|
+
* @param e - The mouse down event object.
|
80
100
|
*/
|
81
|
-
normalizeValue(value: number): number;
|
82
101
|
protected _handleMousedownRoot(e: MouseEvent): void;
|
102
|
+
/**
|
103
|
+
* Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range.
|
104
|
+
* @param index - The index of the handle to focus.
|
105
|
+
* @returns A function that handles the mouse down event and updates the range value.
|
106
|
+
*/
|
83
107
|
protected createMousedownListener(mouseMoveCallback: (arg0: number) => void): (e: MouseEvent) => void;
|
84
|
-
|
108
|
+
/**
|
109
|
+
* Creates a mouse move event handler that updates the range value based on the mouse position.
|
110
|
+
* @param callback - A function to call with the new value when the mouse is moved.
|
111
|
+
* @returns A function that handles the mouse move event and updates the range value.
|
112
|
+
*/
|
113
|
+
protected createMousemoveListener(callback: (newValue: number) => void): (e: MouseEvent) => void;
|
85
114
|
protected _connectedInit(): void;
|
86
115
|
reset(): void;
|
87
116
|
sort(): number | number[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../src/components/range.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../src/components/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsE,MAAM,EAAQ,MAAM,iBAAiB,C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AM,GAAG,IAAI;IAehC;;OAEG;IACH,UAAU,IAAI,IAAI;IAMlB;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,OAK7B,aAAa,KAAG,IAAI;IAYjC;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,OAC1B,UAAU,KAAG,IAAI;IAM9B;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,WACrB,MAAM,KAAG,IAAI;IAY9B;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,MAAM;IAKjE;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAenD;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,OAC9D,UAAU,KAAG,IAAI;IAa9B;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,OACzD,UAAU,KAAG,IAAI;IAS9B,SAAS,CAAC,cAAc,IAAI,IAAI;IAahC,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,MAAM,GAAG,MAAM,EAAE;IAIzB,QAAQ,IAAI,MAAM,GAAG,MAAM,EAAE;CAM9B;AAED,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/components/range.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{part as e,godown as r,styles as a,
|
1
|
+
import{__decorate as t}from"tslib";import{part as e,godown as r,styles as a,Ranger as s,omit as o,attr as i,joinProperties as n,loop as h,tokenList as l,isNil as d}from"@godown/element";import{css as u,html as c}from"lit";import{property as v,queryAll as p,state as m}from"lit/decorators.js";import{scopePrefix as f,cssGlobalVars as g}from"../core/global-style.js";import{SuperInput as w}from"../core/super-input.js";const y="range",_=f(y);let b=class Range extends w{constructor(){super(...arguments),this.min=0,this.max=100,this.vertical=!1,this.__focusStack=[]}get range(){return Array.isArray(this.value)}get rangeValue(){return this.range?this.value:[this.value]}padValue(t,e=0){const{rangeValue:r}=this,a=t-r.length;return a>0?new Array(a).fill(e).concat(r):r}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r),"max"!==t&&"min"!==t&&"step"!==t||(this._ranger=new s(this.min,this.max,this.step))}get observedRecord(){return o(super.observedRecord,"outline-type")}render(){const t=this.padValue(2),e=Math.min(...t),r=Math.max(...t),a=this._ranger.diff;return c`<div part="root" ${i(this.observedRecord)} @mousedown="${this.disabled?null:this._handleMousedownRoot}" style="${n([["--from",(e-this.min)/a*100+"%"],["--to",(r-this.min)/a*100+"%"],...t.map(((t,e)=>[`--handle-${e}`,(t-this.min)/a*100+"%"]))])}"><div part="track"></div>${h(this.rangeValue.length,(t=>this._renderHandle(t)))}</div>`}_renderHandle(t){const{disabled:e,range:r,rangeValue:a}=this,s=!r||r&&t===a.length-1&&1===a.length;return c`<i tabindex="0" part="handle" class="${l({"last-focus":this.lastFocus===t})}" @mousedown="${e?null:this.createMouseDown(t)}" @focus="${e?null:()=>this.focusHandle(t)}" @blur="${e?null:this.blurHandle}" style="${n({"z-index":this.__focusStack.indexOf(t)+1,"--handle":`var(--${s?"to":`handle-${t}`})`})}"></i>`}focusHandle(t){this.lastFocus=t;const e=this.__focusStack.indexOf(t);-1!==e&&this.__focusStack.splice(e,1),this.__focusStack.push(t);const r=this._handles.item(t);r?.focus(),this.__keydownEvent||(this.__keydownEvent=this.events.add(document,"keydown",this.createKeydownEvent(t))),this.dispatchEvent(new CustomEvent("focus",{detail:t}))}blurHandle(){this.lastFocus=void 0,this.__keydownEvent=this.events.remove(document,"keydown",this.__keydownEvent),this.dispatchEvent(new CustomEvent("blur"))}createKeydownEvent(t){const{rangeValue:e,step:r}=this;return e.length<2&&(t=0),a=>{const s=e[t];"ArrowLeft"===a.key||"ArrowDown"===a.key?(a.preventDefault(),this.createSetValue(t)(s-r)):"ArrowRight"!==a.key&&"ArrowUp"!==a.key||(a.preventDefault(),this.createSetValue(t)(s+r))}}createMouseDown(t){return e=>{this.focusHandle(t),this.createMousedownListener(this.createSetValue(t))(e)}}createSetValue(t){return e=>{const r=this._ranger.normalize(e);let a=r;this.range&&(a=[...this.value],a[t]=r),this.value=a,this.dispatchEvent(new CustomEvent("range",{detail:this.value}))}}_computeValue({clientX:t,clientY:e}){const{top:r,left:a,height:s,width:o}=this._root.getBoundingClientRect();return this._ranger.present(this.vertical?(e-r)/s:(t-a)/o)}_handleMousedownRoot(t){const e=this._computeValue(t),r=this.range?this.rangeValue.reduce(((t,r,a)=>Math.abs(e-r)<Math.abs(e-this.rangeValue[t])?a:t),0):0,a=this.createSetValue(r);a(e),this.createMousedownListener(a)(t),this.focusHandle(r)}createMousedownListener(t){return e=>{e.preventDefault(),e.stopPropagation();const r=this.createMousemoveListener(t);this.events.add(document,"mousemove",r);const a=()=>{this.events.remove(document,"mousemove",r),this.events.remove(document,"mouseup",a)};this.events.add(document,"mouseup",a)}}createMousemoveListener(t){return e=>{const r=this._computeValue(e);r===this._ranger.restrict(r)&&t?.call(this,r)}}_connectedInit(){const t=this._ranger.diff;this.step||=t/100,d(this.value)&&(d(this.default)?this.value=Math.round(t/2/this.step)*this.step:this.value=this.default),this.default??=this.value}reset(){this.value=this.default}sort(){return this.value=this.toSorted()}toSorted(){return this.range?[...this.value].sort(((t,e)=>t-e)):this.value}};t([v({type:Number})],b.prototype,"min",void 0),t([v({type:Number})],b.prototype,"max",void 0),t([v({type:Number})],b.prototype,"step",void 0),t([v({type:Boolean,reflect:!0})],b.prototype,"vertical",void 0),t([v({type:Array})],b.prototype,"value",void 0),t([v({type:Array})],b.prototype,"default",void 0),t([e("root")],b.prototype,"_root",void 0),t([p("[part=handle]")],b.prototype,"_handles",void 0),t([m()],b.prototype,"lastFocus",void 0),b=t([r(y),a(u`:host{${_}--handle-active:var(${g.active});${_}--track-width:.5em;${_}--length:var(${g.input}-width);background:var(${g.passive});display:block;width:var(${_}--length)}:host([contents]) [part=root]{width:inherit}:host([vertical]){height:var(${_}--length);width:-moz-fit-content;width:fit-content}:host(:not([disabled])) .last-focus{${_}--handle-scale:1.05;background:var(${_}--handle-active)}[part=root]{position:relative;width:100%;--from:0%;--to:50%;height:var(${_}--track-width)}[part=root],[part=track]{border-radius:inherit;min-height:inherit}[part=track]{background:var(${g.active});height:100%;justify-content:space-between;left:min(var(--from),var(--to));pointer-events:none;width:max(calc(var(--to) - var(--from)),calc(var(--from) - var(--to)))}[part=handle],[part=track]{display:flex;position:absolute}[part=handle]{align-items:center;background:var(${g.active});border:.1em solid;border-color:var(${g.input}-control);border-radius:50%;height:1em;justify-content:center;transform:scale(var(${_}--handle-scale,1)) translate(-50%,-25%);transform-origin:0 25%;-webkit-user-select:none;user-select:none;width:1em}`,u`[vertical]{height:inherit;width:var(${_}--track-width)}[vertical] i{transform:translate(-25%,-50%)}[vertical] [part=track]{height:max(calc(var(--to) - var(--from)),calc(var(--from) - var(--to)));left:0;top:min(var(--from),var(--to));width:100%}`,u`[part=handle]{left:var(--handle);top:0}[vertical] [part=handle]{left:0;top:var(--handle)}`)],b);var k=b;export{b as Range,k as default};
|
2
2
|
//# sourceMappingURL=range.js.map
|
package/components/range.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"range.js","sources":["../src/components/range.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Range","SuperInput","constructor","this","min","max","vertical","__focusStack","
|
1
|
+
{"version":3,"file":"range.js","sources":["../src/components/range.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Range","SuperInput","constructor","this","min","max","vertical","__focusStack","range","Array","isArray","value","rangeValue","padValue","len","miss","length","fill","concat","attributeChangedCallback","name","_old","super","_ranger","Ranger","step","observedRecord","omit","render","from","Math","to","gap","diff","html","attr","disabled","_handleMousedownRoot","joinProperties","map","index","loop","_renderHandle","end","tokenList","lastFocus","createMouseDown","focusHandle","blurHandle","indexOf","indexOfFocusStack","splice","push","handleItem","_handles","item","focus","__keydownEvent","events","add","document","createKeydownEvent","dispatchEvent","CustomEvent","detail","undefined","remove","e","old","key","preventDefault","createSetValue","createMousedownListener","normalizeValue","normalize","newValue","_computeValue","clientX","clientY","top","left","height","width","_root","getBoundingClientRect","present","reduce","acc","abs","set","mouseMoveCallback","stopPropagation","move","createMousemoveListener","stop","callback","restrict","call","_connectedInit","isNil","default","round","reset","sort","toSorted","a","b","__decorate","property","type","Number","prototype","Boolean","reflect","part","queryAll","state","godown","styles","css","cssGlobalVars","active","input","passive","Range$1"],"mappings":"iaAOA,MAAMA,EAAY,QACZC,EAAWC,EAAYF,GAsB7B,IAAMG,EAAN,MAAMA,cAAcC,EAApB,WAAAC,uBAKEC,KAAGC,IAAG,EAMND,KAAGE,IAAG,IAYNF,KAAQG,UAAG,EA0BHH,KAAYI,aAAa,GAEjC,SAAIC,GACF,OAAOC,MAAMC,QAAQP,KAAKQ,OAM5B,cAAIC,GACF,OAAQT,KAAKK,MAAQL,KAAKQ,MAAQ,CAACR,KAAKQ,OAM1C,QAAAE,CAASC,EAAaH,EAAQ,GAC5B,MAAMC,WAAEA,GAAeT,KACjBY,EAAOD,EAAMF,EAAWI,OAC9B,OAAID,EAAO,EACF,IAAIN,MAAMM,GAAME,KAAKN,GAAOO,OAAON,GAErCA,EAGT,wBAAAO,CAAyBC,EAAcC,EAAqBV,GAC1DW,MAAMH,yBAAyBC,EAAMC,EAAMV,GAC9B,QAATS,GAA2B,QAATA,GAA2B,SAATA,IACtCjB,KAAKoB,QAAU,IAAIC,EAAOrB,KAAKC,IAAKD,KAAKE,IAAKF,KAAKsB,OAIvD,kBAAIC,GACF,OAAOC,EAAKL,MAAMI,eAAgB,gBAG1B,MAAAE,GACR,MAAMhB,EAAaT,KAAKU,SAAS,GAC3BgB,EAAOC,KA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KAAKK,MACA,IAAKL,KAAKQ,OAAoB4F,MAAK,CAACE,EAAGC,IAAMD,EAAIC,IAEnDvG,KAAKQ,QAxSdgG,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACX9G,EAAA+G,UAAA,WAAA9C,GAMP0C,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACT9G,EAAA+G,UAAA,WAAA9C,GAMT0C,EAAA,CADCC,EAAS,CAAEC,KAAMC,UACN9G,EAAA+G,UAAA,YAAA9C,GAMZ0C,EAAA,CADCC,EAAS,CAAEC,KAAMG,QAASC,SAAS,KACpBjH,EAAA+G,UAAA,gBAAA9C,GAQhB0C,EAAA,CADCC,EAAS,CAAEC,KAAMpG,SACMT,EAAA+G,UAAA,aAAA9C,GAMxB0C,EAAA,CADCC,EAAS,CAAEC,KAAMpG,SACQT,EAAA+G,UAAA,eAAA9C,GAGhB0C,EAAA,CADTO,EAAK,SACsBlH,EAAA+G,UAAA,aAAA9C,GAGlB0C,EAAA,CADTQ,EAAS,kBACiCnH,EAAA+G,UAAA,gBAAA9C,GAG3C0C,EAAA,CADCS,KACiBpH,EAAA+G,UAAA,iBAAA9C,GA9CdjE,EAAK2G,EAAA,CANVU,EAAOxH,GACPyH,EACCC,CAAG,SAASzH,wBAA+B0H,EAAcC,WAAW3H,uBAA8BA,iBAAwB0H,EAAcE,+BAA+BF,EAAcG,oCAAoC7H,uFAA8FA,2FAAkGA,uCAA8CA,4FAAmGA,iHAAwH0H,EAAcC,0RAA0RD,EAAcC,8CAA8CD,EAAcE,0FAA0F5H,uHAC9mCyH,CAAG,uCAAuCzH,gNAC1CyH,CAAG,8FAECvH,GAiTN,IAAA4H,EAAe5H"}
|
package/components/rotate.d.ts
CHANGED
@@ -12,11 +12,13 @@ declare class Rotate extends GlobalStyle {
|
|
12
12
|
protected _handleRotate(e: MouseEvent): void;
|
13
13
|
/**
|
14
14
|
* Compute offset.
|
15
|
-
*
|
16
|
-
* `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`
|
17
|
-
* ```
|
18
|
-
* @param e Mouse move event.
|
15
|
+
*
|
19
16
|
* @returns rotateX, rotateY
|
17
|
+
* @example
|
18
|
+
* ```ts
|
19
|
+
* const { rotateX, rotateY } = this._computeOffset(e);
|
20
|
+
* `rotateX(${rotateX}rad) rotateY(${rotateY}rad)`;
|
21
|
+
* ```
|
20
22
|
*/
|
21
23
|
protected _computeOffset(e: MouseEvent): {
|
22
24
|
rotateX: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rotate.d.ts","sourceRoot":"","sources":["../src/components/rotate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAKnE;;;;GAIG;AACH,cAEM,MAAO,SAAQ,WAAW;IAE9B,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAE7B,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAIrC,KAAK,IAAI,IAAI;IAKb,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAM5C
|
1
|
+
{"version":3,"file":"rotate.d.ts","sourceRoot":"","sources":["../src/components/rotate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,WAAW,EAAe,MAAM,yBAAyB,CAAC;AAKnE;;;;GAIG;AACH,cAEM,MAAO,SAAQ,WAAW;IAE9B,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAE7B,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAIrC,KAAK,IAAI,IAAI;IAKb,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAM5C;;;;;;;;;OASG;IACH,SAAS,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU,GAAG;QACvC,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB;CAUF;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/components/rotate.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rotate.js","sources":["../src/components/rotate.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Rotate","GlobalStyle","render","html","this","_handleRotate","htmlSlot","reset","_root","style","removeProperty","e","rotateX","rotateY","_computeOffset","setProperty","left","top","width","height","getBoundingClientRect","clientX","clientY","__decorate","part","prototype","undefined","godown","styles","css","Rotate$1"],"mappings":"2NAKA,MAAMA,EAAY,SACZC,EAAWC,EAAYF,GAS7B,IAAMG,EAAN,MAAMA,eAAeC,EAIT,MAAAC,GACR,OAAOC,CAAI,iDAISC,KAAKC,kBAEjBC,4BAEcF,KAAKG,oBAK7B,KAAAA,GACEH,KAAKI,MAAMC,MAAMC,eAAe,aAChCN,KAAKI,MAAMC,MAAMC,eAAe,cAGxB,aAAAL,CAAcM,GACtB,MAAMC,QAAEA,EAAOC,QAAEA,GAAYT,KAAKU,eAAeH,GACjDP,KAAKI,MAAMC,MAAMM,YAAY,YAAa,WAAWH,iBAAuBC,SAC5ET,KAAKI,MAAMC,MAAMM,YAAY,aAAc,
|
1
|
+
{"version":3,"file":"rotate.js","sources":["../src/components/rotate.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Rotate","GlobalStyle","render","html","this","_handleRotate","htmlSlot","reset","_root","style","removeProperty","e","rotateX","rotateY","_computeOffset","setProperty","left","top","width","height","getBoundingClientRect","clientX","clientY","__decorate","part","prototype","undefined","godown","styles","css","Rotate$1"],"mappings":"2NAKA,MAAMA,EAAY,SACZC,EAAWC,EAAYF,GAS7B,IAAMG,EAAN,MAAMA,eAAeC,EAIT,MAAAC,GACR,OAAOC,CAAI,iDAISC,KAAKC,kBAEjBC,4BAEcF,KAAKG,oBAK7B,KAAAA,GACEH,KAAKI,MAAMC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T,EAGf;IAED,IAAI,MAAM,IAAI,SAAS,EAAE,CAExB;IAED,KAAK,IAAI,IAAI;IAIb,SAAS,CAAC,MAAM,IAAI,OAAO;IAsB3B,iBAAiB,IAAI,IAAI;IAczB,oBAAoB,IAAI,IAAI;IAK5B,SAAS,IAAI,WAAW;IASxB,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI;IAWlE;;OAEG;IACH,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAoBvC;;OAEG;IACH,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAiBnD;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAQ5B;;OAEG;IACH,kBAAkB,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI;IAQnD,MAAM,CAAC,SAAS,IAAI,IAAI;IAMxB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAInC,cAAc,EAAE,MAAM,IAAI,CAEvB;CACJ;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/components/router.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as e,styles as s,RouteTree as o,htmlSlot as a,omit as h}from"@godown/element";import{css as i}from"lit";import{state as n,property as r}from"lit/decorators.js";import{GlobalStyle as p}from"../core/global-style.js";var c;const l="field",d="slotted",u="united";let m=c=class Router extends p{constructor(){super(...arguments),this.__fieldRouteTree=new o,this.__slottedRouteTree=new o,this.__cacheRecord=new Map,this.component=null,this.pathname=location.pathname,this.default=a(),this.type=u,this.cache=!1,this.handlePopstate=this.events.add(window,"popstate",(()=>{this.pathname=location.pathname}))}get params(){return this.path?o.parseParams(this.pathname,this.path):{}}set routes(t){this.__routes=t,this.collectFieldRoutes(t)}get routes(){return this.__routes}clear(){this.__cacheRecord.clear()}render(){let t;if(this.cache&&(t=this.__cacheRecord.get(this.pathname))&&(this.component=t.component,this.path=t.path,this.pathname=t.pathname),!t)switch(this.type){case l:this.component=this.fieldComponent();break;case d:this.component=this.slottedComponent();break;default:this.component=this.fieldComponent()??this.slottedComponent()}return this.component??this.default}connectedCallback(){
|
1
|
+
import{__decorate as t}from"tslib";import{godown as e,styles as s,RouteTree as o,htmlSlot as a,omit as h}from"@godown/element";import{css as i}from"lit";import{state as n,property as r}from"lit/decorators.js";import{GlobalStyle as p}from"../core/global-style.js";var c;const l="field",d="slotted",u="united";let m=c=class Router extends p{constructor(){super(...arguments),this.__fieldRouteTree=new o,this.__slottedRouteTree=new o,this.__cacheRecord=new Map,this.component=null,this.pathname=location.pathname,this.default=a(),this.type=u,this.cache=!1,this.handlePopstate=this.events.add(window,"popstate",(()=>{this.pathname=location.pathname}))}get params(){return this.path?o.parseParams(this.pathname,this.path):{}}set routes(t){this.__routes=t,this.collectFieldRoutes(t)}get routes(){return this.__routes}clear(){this.__cacheRecord.clear()}render(){let t;if(this.cache&&(t=this.__cacheRecord.get(this.pathname))&&(this.component=t.component,this.path=t.path,this.pathname=t.pathname),!t)switch(this.type){case l:this.component=this.fieldComponent();break;case d:this.component=this.slottedComponent();break;default:this.component=this.fieldComponent()??this.slottedComponent()}return this.component??this.default}connectedCallback(){super.connectedCallback(),c.routerInstances.add(this),"field"!==this.type&&(this.observers.add(this,MutationObserver,this.collectSlottedRoutes,{attributes:!0,attributeFilter:["slot"],subtree:!0}),this.collectSlottedRoutes())}disconnectedCallback(){super.disconnectedCallback(),c.routerInstances.delete(this)}useRouter(){return{pathname:this.pathname,params:this.params,path:this.path,component:this.component}}updated(t){if(t.has("pathname")||t.has("path")){const t=this.useRouter();!this.__cacheRecord.has(this.pathname)&&this.path&&this.__cacheRecord.set(this.pathname,t),this.dispatchEvent(new CustomEvent("change",{detail:t}))}}fieldComponent(t){if(t||=this.__fieldRouteTree.search(this.pathname)?.pattern,this.path=t,!t)return null;const e=this.routes.find((e=>e.path===t));return e?"render"in e?e.render?.(h(this.useRouter(),"component"))||null:e.component:null}slottedComponent(t){const e=this._slottedNames;return t||=this.__slottedRouteTree.search(this.pathname)?.pattern,this.path=t,t?(this.path=e.find((e=>e===t)),this.path?a(this.path):null):null}collectSlottedRoutes(){this.__slottedRouteTree=new o,this.clear(),this._slottedNames.forEach((t=>{this.__slottedRouteTree.insert(t)}))}collectFieldRoutes(t){this.__fieldRouteTree=new o,this.clear(),t.forEach((({path:t})=>{this.__fieldRouteTree.insert(t)}))}static updateAll(){this.routerInstances.forEach((t=>{t.handlePopstate()}))}search(t){return this.__fieldRouteTree.search(t)||this.__slottedRouteTree.search(t)}};m.routerInstances=new Set,t([n()],m.prototype,"component",void 0),t([n()],m.prototype,"path",void 0),t([r()],m.prototype,"pathname",void 0),t([n()],m.prototype,"default",void 0),t([r()],m.prototype,"type",void 0),t([r({type:Boolean})],m.prototype,"cache",void 0),t([n()],m.prototype,"routes",null),m=c=t([e("router"),s(i`:host{display:contents}`)],m);var _=m;export{m as Router,_ as default};
|
2
2
|
//# sourceMappingURL=router.js.map
|
package/components/router.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"router.js","sources":["../src/components/router.ts"],"sourcesContent":null,"names":["routerTypes","Router","Router_1","GlobalStyle","constructor","this","__fieldRouteTree","RouteTree","__slottedRouteTree","__cacheRecord","Map","component","pathname","location","default","htmlSlot","type","cache","handlePopstate","events","add","window","params","path","parseParams","routes","value","__routes","collectFieldRoutes","clear","render","cached","get","fieldComponent","slottedComponent","connectedCallback","super","routerInstances","MutationObserver","collectSlottedRoutes","
|
1
|
+
{"version":3,"file":"router.js","sources":["../src/components/router.ts"],"sourcesContent":null,"names":["routerTypes","Router","Router_1","GlobalStyle","constructor","this","__fieldRouteTree","RouteTree","__slottedRouteTree","__cacheRecord","Map","component","pathname","location","default","htmlSlot","type","cache","handlePopstate","events","add","window","params","path","parseParams","routes","value","__routes","collectFieldRoutes","clear","render","cached","get","fieldComponent","slottedComponent","connectedCallback","super","routerInstances","observers","MutationObserver","collectSlottedRoutes","attributes","attributeFilter","subtree","disconnectedCallback","delete","useRouter","updated","changedProperties","has","ur","set","dispatchEvent","CustomEvent","detail","query","search","pattern","route","find","r","omit","slottedPaths","_slottedNames","s","forEach","slotName","insert","updateAll","i","Set","__decorate","state","prototype","undefined","property","Boolean","godown","styles","css","Router$1"],"mappings":"6QAuBA,MAAMA,EACG,QADHA,EAEK,UAFLA,EAGI,SA+BV,IAAMC,EAAMC,EAAZ,MAAMD,eAAeE,EAArB,WAAAC,uBAGUC,KAAAC,iBAA8B,IAAIC,EAClCF,KAAAG,mBAAgC,IAAID,EACpCF,KAAAI,cAAgB,IAAIC,IAO5BL,KAASM,UAA6B,KAsBtCN,KAAAO,SAAmBC,SAASD,SAM5BP,KAAOS,QAAmBC,IAU1BV,KAAAW,KAAmBhB,EAQnBK,KAAKY,OAAG,EAwJRZ,KAAAa,eAA6Bb,KAAKc,OAAOC,IAAIC,OAAQ,YAAY,KAC/DhB,KAAKO,SAAWC,SAASD,QAAQ,IAlMnC,UAAIU,GACF,OAAKjB,KAAKkB,KAGHhB,EAAUiB,YAAYnB,KAAKO,SAAUP,KAAKkB,MAFxC,CAAE,EA0Cb,UAAIE,CAAOC,GACTrB,KAAKsB,SAAWD,EAChBrB,KAAKuB,mBAAmBF,GAG1B,UAAID,GACF,OAAOpB,KAAKsB,SAGd,KAAAE,GACExB,KAAKI,cAAcoB,QAGX,MAAAC,GACR,IAAIC,EAMJ,GALI1B,KAAKY,QAAUc,EAAS1B,KAAKI,cAAcuB,IAAI3B,KAAKO,aACtDP,KAAKM,UAAYoB,EAAOpB,UACxBN,KAAKkB,KAAOQ,EAAOR,KACnBlB,KAAKO,SAAWmB,EAAOnB,WAEpBmB,EACH,OAAQ1B,KAAKW,MACX,KAAKhB,EACHK,KAAKM,UAAYN,KAAK4B,iBACtB,MACF,KAAKjC,EACHK,KAAKM,UAAYN,KAAK6B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AAOuC,EAAaH,MAAMK,GAAMA,IAAMT,IACtClD,KAAKkB,KAIHR,EAASV,KAAKkB,MAHZ,MALA,KAcX,oBAAAiB,GACEnC,KAAKG,mBAAqB,IAAID,EAC9BF,KAAKwB,QACLxB,KAAK0D,cAAcE,SAASC,IAC1B7D,KAAKG,mBAAmB2D,OAAOD,EAAS,IAO5C,kBAAAtC,CAAmBF,GACjBrB,KAAKC,iBAAmB,IAAIC,EAC5BF,KAAKwB,QACLH,EAAMuC,SAAQ,EAAG1C,WACflB,KAAKC,iBAAiB6D,OAAO5C,EAAK,IAItC,gBAAO6C,GACL/D,KAAKgC,gBAAgB4B,SAASI,IAC5BA,EAAEnD,gBAAgB,IAItB,MAAAsC,CAAO5C,GACL,OAAOP,KAAKC,iBAAiBkD,OAAO5C,IAAaP,KAAKG,mBAAmBgD,OAAO5C,KA9M3EX,EAAAoC,gBAA+B,IAAIiC,IAW1CC,EAAA,CADCC,KACyCvE,EAAAwE,UAAA,iBAAAC,GAgB1CH,EAAA,CADCC,KACYvE,EAAAwE,UAAA,YAAAC,GAMbH,EAAA,CADCI,KACmC1E,EAAAwE,UAAA,gBAAAC,GAMpCH,EAAA,CADCC,KACmCvE,EAAAwE,UAAA,eAAAC,GAUpCH,EAAA,CADCI,KACoC1E,EAAAwE,UAAA,YAAAC,GAQrCH,EAAA,CADCI,EAAS,CAAE3D,KAAM4D,WACL3E,EAAAwE,UAAA,aAAAC,GAGbH,EAAA,CADCC,KAIDvE,EAAAwE,UAAA,SAAA,MAhEIxE,EAAMC,EAAAqE,EAAA,CAFXM,EAxBiB,UAyBjBC,EAAOC,CAAG,4BACL9E,GAuNN,IAAA+E,EAAe/E"}
|
package/components/select.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { type HandlerEvent } from "@godown/element";
|
2
2
|
import { type TemplateResult } from "lit";
|
3
3
|
import Input from "./input.js";
|
4
|
+
import { type DirectionCardinalY } from "../core/direction.js";
|
4
5
|
/**
|
5
6
|
* {@linkcode Select} is similar to `<select>`.
|
6
7
|
*
|
@@ -25,14 +26,15 @@ declare class Select extends Input {
|
|
25
26
|
*/
|
26
27
|
text: string;
|
27
28
|
protected _content: HTMLElement;
|
28
|
-
direction:
|
29
|
+
direction: DirectionCardinalY;
|
29
30
|
multiple: boolean;
|
30
31
|
visible: boolean;
|
31
|
-
protected autoDirection:
|
32
|
+
protected autoDirection: DirectionCardinalY;
|
32
33
|
protected lastChecked: HTMLElement;
|
33
34
|
protected defaultText: string;
|
34
35
|
protected defaultChecked: HTMLElement[];
|
35
36
|
private __store;
|
37
|
+
get observedRecord(): Record<string, any>;
|
36
38
|
protected render(): TemplateResult<1>;
|
37
39
|
protected _handleFocus(): void;
|
38
40
|
protected firstUpdated(): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../src/components/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAwC,MAAM,iBAAiB,CAAC;AAE1F,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,KAAK,CAAC;AAG9D,OAAO,KAAK,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../src/components/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAwC,MAAM,iBAAiB,CAAC;AAE1F,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,KAAK,CAAC;AAG9D,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,EAAE,KAAK,kBAAkB,EAAwB,MAAM,sBAAsB,CAAC;AAyBrF;;;;;;;;;;;;;;;;GAgBG;AACH,cAKM,MAAO,SAAQ,KAAK;IAExB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEzB;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC;IAGhC,SAAS,EAAE,kBAAkB,CAAC;IAG9B,QAAQ,UAAS;IAGjB,OAAO,UAAS;IAGhB,SAAS,CAAC,aAAa,EAAE,kBAAkB,CAAY;IAEvD,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC;IACxC,OAAO,CAAC,OAAO,CAAyC;IAExD,IAAI,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAKxC;IAED,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IASrC,SAAS,CAAC,YAAY,IAAI,IAAI;IAY9B,SAAS,CAAC,YAAY,IAAI,IAAI;IA0B9B,SAAS,CAAC,cAAc,IAAI,IAAI;IAkBhC,KAAK,IAAI,IAAI;IAOb,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC;IA4B3C,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAW5B,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzE,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAW/D,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAKnC,IAAI,IAAI,IAAI;IAMZ,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM;CAGzC;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/components/select.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{part as e,godown as i,styles as o,attr as s,htmlSlot as
|
1
|
+
import{__decorate as t}from"tslib";import{part as e,godown as i,styles as o,attr as s,htmlSlot as l}from"@godown/element";import n from"@godown/f7-icon/icons/chevron-down.js";import{css as r,html as h,nothing as a}from"lit";import{property as c,state as u}from"lit/decorators.js";import p from"./input.js";import{cssGlobalVars as d}from"../core/global-style.js";import{directionOutsetPlace as f}from"../core/direction.js";function v(t,e){return t&&e&&t.toLowerCase().includes(e.toLowerCase())}function m(t,e){if(t){const i="checked";e?t.setAttribute(i,""):t.removeAttribute(i)}}let b=class Select extends p{constructor(){super(...arguments),this.multiple=!1,this.visible=!1,this.autoDirection="bottom",this.__store=[]}get observedRecord(){return{...super.observedRecord,direction:this.direction||this.autoDirection}}render(){return h`<div part="root" ${s(this.observedRecord)} class="input-field">${[this._renderPrefix(),h`<input part="input" type="${this.type}" .value="${this.text}" ?autofocus="${this.autofocus}" ?disabled="${this.disabled}" autocapitalize="${this.autocapitalize||a}" autocomplete="${this.autocomplete||a}" placeholder="${this.placeholder||a}" id="${this.makeId}" @focus="${this._handleFocus}" @input="${this._handleInput}">`,h`<label for="${this.makeId}" part="suffix"><i part="icon">${n()}</i></label>`,h`<label for="${this.makeId}" part="content" direction-outset-place>${l()}</label>`]}</div>`}_handleFocus(){if(!this.direction){const{top:t,bottom:e}=this.getBoundingClientRect();window.innerHeight-e<this._content.clientHeight&&t>this._content.clientHeight?this.autoDirection="top":this.autoDirection="bottom"}this.visible=!0}firstUpdated(){this.events.add(this._content,"click",(t=>{t.preventDefault(),t.stopPropagation();const{target:e}=t,i=this.optionValue(e);if(i){const t=this.select(i,e.textContent);this.multiple||m(this.lastChecked,0),m(e,t),this.lastChecked=e}this._input.focus()})),this.events.add(document,"click",(t=>{t.stopPropagation();const e=t.composedPath()[0];e&&!this.shadowRoot.contains(e)&&this.blur()}))}_connectedInit(){if(!this.value){const t=[...this.querySelectorAll("[checked]")];(this.multiple?t:t.length?[this.lastChecked=t[0]]:[]).forEach((t=>{m(t,this.select(this.optionValue(t),t.textContent))})),this.default=this.value,this.defaultText=this.text,this.defaultChecked=t}this.text||(this.text="")}reset(){this.value=this.default,this.text=this.defaultText,this.querySelectorAll("[checked]").forEach((t=>m(t,0))),this.defaultChecked.forEach((t=>m(t,1)))}select(t,e){e||=t;let i=0;if(this.multiple){const o=this.__store.findIndex((e=>e.value===t));o>-1?this.__store.splice(o,1):(this.__store.push({value:t,text:e}),i=1),this.value=this.__store.map((t=>t.value)),this.text=this.__store.map((t=>t.text)).join(", ")}else this.value===t?(this.value="",this.text=""):(this.value=t,this.text=e,i=1);return this.dispatchEvent(new CustomEvent("select",{detail:this.value,composed:!0})),this.filter(),i}filter(t){t=t?.trim(),[...this.children].forEach((e=>{this.filterCallback(e,!t||v(this.optionValue(e),t)||v(e.textContent,t),t)}))}filterCallback(t,e,i){t.style.display=e?"":"none"}_handleInput(t){if(t.stopPropagation(),this.compositing)return;const e=this._input.value;this.filter(this.multiple?function(t,e,i){const o=e.slice(0,t).lastIndexOf(i)+1||0,s=e.indexOf(i,t)||e.length;return e.slice(o,s)}(this._input.selectionStart,e,","):e),this.dispatchEvent(new CustomEvent("input",{detail:this.value,composed:!0,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:this.value,composed:!0}))}focus(t){this._input.focus(t),this.visible=!0}blur(){this._input.blur(),this.visible=!1,super.blur()}optionValue(t){return t.value||t.getAttribute("value")||""}};t([c()],b.prototype,"text",void 0),t([e("content")],b.prototype,"_content",void 0),t([c()],b.prototype,"direction",void 0),t([c({type:Boolean})],b.prototype,"multiple",void 0),t([c({type:Boolean})],b.prototype,"visible",void 0),t([u()],b.prototype,"autoDirection",void 0),b=t([i("select"),o(f,r`.outline,:host(:focus-within){${d.input}-outline-color:var(${d.active})}[part=input]{text-overflow:ellipsis}[part=content]{position:absolute;visibility:hidden;width:100%}[visible] [part=content]{visibility:visible}`)],b);var _=b;export{b as Select,_ as default};
|
2
2
|
//# sourceMappingURL=select.js.map
|
package/components/select.js.map
CHANGED
@@ -1 +1 @@
|
|
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","
|
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","observedRecord","super","direction","render","html","attr","_renderPrefix","type","text","autofocus","disabled","autocapitalize","nothing","autocomplete","placeholder","makeId","_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","composed","filter","query","trim","children","filterCallback","match","style","display","compositing","c","start","slice","lastIndexOf","end","indexOf","betweenAt","selectionStart","bubbles","options","option","getAttribute","__decorate","property","prototype","undefined","part","Boolean","state","godown","styles","directionOutsetPlace","css","cssGlobalVars","input","active","Select$1"],"mappings":"saASA,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,CA0BA,IAAMG,EAAN,MAAMA,eAAeC,EAArB,WAAAC,uBAiBEC,KAAQC,UAAG,EAGXD,KAAOE,SAAG,EAGAF,KAAaG,cAAuB,SAKtCH,KAAOI,QAAsC,GAErD,kBAAIC,GACF,MAAO,IACFC,MAAMD,eACTE,UAAWP,KAAKO,WAAaP,KAAKG,eAI5B,MAAAK,GACR,OAAOC,CAAI,oBAGLC,EAAKV,KAAKK,uCAGV,CACAL,KAAKW,gBACLF,CAAI,6BA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