aptechka 0.64.9 → 0.65.1
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/lib/{DragControls-DGDUw6bM.js → DragControls-DNwpgJ9b.js} +2 -2
- package/lib/{Tweened-_pF0zXXN.js → Tweened-CtbUoAvI.js} +1 -1
- package/lib/animation/index.js +1 -1
- package/lib/controls/index.js +1 -1
- package/lib/custom-element/CustomElement.d.ts +20 -0
- package/lib/custom-scrollbar/index.cjs +1 -1
- package/lib/custom-scrollbar/index.js +69 -45
- package/lib/{easings-BEmRlrDd.js → easings-DngMp9IN.js} +14 -14
- package/lib/morph/Morph.d.ts +8 -2
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +250 -229
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +69 -65
- package/lib/scroll/index.js +3 -3
- package/lib/scroll-CIdNtj3G.cjs +1 -0
- package/lib/scroll-DNGJVxa2.js +37 -0
- package/lib/utils/custom-elements.d.ts +1 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +169 -147
- package/lib/utils/scroll.d.ts +1 -1
- package/package.json +9 -9
- package/lib/scroll-BWF48oHS.js +0 -37
- package/lib/scroll-CFDCeArT.cjs +0 -1
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=c=>{throw TypeError(c)};var Q=(c,o,t)=>o.has(c)||te("Cannot "+t);var e=(c,o,t)=>(Q(c,o,"read from private field"),t?t.call(c):o.get(c)),r=(c,o,t)=>o.has(c)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(c):o.set(c,t),n=(c,o,t,s)=>(Q(c,o,"write to private field"),s?s.call(c,t):o.set(c,t),t),y=(c,o,t)=>(Q(c,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),m=require("../css-property/index.cjs"),_=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ie=require("../url-lnBE_6yf.cjs"),re=require("../window-resizer/index.cjs"),F=require("../Viewport-DB0qAZPJ.cjs");var u,b,J,K;class le{constructor(){r(this,u,new Map);r(this,b,[]);r(this,J,o=>{var s;const t=[...e(this,b)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),H=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,K,o=>{if(o.code==="Escape"){const t=[...e(this,b)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,b)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,b).push(t),s.push(t)}remove(o,t){if(n(this,b,e(this,b).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,b=new WeakMap,J=new WeakMap,K=new WeakMap;var f,$,M,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,V,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,$);r(this,M);r(this,C);r(this,B);r(this,v);r(this,w);r(this,x);r(this,A);r(this,g);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,V);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new m.CSSProperty(this,"--history",!1)),n(this,w,new m.CSSProperty(this,"--restore",!1)),n(this,x,new m.CSSProperty(this,"--close-rest",!1)),n(this,A,new m.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new m.CSSProperty(this,"--group","")),n(this,R,new m.CSSProperty(this,"--click-outside",!1)),n(this,q,new m.CSSProperty(this,"--escape",!1)),n(this,L,new m.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,V,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>F.viewport.width?s=F.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>F.viewport.height?i=F.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),e(this,g).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,x)}get closeRestInGroup(){return e(this,A)}get group(){return e(this,g)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),Y.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,S).call(this),e(this,a).set("opened",!0),Y.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)}}),n(this,C,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,B)),E.stack.remove(e(this,g).current,this),n(this,f,!1),y(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),Y.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,x).observe(),e(this,A).observe(),e(this,g).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(y(this,P,I).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,x).close(),e(this,A).close(),e(this,g).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),y(this,P,I).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,C=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,x=new WeakMap,A=new WeakMap,g=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;_.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,N;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new m.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,U,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,j,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});_.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(y(this,k,Z).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=l(p.parentElement)),H};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,U)),e(this,h).addEventListener("popoverClosing",e(this,j)),e(this,h).addEventListener("popoverClosed",e(this,X))):console.warn(this,`target ${t} not found`)}y(this,k,N).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{y(this,k,N).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),y(this,k,Z).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Z=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,U)),e(this,h).removeEventListener("popoverClosing",e(this,j)),e(this,h).removeEventListener("popoverClosed",e(this,X)))},D=new WeakMap,U=new WeakMap,j=new WeakMap,X=new WeakMap,N=function(t){e(this,h)instanceof z&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};_.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
|
1
|
+
"use strict";var te=l=>{throw TypeError(l)};var K=(l,o,t)=>o.has(l)||te("Cannot "+t);var e=(l,o,t)=>(K(l,o,"read from private field"),t?t.call(l):o.get(l)),r=(l,o,t)=>o.has(l)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(l):o.set(l,t),n=(l,o,t,s)=>(K(l,o,"write to private field"),s?s.call(l,t):o.set(l,t),t),y=(l,o,t)=>(K(l,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),g=require("../css-property/index.cjs"),_=require("../index-DekP7OZe.cjs"),X=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ie=require("../url-lnBE_6yf.cjs"),re=require("../window-resizer/index.cjs"),Y=require("../Viewport-DB0qAZPJ.cjs");var u,b,I,J;class le{constructor(){r(this,u,new Map);r(this,b,[]);r(this,I,o=>{var s;const t=[...e(this,b)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const c=i[0],p=c instanceof Node&&(t.contains(c)||((s=t.shadowRoot)==null?void 0:s.contains(c))),H=c instanceof HTMLElement&&c.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,J,o=>{if(o.code==="Escape"){const t=[...e(this,b)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,I)),addEventListener("keydown",e(this,J))}get groups(){return e(this,u)}get stack(){return e(this,b)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(c=>{c.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(c=>{c.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,b).push(t),s.push(t)}remove(o,t){if(n(this,b,e(this,b).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(c=>s.push(c))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,b=new WeakMap,I=new WeakMap,J=new WeakMap;var f,$,M,A,B,v,w,C,x,m,R,q,L,T,O,a,P,oe,F,V,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,$);r(this,M);r(this,A);r(this,B);r(this,v);r(this,w);r(this,C);r(this,x);r(this,m);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,V);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new g.CSSProperty(this,"--history",!1)),n(this,w,new g.CSSProperty(this,"--restore",!1)),n(this,C,new g.CSSProperty(this,"--close-rest",!1)),n(this,x,new g.CSSProperty(this,"--close-rest-in-group",!1)),n(this,m,new g.CSSProperty(this,"--group","")),n(this,R,new g.CSSProperty(this,"--click-outside",!1)),n(this,q,new g.CSSProperty(this,"--escape",!1)),n(this,L,new g.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,V,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Y.viewport.width?s=Y.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Y.viewport.height?i=Y.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),e(this,m).subscribe(t=>{t.previous&&(E.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=E.stack.groups.get(this.group.current),i=s==null?void 0:s.find(c=>c.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,C)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,m)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),this.hasAttribute("data-document-class")&&this.getAttribute("data-document-class").split(" ").map(c=>{document.documentElement.classList.add(c.trim())}),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),X.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,m).current,this),e(this,S).call(this),e(this,a).set("opened",!0),X.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)}}),n(this,A,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,A,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,A)),clearTimeout(e(this,B)),E.stack.remove(e(this,m).current,this),n(this,f,!1),y(this,P,F).call(this),this.hasAttribute("data-document-class")&&this.getAttribute("data-document-class").split(" ").map(s=>{document.documentElement.classList.remove(s.trim())}),e(this,a).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),X.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),X.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,C).observe(),e(this,x).observe(),e(this,m).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,V)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,V).call(this)):(y(this,P,F).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,m).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,C).close(),e(this,x).close(),e(this,m).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,A)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,V)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),y(this,P,F).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,A=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,C=new WeakMap,x=new WeakMap,m=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},F=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},V=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;_.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Q,D,N,U,j,Z;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new g.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,N,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,U,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,j,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});_.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(y(this,k,Q).call(this),t){let i=null;if(t==="parent"){const c=this.closest("[data-popover]");if(c)i=c;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const c=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=c(p.parentElement)),H};i=c(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,N)),e(this,h).addEventListener("popoverClosing",e(this,U)),e(this,h).addEventListener("popoverClosed",e(this,j))):console.warn(this,`target ${t} not found`)}y(this,k,Z).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{y(this,k,Z).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),y(this,k,Q).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Q=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,N)),e(this,h).removeEventListener("popoverClosing",e(this,U)),e(this,h).removeEventListener("popoverClosed",e(this,j)))},D=new WeakMap,N=new WeakMap,U=new WeakMap,j=new WeakMap,Z=function(t){e(this,h)instanceof z&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};_.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var et = (
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var et = (a) => {
|
|
2
|
+
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var t = (
|
|
4
|
+
var K = (a, o, e) => o.has(a) || et("Cannot " + e);
|
|
5
|
+
var t = (a, o, e) => (K(a, o, "read from private field"), e ? e.call(a) : o.get(a)), r = (a, o, e) => o.has(a) ? et("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(a) : o.set(a, e), h = (a, o, e, s) => (K(a, o, "write to private field"), s ? s.call(a, e) : o.set(a, e), e), y = (a, o, e) => (K(a, o, "access private method"), e);
|
|
6
6
|
import { ElementLinkedStore as ot } from "../element-linked-store/index.js";
|
|
7
7
|
import { CSSProperty as g } from "../css-property/index.js";
|
|
8
8
|
import { i as _ } from "../index-Bv9zgfdb.js";
|
|
9
|
-
import { d as
|
|
9
|
+
import { d as X } from "../events-CsVF98U6.js";
|
|
10
10
|
import { d as ht } from "../function-C10DGppn.js";
|
|
11
11
|
import { g as st } from "../style-j2TwriJ_.js";
|
|
12
12
|
import "construct-style-sheets-polyfill";
|
|
13
13
|
import { u as nt, p as ct } from "../url-Cc-RVfii.js";
|
|
14
14
|
import { windowResizer as it } from "../window-resizer/index.js";
|
|
15
|
-
import { v as
|
|
16
|
-
var u, b,
|
|
17
|
-
class
|
|
15
|
+
import { v as Y } from "../Viewport-DA10iWAO.js";
|
|
16
|
+
var u, b, I, J;
|
|
17
|
+
class at {
|
|
18
18
|
constructor() {
|
|
19
19
|
r(this, u, /* @__PURE__ */ new Map());
|
|
20
20
|
r(this, b, []);
|
|
21
|
-
r(this,
|
|
21
|
+
r(this, I, (o) => {
|
|
22
22
|
var s;
|
|
23
23
|
const e = [...t(this, b)].reverse().find((i) => i.clickOutside.current);
|
|
24
24
|
if (e) {
|
|
@@ -27,11 +27,11 @@ class lt {
|
|
|
27
27
|
(tt) => tt instanceof HTMLElement && tt.hasAttribute("data-popover-content")
|
|
28
28
|
))
|
|
29
29
|
return;
|
|
30
|
-
const
|
|
30
|
+
const c = i[0], p = c instanceof Node && (e.contains(c) || ((s = e.shadowRoot) == null ? void 0 : s.contains(c))), G = c instanceof HTMLElement && c.hasAttribute("data-outside");
|
|
31
31
|
(!p || G) && e.close();
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
r(this,
|
|
34
|
+
r(this, J, (o) => {
|
|
35
35
|
if (o.code === "Escape") {
|
|
36
36
|
const e = [...t(this, b)].reverse().find((s) => s.escape.current);
|
|
37
37
|
e && e.close();
|
|
@@ -39,8 +39,8 @@ class lt {
|
|
|
39
39
|
});
|
|
40
40
|
document.documentElement.addEventListener(
|
|
41
41
|
"click",
|
|
42
|
-
t(this,
|
|
43
|
-
), addEventListener("keydown", t(this,
|
|
42
|
+
t(this, I)
|
|
43
|
+
), addEventListener("keydown", t(this, J));
|
|
44
44
|
}
|
|
45
45
|
get groups() {
|
|
46
46
|
return t(this, u);
|
|
@@ -51,14 +51,14 @@ class lt {
|
|
|
51
51
|
add(o, e) {
|
|
52
52
|
if (e.closeRest.current)
|
|
53
53
|
t(this, u).forEach((i) => {
|
|
54
|
-
i.forEach((
|
|
55
|
-
|
|
54
|
+
i.forEach((c) => {
|
|
55
|
+
c.close();
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
else if (e.closeRestInGroup.current) {
|
|
59
59
|
let i = t(this, u).get(o);
|
|
60
|
-
i == null || i.forEach((
|
|
61
|
-
|
|
60
|
+
i == null || i.forEach((c) => {
|
|
61
|
+
c.close();
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
let s = t(this, u).get(o);
|
|
@@ -68,7 +68,7 @@ class lt {
|
|
|
68
68
|
if (h(this, b, t(this, b).filter((s) => s !== e)), e.closeRest.current) {
|
|
69
69
|
let s = [];
|
|
70
70
|
t(this, u).forEach((i) => {
|
|
71
|
-
i.forEach((
|
|
71
|
+
i.forEach((c) => s.push(c));
|
|
72
72
|
}), t(this, u).clear(), s.forEach((i) => i.close());
|
|
73
73
|
} else if (e.closeRestInGroup.current) {
|
|
74
74
|
const s = t(this, u).get(o);
|
|
@@ -81,8 +81,8 @@ class lt {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
u = new WeakMap(), b = new WeakMap(),
|
|
85
|
-
var f, M, H, x, W, m, w, S, C, v, R, $, L, T, O,
|
|
84
|
+
u = new WeakMap(), b = new WeakMap(), I = new WeakMap(), J = new WeakMap();
|
|
85
|
+
var f, M, H, x, W, m, w, S, C, v, R, $, L, T, O, l, A, rt, j, V, k, q, z;
|
|
86
86
|
const E = class E extends HTMLElement {
|
|
87
87
|
constructor() {
|
|
88
88
|
super();
|
|
@@ -102,7 +102,7 @@ const E = class E extends HTMLElement {
|
|
|
102
102
|
r(this, L);
|
|
103
103
|
r(this, T);
|
|
104
104
|
r(this, O);
|
|
105
|
-
r(this,
|
|
105
|
+
r(this, l);
|
|
106
106
|
r(this, V);
|
|
107
107
|
r(this, k);
|
|
108
108
|
r(this, q);
|
|
@@ -111,7 +111,7 @@ const E = class E extends HTMLElement {
|
|
|
111
111
|
this,
|
|
112
112
|
"--close-rest-in-group",
|
|
113
113
|
!1
|
|
114
|
-
)), h(this, v, new g(this, "--group", "")), h(this, R, new g(this, "--click-outside", !1)), h(this, $, new g(this, "--escape", !1)), h(this, L, new g(this, "--check-viewport-bounds", !1)), h(this, T, !1), h(this,
|
|
114
|
+
)), h(this, v, new g(this, "--group", "")), h(this, R, new g(this, "--click-outside", !1)), h(this, $, new g(this, "--escape", !1)), h(this, L, new g(this, "--check-viewport-bounds", !1)), h(this, T, !1), h(this, l, new ot(this, {
|
|
115
115
|
opened: !1,
|
|
116
116
|
closing: !1,
|
|
117
117
|
triggered: !1,
|
|
@@ -126,7 +126,7 @@ const E = class E extends HTMLElement {
|
|
|
126
126
|
if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this, L).current) {
|
|
127
127
|
const e = this.getBoundingClientRect();
|
|
128
128
|
let s = 0, i = 0;
|
|
129
|
-
e.right >
|
|
129
|
+
e.right > Y.width ? s = Y.width - e.right : e.left < 0 && (s = e.left * -1), e.bottom > Y.height ? i = Y.height - e.bottom : e.top < 0 && (i = e.top * -1), this.style.setProperty("--viewport-offset-x", s + "px"), this.style.setProperty("--viewport-offset-y", i + "px");
|
|
130
130
|
}
|
|
131
131
|
}), t(this, v).subscribe((e) => {
|
|
132
132
|
e.previous && (E.stack.remove(e.previous, this), e.current || (document.documentElement.classList.remove(
|
|
@@ -134,13 +134,13 @@ const E = class E extends HTMLElement {
|
|
|
134
134
|
), document.documentElement.classList.remove(
|
|
135
135
|
`${this.group.previous}-opened`
|
|
136
136
|
)));
|
|
137
|
-
}), t(this,
|
|
137
|
+
}), t(this, l).subscribe((e) => {
|
|
138
138
|
if (this.group.current) {
|
|
139
139
|
document.documentElement.classList.toggle(
|
|
140
140
|
`${this.group.current}-closing`,
|
|
141
141
|
e.current.closing
|
|
142
142
|
);
|
|
143
|
-
const s = E.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((
|
|
143
|
+
const s = E.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((c) => c.opened);
|
|
144
144
|
document.documentElement.classList.toggle(
|
|
145
145
|
`${this.group.current}-opened`,
|
|
146
146
|
!!i
|
|
@@ -184,30 +184,34 @@ const E = class E extends HTMLElement {
|
|
|
184
184
|
open(e) {
|
|
185
185
|
if (t(this, f))
|
|
186
186
|
return;
|
|
187
|
-
h(this, O, e == null ? void 0 : e.trigger), clearTimeout(t(this, M)), clearTimeout(t(this, H)),
|
|
187
|
+
h(this, O, e == null ? void 0 : e.trigger), clearTimeout(t(this, M)), clearTimeout(t(this, H)), this.hasAttribute("data-document-class") && this.getAttribute("data-document-class").split(" ").map((c) => {
|
|
188
|
+
document.documentElement.classList.add(c.trim());
|
|
189
|
+
}), t(this, l).set("closing", !1), t(this, l).set("triggered", !0), X(this, "popoverTriggered", {
|
|
188
190
|
custom: !0,
|
|
189
191
|
detail: {
|
|
190
192
|
trigger: t(this, O)
|
|
191
193
|
}
|
|
192
194
|
}), t(this, m).current && t(this, T) && history.pushState(history.state, "", t(this, A, rt)), h(this, f, !0);
|
|
193
195
|
const s = () => {
|
|
194
|
-
E.stack.add(t(this, v).current, this), t(this, k).call(this), t(this,
|
|
196
|
+
E.stack.add(t(this, v).current, this), t(this, k).call(this), t(this, l).set("opened", !0), X(this, "popoverOpened", {
|
|
195
197
|
custom: !0,
|
|
196
198
|
detail: {
|
|
197
199
|
trigger: t(this, O)
|
|
198
200
|
}
|
|
199
201
|
}), h(this, x, void 0), h(this, W, setTimeout(() => {
|
|
200
|
-
t(this,
|
|
202
|
+
t(this, l).set("transitionend", !0);
|
|
201
203
|
}, st(this) + 10));
|
|
202
204
|
};
|
|
203
205
|
e != null && e.skipTransition ? s() : h(this, x, setTimeout(s, 10));
|
|
204
206
|
}
|
|
205
207
|
close() {
|
|
206
|
-
t(this, f) && (clearTimeout(t(this, x)), clearTimeout(t(this, W)), E.stack.remove(t(this, v).current, this), h(this, f, !1), y(this, A,
|
|
207
|
-
|
|
208
|
+
t(this, f) && (clearTimeout(t(this, x)), clearTimeout(t(this, W)), E.stack.remove(t(this, v).current, this), h(this, f, !1), y(this, A, j).call(this), this.hasAttribute("data-document-class") && this.getAttribute("data-document-class").split(" ").map((s) => {
|
|
209
|
+
document.documentElement.classList.remove(s.trim());
|
|
210
|
+
}), t(this, l).set("transitionend", !1), h(this, M, setTimeout(() => {
|
|
211
|
+
t(this, l).set("opened", !1), t(this, l).set("closing", !0), X(this, "popoverClosing", {
|
|
208
212
|
custom: !0
|
|
209
213
|
}), h(this, H, setTimeout(() => {
|
|
210
|
-
t(this,
|
|
214
|
+
t(this, l).set("triggered", !1), t(this, l).set("closing", !1), X(this, "popoverClosed", {
|
|
211
215
|
custom: !0
|
|
212
216
|
});
|
|
213
217
|
}, st(this) + 10));
|
|
@@ -215,27 +219,27 @@ const E = class E extends HTMLElement {
|
|
|
215
219
|
}
|
|
216
220
|
connectedCallback() {
|
|
217
221
|
t(this, m).observe(), t(this, w).observe(), t(this, S).observe(), t(this, C).observe(), t(this, v).observe(), t(this, R).observe(), t(this, $).observe(), t(this, L).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, V)), setTimeout(() => {
|
|
218
|
-
t(this, w).current ? (this.urlValue = ct(location.search)[this.id], t(this, V).call(this)) : (y(this, A,
|
|
222
|
+
t(this, w).current ? (this.urlValue = ct(location.search)[this.id], t(this, V).call(this)) : (y(this, A, j).call(this), h(this, T, !0));
|
|
219
223
|
}, 0), t(this, L).subscribe(() => {
|
|
220
224
|
t(this, k).call(this);
|
|
221
225
|
}), it.subscribe(t(this, k));
|
|
222
226
|
}
|
|
223
227
|
disconnectedCallback() {
|
|
224
|
-
E.stack.remove(t(this, v).current, this), it.unsubscribe(t(this, k)), t(this,
|
|
228
|
+
E.stack.remove(t(this, v).current, this), it.unsubscribe(t(this, k)), t(this, l).close(), t(this, m).close(), t(this, w).close(), t(this, S).close(), t(this, C).close(), t(this, v).close(), t(this, R).close(), t(this, $).close(), t(this, L).close(), this.removeAttribute("role"), clearTimeout(t(this, M)), clearTimeout(t(this, H)), clearTimeout(t(this, x)), clearTimeout(t(this, W)), removeEventListener("popstate", t(this, V)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), y(this, A, j).call(this);
|
|
225
229
|
}
|
|
226
230
|
};
|
|
227
|
-
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), x = new WeakMap(), W = new WeakMap(), m = new WeakMap(), w = new WeakMap(), S = new WeakMap(), C = new WeakMap(), v = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), L = new WeakMap(), T = new WeakMap(), O = new WeakMap(),
|
|
231
|
+
f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), x = new WeakMap(), W = new WeakMap(), m = new WeakMap(), w = new WeakMap(), S = new WeakMap(), C = new WeakMap(), v = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), L = new WeakMap(), T = new WeakMap(), O = new WeakMap(), l = new WeakMap(), A = new WeakSet(), rt = function() {
|
|
228
232
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
|
|
229
|
-
},
|
|
233
|
+
}, j = function() {
|
|
230
234
|
if (t(this, m).current) {
|
|
231
235
|
const e = new URL(location.href);
|
|
232
236
|
e.searchParams.delete(this.id), history.replaceState(history.state, "", e.href);
|
|
233
237
|
}
|
|
234
|
-
}, V = new WeakMap(), k = new WeakMap(), q = new WeakMap(), z = new WeakMap(), E.stack = new
|
|
235
|
-
let
|
|
236
|
-
_ && !customElements.get("e-popover") && customElements.define("e-popover",
|
|
237
|
-
var n, d, P,
|
|
238
|
-
class
|
|
238
|
+
}, V = new WeakMap(), k = new WeakMap(), q = new WeakMap(), z = new WeakMap(), E.stack = new at();
|
|
239
|
+
let F = E;
|
|
240
|
+
_ && !customElements.get("e-popover") && customElements.define("e-popover", F);
|
|
241
|
+
var n, d, P, Q, B, N, D, U, Z;
|
|
242
|
+
class lt extends HTMLElement {
|
|
239
243
|
constructor() {
|
|
240
244
|
super();
|
|
241
245
|
r(this, P);
|
|
@@ -244,13 +248,13 @@ class at extends HTMLElement {
|
|
|
244
248
|
r(this, B, () => {
|
|
245
249
|
t(this, d).current !== "close" && this.classList.add("triggered");
|
|
246
250
|
});
|
|
247
|
-
r(this,
|
|
251
|
+
r(this, N, () => {
|
|
248
252
|
t(this, d).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
|
|
249
253
|
});
|
|
250
|
-
r(this,
|
|
254
|
+
r(this, D, () => {
|
|
251
255
|
t(this, d).current !== "close" && this.classList.remove("opened");
|
|
252
256
|
});
|
|
253
|
-
r(this,
|
|
257
|
+
r(this, U, () => {
|
|
254
258
|
t(this, d).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
|
|
255
259
|
});
|
|
256
260
|
_ && (this.addEventListener("click", () => {
|
|
@@ -270,12 +274,12 @@ class at extends HTMLElement {
|
|
|
270
274
|
}
|
|
271
275
|
changePopover(e) {
|
|
272
276
|
var s;
|
|
273
|
-
if (y(this, P,
|
|
277
|
+
if (y(this, P, Q).call(this), e) {
|
|
274
278
|
let i = null;
|
|
275
279
|
if (e === "parent") {
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
i =
|
|
280
|
+
const c = this.closest("[data-popover]");
|
|
281
|
+
if (c)
|
|
282
|
+
i = c;
|
|
279
283
|
else {
|
|
280
284
|
const p = this.getRootNode();
|
|
281
285
|
p instanceof ShadowRoot ? i = p.host.closest("[data-popover]") : p instanceof HTMLElement && (i = p.closest("[data-popover]"));
|
|
@@ -283,13 +287,13 @@ class at extends HTMLElement {
|
|
|
283
287
|
} else if (e === "sibling")
|
|
284
288
|
i = (s = this.parentElement) == null ? void 0 : s.querySelector("[data-popover]");
|
|
285
289
|
else if (e === "ancestor-child") {
|
|
286
|
-
const
|
|
290
|
+
const c = (p) => {
|
|
287
291
|
if (!p)
|
|
288
292
|
return null;
|
|
289
293
|
let G = p.querySelector("[data-popover]");
|
|
290
|
-
return !G && (p != null && p.parentElement) && (G =
|
|
294
|
+
return !G && (p != null && p.parentElement) && (G = c(p.parentElement)), G;
|
|
291
295
|
};
|
|
292
|
-
i =
|
|
296
|
+
i = c(this.parentElement) || null;
|
|
293
297
|
} else
|
|
294
298
|
!e.startsWith(".") && !e.startsWith("[") && (e = `#${e}`), i = document.querySelector(e) || this.getRootNode().querySelector(e);
|
|
295
299
|
i instanceof HTMLElement ? (h(this, n, i), t(this, n).addEventListener(
|
|
@@ -297,50 +301,50 @@ class at extends HTMLElement {
|
|
|
297
301
|
t(this, B)
|
|
298
302
|
), t(this, n).addEventListener(
|
|
299
303
|
"popoverOpened",
|
|
300
|
-
t(this,
|
|
304
|
+
t(this, N)
|
|
301
305
|
), t(this, n).addEventListener(
|
|
302
306
|
"popoverClosing",
|
|
303
|
-
t(this,
|
|
307
|
+
t(this, D)
|
|
304
308
|
), t(this, n).addEventListener(
|
|
305
309
|
"popoverClosed",
|
|
306
|
-
t(this,
|
|
310
|
+
t(this, U)
|
|
307
311
|
)) : console.warn(this, `target ${e} not found`);
|
|
308
312
|
}
|
|
309
|
-
y(this, P,
|
|
313
|
+
y(this, P, Z).call(this, t(this, d).current);
|
|
310
314
|
}
|
|
311
315
|
connectedCallback() {
|
|
312
316
|
t(this, d).subscribe((s) => {
|
|
313
|
-
y(this, P,
|
|
317
|
+
y(this, P, Z).call(this, s.current);
|
|
314
318
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("role") || this.setAttribute("role", "button");
|
|
315
319
|
const e = this.getAttribute("target");
|
|
316
320
|
e && this.changePopover(e), this.isConnected && t(this, d).observe();
|
|
317
321
|
}
|
|
318
322
|
disconnectedCallback() {
|
|
319
|
-
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"), y(this, P,
|
|
323
|
+
t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"), y(this, P, Q).call(this);
|
|
320
324
|
}
|
|
321
325
|
}
|
|
322
|
-
n = new WeakMap(), d = new WeakMap(), P = new WeakSet(),
|
|
326
|
+
n = new WeakMap(), d = new WeakMap(), P = new WeakSet(), Q = function() {
|
|
323
327
|
t(this, n) && (t(this, n).removeEventListener(
|
|
324
328
|
"popoverTriggered",
|
|
325
329
|
t(this, B)
|
|
326
330
|
), t(this, n).removeEventListener(
|
|
327
331
|
"popoverOpened",
|
|
328
|
-
t(this,
|
|
332
|
+
t(this, N)
|
|
329
333
|
), t(this, n).removeEventListener(
|
|
330
334
|
"popoverClosing",
|
|
331
|
-
t(this,
|
|
335
|
+
t(this, D)
|
|
332
336
|
), t(this, n).removeEventListener(
|
|
333
337
|
"popoverClosed",
|
|
334
|
-
t(this,
|
|
338
|
+
t(this, U)
|
|
335
339
|
));
|
|
336
|
-
}, B = new WeakMap(),
|
|
337
|
-
t(this, n) instanceof
|
|
340
|
+
}, B = new WeakMap(), N = new WeakMap(), D = new WeakMap(), U = new WeakMap(), Z = function(e) {
|
|
341
|
+
t(this, n) instanceof F && (e !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
|
|
338
342
|
"aria-expanded",
|
|
339
343
|
t(this, n).opened ? "true" : "false"
|
|
340
344
|
), this.setAttribute("aria-controls", t(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
|
|
341
345
|
};
|
|
342
|
-
_ && !customElements.get("e-popover-button") && customElements.define("e-popover-button",
|
|
346
|
+
_ && !customElements.get("e-popover-button") && customElements.define("e-popover-button", lt);
|
|
343
347
|
export {
|
|
344
|
-
|
|
345
|
-
|
|
348
|
+
lt as PopoverButtonElement,
|
|
349
|
+
F as PopoverElement
|
|
346
350
|
};
|
package/lib/scroll/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var Ke = (u, n, e) => new Promise((i, r) => {
|
|
|
32
32
|
});
|
|
33
33
|
import { S as ns } from "../Store-0BVty6AZ.js";
|
|
34
34
|
import { i as D } from "../index-Bv9zgfdb.js";
|
|
35
|
-
import {
|
|
35
|
+
import { b as hs } from "../easings-DngMp9IN.js";
|
|
36
36
|
import { i as os } from "../element-CGVl1jA-.js";
|
|
37
37
|
import { d as oe } from "../events-CsVF98U6.js";
|
|
38
38
|
import { d as Ae } from "../function-C10DGppn.js";
|
|
@@ -43,8 +43,8 @@ import { c as je } from "../stylesheet-DpnWNVyD.js";
|
|
|
43
43
|
import "../ticker/index.js";
|
|
44
44
|
import { TICK_ORDER as as, RESIZE_ORDER as De } from "../order/index.js";
|
|
45
45
|
import { D as us } from "../Damped-YrqW5V4w.js";
|
|
46
|
-
import { T as ds } from "../Tweened-
|
|
47
|
-
import { W as bs, K as ps, D as fs, A as ms } from "../DragControls-
|
|
46
|
+
import { T as ds } from "../Tweened-CtbUoAvI.js";
|
|
47
|
+
import { W as bs, K as ps, D as fs, A as ms } from "../DragControls-DNwpgJ9b.js";
|
|
48
48
|
import { windowResizer as Wt } from "../window-resizer/index.js";
|
|
49
49
|
import { scrollEntries as Ct } from "../scroll-entries/index.js";
|
|
50
50
|
import { cssUnitParser as Ze } from "../css-unit-parser/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const f=require("./dom-JBOkFLTh.cjs"),g=require("./layout-Ctc2p3uz.cjs");require("construct-style-sheets-polyfill");require("./index-DekP7OZe.cjs");function h(t){return new Promise(o=>{setTimeout(()=>{o()},t)})}function E(t,{behavior:o="instant",offset:s=0,center:c=!1,scrollElement:l}={}){var u;let n,i=l,r=l;if(typeof t=="number")n=t;else{const e=f.getElement(t);e&&(i=e,r=l||f.findScrollParentElement(e),n=g.getCumulativeOffsetTop(e))}if(i&&r&&typeof n=="number"){const e=(typeof s=="number"?s:((u=f.getElement(s))==null?void 0:u.offsetHeight)||0)*-1,a=i instanceof HTMLElement?i.offsetHeight:innerHeight,m=c?innerHeight/2*-1+a/2:0;r.scroll({top:n+e+m,behavior:o})}}exports.scrollToElement=E;exports.wait=h;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { g as l, f as u } from "./dom-CVWzyXPH.js";
|
|
2
|
+
import { a as g } from "./layout-BSMtwCga.js";
|
|
3
|
+
import "construct-style-sheets-polyfill";
|
|
4
|
+
import "./index-Bv9zgfdb.js";
|
|
5
|
+
function w(e) {
|
|
6
|
+
return new Promise((o) => {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
o();
|
|
9
|
+
}, e);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function y(e, {
|
|
13
|
+
behavior: o = "instant",
|
|
14
|
+
offset: s = 0,
|
|
15
|
+
center: m = !1,
|
|
16
|
+
scrollElement: f
|
|
17
|
+
} = {}) {
|
|
18
|
+
var r;
|
|
19
|
+
let n, i = f, a = f;
|
|
20
|
+
if (typeof e == "number")
|
|
21
|
+
n = e;
|
|
22
|
+
else {
|
|
23
|
+
const t = l(e);
|
|
24
|
+
t && (i = t, a = f || u(t), n = g(t));
|
|
25
|
+
}
|
|
26
|
+
if (i && a && typeof n == "number") {
|
|
27
|
+
const t = (typeof s == "number" ? s : ((r = l(s)) == null ? void 0 : r.offsetHeight) || 0) * -1, p = i instanceof HTMLElement ? i.offsetHeight : innerHeight, c = m ? innerHeight / 2 * -1 + p / 2 : 0;
|
|
28
|
+
a.scroll({
|
|
29
|
+
top: n + t + c,
|
|
30
|
+
behavior: o
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
y as s,
|
|
36
|
+
w
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function whenDefined<T extends keyof HTMLElementTagNameMap>(...elements: Array<T>): Promise<CustomElementConstructor[]>;
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var x=(t,e,n)=>new Promise((o,r)=>{var s=a=>{try{m(n.next(a))}catch(f){r(f)}},d=a=>{try{m(n.throw(a))}catch(f){r(f)}},m=a=>a.done?o(a.value):Promise.resolve(a.value).then(s,d);m((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../attributes-Bf2svn4j.cjs"),O=require("../index-DekP7OZe.cjs"),g=require("../canvas-CU5Xjahf.cjs"),C=require("../coordinates-D8Np3cPD.cjs"),h=require("../dom-JBOkFLTh.cjs"),i=require("../easings-GegIwET5.cjs"),Q=require("../element-yhcBhsho.cjs"),A=require("../events-KVanG9sR.cjs"),T=require("../file-DSpfWdd9.cjs"),S=require("../function-MthRj-GJ.cjs"),B=require("../gestures-C7gbKx11.cjs"),v=require("../stylesheet-HWF2a3nr.cjs"),y=require("../layout-Ctc2p3uz.cjs"),l=require("../math-GDWEqu7y.cjs"),p=require("../number-DyefJ5a1.cjs"),u=require("../object-CCiXnER2.cjs"),P=require("../polyfills-Df4r-ETT.cjs"),w=require("../scroll-CIdNtj3G.cjs"),c=require("../string-DUXXtU8v.cjs"),q=require("../style-At6aDoqG.cjs"),b=require("../url-lnBE_6yf.cjs");function R(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function N(t,e){const n=t.length;e=e%n;const o=new Array(n);for(let r=0;r<n;r++){const s=(r+e)%n;o[s]=t[r]}return o}function z(t,e=2){if(!+t)return"0 Bytes";const n=1024,o=e<0?0:e,r=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],s=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,s)).toFixed(o))} ${r[s]}`}function j(t){if(navigator.clipboard)navigator.clipboard.writeText(t).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(e=>{console.error("Failed to copy text to clipboard:",e)});else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.top="0",e.style.left="0",document.body.appendChild(e),e.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(n){console.error("Failed to copy text to clipboard:",n)}document.body.removeChild(e)}}function M(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function V(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function k(t,e){let n=!1;const{x:o,y:r}=t;for(let s=0,d=e.length-1;s<e.length;d=s++){const m=e[s].x,a=e[s].y,f=e[d].x,I=e[d].y;a>r!=I>r&&o<(f-m)*(r-a)/(I-a)+m&&(n=!n)}return n}function D(t,e){const n=t.style.getPropertyValue(e);if(n){const o=n.toString();return o.startsWith("var")?D(t,o.slice(4,-1)):o}}function F(...t){const e={};return Array.from(document.styleSheets).forEach(n=>{Array.from(n.cssRules).forEach(o=>{o instanceof CSSStyleRule&&o.selectorText===":root"&&t.forEach(r=>{const s=D(o,r);s&&(e[r]=s)})})}),t.forEach(n=>{e[n]||console.warn(`variable named ${n} not found`)}),e}function $(...t){return x(this,null,function*(){return yield Promise.all(t.map(e=>customElements.whenDefined(e)))})}function H(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function U(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}const K=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,W=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function Z(t){let e,n;return W.test(t)?(e=`mailto:${t.trim()}`,n="email"):K.test(t)&&(e=`tel:${t.replace(/[^0-9\\.\\+]+/g,"")}`,n="phone"),{href:e,type:n,contact:t}}function J(t,e){if(t){const o=t.content.cloneNode(!0).firstElementChild;return o&&(e==null||e(o)),o}return null}function L(t,e,n,o){let r,s=!1,d=0;const m=()=>{clearInterval(r),o!=null&&o.restartCounter&&(d=0),s&&(r=setInterval(()=>{n(d++)},e))},a=O.intersector.subscribe(t,f=>{s=f.isIntersecting,m()});return()=>{a(),clearInterval(r)}}exports.parseAttribute=E.parseAttribute;exports.parseAttributeValue=E.parseAttributeValue;exports.isBrowser=O.isBrowser;exports.contain=g.contain;exports.cover=g.cover;exports.fixPosition=g.fixPosition;exports.measureText=g.measureText;exports.getPointerPosition=C.getPointerPosition;exports.normalize=C.normalize;exports.screenToCartesian=C.screenToCartesian;exports.findParentElement=h.findParentElement;exports.findScrollParentElement=h.findScrollParentElement;exports.getAllParentElements=h.getAllParentElements;exports.getElement=h.getElement;exports.easeInCubic=i.easeInCubic;exports.easeInExpo=i.easeInExpo;exports.easeInOutCubic=i.easeInOutCubic;exports.easeInOutExpo=i.easeInOutExpo;exports.easeInOutQuad=i.easeInOutQuad;exports.easeInOutQuart=i.easeInOutQuart;exports.easeInOutQuint=i.easeInOutQuint;exports.easeInQuad=i.easeInQuad;exports.easeInQuart=i.easeInQuart;exports.easeInQuint=i.easeInQuint;exports.easeOutCubic=i.easeOutCubic;exports.easeOutExpo=i.easeOutExpo;exports.easeOutQuad=i.easeOutQuad;exports.easeOutQuart=i.easeOutQuart;exports.easeOutQuint=i.easeOutQuint;exports.linear=i.linear;exports.isElementVisible=Q.isElementVisible;exports.dispatchEvent=A.dispatchEvent;exports.createJSONAndSave=T.createJSONAndSave;exports.downloadURI=T.downloadURI;exports.debounce=S.debounce;exports.throttle=S.throttle;exports.setupDrag=B.setupDrag;exports.createStylesheet=v.createStylesheet;exports.styleToString=v.styleToString;exports.getCumulativeOffsetLeft=y.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=y.getCumulativeOffsetTop;exports.getCumulativePosition=y.getCumulativePosition;exports.getStickyOffset=y.getStickyOffset;exports.calculateDistance=l.calculateDistance;exports.calculateDistanceWithRadius=l.calculateDistanceWithRadius;exports.clamp=l.clamp;exports.damp=l.damp;exports.lerp=l.lerp;exports.mapRange=l.mapRange;exports.round=l.round;exports.smootherstep=l.smootherstep;exports.smoothstep=l.smoothstep;exports.step=l.step;exports.beautifyNumber=p.beautifyNumber;exports.loopNumber=p.loopNumber;exports.preciseNumber=p.preciseNumber;exports.roundNumberTo=p.roundNumberTo;exports.toStep=p.toStep;exports.cloneDeep=u.cloneDeep;exports.compareObjects=u.compareObjects;exports.isESClass=u.isESClass;exports.isNullish=u.isNullish;exports.isObject=u.isObject;exports.mergeDeep=u.mergeDeep;exports.mixin=u.mixin;exports.omit=u.omit;exports.pick=u.pick;exports.nullishCoalescing=P.nullishCoalescing;exports.requestIdleCallback=P.requestIdleCallback;exports.scrollToElement=w.scrollToElement;exports.wait=w.wait;exports.camelToKebab=c.camelToKebab;exports.capitalize=c.capitalize;exports.declension=c.declension;exports.decodeHtmlEntities=c.decodeHtmlEntities;exports.generateId=c.generateId;exports.isUppercase=c.isUppercase;exports.kebabToCamel=c.kebabToCamel;exports.snakeToDotted=c.snakeToDotted;exports.toPascalCase=c.toPascalCase;exports.uncapitalize=c.uncapitalize;exports.getElementTransitionDurationMS=q.getElementTransitionDurationMS;exports.getElementTransitionDurationS=q.getElementTransitionDurationS;exports.changeHistory=b.changeHistory;exports.normalizeBase=b.normalizeBase;exports.parseSearchParameters=b.parseSearchParameters;exports.splitPath=b.splitPath;exports.updateSearchParameter=b.updateSearchParameter;exports.cloneTemplateContent=J;exports.copyTextToClipboard=j;exports.decode=U;exports.dotCircleCollision=V;exports.dotPolygonCollision=k;exports.dotRectCollision=M;exports.encode=H;exports.formatBytes=z;exports.getRootVariables=F;exports.insert=R;exports.setIntervalOnIntersection=L;exports.shiftArray=N;exports.tryCreateHrefFromContact=Z;exports.whenDefined=$;
|
package/lib/utils/index.d.ts
CHANGED