godown 3.11.2 → 3.13.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 -13
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +11 -12
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +12 -13
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +9 -8
- package/build/godown.iife.js.map +1 -0
- package/build/godown.js +7 -7
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +8 -8
- package/build/godown.umd.js.map +1 -1
- package/custom-elements.json +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/internal/global-style.d.ts.map +1 -1
- package/internal/global-style.js +1 -1
- package/internal/global-style.js.map +1 -1
- package/internal/popover.d.ts +3 -0
- package/internal/popover.d.ts.map +1 -0
- package/internal/popover.js +2 -0
- package/internal/popover.js.map +1 -0
- package/internal/reset-style.d.ts +3 -0
- package/internal/reset-style.d.ts.map +1 -0
- package/internal/reset-style.js +2 -0
- package/internal/reset-style.js.map +1 -0
- package/internal/ring.d.ts +1 -0
- package/internal/ring.d.ts.map +1 -1
- package/internal/ring.js +1 -1
- package/internal/ring.js.map +1 -1
- package/internal/super-input.d.ts +1 -4
- package/internal/super-input.d.ts.map +1 -1
- package/internal/super-input.js +1 -1
- package/internal/super-input.js.map +1 -1
- package/internal/utils.d.ts +2 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +2 -0
- package/internal/utils.js.map +1 -0
- package/package.json +3 -4
- package/popover.d.ts +2 -0
- package/popover.d.ts.map +1 -0
- package/popover.js +2 -0
- package/popover.js.map +1 -0
- package/src/index.ts +1 -0
- package/src/internal/global-style.ts +6 -34
- package/src/internal/popover.ts +64 -0
- package/src/internal/reset-style.ts +63 -0
- package/src/internal/ring.ts +3 -2
- package/src/internal/super-input.ts +2 -33
- package/src/internal/utils.ts +10 -0
- package/src/popover.ts +1 -0
- package/src/web-components/alert/component.ts +5 -4
- package/src/web-components/avatar/component.ts +1 -0
- package/src/web-components/button/component.ts +22 -18
- package/src/web-components/card/component.ts +3 -2
- package/src/web-components/chip/component.ts +1 -3
- package/src/web-components/details/component.ts +28 -17
- package/src/web-components/dialog/component.ts +51 -67
- package/src/web-components/heading/component.ts +0 -1
- package/src/web-components/input/component.ts +38 -30
- package/src/web-components/layout/component.ts +1 -0
- package/src/web-components/link/component.ts +0 -2
- package/src/web-components/popover/component.ts +172 -0
- package/src/web-components/popover/definition.ts +11 -0
- package/src/web-components/range/component.ts +2 -1
- package/src/web-components/rotate/component.ts +0 -1
- package/src/web-components/select/component.ts +109 -173
- package/src/web-components/split/component.ts +2 -2
- package/src/web-components/switch/component.ts +2 -1
- package/src/web-components/tabs/component.ts +99 -100
- package/src/web-components/text/component.ts +47 -52
- package/src/web-components/time/component.ts +5 -15
- package/src/web-components/tooltip/component.ts +44 -111
- package/vscode.css-custom-data.json +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-components/alert/component.d.ts.map +1 -1
- package/web-components/alert/component.js +1 -1
- package/web-components/alert/component.js.map +1 -1
- package/web-components/avatar/component.d.ts.map +1 -1
- package/web-components/avatar/component.js +1 -1
- package/web-components/avatar/component.js.map +1 -1
- package/web-components/button/component.d.ts.map +1 -1
- package/web-components/button/component.js +1 -1
- package/web-components/button/component.js.map +1 -1
- package/web-components/card/component.d.ts.map +1 -1
- package/web-components/card/component.js +1 -1
- package/web-components/card/component.js.map +1 -1
- package/web-components/chip/component.d.ts +1 -3
- package/web-components/chip/component.d.ts.map +1 -1
- package/web-components/chip/component.js.map +1 -1
- package/web-components/details/component.d.ts +9 -13
- package/web-components/details/component.d.ts.map +1 -1
- package/web-components/details/component.js +1 -1
- package/web-components/details/component.js.map +1 -1
- package/web-components/dialog/component.d.ts +12 -14
- package/web-components/dialog/component.d.ts.map +1 -1
- package/web-components/dialog/component.js +1 -1
- package/web-components/dialog/component.js.map +1 -1
- package/web-components/heading/component.d.ts.map +1 -1
- package/web-components/heading/component.js +1 -1
- package/web-components/heading/component.js.map +1 -1
- package/web-components/input/component.d.ts +3 -1
- package/web-components/input/component.d.ts.map +1 -1
- package/web-components/input/component.js +1 -1
- package/web-components/input/component.js.map +1 -1
- package/web-components/layout/component.d.ts.map +1 -1
- package/web-components/layout/component.js +1 -1
- package/web-components/layout/component.js.map +1 -1
- package/web-components/link/component.d.ts.map +1 -1
- package/web-components/link/component.js +1 -1
- package/web-components/link/component.js.map +1 -1
- package/web-components/popover/component.d.ts +35 -0
- package/web-components/popover/component.d.ts.map +1 -0
- package/web-components/popover/component.js +2 -0
- package/web-components/popover/component.js.map +1 -0
- package/web-components/popover/definition.d.ts +8 -0
- package/web-components/popover/definition.d.ts.map +1 -0
- package/web-components/popover/definition.js +2 -0
- package/web-components/popover/definition.js.map +1 -0
- package/web-components/range/component.d.ts.map +1 -1
- package/web-components/range/component.js +1 -1
- package/web-components/range/component.js.map +1 -1
- package/web-components/rotate/component.d.ts.map +1 -1
- package/web-components/rotate/component.js.map +1 -1
- package/web-components/select/component.d.ts +11 -27
- package/web-components/select/component.d.ts.map +1 -1
- package/web-components/select/component.js +1 -1
- package/web-components/select/component.js.map +1 -1
- package/web-components/split/component.js +1 -1
- package/web-components/split/component.js.map +1 -1
- package/web-components/switch/component.d.ts.map +1 -1
- package/web-components/switch/component.js +1 -1
- package/web-components/switch/component.js.map +1 -1
- package/web-components/tabs/component.d.ts +18 -25
- package/web-components/tabs/component.d.ts.map +1 -1
- package/web-components/tabs/component.js +1 -1
- package/web-components/tabs/component.js.map +1 -1
- package/web-components/text/component.d.ts +4 -7
- package/web-components/text/component.d.ts.map +1 -1
- package/web-components/text/component.js +1 -1
- package/web-components/text/component.js.map +1 -1
- package/web-components/time/component.d.ts +2 -2
- package/web-components/time/component.d.ts.map +1 -1
- package/web-components/time/component.js +1 -1
- package/web-components/time/component.js.map +1 -1
- package/web-components/tooltip/component.d.ts +15 -39
- package/web-components/tooltip/component.d.ts.map +1 -1
- package/web-components/tooltip/component.js +1 -1
- package/web-components/tooltip/component.js.map +1 -1
- package/web-types.json +1 -1
- package/internal/direction.d.ts +0 -27
- package/internal/direction.d.ts.map +0 -1
- package/internal/direction.js +0 -2
- package/internal/direction.js.map +0 -1
- package/internal/super-openable.d.ts +0 -15
- package/internal/super-openable.d.ts.map +0 -1
- package/internal/super-openable.js +0 -2
- package/internal/super-openable.js.map +0 -1
- package/src/internal/direction.ts +0 -65
- package/src/internal/super-openable.ts +0 -34
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/layout/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D;;;;;;;;;;;;;GAaG;AACH,
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/layout/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAI7D;;;;;;;;;;;;;GAaG;AACH,cAmCM,MAAO,SAAQ,WAAW;IAC9B;;OAEG;IAEH,MAAM,UAAS;IAEf,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAYtC;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as o,styles as r,attr as e,htmlSlot as i}from"@godown/element";import{css as a,html as s}from"lit";import{property as p}from"lit/decorators.js";import{GlobalStyle as d}from"../../internal/global-style.js";let n=class Layout extends d{constructor(){super(...arguments),this.sticky=!1}render(){return s`<div part="root" ${e(this.observedRecord)}> <header part="header">${i("header")}</header> <main part="main">${i()}</main> <footer part="footer">${i("footer")}</footer> </div>`}};t([p({type:Boolean})],n.prototype,"sticky",void 0),n=t([o("layout"),r(a`:host{flex-direction:column;grid-template-rows:auto 1fr auto;min-height:100%;width:100%}:host,:host([contents]) [part=root]{display:flex}[part=root]{display:contents}[part=main]{flex:1;width:100%}[part=footer],[part=header]{flex-shrink:0;width:100%}[sticky] header{position:sticky;top:0}`)],n);var l=n;export{n as Layout,l as default};
|
1
|
+
import{__decorate as t}from"tslib";import{godown as o,styles as r,attr as e,htmlSlot as i}from"@godown/element";import{css as a,html as s}from"lit";import{property as p}from"lit/decorators.js";import{GlobalStyle as d}from"../../internal/global-style.js";let n=class Layout extends d{constructor(){super(...arguments),this.sticky=!1}render(){return s`<div part="root" ${e(this.observedRecord)}> <header part="header">${i("header")}</header> <main part="main">${i()}</main> <footer part="footer">${i("footer")}</footer> </div>`}};t([p({type:Boolean})],n.prototype,"sticky",void 0),n=t([o("layout"),r(a`:host{flex-direction:column;grid-template-rows:auto 1fr auto;height:100%;min-height:100%;width:100%}:host,:host([contents]) [part=root]{display:flex}[part=root]{display:contents}[part=main]{flex:1;width:100%}[part=footer],[part=header]{flex-shrink:0;width:100%}[sticky] header{position:sticky;top:0}`)],n);var l=n;export{n as Layout,l as default};
|
2
2
|
//# sourceMappingURL=component.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/web-components/layout/component.ts"],"sourcesContent":null,"names":["Layout","GlobalStyle","constructor","this","sticky","render","html","attr","observedRecord","htmlSlot","__decorate"],"mappings":"
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/layout/component.ts"],"sourcesContent":null,"names":["Layout","GlobalStyle","constructor","this","sticky","render","html","attr","observedRecord","htmlSlot","__decorate"],"mappings":"8PAyDA,IAAMA,EAAN,MAAMA,eAAeC,EAArB,WAAAC,uBAKEC,KAAMC,QAAG,EAEC,MAAAC,GACR,OAAOC,CAAI,oBAAAC,EAAAJ,KAAAK,0CAAAC,EAAA,wCAAAA,oCAAAA,EAAA,8BAGLC,EAAA,iDAGkBV,EAAAU,EAAA,GAjEV,sUAqEhBV"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/link/component.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAC9D,OAAO,WAAW,MAAM,gCAAgC,CAAC;AAIzD,QAAA,MAAM,SAAS;;;;;CAKL,CAAC;AAEX,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/link/component.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAC9D,OAAO,WAAW,MAAM,gCAAgC,CAAC;AAIzD,QAAA,MAAM,SAAS;;;;;CAKL,CAAC;AAEX,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,cAeM,IAAK,SAAQ,WAAW;IAC5B;;;;;;OAMG;IAEH,IAAI,EAAE,QAAQ,CAAkB;IAEhC;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IAEH,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAW;IAE1D;;OAEG;IACH,KAAK,KAAM;IAEX,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IA6B3C,WAAW,EAAE,MAAM,IAAI,CAcrB;IAEF,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAatC;AAED,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as e,styles as r,attr as
|
1
|
+
import{__decorate as t}from"tslib";import{godown as e,styles as r,attr as s,htmlSlot as o}from"@godown/element";import{property as a}from"lit/decorators.js";import i from"../router/component.js";import{css as h,nothing as p,html as n}from"lit";import{GlobalStyle as l}from"../../internal/global-style.js";const c="push",d="replace",f="normal",m="auto";let u=class Link extends l{constructor(){super(...arguments),this.type=m,this.suppress=!1,this.replace=!1,this.target="_self",this.state={},this.handleState=()=>{switch(this.type){case m:case c:if(!this.replace){history.pushState(this.state,"",this.href);break}case d:history.replaceState(this.state,"",this.href)}}}get pathname(){return new URL(this.href,location.href).pathname}_handleClick(t){const{state:e,type:r,href:s,pathname:o,suppress:a}=this;if(!s)return;if(this.dispatchCustomEvent("navigate",{...this.observedRecord,pathname:o,state:e}),s.startsWith("#")||r===f)return;this.handleState();const h=[...i.routerInstances];a||r===m&&!h.some((t=>t.search(location.pathname)))||(t.preventDefault(),i.routerInstances.forEach((t=>{t.handlePopstate()})))}render(){return n`<a part="root" ${s(this.observedRecord)} href="${this.href||p}" target="${this.target}" @click=${this._handleClick}> ${o()} </a>`}};t([a()],u.prototype,"type",void 0),t([a({type:Boolean})],u.prototype,"suppress",void 0),t([a({type:Boolean})],u.prototype,"replace",void 0),t([a()],u.prototype,"href",void 0),t([a()],u.prototype,"target",void 0),u=t([e("link"),r(h`:host{cursor:default;display:inline-block}:host([href]){cursor:pointer}a{display:contents}`)],u);var y=u;export{u as Link,y as default};
|
2
2
|
//# sourceMappingURL=component.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/web-components/link/component.ts"],"sourcesContent":null,"names":["linkTypes","Link","GlobalStyle","constructor","this","type","suppress","replace","target","state","handleState","history","pushState","href","replaceState","pathname","URL","location","_handleClick","e","dispatchCustomEvent","observedRecord","startsWith","routers","Router","routerInstances","some","i","search","preventDefault","forEach","handlePopstate","render","html","attr","nothing","htmlSlot","__decorate","prototype","Boolean","property","godown","styles","css","Link$1"],"mappings":"iTAOA,MAEMA,EACE,OADFA,EAEK,UAFLA,EAGI,SAHJA,EAIE,
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/link/component.ts"],"sourcesContent":null,"names":["linkTypes","Link","GlobalStyle","constructor","this","type","suppress","replace","target","state","handleState","history","pushState","href","replaceState","pathname","URL","location","_handleClick","e","dispatchCustomEvent","observedRecord","startsWith","routers","Router","routerInstances","some","i","search","preventDefault","forEach","handlePopstate","render","html","attr","nothing","htmlSlot","__decorate","prototype","Boolean","property","godown","styles","css","Link$1"],"mappings":"iTAOA,MAEMA,EACE,OADFA,EAEK,UAFLA,EAGI,SAHJA,EAIE,OAuCR,IAAMC,EAAN,MAAMA,aAAaC,EAAnB,WAAAC,uBASEC,KAAAC,KAAiBL,EAMjBI,KAAQE,UAAG,EAMXF,KAAOG,SAAG,EAYVH,KAAMI,OAA4C,QAKlDJ,KAAKK,MAAG,CAAE,EAmCVL,KAAWM,YAAe,KACxB,OAAQN,KAAKC,MACX,KAAKL,EACL,KAAKA,EACH,IAAKI,KAAKG,QAAS,CAEjBI,QAAQC,UAAUR,KAAKK,MAAO,GAAIL,KAAKS,MACvC,MAGJ,KAAKb,EACHW,QAAQG,aAAaV,KAAKK,MAAO,GAAIL,KAAKS,QA5ChD,YAAIE,GACF,OAAO,IAAIC,IAAIZ,KAAKS,KAAMI,SAASJ,MAAME,SAGjC,YAAAG,CAAaC,GACrB,MAAMV,MAAEA,EAAKJ,KAAEA,EAAIQ,KAAEA,EAAIE,SAAEA,EAAQT,SAAEA,GAAaF,KAClD,IAAKS,EACH,OAOF,GALAT,KAAKgB,oBAAoB,WAAY,IAChChB,KAAKiB,eACRN,WACAN,UAEEI,EAAKS,WAAW,MAAQjB,IAASL,EACnC,OAEFI,KAAKM,cACL,MAAMa,EAAU,IAAIC,EAAOC,iBAGxBnB,GACAD,IAASL,IAERuB,EAAQG,MAAMC,GAAMA,EAAEC,OAAOX,SAASF,cAExCI,EAAEU,iBACFL,EAAOC,gBAAgBK,SAASH,IAC9BA,EAAEI,gBAAgB,KAqBd,MAAAC,GACR,OAAOC,CAAI,kBAAAC,EAAA9B,KAAAiB,yBAAAjB,KAAAS,MAAAsB,cAAA/B,KAAAI,kBAAAJ,KAAAc,iBAAAkB,aAGLC,EAAA,MAEQpC,EAAAqC,UAAA,YAAW,GACZD,EAAA,oBAEPpC,EAAAqC,UAAU,gBAAA,QAEf,CAAAjC,KAAAkC,aACHD,UAAA,eAAA,KACD,CA7FCE,KADCvC,EAAAqC,UAAU,YAAA,GACqBD,EAAA,CAMhCG,KADCvC,EAAAqC,UAAe,iBACCrC,EAAAoC,EAAA,CAMjBI,EAlEgB,QAiEfC,EAAAC,CAAW,+FACI1C,GAMhB,IAAA2C,EAAA3C"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import GlobalStyle from "../../internal/global-style.js";
|
2
|
+
import { type PropertyValues, type TemplateResult } from "lit";
|
3
|
+
/**
|
4
|
+
* {@link Popover} renders a popover.
|
5
|
+
*
|
6
|
+
* This requires the support of the popover API and CSS position-area.
|
7
|
+
*
|
8
|
+
* @fires toggle - Fired when the popover is toggled.
|
9
|
+
* @slot popover - Popover content.
|
10
|
+
* @slot - Popover trigger.
|
11
|
+
* @category display
|
12
|
+
*/
|
13
|
+
declare class Popover extends GlobalStyle {
|
14
|
+
anchorName: string;
|
15
|
+
open: boolean;
|
16
|
+
action: "hide" | "show" | "toggle" | "none";
|
17
|
+
span: "span" | "spread" | "isolated";
|
18
|
+
/**
|
19
|
+
* The position refers to the spatial location of the popover in relation to the trigger,
|
20
|
+
* rather than the alignment property between them.
|
21
|
+
*/
|
22
|
+
position: "center" | "left" | "left-top" | "left-bottom" | "right" | "right-top" | "right-bottom" | "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | "start" | "start-start" | "start-end" | "end" | "end-start" | "end-end";
|
23
|
+
protected _popover: HTMLElement;
|
24
|
+
constructor();
|
25
|
+
protected render(): TemplateResult<1>;
|
26
|
+
protected _handleClick(): void;
|
27
|
+
show(): void;
|
28
|
+
hide(): void;
|
29
|
+
toggle(force?: boolean): void;
|
30
|
+
protected updated(_changedProperties: PropertyValues): void;
|
31
|
+
protected _openChange(): void;
|
32
|
+
resolveArea(): string;
|
33
|
+
}
|
34
|
+
export { Popover, Popover as default };
|
35
|
+
//# sourceMappingURL=component.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/popover/component.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAO1E;;;;;;;;;GASG;AACH,cAsBM,OAAQ,SAAQ,WAAW;IAC/B,UAAU,SAAyD;IAGnE,IAAI,UAAS;IAGb,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAU;IAGrD,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAU;IAE9C;;;OAGG;IAEH,QAAQ,EACJ,QAAQ,GACR,MAAM,GACN,UAAU,GACV,aAAa,GACb,OAAO,GACP,WAAW,GACX,cAAc,GACd,KAAK,GACL,UAAU,GACV,WAAW,GACX,QAAQ,GACR,aAAa,GACb,cAAc,GACd,OAAO,GACP,aAAa,GACb,WAAW,GACX,KAAK,GACL,WAAW,GACX,SAAS,CAAY;IAGzB,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC;;IAgBhC,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAmBrC,SAAS,CAAC,YAAY,IAAI,IAAI;IAU9B,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAI7B,SAAS,CAAC,OAAO,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAM3D,SAAS,CAAC,WAAW,IAAI,IAAI;IAiB7B,WAAW,IAAI,MAAM;CAStB;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,CAAC"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{__decorate as o}from"tslib";import{property as t}from"lit/decorators.js";import{GlobalStyle as e}from"../../internal/global-style.js";import{css as i,html as s}from"lit";import{part as p,godown as r,styles as n,StyleController as a,joinRules as h,htmlSlot as l}from"@godown/element";import{showPopover as c,hidePopover as d}from"../../internal/popover.js";const v="popover",m=v;let g=class Popover extends e{constructor(){super(),this.anchorName=`--${v}-${Math.random().toString(36).slice(2)}`,this.open=!1,this.action="show",this.span="span",this.position="bottom",new a(this,(()=>h({"[part=root],slot:not([name])::slotted(*)":{"anchor-name":this.anchorName},"[part=popover]":{"position-anchor":this.anchorName,"position-area":this.resolveArea()}})))}render(){return s`<div part="root"> <div part="trigger" @click=${this._handleClick}> ${l()} </div> <div part="popover" popover="manual"> ${l("popover")} </div> </div>`}_handleClick(){const{action:o}=this;switch(o){case"show":case"hide":case"toggle":this[o]()}}show(){this.toggle(!0)}hide(){this.toggle(!1)}toggle(o){this.open=o??!this.open}updated(o){o.has("open")&&this._openChange()}_openChange(){const{open:o}=this;if(o){c.call(this,this._popover);const o=t=>{this.contains(t.target)||(this.events.remove(document,"click",o),this.open=!1)};this.events.add(document,"click",o)}else d(this._popover);this.dispatchCustomEvent("toggle",o)}resolveArea(){const o=this.position.split("-"),t="spread"===this.span?`span-${o[0]}`:o[0];if(o.length<2)return`${t} center`;return`${t} ${"isolated"===this.span?o[1]:`span-${o[1]}`}`}};o([t({type:Boolean,reflect:!0})],g.prototype,"open",void 0),o([t()],g.prototype,"action",void 0),o([t()],g.prototype,"span",void 0),o([t()],g.prototype,"position",void 0),o([p(v)],g.prototype,"_popover",void 0),g=o([r(m),n(i`:host{display:inline-block}[part=trigger]{display:contents}[part=root]{display:inherit}[part=popover]{inset:unset;overflow:visible;position:absolute;z-index:1;position-try-fallbacks:flip-block}`)],g);export{g as Popover,g as default};
|
2
|
+
//# sourceMappingURL=component.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/popover/component.ts"],"sourcesContent":null,"names":["POPOVER","protoName","Popover","GlobalStyle","constructor","super","this","anchorName","Math","random","toString","slice","open","action","span","position","StyleController","joinRules","resolveArea","render","html","_handleClick","htmlSlot","toggle","force","updated","_changedProperties","has","_openChange","showPopover","call","_popover","listener","e","contains","target","events","remove","document","add","hidePopover","dispatchCustomEvent","split","firstValue","length","property","type","Boolean","reflect","prototype","__decorate","part","godown","styles","css"],"mappings":"2WAMA,MAAMA,EAAU,UACVC,EAAYD,EAkClB,IAAME,EAAN,MAAMA,gBAAgBC,EAyCpB,WAAAC,GACEC,QAzCFC,KAAAC,WAAa,KAAKP,KAAWQ,KAAKC,SAASC,SAAS,IAAIC,MAAM,KAG9DL,KAAIM,MAAG,EAGPN,KAAMO,OAAwC,OAG9CP,KAAIQ,KAAmC,OAOvCR,KAAQS,SAmBQ,SAOd,IAAIC,EAAgBV,MAAM,IACjBW,EAAU,CACf,2CAA4C,CAC1C,cAAeX,KAAKC,YAEtB,iBAAkB,CAChB,kBAAmBD,KAAKC,WACxB,gBAAiBD,KAAKY,mBAKpB,MAAAC,GACR,OAAOC,CAAI,gDAAAd,KAAAe,iBAAAC,oDAAAA,EAAA,+DAII,OAAAT,cAEP,IAAA,2CAMQU,QAAA,UAGfjB,KAAAiB,QAAA,GAGO,MAAAA,CAAYC,GACpBlB,KAAAM,KAAQY,SAAeZ,KAErB,OAAAa,CAAAC,GACAA,EAAWC,IAAA,SACXrB,KAAKsB,cAGT,WAAAA,GAEI,MAAAhB,KAAAA,GAAAN,KACF,GAAIM,EAAC,CACPiB,EAAAC,KAAAxB,KAAAA,KAAAyB,UAEI,MAAAC,EAAAC,IACU3B,KAAM4B,SAAAD,EAAAE,UACpB7B,KAAA8B,OAAAC,OAAAC,SAAA,QAAAN,GAEsB1B,KAAAM,MAAA,IAIJN,KAAkC8B,OAAAG,IAAAD,SAAA,QAAAN,EAClD,MAEAQ,EAAAlC,KAAAyB,UAGmBzB,KAAAmC,oBAAA,SAAA7B,EACnB,qBAEa8B,EAAApC,cAAgBoC,MAAS,KACpCC,EAAuB,WAATrC,UAAS,QAAAoC,EAAA,KAAAA,EAAA,QACjBE,OAAc,WACZD,WAGR,MAAC,GAAAA,KADC,aAAArC,KAAAQ,KAAA4B,EAAA,GAAA,QAAAA,EAAA,YAIFG,EAAA,CAAAC,KAAAC,QAAiBC,SAAS,OAC5BC,UAAA,YAAA,GACAC,EAAA,CACFL,OAEWI,UAAA,cAAA,KACH,MAEN/C,EAAA+C,UAAU,YAAY,aAGhBA,UAAA,mBACNC,EAAA,CACFC,EAAAnD,IACDE,EAAA+C,UAAA,gBAAA,GA5HC/C,EAAAgD,EAAA,CADCE,EAAQnD,GACIoD,EAAAC,CAAA,sMAGbpD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"__source__/","sources":["web-components/popover/definition.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAIrC,eAAe,OAAO,CAAC;AAEvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,OAAO,CAAC;KAC3B;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"definition.js","sources":["../../src/web-components/popover/definition.ts"],"sourcesContent":null,"names":["Popover","define"],"mappings":"yCAEAA,EAAQC,SAER,IAAAD,EAAeA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/range/component.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,MAAM,EAEP,MAAM,iBAAiB,CAAC;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AO,EAAE,KAAK,EAAE,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{queryPart as e,godown as r,styles as a,Ranger as o,omit as s,attr as i,joinDeclarations as n,loop as h,tokenList as l,isNullable 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 g,cssGlobalVars as f}from"../../internal/global-style.js";import{SuperInput as w}from"../../internal/super-input.js";const
|
1
|
+
import{__decorate as t}from"tslib";import{queryPart as e,godown as r,styles as a,Ranger as o,omit as s,attr as i,joinDeclarations as n,loop as h,tokenList as l,isNullable 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 g,cssGlobalVars as f}from"../../internal/global-style.js";import{SuperInput as w}from"../../internal/super-input.js";import{ringTypeAttribute as y}from"../../internal/ring.js";const _="range",k=g(_);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 o(this.min,this.max,this.step))}get observedRecord(){return s(super.observedRecord,y)}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,o=!r||r&&t===a.length-1&&1===a.length;return c`<i tabindex="0" part="${l("handle",`handle-${t}`)}" @mousedown="${e?null:this.createMouseDown(t)}" style="${n({"z-index":this.__focusStack.indexOf(t)+1,"--handle":`var(--${o?"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)))}blurHandle(){this.lastFocus=void 0,this.__keydownEvent=this.events.remove(document,"keydown",this.__keydownEvent)}createKeydownEvent(t){return e=>{const{rangeValue:r,step:a}=this;r.length<2&&(t=0);const o=r[t];"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),this.createSetValue(t)(o-a)):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),this.createSetValue(t)(o+a))}}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.dispatchCustomEvent("change",this.value)}}_computeValue({clientX:t,clientY:e}){const{top:r,left:a,height:o,width:s}=this._root.getBoundingClientRect();return this._ranger.present(this.vertical?(e-r)/o:(t-a)/s)}_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(){this._ranger=new o(this.min,this.max,this.step);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(_),a(u`:host{${k}--track-width:.5em;${k}--handle-scale:1;${k}--track-background:var(${f.active});background:var(${f.passive});display:block;height:var(${k}--track-width);width:100%}:host([contents]) [part=root]{width:inherit}:host([vertical]){height:100%;width:-moz-fit-content;width:fit-content}[part=root]{position:relative;--from:0%;--to:50%}[part=root],[part=track]{border-radius:inherit;min-height:inherit}[part=track]{background:var(${k}--track-background);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=track],[part~=handle]{display:flex;position:absolute}[part~=handle]{align-items:center;background:var(${f.background});border:.1em solid;border-radius:50%;height:1em;justify-content:center;outline:0;transform:scale(var(${k}--handle-scale)) translate(-50%,-25%);transform-origin:0 25%;-webkit-user-select:none;user-select:none;width:1em}`,u`[vertical]{height:inherit;width:var(${k}--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 $=b;export{b as Range,$ as default};
|
2
2
|
//# sourceMappingURL=component.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/web-components/range/component.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","joinDeclarations","map","index","loop","_renderHandle","end","lastFocus","splice","indexOfFocusStack","push","handleItem","_handles","item","focus","__keydownEvent","blurHandle","undefined","events","remove","document","e","key","preventDefault","createSetValue","old","focusHandle","createMousedownListener","newValue","normalizeValue","dispatchCustomEvent","_computeValue","clientX","clientY","top","left","height","width","_root","getBoundingClientRect","present","reduce","acc","abs","set","mouseMoveCallback","stopPropagation","move","createMousemoveListener","add","stop","callback","call","round","reset","default","sort","toSorted","a","b","type","Number","prototype","property","Boolean","reflect","__decorate","queryPart","queryAll","state","godown","styles","css","cssGlobalVars","active","passive","background","Range$1"],"mappings":"
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/range/component.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","ringTypeAttribute","render","from","Math","to","gap","diff","html","attr","disabled","_handleMousedownRoot","joinDeclarations","map","index","loop","_renderHandle","end","lastFocus","splice","indexOfFocusStack","push","handleItem","_handles","item","focus","__keydownEvent","blurHandle","undefined","events","remove","document","e","key","preventDefault","createSetValue","old","focusHandle","createMousedownListener","newValue","normalizeValue","dispatchCustomEvent","_computeValue","clientX","clientY","top","left","height","width","_root","getBoundingClientRect","present","reduce","acc","abs","set","mouseMoveCallback","stopPropagation","move","createMousemoveListener","add","stop","callback","call","round","reset","default","sort","toSorted","a","b","type","Number","prototype","property","Boolean","reflect","__decorate","queryPart","queryAll","state","godown","styles","css","cssGlobalVars","active","passive","background","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,KAAAzF,WACO2F,UAAK,aAAK,KACnB,CACDC,EAAA,CAAAH,KAAAzF,SAtSCT,EAAAoG,UAAA,eAAA,GADCI,EAAA,CACOC,EAAA,SAMRzG,EAAAoG,UAAA,aAAA,GADCI,EAAA,CACSE,EAAA,kBAMV1G,EAAAoG,UAAA,gBAAA,GADCI,EAAA,CACYG,KAMb3G,EAAAoG,UAAA,iBAAA,KADSI,EAAO,CACCI,EAAA/G,GAQjBgH,EAAAC,CAAA,SAAAhH,uBAAAA,qBAAAA,2BAAAiH,EAAAC,0BAAAD,EAAAE,qCAAAnH,gSAAAA,ySAAAiH,EAAAG,mHAAApH,qHAAAgH,CAAA,uCAAAhH,gNAAAgH,CAAA,gGADC9G,GACQ,IAAAmH,EAAAnH"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/rotate/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,WAAW,EAAe,MAAM,gCAAgC,CAAC;AAK1E;;;;GAIG;AACH,
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/rotate/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,WAAW,EAAe,MAAM,gCAAgC,CAAC;AAK1E;;;;GAIG;AACH,cA6BM,MAAO,SAAQ,WAAW;IAE9B,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC;IAE7B,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAcrC,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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/web-components/rotate/component.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Rotate","GlobalStyle","render","html","this","_handleRotate","htmlSlot","reset","_root","style","removeProperty","e","setProperty","rotateX","rotateY","_computeOffset","__decorate","queryPart","prototype","godown","styles","css","Rotate$1"],"mappings":"uOAKA,MAAMA,EAAY,SACZC,EAAWC,EAAYF,
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/rotate/component.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Rotate","GlobalStyle","render","html","this","_handleRotate","htmlSlot","reset","_root","style","removeProperty","e","setProperty","rotateX","rotateY","_computeOffset","__decorate","queryPart","prototype","godown","styles","css","Rotate$1"],"mappings":"uOAKA,MAAMA,EAAY,SACZC,EAAWC,EAAYF,GAoC7B,IAAMG,EAAN,MAAMA,eAAeC,EAIT,MAAAC,GACR,OAAOC,CAAI,kDAAAC,KAAAC,mBAAAC,8BAAAF,KAAAG,0EAISH,KAAAI,MAAAC,MAAAC,eAAkB,cAE9B,aAAAL,CAAAM,qDAEcP,KAAAI,MAAAC,MAAAG,YAAU,YAAA,WAAAC,iBAAAC,yDAgBlC,cAAAC,CAAAJ,0JAUUK,EAAA,CAIRC,EAAM,SACNjB,EAAAkB,UAAe,gBACflB,EAAAgB,EAAa,CACbG,EAAAtB,GAEAuB,EAAAC,CAAa,+FAAuCvB,8IAAAA,8BAAAA,yEACpDE,GACA,IAAAsB,EAAOtB"}
|
@@ -1,18 +1,8 @@
|
|
1
|
-
import { type HandlerEvent } from "@godown/element";
|
2
1
|
import { type TemplateResult } from "lit";
|
3
2
|
import Input from "../input/component.js";
|
4
|
-
import { type DirectionCardinalY } from "../../internal/direction.js";
|
5
3
|
/**
|
6
4
|
* {@linkcode Select} is similar to `<select>`.
|
7
5
|
*
|
8
|
-
* Elements with the value attribute/property can be used as options.
|
9
|
-
*
|
10
|
-
* The checked attribute will be added to the selected element.
|
11
|
-
*
|
12
|
-
* Multi-selected state looks the same as single-selected.
|
13
|
-
*
|
14
|
-
* Input will filter the options.
|
15
|
-
*
|
16
6
|
* @fires input - Fires when the input value changes.
|
17
7
|
* @fires change - Fires when the input value changes.
|
18
8
|
* @fires select - Fires when select an option.
|
@@ -20,34 +10,28 @@ import { type DirectionCardinalY } from "../../internal/direction.js";
|
|
20
10
|
* @category input
|
21
11
|
*/
|
22
12
|
declare class Select extends Input {
|
23
|
-
value: string | string[];
|
24
|
-
/**
|
25
|
-
* Selected texts.
|
26
|
-
*/
|
27
13
|
text: string;
|
28
|
-
protected _content: HTMLElement;
|
29
|
-
direction: DirectionCardinalY;
|
30
14
|
multiple: boolean;
|
31
|
-
|
32
|
-
|
15
|
+
noEdit: boolean;
|
16
|
+
values: {
|
17
|
+
value: string;
|
18
|
+
label?: string;
|
19
|
+
}[];
|
20
|
+
_popover: HTMLElement;
|
33
21
|
protected lastChecked: HTMLElement;
|
34
22
|
protected defaultText: string;
|
35
|
-
protected
|
36
|
-
private __store;
|
37
|
-
get observedRecord(): Record<string, any>;
|
23
|
+
protected optionsVisible: boolean;
|
38
24
|
protected render(): TemplateResult<1>;
|
39
25
|
protected _renderSuffix(): TemplateResult<1>;
|
40
|
-
protected _handleFocus(): void;
|
41
26
|
protected firstUpdated(): void;
|
42
27
|
protected _connectedInit(): void;
|
43
28
|
reset(): void;
|
44
|
-
select(value: string,
|
45
|
-
|
46
|
-
|
47
|
-
|
29
|
+
select(value: string, label: string): 0 | 1;
|
30
|
+
checkValues(): void;
|
31
|
+
showOptions(): void;
|
32
|
+
hideOptions(): void;
|
48
33
|
focus(options?: FocusOptions): void;
|
49
34
|
blur(): void;
|
50
|
-
optionValue(option: HTMLElement): string;
|
51
35
|
}
|
52
36
|
export default Select;
|
53
37
|
export { Select };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/select/component.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/select/component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,KAAK,CAAC;AAG9D,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAmB1C;;;;;;;;GAQG;AACH,cAiCM,MAAO,SAAQ,KAAK;IAExB,IAAI,EAAE,MAAM,CAAC;IAGb,QAAQ,UAAS;IAGjB,MAAM,UAAS;IAGf,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,EAAE,CAAM;IAGT,QAAQ,EAAE,WAAW,CAAC;IAEtB,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,cAAc,UAAS;IAEjC,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAuCrC,SAAS,CAAC,aAAa,IAAI,cAAc,CAAC,CAAC,CAAC;IAM5C,SAAS,CAAC,YAAY,IAAI,IAAI;IAiB9B,SAAS,CAAC,cAAc,IAAI,IAAI;IAMhC,KAAK,IAAI,IAAI;IAKb,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC;IAiB3C,WAAW,IAAI,IAAI;IAOnB,WAAW,IAAI,IAAI;IAenB,WAAW,IAAI,IAAI;IAQnB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAMnC,IAAI,IAAI,IAAI;CAKb;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{queryPart as e,godown as i,styles as
|
1
|
+
import{__decorate as t}from"tslib";import{queryPart as e,godown as i,styles as s,attr as o,htmlSlot as l}from"@godown/element";import p from"../../internal/icons/caret-down.js";import{css as r,nothing as a,html as n}from"lit";import{property as h}from"lit/decorators.js";import u from"../input/component.js";import{showPopover as c,hidePopover as d}from"../../internal/popover.js";import{memoize as v}from"../../internal/utils.js";const f=v((()=>CSS.supports("position-area:top")));function m(t,e){if(t){const i="selected";e?t.setAttribute(i,""):t.removeAttribute(i)}}let b=class Select extends u{constructor(){super(...arguments),this.multiple=!1,this.noEdit=!1,this.values=[],this.optionsVisible=!1}render(){const t=this.noEdit||this.disabled;return n`<label part="root" ${o(this.observedRecord)}> ${[this._renderPrefix(),this.noEdit?n`<input style="position: absolute;inset: 0;opacity: 0;"/>`:"",n`<input part="input" .value="${this.text}" ?autofocus="${this.autofocus}" ?disabled="${t}" autocapitalize="${this.autocapitalize||a}" autocomplete="${this.autocomplete||a}" placeholder="${this.placeholder||a}" @input="${t?null:this._handleInput}" @change="${t?null:this._handleChange}"/>`,this._renderSuffix()]} <div part="popover" popover="${f()?"manual":a}"> ${l()} </div> </label>`}_renderSuffix(){return n`<i part="suffix">${l("suffix",p())}</i>`}firstUpdated(){this.events.add(this._slot,"click",(t=>{const{target:e}=t;if("OPTION"!==e.tagName)return;const{label:i,value:s}=e,o=this.select(s,i);this.multiple||(m(this.lastChecked,0),this.hideOptions()),m(e,o),this.lastChecked=e}))}_connectedInit(){this.default=this.value??="",this.defaultText=this.text??="",this.events.add(this,"focus",this.showOptions)}reset(){this.value=this.default,this.text=this.defaultText}select(t,e){e||=t;let i=0;const s=this.values.findIndex((e=>e.value===t));return s>-1?this.values.splice(s,1):(this.values.push({value:t,label:e}),i=1),this.checkValues(),this.value=this.values.map((t=>t.value)).join(","),this.text=this.values.map((t=>t.label)).join(", "),this.dispatchCustomEvent("select",this.value),i}checkValues(){!this.multiple&&this.values.length>1&&(this.values.splice(0,this.values.length-1),this.requestUpdate())}showOptions(){if(this.optionsVisible)return;c(this._popover);const t=e=>{this.contains(e.target)||(this.hideOptions(),this.events.remove(document,"click",t))};this.events.add(document,"click",t),this.optionsVisible=!0}hideOptions(){this.optionsVisible&&(d(this._popover),this.optionsVisible=!1)}focus(t){super.focus(),this._input.focus(t),this.showOptions()}blur(){super.blur(),this._input.blur(),d(this._popover)}};t([h()],b.prototype,"text",void 0),t([h({type:Boolean})],b.prototype,"multiple",void 0),t([h({type:Boolean})],b.prototype,"noEdit",void 0),t([h({type:Array})],b.prototype,"values",void 0),t([e("popover")],b.prototype,"_popover",void 0),b=t([i("select"),s(r`[part=root]{position:relative;anchor-name:--select}label{display:contents}[part=popover]{background:none;border:0;width:100%;position-anchor:--select;position-area:bottom center;position-try-fallbacks:flip-block}[part=input]{text-overflow:ellipsis}@supports not (position-area:top){[part=popover]{display:none;left:0;position:absolute;top:100%}}`)],b);var x=b;export{b as Select,x as default};
|
2
2
|
//# sourceMappingURL=component.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/web-components/select/component.ts"],"sourcesContent":null,"names":["
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/select/component.ts"],"sourcesContent":null,"names":["supportsPositionArea","memoize","CSS","supports","updateSelected","element","operation","name","setAttribute","removeAttribute","Select","Input","constructor","this","multiple","noEdit","values","optionsVisible","render","inputNoEdit","disabled","html","attr","observedRecord","text","autofocus","autocapitalize","nothing","autocomplete","placeholder","_handleInput","_handleChange","_renderSuffix","htmlSlot","svgCaretDown","firstUpdated","target","tagName","select","value","label","lastChecked","events","add","showOptions","default","defaultText","i","findIndex","s","splice","push","checkValues","map","join","length","requestUpdate","showPopover","_popover","listener","e","contains","remove","document","hidePopover","focus","options","super","_input","blur","property","prototype","Boolean","type","__decorate","Array","godown","styles","css"],"mappings":"+aASA,MAAMA,EAAuBC,GAAQ,IAAMC,IAAIC,SAAS,uBAExD,SAASC,EAAeC,EAA6BC,GACnD,GAAID,EAAS,CACX,MAAME,EAAO,WACTD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AG,OAAmBqC,kBAAgBC,KAAA,+BACnB,SAAEzC,KAAA0B,OACpBjC,CACA,CACA,WAAA8C,IACAvC,KAAAC,UAAAD,KAAAG,OAAAuC,OAAA,IACJ1C,KAAAG,OAAAkC,OAAA,EAAArC,KAAAG,OAAAuC,OAAA,GAEwB1C,KAAA2C,iBAGtB,WAAAZ,GACF,GAAA/B,KAAAI,eAEK,OAEHwC,EAAY5C,KAAK6C,UACnB,MAAAC,EAAAC,IAEoB/C,KAAegD,SAAAD,EAAAxB,UAC5BvB,mBACDA,KAAS6B,OAAWoB,OAAAC,SAAA,QAAAJ,GACxB,OAEMjB,WAAQqB,SAAU,QAAEJ,GAC1B9C,KAAAI,gBAAA,gBAEWJ,KAAAI,iBAGX+C,EAAanD,KAAI6C,UACjB7C,KAAKI,gBAAkB,GAEvB,KAAAgD,CAAAC,GACFC,MAAAF,QAEWpD,KAAAuD,OAAAH,MAAAC,GACTrD,KAAK+B,aACH,QAEFuB,MAAAE,OACFxD,KAAAuD,OAAAC,OAEWL,EAAAnD,KAAA6C,SACT,KAEA,CACAY,KACA5D,EAAA6D,UAAc,YAAO,cAEZC,uBACA,gBAAa,MAEtBF,EAAC,CAAAG,KAAAD,aACGD,UAAW,cAAS,GACxBG,EAAA,CACFJ,EAAA,CAAAG,KAAAE,WAEWJ,UAAA,cAAA,GACTG,EAAA,GACS,cACTH,UAAA,gBAAA,GACA7D,EAAAgE,EAAY,CACZE,EAxLc,UAyLhBC,EAAAC,CAAA,8VAEApE,SACaA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as e,styles as i,StyleController as r,omit as n,attr as s,loop as u,tokenList as l}from"@godown/element";import{css as o,html as a}from"lit";import{property as c,state as h}from"lit/decorators.js";import{scopePrefix as p,cssGlobalVars as d}from"../../internal/global-style.js";import{SuperInput as f}from"../../internal/super-input.js";import{RingBuilder as b}from"../../internal/ring.js";const
|
1
|
+
import{__decorate as t}from"tslib";import{godown as e,styles as i,StyleController as r,omit as n,attr as s,loop as u,tokenList as l}from"@godown/element";import{css as o,html as a}from"lit";import{property as c,state as h}from"lit/decorators.js";import{scopePrefix as p,cssGlobalVars as d}from"../../internal/global-style.js";import{SuperInput as f}from"../../internal/super-input.js";import{RingBuilder as b,ringTypeAttribute as v}from"../../internal/ring.js";const m="split",g=p(m);let y=class Split extends f{constructor(){super(),this.len=6,this.index=-1,this.current=-1,this.currentValue=[],new r(this,(()=>new b({selector:"[part=input-box]",type:this.ringType}).css))}get observedRecord(){return n(super.observedRecord,v)}render(){return a`<div part="root" ${s(this.observedRecord)}> ${u(this.len,(t=>a`<span part="input-box" ring-type="${this.ringType}" class="${l({focus:this.current===t})}" @click="${this.disabled?null:()=>this.focusAt(t)}"> ${this.currentValue[t]} </span>`))} <input part="input" @blur=${this.blur} @input="${this._handleInput}" @change="${this._handleChange}" .value="${this.value.padStart(this.len," ")}"/> </div>`}connectedCallback(){super.connectedCallback(),this.reset()}_handleInput(t){t.stopPropagation(),this.compositing||(this.fillInput(t.data),this.value=this.currentValue.join(""),this.dispatchCustomEvent("input",this.value,{bubbles:!0}))}fillInput(t){if(null===t){if(null!==this.currentValue[this.current])this.currentValue[this.current]=null;else{this.currentValue[this.current-1]=null;const t=this.currentValue.findLastIndex((t=>null!==t));this.current=this.current-1<0?t<0?0:t:this.current-1}return}const e=t.length>1;if(this.currentValue[this.current]=t[0],this.current+1>=this.len?(this.current=this.currentValue.indexOf(null),-1===this.current&&this.blur()):this.current+=1,e){const e=t.slice(1);e&&this.fillInput(e)}}focus(){this.focusAt(this.current),super.focus()}focusAt(t){this.current=t,this._input.focus()}blur(){this._input.blur(),this.current=-1,super.blur()}reset(){this.current=-1,this.value=this.default,this.currentValue=this.value.split("").concat(Array(this.len-this.value.length).fill(null)),this.index>-1&&(this.current=this.index)}};t([c({type:Number})],y.prototype,"len",void 0),t([c({type:Number})],y.prototype,"index",void 0),t([h()],y.prototype,"current",void 0),t([h()],y.prototype,"currentValue",void 0),y=t([e(m),i(o`:host{border-radius:.1em;display:block;width:-moz-fit-content;width:fit-content;${g}--size:2em;${g}--gap:.25em}[part=root]{display:flex;gap:var(${g}--gap);justify-content:space-between;position:relative}[part=input-box],[part=root]{border-radius:inherit;vertical-align:top}[part=input-box]{align-items:center;display:inline-flex;height:var(${g}--size);justify-content:center;width:var(${g}--size)}[part=input]{background:none;height:100%;opacity:0;position:absolute;width:100%;z-index:-1}.focus,[part=input-box]:active{${d.ringColor}:var(${d.active})}`)],y);var $=y;export{y as Split,$ as default};
|
2
2
|
//# sourceMappingURL=component.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/web-components/split/component.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Split","SuperInput","constructor","super","this","len","index","current","currentValue","StyleController","RingBuilder","selector","type","ringType","css","observedRecord","omit","render","html","attr","loop","tokenList","focus","disabled","focusAt","blur","_handleInput","_handleChange","value","padStart","connectedCallback","compositing","join","fillInput","data","after","i","_input","default","split","concat","Array","length","fill","Number","prototype","property","state","__decorate","godown","cssGlobalVars","ringColor","active"],"mappings":"
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/split/component.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Split","SuperInput","constructor","super","this","len","index","current","currentValue","StyleController","RingBuilder","selector","type","ringType","css","observedRecord","omit","ringTypeAttribute","render","html","attr","loop","tokenList","focus","disabled","focusAt","blur","_handleInput","_handleChange","value","padStart","connectedCallback","compositing","join","fillInput","data","after","i","_input","default","split","concat","Array","length","fill","Number","prototype","property","state","__decorate","godown","cssGlobalVars","ringColor","active"],"mappings":"6cAQA,MAAMA,EAAY,QACZC,EAAWC,EAAYF,GA0D7B,IAAMG,EAAN,MAAMA,cAAcC,EAmBlB,WAAAC,GACEC,QAfFC,KAAGC,IAAG,EAMND,KAAKE,OAAK,EAGVF,KAAOG,SAAK,EAGZH,KAAYI,aAAsB,GAIhC,IAAIC,EACFL,MACA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C,UAAY,eAAI,GAChBG,EAAA,CACFD,OAEIF,UAAA,oBAAA,GACF9C,EAAAiD,EAAW,CACXC,EAAArD,KACKiB,CAAK,mFAAEhB,eAAAA,iDAAAA,oMAAAA,6CAAAA,sIAAAqD,EAAAC,iBAAAD,EAAAE,sBAGTrD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/switch/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAIrD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/switch/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,KAAK,CAAC;AAIrD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAM3D;;;;;GAKG;AACH,cA0DM,MAAO,SAAQ,UAAU,CAAC,OAAO,CAAC;IACtC,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO,EAErB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,UAAS;IAEd,IAAI,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAExC;IAED,SAAS,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IAmBrC,KAAK,IAAI,IAAI;IAKb,SAAS,CAAC,cAAc,IAAI,IAAI;IAWhC,SAAS,CAAC,aAAa,IAAI,IAAI;CAKhC;AAED,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as e,styles as a,omit as
|
1
|
+
import{__decorate as t}from"tslib";import{godown as e,styles as a,omit as r,attr as i}from"@godown/element";import{css as o,html as s}from"lit";import{property as n}from"lit/decorators.js";import{scopePrefix as h,cssGlobalVars as l}from"../../internal/global-style.js";import{SuperInput as d}from"../../internal/super-input.js";import{ringTypeAttribute as c}from"../../internal/ring.js";const p="switch",u=h(p);let v=class Switch extends d{constructor(){super(...arguments),this.default=!1,this.value=!1}set checked(t){this.value=t}get checked(){return this.value}get observedRecord(){return r(super.observedRecord,c)}render(){return s`<div part="root" ${i(this.observedRecord)} class="round"> <input part="input" type="checkbox" ?disabled="${this.disabled}" ?checked="${this.value}" @change="${this._handleChange}"/> <span part="handle"></span> </div>`}reset(){this.value=this.default,this._input.checked=this.value}_connectedInit(){this.default?this.value=!0:this.value&&(this.value=!0,this.default=!0)}_handleChange(){const{checked:t}=this._input;this.value=t,this.dispatchCustomEvent("change",this.value)}};t([n({type:Boolean})],v.prototype,"default",void 0),t([n({type:Boolean,attribute:"checked",reflect:!0})],v.prototype,"value",void 0),v=t([e(p),a(o`:host,:host([contents]) [part=root]{display:inline-block}:host{${u}-width:3em;${u}-height:calc(var(${u}-width)/2);${u}-handle-size:1.25em;${u}-handle-space:calc(var(${u}-width)/4 - var(${u}-handle-size)/2);background:var(${l.passive});border-radius:calc(var(${u}-height)/2);height:var(${u}-height);transition:.2s ease-in-out;transition-property:background,left;vertical-align:bottom;width:var(${u}-width)}:host([checked]){background:var(${l.active})}[part=root]{position:relative}[part=handle],[part=root]{align-items:center;display:flex;transition:inherit}[part=handle]{background:var(${l.background});border-radius:100%;height:var(${u}-handle-size);justify-content:center;left:0;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%) translateX(var(${u}-handle-space));width:var(${u}-handle-size)}:host([checked]) [part=handle]{left:50%}[part=input]{height:100%;opacity:0;width:100%}`)],v);var g=v;export{v as Switch,g as default};
|
2
2
|
//# sourceMappingURL=component.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/web-components/switch/component.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Switch","SuperInput","constructor","this","default","value","checked","v","observedRecord","omit","super","render","html","attr","disabled","_handleChange","_input","dispatchCustomEvent","__decorate","type","Boolean","property","attribute","reflect","prototype","styles","css","cssGlobalVars","passive","active","background","Switch$1"],"mappings":"
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/web-components/switch/component.ts"],"sourcesContent":null,"names":["protoName","cssScope","scopePrefix","Switch","SuperInput","constructor","this","default","value","checked","v","observedRecord","omit","super","ringTypeAttribute","render","html","attr","disabled","_handleChange","_input","dispatchCustomEvent","__decorate","type","Boolean","property","attribute","reflect","prototype","styles","css","cssGlobalVars","passive","active","background","Switch$1"],"mappings":"mYAQA,MAAMA,EAAY,SACZC,EAAWC,EAAYF,GAkE7B,IAAMG,EAAN,MAAMA,eAAeC,EAArB,WAAAC,uBAaEC,KAAOC,SAAG,EAMVD,KAAKE,OAAG,EAlBR,WAAIC,CAAQC,GACVJ,KAAKE,MAAQE,EAGf,WAAID,GACF,OAAOH,KAAKE,MAed,kBAAIG,GACF,OAAOC,EAAKC,MAAMF,eAAgBG,GAG1B,MAAAC,GACR,OAAOC,CAAI,oBAAAC,EAAAX,KAAAK,iFAAAL,KAAAY,uBAAAZ,KAAAE,mBAAAF,KAAAa,8DAGLb,KAAAE,MAAUF,KAAAC,mFAQCD,KAAAE,uCAOnB,aAAAW,GACE,MAAUV,QAAAA,QAAeW,OACzBd,KAAKE,MAAOC,EACdH,KAAAe,oBAAA,SAAAf,KAAAE,SAIIc,EAAA,GACF,CAAAC,KAAAC,uBAAO,eAAA,GACLF,EAAA,CACEG,EAAA,CAAAF,KAAKC,QAAQE,UAAI,UAAAC,SAAA,KACjBxB,EAAAyB,UAAK,aAAU,OACjB,GACF5B,GACF6B,EAAAC,CAAA,kEAAA7B,eAAAA,qBAAAA,eAAAA,wBAAAA,2BAAAA,oBAAAA,oCAAA8B,EAAAC,mCAAA/B,2BAAAA,4GAAAA,4CAAA8B,EAAAE,mJAAAF,EAAAG,6CAAAjC,wIAAAA,8BAAAA,6GAGE,IAAAkC"}
|
@@ -4,50 +4,43 @@ import { type RingType } from "../../internal/ring.js";
|
|
4
4
|
/**
|
5
5
|
* {@linkcode Tabs} used to render a set of tabs.
|
6
6
|
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
* When "useSlot" is enabled, each item in "tabs" becomes a named slot with the same name as itself,
|
10
|
-
* while for non-slot tabs, the content is rendered as a horizontally padded string.
|
11
|
-
*
|
12
|
-
* When "mouseenter" and "mouseleave" are triggered on an individual tab, the indicator will move.
|
13
|
-
*
|
14
|
-
* The moving indicator will start from the position of the item that was last entered.
|
15
|
-
*
|
16
|
-
* If the pointer moves out of the root element or the element is connected to the document,
|
17
|
-
* the starting position of the indicator will be regarded as the current selection.
|
18
|
-
*
|
19
|
-
* Apply "flex-direction: column" to the tabs to arrange them vertically.
|
20
|
-
*
|
21
|
-
* @csspart root - The root element.
|
22
|
-
* @csspart item - The tab items.
|
23
|
-
* @csspart indicator - The indicator.
|
24
|
-
* @csspart selected - The selected tab item.
|
25
|
-
* @csspart hover - The hovered tab item.
|
26
|
-
* @fires select - Fires when the tab is selected.
|
7
|
+
* @fires select - Fires when the tab index is changed.
|
27
8
|
* @category display
|
28
9
|
*/
|
29
10
|
declare class Tabs extends GlobalStyle {
|
30
11
|
ringType: RingType;
|
31
12
|
/**
|
32
|
-
*
|
13
|
+
* If it is "select", the indicator moves from the selected content to the hover position.
|
14
|
+
*
|
15
|
+
* If it is "previous", the indicator moves from the last moved position to the hover position.
|
16
|
+
*
|
17
|
+
* If "none", the indicator will not move.
|
18
|
+
*/
|
19
|
+
beginning: "selected" | "previous" | "none";
|
20
|
+
/**
|
21
|
+
* The behavior of the indicator:
|
22
|
+
*
|
23
|
+
* If "background", its size will be consistent with that of a single tab.
|
24
|
+
*
|
25
|
+
* If "underline", an underline will be displayed at the bottom of the tab.
|
33
26
|
*/
|
34
|
-
|
27
|
+
indicator: "background" | "underline";
|
35
28
|
/**
|
36
|
-
*
|
29
|
+
* Tab list or slot list.
|
37
30
|
*/
|
38
31
|
tabs: string[];
|
39
32
|
/**
|
40
33
|
* The index of the currently selected tab.
|
41
34
|
*/
|
42
35
|
index: number;
|
43
|
-
protected
|
36
|
+
protected previousIndex: number;
|
44
37
|
protected _items: HTMLCollectionOf<HTMLLIElement>;
|
45
38
|
protected _indicators: HTMLCollectionOf<HTMLDivElement>;
|
46
39
|
constructor();
|
47
40
|
render(): TemplateResult<1>;
|
48
41
|
connectedCallback(): void;
|
49
42
|
protected _handleMouseLeave(): void;
|
50
|
-
move(
|
43
|
+
move(sourceIndex: number, targetIndex: number): void;
|
51
44
|
select(selected: number): void;
|
52
45
|
}
|
53
46
|
export default Tabs;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/tabs/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAe,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"__source__/","sources":["web-components/tabs/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAe,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAkC,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOvF;;;;;GAKG;AACH,cAyEM,IAAK,SAAQ,WAAW;IAE5B,QAAQ,EAAE,QAAQ,CAAY;IAE9B;;;;;;OAMG;IAEH,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAc;IAEzD;;;;;;OAMG;IAEH,SAAS,EAAE,YAAY,GAAG,WAAW,CAAgB;IAErD;;OAEG;IAEH,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf;;OAEG;IAEH,KAAK,SAAK;IAEV,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;IAGhC,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAGlD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;;IAOxD,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;IA0B3B,iBAAiB,IAAI,IAAI;IAKzB,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAQnC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAsCpD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAS/B;AAED,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{godown as i,styles as e,StyleController as r,attr as
|
1
|
+
import{__decorate as t}from"tslib";import{godown as i,styles as e,StyleController as r,attr as n,tokenList as o,htmlSlot as s}from"@godown/element";import{scopePrefix as a,cssGlobalVars as d,GlobalStyle as p}from"../../internal/global-style.js";import{css as c,html as l}from"lit";import{property as h,queryAll as u}from"lit/decorators.js";import{ringTypeAttribute as m,RingBuilder as v}from"../../internal/ring.js";const g="tabs",b=a(g),x="hover";let y=class Tabs extends p{constructor(){super(),this.ringType="border",this.beginning="selected",this.indicator="background",this.index=0,new r(this,(()=>new v({type:this.ringType}).css))}render(){return l`<ul part="root" ${n(this.observedRecord)} @mouseleave="${this._handleMouseLeave}"> ${this.tabs?.map(((t,i)=>l`<li part="${o("item",this.index===i&&"selected")}" @mouseenter=${()=>{this.move(this.previousIndex,i),this.previousIndex=i}} @click=${()=>this.select(i)}> ${s(t,t)} <div part="indicator"></div> </li>`))} </ul>`}connectedCallback(){super.connectedCallback(),this.previousIndex="selected"===this.beginning?this.index:-1}_handleMouseLeave(){const t=this._items[this.previousIndex];t&&t.part.remove(x),this.previousIndex="selected"===this.beginning?this.index:-1}move(t,i){if(t===i)return;const{_items:e,_indicators:r}=this,n=e[i];if(!n)return;n.part.add(x);const o=e[t];if(!o)return;if(o.part.remove(x),"none"===this.beginning)return;const s=r[i],a=r[t];if(!s||!a)return;const{x:d,y:p,width:c}=a.getBoundingClientRect(),{x:l,y:h}=s.getBoundingClientRect(),u=d-l,m=p-h,{style:v}=s,{style:g}=a;v.transform=`translate3d(${u}px,${m}px,0)`,v.width=`${c}px`,v.transition=g.transition="none",s.getBoundingClientRect(),v.width=v.transform=v.transition=g.transition=""}select(t){const{index:i,previousIndex:e}=this;this.move(e,t),t!==i&&(this.previousIndex=t,this.index=t,this.dispatchCustomEvent("select",t))}};t([h({attribute:m})],y.prototype,"ringType",void 0),t([h()],y.prototype,"beginning",void 0),t([h()],y.prototype,"indicator",void 0),t([h({type:Array})],y.prototype,"tabs",void 0),t([h({type:Number})],y.prototype,"index",void 0),t([u("[part~=item]")],y.prototype,"_items",void 0),t([u("[part=indicator]")],y.prototype,"_indicators",void 0),y=t([i(g),e(c`:host{${b}--indicator-background:var(${d.passive});${b}--selected-background:var(${d.passive});cursor:default;display:flex;transition:.2s ease-in-out}[part=root]{border-radius:inherit;display:flex;flex-direction:inherit;gap:.25em;overflow-x:clip;padding:.25em;position:relative;transition:inherit;transition-property:width,transform,opacity;z-index:1}[part~=item]{display:block;padding:0 .25em;position:relative;white-space:nowrap}[part=indicator],[part~=item],[part~=item]:after{border-radius:inherit;transition:inherit;transition-property:inherit;width:100%}[part=indicator],[part~=item]:after{background:var(${b}--indicator-background);height:100%;inset:0;position:absolute}[part=indicator]{opacity:0;z-index:-1}[part~=item]:after{z-index:-2}[indicator=underline] [part=indicator],[indicator=underline] [part~=item]:after{border-radius:.075em;height:.15em;margin-top:.15em;top:100%}[part~=selected]:after{background:var(${b}--selected-background);content:""}[part~=hover] [part=indicator]{opacity:1}`)],y);var f=y;export{y as Tabs,f as default};
|
2
2
|
//# sourceMappingURL=component.js.map
|