aptechka 0.63.0 → 0.63.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/morph/Morph.d.ts +2 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +151 -149
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +1 -1
- package/lib/{url-B6BNcw6_.js → url-Cc-RVfii.js} +9 -7
- package/lib/url-lnBE_6yf.cjs +1 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +1 -1
- package/lib/url-D1CgmwZ_.cjs +0 -1
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface MorphNavigateOptions {
|
|
|
29
29
|
revalidate?: boolean;
|
|
30
30
|
keepSearchParameters?: boolean;
|
|
31
31
|
submorph?: Array<string>;
|
|
32
|
+
clearState?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export interface MorphScrollDetail {
|
|
34
35
|
left: number;
|
|
@@ -66,7 +67,7 @@ export declare class Morph {
|
|
|
66
67
|
hash: string;
|
|
67
68
|
};
|
|
68
69
|
prefetch(path: string, revalidate?: boolean): Promise<void>;
|
|
69
|
-
navigate(path: string, { historyAction, centerScroll, offsetScroll, revalidate, keepSearchParameters, submorph, }?: MorphNavigateOptions): Promise<void>;
|
|
70
|
+
navigate(path: string, { historyAction, centerScroll, offsetScroll, revalidate, keepSearchParameters, submorph, clearState, }?: MorphNavigateOptions): Promise<void>;
|
|
70
71
|
addLink(element: HTMLAnchorElement): void;
|
|
71
72
|
addLinks(elements: Array<HTMLAnchorElement>): void;
|
|
72
73
|
removeLink(element: HTMLAnchorElement): void;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var At=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),kt=n=>{throw TypeError(n)};var ut=(n,t,s)=>t.has(n)||kt("Cannot "+s);var e=(n,t,s)=>(ut(n,t,"read from private field"),s?s.call(n):t.get(n)),a=(n,t,s)=>t.has(n)?kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),o=(n,t,s,i)=>(ut(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),m=(n,t,s)=>(ut(n,t,"access private method"),s);var z=(n,t,s)=>new Promise((i,d)=>{var v=S=>{try{g(s.next(S))}catch(A){d(A)}},L=S=>{try{g(s.throw(S))}catch(A){d(A)}},g=S=>S.done?i(S.value):Promise.resolve(S.value).then(v,L);g((s=s.apply(n,t)).next())});var Ct=(n,t,s)=>(t=n[At("asyncIterator")])?t.call(n):(n=n[At("iterator")](),t={},s=(i,d)=>(d=n[i])&&(t[i]=v=>new Promise((L,g,S)=>(v=d.call(n,v),S=v.done,Promise.resolve(v.value).then(A=>L({value:A,done:S}),g)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("../index-Cqw2NKev.cjs"),$=require("../events-KVanG9sR.cjs"),Ot=require("../polyfills-Df4r-ETT.cjs"),Tt=require("../scroll-DAhSpkhR.cjs"),rt=require("../url-D1CgmwZ_.cjs"),Bt=require("../css-value-parser/index.cjs");class xt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Ht.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",xt);var C,l,I,_,K;class dt{constructor(t,s){a(this,C);a(this,l);a(this,I);a(this,_,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{const d=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),L=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),g=L?Bt.cssValueParser.parse(L):void 0,S=e(this,l).hasAttribute("data-revalidate"),A=e(this,l).hasAttribute("data-keep-search-parameters"),f=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(W=>W.trim());e(this,C).navigate(e(this,I),{historyAction:d,centerScroll:v,offsetScroll:g,revalidate:S,keepSearchParameters:A,submorph:f})}});a(this,K,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,I),t),e(this,l).removeEventListener("pointerenter",e(this,K))});o(this,C,s),o(this,l,t),o(this,I,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,_)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,K))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,I));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,_)),e(this,l).removeEventListener("pointerenter",e(this,K)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,I=new WeakMap,_=new WeakMap,K=new WeakMap;var x,Y,w,O,B,N,G;class Mt{constructor(t,s,i){a(this,x);a(this,Y);a(this,w,{x:0,y:0});a(this,O);a(this,B,null);a(this,N,null);a(this,G,null);o(this,x,t),o(this,Y,s),o(this,O,i.cloneNode(!0))}get pathname(){return e(this,Y)}get scrollState(){return e(this,w)}get document(){return e(this,N)}cloneDocument(){o(this,N,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,N).title)t=e(this,N).title;else{const s=e(this,N).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,Y)}return t}clearScrollState(){e(this,w).x=0,e(this,w).y=0}clearDocumentState(){o(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,w).x=0,e(this,w).y=0):(e(this,w).x=e(this,x).scrollElement.scrollLeft,e(this,w).y=e(this,x).scrollElement.scrollTop)}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,w).y,left:e(this,w).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?o(this,B,null):o(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,x).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){o(this,G,t)}clearState(){const t=e(this,G);return o(this,G,null),t}}x=new WeakMap,Y=new WeakMap,w=new WeakMap,O=new WeakMap,B=new WeakMap,N=new WeakMap,G=new WeakMap;var T,J,p,at,q,u,tt,F,M,P,D,V,et,c,nt,Nt,ft,qt,pt,Et,gt,vt,ot,Q;const Z=class Z{constructor(t){a(this,c);a(this,T,null);a(this,J,null);a(this,p,[]);a(this,at,new DOMParser);a(this,q);a(this,u,null);a(this,tt);a(this,F,[]);a(this,M,!1);a(this,P,null);a(this,D,new Map);a(this,V,null);a(this,et,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ot,t=>z(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),o(this,M,!0),yield this.navigate(t.state.path,{historyAction:"none"}),o(this,M,!1))}));a(this,Q,()=>{const t=e(this,P).scrollTop,s=e(this,P).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),$.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(Ht.isBrowser&&!Z.instance){Z.instance=this,o(this,T,{base:rt.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),o(this,J,m(this,c,ft).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);o(this,u,s.pathname),e(this,D).set(e(this,u),new Mt(this,e(this,u),document)),document.documentElement.setAttribute("data-current-pathname",e(this,u)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,ot)),rt.changeHistory({action:"replace",pathname:e(this,u),searchParameters:s.parameters||location.search,hash:s.hash}),o(this,V,new xt),m(this,c,gt).call(this,document)}}get currentPathname(){return e(this,u)}get previousPathname(){return e(this,tt)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,M)}saveState(t){const s=e(this,D).get(e(this,u));s&&s.saveState(t)}getState(){const t=e(this,D).get(e(this,u));return t==null?void 0:t.clearState()}normalizePath(t){return rt.splitPath(t,{base:e(this,T).base,trailingSlash:e(this,T).trailingSlash})}prefetch(t,s){return z(this,null,function*(){const i=this.normalizePath(t);m(this,c,nt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(S){return z(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:d,revalidate:v,keepSearchParameters:L,submorph:g}={}){var yt;if(e(this,F).length)return;const A=this.normalizePath(((yt=this.pathnameModifier)==null?void 0:yt.call(this,t))||t);let{pathname:f,hash:W,parameters:St,leaf:Dt}=A;if(e(this,q)===f||e(this,u)===f){e(this,M)||m(this,c,vt).call(this,W||0,{centerScroll:i,offsetScroll:d,behavior:"smooth"});return}o(this,q,f),e(this,p).forEach(j=>{j.checkCurrent(f)});try{let j=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:k,submorph:g})})}catch(r){r?console.error(r):console.log("Route change canceled"),j=!1}if(!j||e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}const lt={pathname:f,submorph:g};$.dispatchEvent(document,"morphNavigation",{detail:lt});const ct=yield m(this,c,nt).call(this,e(this,u)),b=yield m(this,c,nt).call(this,f,{searchParameters:St,revalidate:v});if(e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}ct.clearState(),ct.saveScrollState(),ct.saveDocumentState(),e(this,M)||(b.clearScrollState(),b.clearDocumentState()),b.cloneDocument(),e(this,V).textContent=b.title,document.body.appendChild(e(this,V)),$.dispatchEvent(document,"morphStart",{detail:lt});const wt=Array.from(document.head.children),Lt=Array.from(b.document.head.children),bt=m(this,c,qt).call(this,wt,Lt),Rt=m(this,c,pt).call(this,wt,bt),st=m(this,c,pt).call(this,Lt,bt);st.forEach((r,k)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),st[k]=y}}),st.forEach(r=>{document.head.appendChild(r)});const ht=st.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,Et).call(this,r))return!0});e(this,T).waitForHeadToLoad&&ht.length&&(yield new Promise(r=>z(this,null,function*(){let k=0;try{for(var y=Ct(ht),X,R,U;X=!(R=yield y.next()).done;X=!1){const it=R.value;it.onload=()=>{k++,k===ht.length&&r()}}}catch(R){U=[R]}finally{try{X&&(R=y.return)&&(yield R.call(y))}finally{if(U)throw U[0]}}}))),yield Tt.wait(10);const Pt=[];Rt.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,Et).call(this,r)?Pt.push(r):r.remove())});const zt=m(this,c,ft).call(this,b.document.body);e(this,T).morphInsideScrollContainer||m(this,c,gt).call(this,b.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",Dt),rt.changeHistory({action:s,pathname:f,searchParameters:St||(L?location.search:""),hash:W}),e(this,V).remove(),o(this,tt,e(this,u)),o(this,u,f),e(this,J).forEach((r,k)=>{const y=zt[k],X=getComputedStyle(r).getPropertyValue("--morph-duration");let R=[],U=[];g?g.forEach(h=>{const E=r.querySelector(h),H=y.querySelector(h);E&&H&&(U.push(E),R.push(H))}):(R.push(...y.childNodes),U.push(...r.childNodes)),U.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),R.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),g?R.forEach((h,E)=>{var H;(H=U[E].parentElement)==null||H.insertBefore(h,U[E])}):r.prepend(...R),Ot.requestIdleCallback(()=>{R.forEach(h=>{var E;h instanceof HTMLElement&&((E=h.parentElement)==null||E.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("in"))})});const it={morphElement:r,pathname:f};$.dispatchEvent(document,"morphNewChildrenAdded",{detail:it});const It=new Promise(h=>{setTimeout(()=>{U.forEach(E=>E.remove()),R.forEach(E=>{var H;E instanceof HTMLElement&&((H=E.parentElement)==null||H.style.removeProperty("--new-content-height"),E.classList.remove("in","new"))}),$.dispatchEvent(document,"morphOldChildrenRemoved",{detail:it}),h()},(parseFloat(X)||0)*1e3+10)});e(this,F).push(It)}),W?(b.clearScrollState(),m(this,c,vt).call(this,W,{centerScroll:i,offsetScroll:d})):e(this,M)?b.restoreScrollPosition():b.renewScrollPosition(),yield Promise.all(e(this,F)),Pt.forEach(r=>r.remove()),o(this,F,[]),e(this,J).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const X=document.createElement("script");X.type="module",X.src=y.getAttribute("src"),y.replaceWith(X)})}),$.dispatchEvent(document,"morphComplete",{detail:lt}),window.dispatchEvent(new Event("resize"))}catch(j){console.error(j)}o(this,q,void 0)})}addLink(t){e(this,p).push(new dt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){o(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){o(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,et));e(this,p).push(...s.map(i=>new dt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,et));e(this,p).forEach(s=>s.destroy()),o(this,p,t.map(s=>new dt(s,this)))}};T=new WeakMap,J=new WeakMap,p=new WeakMap,at=new WeakMap,q=new WeakMap,u=new WeakMap,tt=new WeakMap,F=new WeakMap,M=new WeakMap,P=new WeakMap,D=new WeakMap,V=new WeakMap,et=new WeakMap,c=new WeakSet,nt=function(t,s){return z(this,null,function*(){let i=e(this,D).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,Nt).call(this,t,s==null?void 0:s.searchParameters)),i})},Nt=function(t,s){return z(this,null,function*(){const d=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,at).parseFromString(d,"text/html"),L=new Mt(this,t,v);return e(this,D).set(t,L),L})},ft=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},qt=function(t,s){return t.filter(i=>s.find(d=>d.outerHTML===i.outerHTML))},pt=function(t,s){return t.filter(i=>!s.find(d=>d.outerHTML===i.outerHTML))},Et=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},gt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Q)),o(this,P,t.querySelector(e(this,T).scrollSelector)||t.documentElement),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Q)),e(this,Q).call(this)},vt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Tt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ot=new WeakMap,Q=new WeakMap,Z.instance=null;let mt=Z;exports.Morph=mt;
|
|
1
|
+
"use strict";var kt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),Ct=n=>{throw TypeError(n)};var dt=(n,t,s)=>t.has(n)||Ct("Cannot "+s);var e=(n,t,s)=>(dt(n,t,"read from private field"),s?s.call(n):t.get(n)),a=(n,t,s)=>t.has(n)?Ct("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),o=(n,t,s,i)=>(dt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),m=(n,t,s)=>(dt(n,t,"access private method"),s);var z=(n,t,s)=>new Promise((i,d)=>{var v=E=>{try{S(s.next(E))}catch(D){d(D)}},b=E=>{try{S(s.throw(E))}catch(D){d(D)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(v,b);S((s=s.apply(n,t)).next())});var Tt=(n,t,s)=>(t=n[kt("asyncIterator")])?t.call(n):(n=n[kt("iterator")](),t={},s=(i,d)=>(d=n[i])&&(t[i]=v=>new Promise((b,S,E)=>(v=d.call(n,v),E=v.done,Promise.resolve(v.value).then(D=>b({value:D,done:E}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xt=require("../index-Cqw2NKev.cjs"),$=require("../events-KVanG9sR.cjs"),Bt=require("../polyfills-Df4r-ETT.cjs"),Mt=require("../scroll-DAhSpkhR.cjs"),rt=require("../url-lnBE_6yf.cjs"),Ft=require("../css-value-parser/index.cjs");class Nt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}xt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Nt);var k,l,I,_,K;class mt{constructor(t,s){a(this,k);a(this,l);a(this,I);a(this,_,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,k).previousPathname)history.back();else{const d=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),S=b?Ft.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),D=e(this,l).hasAttribute("data-keep-search-parameters"),lt=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(W=>W.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,k).navigate(e(this,I),{historyAction:d,centerScroll:v,offsetScroll:S,revalidate:E,keepSearchParameters:D,submorph:lt,clearState:f})}});a(this,K,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,k).prefetch(e(this,I),t),e(this,l).removeEventListener("pointerenter",e(this,K))});o(this,k,s),o(this,l,t),o(this,I,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,_)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,K))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,k).normalizePath(t),i=e(this,k).normalizePath(e(this,I));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,_)),e(this,l).removeEventListener("pointerenter",e(this,K)),e(this,l).classList.remove("current")}}k=new WeakMap,l=new WeakMap,I=new WeakMap,_=new WeakMap,K=new WeakMap;var H,Y,w,O,B,x,G;class Ht{constructor(t,s,i){a(this,H);a(this,Y);a(this,w,{x:0,y:0});a(this,O);a(this,B,null);a(this,x,null);a(this,G,null);o(this,H,t),o(this,Y,s),o(this,O,i.cloneNode(!0))}get pathname(){return e(this,Y)}get scrollState(){return e(this,w)}get document(){return e(this,x)}cloneDocument(){o(this,x,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,x).title)t=e(this,x).title;else{const s=e(this,x).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,Y)}return t}clearScrollState(){e(this,w).x=0,e(this,w).y=0}clearDocumentState(){o(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,w).x=0,e(this,w).y=0):(e(this,w).x=e(this,H).scrollElement.scrollLeft,e(this,w).y=e(this,H).scrollElement.scrollTop)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,w).y,left:e(this,w).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?o(this,B,null):o(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,H).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){o(this,G,t)}clearState(){const t=e(this,G);return o(this,G,null),t}}H=new WeakMap,Y=new WeakMap,w=new WeakMap,O=new WeakMap,B=new WeakMap,x=new WeakMap,G=new WeakMap;var C,J,p,at,N,u,tt,F,T,P,q,V,et,c,nt,qt,pt,Dt,Et,gt,St,vt,ot,Q;const Z=class Z{constructor(t){a(this,c);a(this,C,null);a(this,J,null);a(this,p,[]);a(this,at,new DOMParser);a(this,N);a(this,u,null);a(this,tt);a(this,F,[]);a(this,T,!1);a(this,P,null);a(this,q,new Map);a(this,V,null);a(this,et,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ot,t=>z(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),o(this,T,!0),yield this.navigate(t.state.path,{historyAction:"none"}),o(this,T,!1))}));a(this,Q,()=>{const t=e(this,P).scrollTop,s=e(this,P).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),$.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(xt.isBrowser&&!Z.instance){Z.instance=this,o(this,C,{base:rt.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),o(this,J,m(this,c,pt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);o(this,u,s.pathname),e(this,q).set(e(this,u),new Ht(this,e(this,u),document)),document.documentElement.setAttribute("data-current-pathname",e(this,u)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,ot)),rt.changeHistory({action:"replace",pathname:e(this,u),searchParameters:s.parameters||location.search,hash:s.hash}),o(this,V,new Nt),m(this,c,St).call(this,document)}}get currentPathname(){return e(this,u)}get previousPathname(){return e(this,tt)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,T)}saveState(t){const s=e(this,q).get(e(this,u));s&&s.saveState(t)}getState(){const t=e(this,q).get(e(this,u));return t==null?void 0:t.clearState()}normalizePath(t){return rt.splitPath(t,{base:e(this,C).base,trailingSlash:e(this,C).trailingSlash})}prefetch(t,s){return z(this,null,function*(){const i=this.normalizePath(t);m(this,c,nt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(D){return z(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:d,revalidate:v,keepSearchParameters:b,submorph:S,clearState:E}={}){var wt;if(e(this,F).length)return;const lt=this.normalizePath(((wt=this.pathnameModifier)==null?void 0:wt.call(this,t))||t);let{pathname:f,hash:W,parameters:yt,leaf:Rt}=lt;if(e(this,N)===f||e(this,u)===f){e(this,T)||m(this,c,vt).call(this,W||0,{centerScroll:i,offsetScroll:d,behavior:"smooth"});return}o(this,N,f),e(this,p).forEach(j=>{j.checkCurrent(f)});try{let j=!0;if(this.preprocessor)try{yield new Promise((r,A)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:A,submorph:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),j=!1}if(!j||e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}const ct={pathname:f,submorph:S};$.dispatchEvent(document,"morphNavigation",{detail:ct});const ht=yield m(this,c,nt).call(this,e(this,u)),L=yield m(this,c,nt).call(this,f,{searchParameters:yt,revalidate:v});if(e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}ht.clearState(),ht.saveScrollState(),ht.saveDocumentState(),e(this,T)||(L.clearScrollState(),L.clearDocumentState()),E&&L.clearState(),L.cloneDocument(),e(this,V).textContent=L.title,document.body.appendChild(e(this,V)),$.dispatchEvent(document,"morphStart",{detail:ct});const bt=Array.from(document.head.children),Lt=Array.from(L.document.head.children),Pt=m(this,c,Dt).call(this,bt,Lt),zt=m(this,c,Et).call(this,bt,Pt),st=m(this,c,Et).call(this,Lt,Pt);st.forEach((r,A)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),st[A]=y}}),st.forEach(r=>{document.head.appendChild(r)});const ut=st.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,gt).call(this,r))return!0});e(this,C).waitForHeadToLoad&&ut.length&&(yield new Promise(r=>z(this,null,function*(){let A=0;try{for(var y=Tt(ut),X,R,U;X=!(R=yield y.next()).done;X=!1){const it=R.value;it.onload=()=>{A++,A===ut.length&&r()}}}catch(R){U=[R]}finally{try{X&&(R=y.return)&&(yield R.call(y))}finally{if(U)throw U[0]}}}))),yield Mt.wait(10);const At=[];zt.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,gt).call(this,r)?At.push(r):r.remove())});const It=m(this,c,pt).call(this,L.document.body);e(this,C).morphInsideScrollContainer||m(this,c,St).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",Rt),rt.changeHistory({action:s,pathname:f,searchParameters:yt||(b?location.search:""),hash:W}),e(this,V).remove(),o(this,tt,e(this,u)),o(this,u,f),e(this,J).forEach((r,A)=>{const y=It[A],X=getComputedStyle(r).getPropertyValue("--morph-duration");let R=[],U=[];S?S.forEach(h=>{const g=r.querySelector(h),M=y.querySelector(h);g&&M&&(U.push(g),R.push(M))}):(R.push(...y.childNodes),U.push(...r.childNodes)),U.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),R.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),S?R.forEach((h,g)=>{var M;(M=U[g].parentElement)==null||M.insertBefore(h,U[g])}):r.prepend(...R),Bt.requestIdleCallback(()=>{R.forEach(h=>{var g;h instanceof HTMLElement&&((g=h.parentElement)==null||g.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("in"))})});const it={morphElement:r,pathname:f};$.dispatchEvent(document,"morphNewChildrenAdded",{detail:it});const Ot=new Promise(h=>{setTimeout(()=>{U.forEach(g=>g.remove()),R.forEach(g=>{var M;g instanceof HTMLElement&&((M=g.parentElement)==null||M.style.removeProperty("--new-content-height"),g.classList.remove("in","new"))}),$.dispatchEvent(document,"morphOldChildrenRemoved",{detail:it}),h()},(parseFloat(X)||0)*1e3+10)});e(this,F).push(Ot)}),W?(L.clearScrollState(),m(this,c,vt).call(this,W,{centerScroll:i,offsetScroll:d})):e(this,T)?L.restoreScrollPosition():L.renewScrollPosition(),yield Promise.all(e(this,F)),At.forEach(r=>r.remove()),o(this,F,[]),e(this,J).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const X=document.createElement("script");X.type="module",X.src=y.getAttribute("src"),y.replaceWith(X)})}),$.dispatchEvent(document,"morphComplete",{detail:ct}),window.dispatchEvent(new Event("resize"))}catch(j){console.error(j)}o(this,N,void 0)})}addLink(t){e(this,p).push(new mt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){o(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){o(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,et));e(this,p).push(...s.map(i=>new mt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,et));e(this,p).forEach(s=>s.destroy()),o(this,p,t.map(s=>new mt(s,this)))}};C=new WeakMap,J=new WeakMap,p=new WeakMap,at=new WeakMap,N=new WeakMap,u=new WeakMap,tt=new WeakMap,F=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,V=new WeakMap,et=new WeakMap,c=new WeakSet,nt=function(t,s){return z(this,null,function*(){let i=e(this,q).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,qt).call(this,t,s==null?void 0:s.searchParameters)),i})},qt=function(t,s){return z(this,null,function*(){const d=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,at).parseFromString(d,"text/html"),b=new Ht(this,t,v);return e(this,q).set(t,b),b})},pt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Dt=function(t,s){return t.filter(i=>s.find(d=>d.outerHTML===i.outerHTML))},Et=function(t,s){return t.filter(i=>!s.find(d=>d.outerHTML===i.outerHTML))},gt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},St=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Q)),o(this,P,t.querySelector(e(this,C).scrollSelector)||t.documentElement),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Q)),e(this,Q).call(this)},vt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Mt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ot=new WeakMap,Q=new WeakMap,Z.instance=null;let ft=Z;exports.Morph=ft;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Pt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), At = (n) => {
|
|
2
2
|
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (n, t, s) => (
|
|
4
|
+
var ut = (n, t, s) => t.has(n) || At("Cannot " + s);
|
|
5
|
+
var e = (n, t, s) => (ut(n, t, "read from private field"), s ? s.call(n) : t.get(n)), a = (n, t, s) => t.has(n) ? At("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), o = (n, t, s, i) => (ut(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), m = (n, t, s) => (ut(n, t, "access private method"), s);
|
|
6
6
|
var z = (n, t, s) => new Promise((i, d) => {
|
|
7
|
-
var
|
|
7
|
+
var v = (E) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
d(
|
|
9
|
+
S(s.next(E));
|
|
10
|
+
} catch (R) {
|
|
11
|
+
d(R);
|
|
12
12
|
}
|
|
13
|
-
}, L = (
|
|
13
|
+
}, L = (E) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
d(
|
|
15
|
+
S(s.throw(E));
|
|
16
|
+
} catch (R) {
|
|
17
|
+
d(R);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, S = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(v, L);
|
|
20
|
+
S((s = s.apply(n, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var
|
|
23
|
-
import { i as
|
|
22
|
+
var kt = (n, t, s) => (t = n[Pt("asyncIterator")]) ? t.call(n) : (n = n[Pt("iterator")](), t = {}, s = (i, d) => (d = n[i]) && (t[i] = (v) => new Promise((L, S, E) => (v = d.call(n, v), E = v.done, Promise.resolve(v.value).then((R) => L({ value: R, done: E }), S)))), s("next"), s("return"), t);
|
|
23
|
+
import { i as Ht } from "../index-euf5anj6.js";
|
|
24
24
|
import { d as j } from "../events-CsVF98U6.js";
|
|
25
|
-
import { r as
|
|
26
|
-
import { w as
|
|
27
|
-
import { n as
|
|
28
|
-
import { cssValueParser as
|
|
29
|
-
class
|
|
25
|
+
import { r as Ft } from "../polyfills-DJrTJQky.js";
|
|
26
|
+
import { w as Ot, s as Bt } from "../scroll-Benkuq-t.js";
|
|
27
|
+
import { n as Vt, c as Ct, s as Wt } from "../url-Cc-RVfii.js";
|
|
28
|
+
import { cssValueParser as Ut } from "../css-value-parser/index.js";
|
|
29
|
+
class Nt extends HTMLElement {
|
|
30
30
|
connectedCallback() {
|
|
31
31
|
const t = {
|
|
32
32
|
"aria-live": "assertive",
|
|
@@ -37,62 +37,63 @@ class Ht extends HTMLElement {
|
|
|
37
37
|
this.setAttribute(s, i);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
class
|
|
40
|
+
Ht && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Nt);
|
|
41
|
+
var k, l, I, _, K;
|
|
42
|
+
class dt {
|
|
43
43
|
constructor(t, s) {
|
|
44
|
-
a(this,
|
|
44
|
+
a(this, k);
|
|
45
45
|
a(this, l);
|
|
46
46
|
a(this, I);
|
|
47
47
|
a(this, _, (t) => {
|
|
48
48
|
var i;
|
|
49
|
-
if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this,
|
|
49
|
+
if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, k).previousPathname)
|
|
50
50
|
history.back();
|
|
51
51
|
else {
|
|
52
52
|
const d = e(this, l).getAttribute(
|
|
53
53
|
"data-history-action"
|
|
54
|
-
) || "push",
|
|
54
|
+
) || "push", v = e(this, l).hasAttribute("data-center-scroll"), L = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = L ? Ut.parse(L) : void 0, E = e(this, l).hasAttribute("data-revalidate"), R = e(this, l).hasAttribute(
|
|
55
55
|
"data-keep-search-parameters"
|
|
56
|
-
),
|
|
57
|
-
e(this,
|
|
56
|
+
), ot = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((W) => W.trim()), f = e(this, l).hasAttribute("data-clear-state");
|
|
57
|
+
e(this, k).navigate(e(this, I), {
|
|
58
58
|
historyAction: d,
|
|
59
|
-
centerScroll:
|
|
60
|
-
offsetScroll:
|
|
61
|
-
revalidate:
|
|
62
|
-
keepSearchParameters:
|
|
63
|
-
submorph:
|
|
59
|
+
centerScroll: v,
|
|
60
|
+
offsetScroll: S,
|
|
61
|
+
revalidate: E,
|
|
62
|
+
keepSearchParameters: R,
|
|
63
|
+
submorph: ot,
|
|
64
|
+
clearState: f
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
a(this, K, () => {
|
|
68
69
|
const t = e(this, l).hasAttribute("data-revalidate");
|
|
69
|
-
e(this,
|
|
70
|
+
e(this, k).prefetch(e(this, I), t), e(this, l).removeEventListener("pointerenter", e(this, K));
|
|
70
71
|
});
|
|
71
|
-
o(this,
|
|
72
|
+
o(this, k, s), o(this, l, t), o(this, I, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, _)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, K));
|
|
72
73
|
}
|
|
73
74
|
get element() {
|
|
74
75
|
return e(this, l);
|
|
75
76
|
}
|
|
76
77
|
checkCurrent(t) {
|
|
77
|
-
const s = e(this,
|
|
78
|
+
const s = e(this, k).normalizePath(t), i = e(this, k).normalizePath(e(this, I));
|
|
78
79
|
e(this, l).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? e(this, l).classList.add("current") : i.pathname === s.pathname ? e(this, l).classList.add("current") : e(this, l).classList.remove("current");
|
|
79
80
|
}
|
|
80
81
|
destroy() {
|
|
81
82
|
e(this, l).removeEventListener("click", e(this, _)), e(this, l).removeEventListener("pointerenter", e(this, K)), e(this, l).classList.remove("current");
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
class
|
|
85
|
+
k = new WeakMap(), l = new WeakMap(), I = new WeakMap(), _ = new WeakMap(), K = new WeakMap();
|
|
86
|
+
var H, Y, w, F, O, N, G;
|
|
87
|
+
class Tt {
|
|
87
88
|
constructor(t, s, i) {
|
|
88
|
-
a(this,
|
|
89
|
+
a(this, H);
|
|
89
90
|
a(this, Y);
|
|
90
91
|
a(this, w, { x: 0, y: 0 });
|
|
91
92
|
a(this, F);
|
|
92
93
|
a(this, O, null);
|
|
93
|
-
a(this,
|
|
94
|
+
a(this, N, null);
|
|
94
95
|
a(this, G, null);
|
|
95
|
-
o(this,
|
|
96
|
+
o(this, H, t), o(this, Y, s), o(this, F, i.cloneNode(!0));
|
|
96
97
|
}
|
|
97
98
|
get pathname() {
|
|
98
99
|
return e(this, Y);
|
|
@@ -101,17 +102,17 @@ class Ct {
|
|
|
101
102
|
return e(this, w);
|
|
102
103
|
}
|
|
103
104
|
get document() {
|
|
104
|
-
return e(this,
|
|
105
|
+
return e(this, N);
|
|
105
106
|
}
|
|
106
107
|
cloneDocument() {
|
|
107
|
-
o(this,
|
|
108
|
+
o(this, N, (e(this, O) || e(this, F)).cloneNode(!0));
|
|
108
109
|
}
|
|
109
110
|
get title() {
|
|
110
111
|
let t = "";
|
|
111
|
-
if (e(this,
|
|
112
|
-
t = e(this,
|
|
112
|
+
if (e(this, N).title)
|
|
113
|
+
t = e(this, N).title;
|
|
113
114
|
else {
|
|
114
|
-
const s = e(this,
|
|
115
|
+
const s = e(this, N).querySelector("h1");
|
|
115
116
|
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, Y);
|
|
116
117
|
}
|
|
117
118
|
return t;
|
|
@@ -125,10 +126,10 @@ class Ct {
|
|
|
125
126
|
saveScrollState() {
|
|
126
127
|
e(this, F).documentElement.hasAttribute(
|
|
127
128
|
"data-no-scroll-restoration"
|
|
128
|
-
) ? (e(this, w).x = 0, e(this, w).y = 0) : (e(this, w).x = e(this,
|
|
129
|
+
) ? (e(this, w).x = 0, e(this, w).y = 0) : (e(this, w).x = e(this, H).scrollElement.scrollLeft, e(this, w).y = e(this, H).scrollElement.scrollTop);
|
|
129
130
|
}
|
|
130
131
|
restoreScrollPosition() {
|
|
131
|
-
e(this,
|
|
132
|
+
e(this, H).scrollElement.scroll({
|
|
132
133
|
top: e(this, w).y,
|
|
133
134
|
left: e(this, w).x,
|
|
134
135
|
behavior: "instant"
|
|
@@ -140,7 +141,7 @@ class Ct {
|
|
|
140
141
|
) ? o(this, O, null) : o(this, O, document.cloneNode(!0));
|
|
141
142
|
}
|
|
142
143
|
renewScrollPosition() {
|
|
143
|
-
e(this,
|
|
144
|
+
e(this, H).scrollElement.scroll({
|
|
144
145
|
top: 0,
|
|
145
146
|
left: 0,
|
|
146
147
|
behavior: "instant"
|
|
@@ -154,22 +155,22 @@ class Ct {
|
|
|
154
155
|
return o(this, G, null), t;
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
|
|
158
|
-
var
|
|
158
|
+
H = new WeakMap(), Y = new WeakMap(), w = new WeakMap(), F = new WeakMap(), O = new WeakMap(), N = new WeakMap(), G = new WeakMap();
|
|
159
|
+
var C, J, p, nt, x, u, tt, B, T, P, D, V, et, h, rt, xt, mt, Dt, ft, pt, Et, gt, at, Q;
|
|
159
160
|
const Z = class Z {
|
|
160
161
|
constructor(t) {
|
|
161
162
|
a(this, h);
|
|
162
|
-
a(this,
|
|
163
|
+
a(this, C, null);
|
|
163
164
|
a(this, J, null);
|
|
164
165
|
a(this, p, []);
|
|
165
166
|
a(this, nt, new DOMParser());
|
|
166
|
-
a(this,
|
|
167
|
+
a(this, x);
|
|
167
168
|
a(this, u, null);
|
|
168
169
|
a(this, tt);
|
|
169
170
|
a(this, B, []);
|
|
170
|
-
a(this,
|
|
171
|
+
a(this, T, !1);
|
|
171
172
|
a(this, P, null);
|
|
172
|
-
a(this,
|
|
173
|
+
a(this, D, /* @__PURE__ */ new Map());
|
|
173
174
|
a(this, V, null);
|
|
174
175
|
a(this, et, (t) => {
|
|
175
176
|
var s;
|
|
@@ -177,7 +178,7 @@ const Z = class Z {
|
|
|
177
178
|
});
|
|
178
179
|
a(this, at, (t) => z(this, null, function* () {
|
|
179
180
|
var s;
|
|
180
|
-
(s = t.state) != null && s.path && (t.preventDefault(), o(this,
|
|
181
|
+
(s = t.state) != null && s.path && (t.preventDefault(), o(this, T, !0), yield this.navigate(t.state.path, { historyAction: "none" }), o(this, T, !1));
|
|
181
182
|
}));
|
|
182
183
|
a(this, Q, () => {
|
|
183
184
|
const t = e(this, P).scrollTop, s = e(this, P).scrollLeft;
|
|
@@ -188,33 +189,33 @@ const Z = class Z {
|
|
|
188
189
|
}
|
|
189
190
|
});
|
|
190
191
|
});
|
|
191
|
-
if (
|
|
192
|
-
Z.instance = this, o(this,
|
|
193
|
-
base:
|
|
192
|
+
if (Ht && !Z.instance) {
|
|
193
|
+
Z.instance = this, o(this, C, {
|
|
194
|
+
base: Vt(t == null ? void 0 : t.base),
|
|
194
195
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
195
196
|
cachePages: (t == null ? void 0 : t.cachePages) !== !1,
|
|
196
197
|
trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
|
|
197
198
|
scrollSelector: (t == null ? void 0 : t.scrollSelector) || "body",
|
|
198
199
|
morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
|
|
199
|
-
}), o(this, J, m(this, h,
|
|
200
|
+
}), o(this, J, m(this, h, mt).call(this, document.body));
|
|
200
201
|
const s = this.normalizePath(
|
|
201
202
|
location.pathname + location.hash
|
|
202
203
|
);
|
|
203
|
-
o(this, u, s.pathname), e(this,
|
|
204
|
+
o(this, u, s.pathname), e(this, D).set(
|
|
204
205
|
e(this, u),
|
|
205
|
-
new
|
|
206
|
+
new Tt(this, e(this, u), document)
|
|
206
207
|
), document.documentElement.setAttribute(
|
|
207
208
|
"data-current-pathname",
|
|
208
209
|
e(this, u)
|
|
209
210
|
), document.documentElement.setAttribute(
|
|
210
211
|
"data-current-leaf",
|
|
211
212
|
s.leaf
|
|
212
|
-
), this.findLinks(), addEventListener("popstate", e(this, at)),
|
|
213
|
+
), this.findLinks(), addEventListener("popstate", e(this, at)), Ct({
|
|
213
214
|
action: "replace",
|
|
214
215
|
pathname: e(this, u),
|
|
215
216
|
searchParameters: s.parameters || location.search,
|
|
216
217
|
hash: s.hash
|
|
217
|
-
}), o(this, V, new
|
|
218
|
+
}), o(this, V, new Nt()), m(this, h, Et).call(this, document);
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
get currentPathname() {
|
|
@@ -230,20 +231,20 @@ const Z = class Z {
|
|
|
230
231
|
return e(this, P);
|
|
231
232
|
}
|
|
232
233
|
get isPopstateNavigation() {
|
|
233
|
-
return e(this,
|
|
234
|
+
return e(this, T);
|
|
234
235
|
}
|
|
235
236
|
saveState(t) {
|
|
236
|
-
const s = e(this,
|
|
237
|
+
const s = e(this, D).get(e(this, u));
|
|
237
238
|
s && s.saveState(t);
|
|
238
239
|
}
|
|
239
240
|
getState() {
|
|
240
|
-
const t = e(this,
|
|
241
|
+
const t = e(this, D).get(e(this, u));
|
|
241
242
|
return t == null ? void 0 : t.clearState();
|
|
242
243
|
}
|
|
243
244
|
normalizePath(t) {
|
|
244
|
-
return
|
|
245
|
-
base: e(this,
|
|
246
|
-
trailingSlash: e(this,
|
|
245
|
+
return Wt(t, {
|
|
246
|
+
base: e(this, C).base,
|
|
247
|
+
trailingSlash: e(this, C).trailingSlash
|
|
247
248
|
});
|
|
248
249
|
}
|
|
249
250
|
prefetch(t, s) {
|
|
@@ -255,95 +256,96 @@ const Z = class Z {
|
|
|
255
256
|
});
|
|
256
257
|
});
|
|
257
258
|
}
|
|
258
|
-
navigate(
|
|
259
|
+
navigate(R) {
|
|
259
260
|
return z(this, arguments, function* (t, {
|
|
260
261
|
historyAction: s = "push",
|
|
261
262
|
centerScroll: i,
|
|
262
263
|
offsetScroll: d,
|
|
263
|
-
revalidate:
|
|
264
|
+
revalidate: v,
|
|
264
265
|
keepSearchParameters: L,
|
|
265
|
-
submorph:
|
|
266
|
+
submorph: S,
|
|
267
|
+
clearState: E
|
|
266
268
|
} = {}) {
|
|
267
|
-
var
|
|
269
|
+
var vt;
|
|
268
270
|
if (e(this, B).length)
|
|
269
271
|
return;
|
|
270
|
-
const
|
|
271
|
-
let { pathname: f, hash: W, parameters:
|
|
272
|
-
if (e(this,
|
|
273
|
-
e(this,
|
|
272
|
+
const ot = this.normalizePath(((vt = this.pathnameModifier) == null ? void 0 : vt.call(this, t)) || t);
|
|
273
|
+
let { pathname: f, hash: W, parameters: St, leaf: Rt } = ot;
|
|
274
|
+
if (e(this, x) === f || e(this, u) === f) {
|
|
275
|
+
e(this, T) || m(this, h, gt).call(this, W || 0, {
|
|
274
276
|
centerScroll: i,
|
|
275
277
|
offsetScroll: d,
|
|
276
278
|
behavior: "smooth"
|
|
277
279
|
});
|
|
278
280
|
return;
|
|
279
281
|
}
|
|
280
|
-
o(this,
|
|
282
|
+
o(this, x, f), e(this, p).forEach((U) => {
|
|
281
283
|
U.checkCurrent(f);
|
|
282
284
|
});
|
|
283
285
|
try {
|
|
284
286
|
let U = !0;
|
|
285
287
|
if (this.preprocessor)
|
|
286
288
|
try {
|
|
287
|
-
yield new Promise((r,
|
|
289
|
+
yield new Promise((r, A) => {
|
|
288
290
|
var y;
|
|
289
291
|
(y = this.preprocessor) == null || y.call(this, {
|
|
290
292
|
pathname: f,
|
|
291
293
|
resolve: r,
|
|
292
|
-
reject:
|
|
293
|
-
submorph:
|
|
294
|
+
reject: A,
|
|
295
|
+
submorph: S
|
|
294
296
|
});
|
|
295
297
|
});
|
|
296
298
|
} catch (r) {
|
|
297
299
|
r ? console.error(r) : console.log("Route change canceled"), U = !1;
|
|
298
300
|
}
|
|
299
|
-
if (!U || e(this,
|
|
301
|
+
if (!U || e(this, x) !== f) {
|
|
300
302
|
e(this, p).forEach((r) => {
|
|
301
303
|
r.checkCurrent(e(this, u));
|
|
302
304
|
});
|
|
303
305
|
return;
|
|
304
306
|
}
|
|
305
|
-
const
|
|
307
|
+
const lt = {
|
|
306
308
|
pathname: f,
|
|
307
|
-
submorph:
|
|
309
|
+
submorph: S
|
|
308
310
|
};
|
|
309
311
|
j(document, "morphNavigation", {
|
|
310
|
-
detail:
|
|
312
|
+
detail: lt
|
|
311
313
|
});
|
|
312
|
-
const
|
|
313
|
-
searchParameters:
|
|
314
|
-
revalidate:
|
|
314
|
+
const ht = yield m(this, h, rt).call(this, e(this, u)), b = yield m(this, h, rt).call(this, f, {
|
|
315
|
+
searchParameters: St,
|
|
316
|
+
revalidate: v
|
|
315
317
|
});
|
|
316
|
-
if (e(this,
|
|
318
|
+
if (e(this, x) !== f) {
|
|
317
319
|
e(this, p).forEach((r) => {
|
|
318
320
|
r.checkCurrent(e(this, u));
|
|
319
321
|
});
|
|
320
322
|
return;
|
|
321
323
|
}
|
|
322
|
-
|
|
323
|
-
detail:
|
|
324
|
+
ht.clearState(), ht.saveScrollState(), ht.saveDocumentState(), e(this, T) || (b.clearScrollState(), b.clearDocumentState()), E && b.clearState(), b.cloneDocument(), e(this, V).textContent = b.title, document.body.appendChild(e(this, V)), j(document, "morphStart", {
|
|
325
|
+
detail: lt
|
|
324
326
|
});
|
|
325
|
-
const
|
|
326
|
-
st.forEach((r,
|
|
327
|
+
const yt = Array.from(document.head.children), wt = Array.from(b.document.head.children), Lt = m(this, h, Dt).call(this, yt, wt), qt = m(this, h, ft).call(this, yt, Lt), st = m(this, h, ft).call(this, wt, Lt);
|
|
328
|
+
st.forEach((r, A) => {
|
|
327
329
|
if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
|
|
328
330
|
const y = document.createElement("script");
|
|
329
|
-
y.type = "module", y.src = r.getAttribute("src"), st[
|
|
331
|
+
y.type = "module", y.src = r.getAttribute("src"), st[A] = y;
|
|
330
332
|
}
|
|
331
333
|
}), st.forEach((r) => {
|
|
332
334
|
document.head.appendChild(r);
|
|
333
335
|
});
|
|
334
|
-
const
|
|
336
|
+
const ct = st.filter((r) => {
|
|
335
337
|
if (r.hasAttribute("data-no-waiting"))
|
|
336
338
|
return !1;
|
|
337
|
-
if (m(this, h,
|
|
339
|
+
if (m(this, h, pt).call(this, r))
|
|
338
340
|
return !0;
|
|
339
341
|
});
|
|
340
|
-
e(this,
|
|
341
|
-
let
|
|
342
|
+
e(this, C).waitForHeadToLoad && ct.length && (yield new Promise((r) => z(this, null, function* () {
|
|
343
|
+
let A = 0;
|
|
342
344
|
try {
|
|
343
|
-
for (var y =
|
|
345
|
+
for (var y = kt(ct), X, q, $; X = !(q = yield y.next()).done; X = !1) {
|
|
344
346
|
const it = q.value;
|
|
345
347
|
it.onload = () => {
|
|
346
|
-
|
|
348
|
+
A++, A === ct.length && r();
|
|
347
349
|
};
|
|
348
350
|
}
|
|
349
351
|
} catch (q) {
|
|
@@ -356,37 +358,37 @@ const Z = class Z {
|
|
|
356
358
|
throw $[0];
|
|
357
359
|
}
|
|
358
360
|
}
|
|
359
|
-
}))), yield
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
r.hasAttribute("data-permanent") || (m(this, h,
|
|
361
|
+
}))), yield Ot(10);
|
|
362
|
+
const bt = [];
|
|
363
|
+
qt.forEach((r) => {
|
|
364
|
+
r.hasAttribute("data-permanent") || (m(this, h, pt).call(this, r) ? bt.push(r) : r.remove());
|
|
363
365
|
});
|
|
364
|
-
const
|
|
365
|
-
e(this,
|
|
366
|
+
const zt = m(this, h, mt).call(this, b.document.body);
|
|
367
|
+
e(this, C).morphInsideScrollContainer || m(this, h, Et).call(this, b.document), document.documentElement.setAttribute("data-current-pathname", f), document.documentElement.setAttribute("data-current-leaf", Rt), Ct({
|
|
366
368
|
action: s,
|
|
367
369
|
pathname: f,
|
|
368
|
-
searchParameters:
|
|
370
|
+
searchParameters: St || (L ? location.search : ""),
|
|
369
371
|
hash: W
|
|
370
|
-
}), e(this, V).remove(), o(this, tt, e(this, u)), o(this, u, f), e(this, J).forEach((r,
|
|
371
|
-
const y =
|
|
372
|
+
}), e(this, V).remove(), o(this, tt, e(this, u)), o(this, u, f), e(this, J).forEach((r, A) => {
|
|
373
|
+
const y = zt[A], X = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
372
374
|
let q = [], $ = [];
|
|
373
|
-
|
|
374
|
-
const
|
|
375
|
-
|
|
375
|
+
S ? S.forEach((c) => {
|
|
376
|
+
const g = r.querySelector(c), M = y.querySelector(c);
|
|
377
|
+
g && M && ($.push(g), q.push(M));
|
|
376
378
|
}) : (q.push(...y.childNodes), $.push(...r.childNodes)), $.forEach((c) => {
|
|
377
379
|
c instanceof HTMLElement && (this.destroyOldLinks(c), c.classList.add("old"));
|
|
378
380
|
}), q.forEach((c) => {
|
|
379
381
|
c instanceof HTMLElement && (this.findNewLinks(c), c.classList.add("new"));
|
|
380
|
-
}),
|
|
381
|
-
var
|
|
382
|
-
(
|
|
382
|
+
}), S ? q.forEach((c, g) => {
|
|
383
|
+
var M;
|
|
384
|
+
(M = $[g].parentElement) == null || M.insertBefore(
|
|
383
385
|
c,
|
|
384
|
-
$[
|
|
386
|
+
$[g]
|
|
385
387
|
);
|
|
386
|
-
}) : r.prepend(...q),
|
|
388
|
+
}) : r.prepend(...q), Ft(() => {
|
|
387
389
|
q.forEach((c) => {
|
|
388
|
-
var
|
|
389
|
-
c instanceof HTMLElement && ((
|
|
390
|
+
var g;
|
|
391
|
+
c instanceof HTMLElement && ((g = c.parentElement) == null || g.style.setProperty(
|
|
390
392
|
"--new-content-height",
|
|
391
393
|
c.offsetHeight + "px"
|
|
392
394
|
), c.classList.add("in"));
|
|
@@ -399,35 +401,35 @@ const Z = class Z {
|
|
|
399
401
|
j(document, "morphNewChildrenAdded", {
|
|
400
402
|
detail: it
|
|
401
403
|
});
|
|
402
|
-
const
|
|
404
|
+
const It = new Promise((c) => {
|
|
403
405
|
setTimeout(() => {
|
|
404
|
-
$.forEach((
|
|
405
|
-
var
|
|
406
|
-
|
|
406
|
+
$.forEach((g) => g.remove()), q.forEach((g) => {
|
|
407
|
+
var M;
|
|
408
|
+
g instanceof HTMLElement && ((M = g.parentElement) == null || M.style.removeProperty(
|
|
407
409
|
"--new-content-height"
|
|
408
|
-
),
|
|
410
|
+
), g.classList.remove("in", "new"));
|
|
409
411
|
}), j(document, "morphOldChildrenRemoved", {
|
|
410
412
|
detail: it
|
|
411
413
|
}), c();
|
|
412
414
|
}, (parseFloat(X) || 0) * 1e3 + 10);
|
|
413
415
|
});
|
|
414
|
-
e(this, B).push(
|
|
415
|
-
}), W ? (b.clearScrollState(), m(this, h,
|
|
416
|
+
e(this, B).push(It);
|
|
417
|
+
}), W ? (b.clearScrollState(), m(this, h, gt).call(this, W, { centerScroll: i, offsetScroll: d })) : e(this, T) ? b.restoreScrollPosition() : b.renewScrollPosition(), yield Promise.all(e(this, B)), bt.forEach((r) => r.remove()), o(this, B, []), e(this, J).forEach((r) => {
|
|
416
418
|
r.querySelectorAll("script").forEach((y) => {
|
|
417
419
|
const X = document.createElement("script");
|
|
418
420
|
X.type = "module", X.src = y.getAttribute("src"), y.replaceWith(X);
|
|
419
421
|
});
|
|
420
422
|
}), j(document, "morphComplete", {
|
|
421
|
-
detail:
|
|
423
|
+
detail: lt
|
|
422
424
|
}), window.dispatchEvent(new Event("resize"));
|
|
423
425
|
} catch (U) {
|
|
424
426
|
console.error(U);
|
|
425
427
|
}
|
|
426
|
-
o(this,
|
|
428
|
+
o(this, x, void 0);
|
|
427
429
|
});
|
|
428
430
|
}
|
|
429
431
|
addLink(t) {
|
|
430
|
-
e(this, p).push(new
|
|
432
|
+
e(this, p).push(new dt(t, this));
|
|
431
433
|
}
|
|
432
434
|
addLinks(t) {
|
|
433
435
|
t.forEach((s) => {
|
|
@@ -445,61 +447,61 @@ const Z = class Z {
|
|
|
445
447
|
e(this, et)
|
|
446
448
|
);
|
|
447
449
|
e(this, p).push(
|
|
448
|
-
...s.map((i) => new
|
|
450
|
+
...s.map((i) => new dt(i, this))
|
|
449
451
|
);
|
|
450
452
|
}
|
|
451
453
|
findLinks() {
|
|
452
454
|
const t = [
|
|
453
455
|
...document.documentElement.querySelectorAll("a")
|
|
454
456
|
].filter(e(this, et));
|
|
455
|
-
e(this, p).forEach((s) => s.destroy()), o(this, p, t.map((s) => new
|
|
457
|
+
e(this, p).forEach((s) => s.destroy()), o(this, p, t.map((s) => new dt(s, this)));
|
|
456
458
|
}
|
|
457
459
|
};
|
|
458
|
-
|
|
460
|
+
C = new WeakMap(), J = new WeakMap(), p = new WeakMap(), nt = new WeakMap(), x = new WeakMap(), u = new WeakMap(), tt = new WeakMap(), B = new WeakMap(), T = new WeakMap(), P = new WeakMap(), D = new WeakMap(), V = new WeakMap(), et = new WeakMap(), h = new WeakSet(), rt = function(t, s) {
|
|
459
461
|
return z(this, null, function* () {
|
|
460
|
-
let i = e(this,
|
|
461
|
-
return (!i || s != null && s.revalidate) && (i = yield m(this, h,
|
|
462
|
+
let i = e(this, D).get(t);
|
|
463
|
+
return (!i || s != null && s.revalidate) && (i = yield m(this, h, xt).call(this, t, s == null ? void 0 : s.searchParameters)), i;
|
|
462
464
|
});
|
|
463
|
-
},
|
|
465
|
+
}, xt = function(t, s) {
|
|
464
466
|
return z(this, null, function* () {
|
|
465
467
|
const d = yield (yield fetch(
|
|
466
468
|
`${t}${s ? "?" + s : ""}`
|
|
467
|
-
)).text(),
|
|
468
|
-
return e(this,
|
|
469
|
+
)).text(), v = e(this, nt).parseFromString(d, "text/html"), L = new Tt(this, t, v);
|
|
470
|
+
return e(this, D).set(t, L), L;
|
|
469
471
|
});
|
|
470
|
-
},
|
|
472
|
+
}, mt = function(t) {
|
|
471
473
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
472
474
|
return s.length ? s : [t];
|
|
473
|
-
},
|
|
475
|
+
}, Dt = function(t, s) {
|
|
474
476
|
return t.filter(
|
|
475
477
|
(i) => s.find(
|
|
476
478
|
(d) => d.outerHTML === i.outerHTML
|
|
477
479
|
)
|
|
478
480
|
);
|
|
479
|
-
},
|
|
481
|
+
}, ft = function(t, s) {
|
|
480
482
|
return t.filter(
|
|
481
483
|
(i) => !s.find(
|
|
482
484
|
(d) => d.outerHTML === i.outerHTML
|
|
483
485
|
)
|
|
484
486
|
);
|
|
485
|
-
}, ft = function(t) {
|
|
486
|
-
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
487
487
|
}, pt = function(t) {
|
|
488
|
+
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
489
|
+
}, Et = function(t) {
|
|
488
490
|
var s, i;
|
|
489
491
|
(s = e(this, P)) == null || s.removeEventListener(
|
|
490
492
|
"scroll",
|
|
491
493
|
e(this, Q)
|
|
492
|
-
), o(this, P, t.querySelector(e(this,
|
|
493
|
-
},
|
|
494
|
+
), o(this, P, t.querySelector(e(this, C).scrollSelector) || t.documentElement), (i = e(this, P)) == null || i.addEventListener("scroll", e(this, Q)), e(this, Q).call(this);
|
|
495
|
+
}, gt = function(t, s) {
|
|
494
496
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
495
|
-
(typeof i == "number" || i) &&
|
|
497
|
+
(typeof i == "number" || i) && Bt(i, {
|
|
496
498
|
scrollElement: e(this, P),
|
|
497
499
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
498
500
|
center: s == null ? void 0 : s.centerScroll,
|
|
499
501
|
offset: s == null ? void 0 : s.offsetScroll
|
|
500
502
|
});
|
|
501
503
|
}, at = new WeakMap(), Q = new WeakMap(), Z.instance = null;
|
|
502
|
-
let
|
|
504
|
+
let Mt = Z;
|
|
503
505
|
export {
|
|
504
|
-
|
|
506
|
+
Mt as Morph
|
|
505
507
|
};
|
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),b=(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"),N=require("../index-Cqw2NKev.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs"),ie=require("../url-D1CgmwZ_.cjs"),re=require("../window-resizer/index.cjs"),F=require("../device/index.cjs");var u,y,J,K;class le{constructor(){r(this,u,new Map);r(this,y,[]);r(this,J,o=>{var s;const t=[...e(this,y)].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,y)].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,y)}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,y).push(t),s.push(t)}remove(o,t){if(n(this,y,e(this,y).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,y=new WeakMap,J=new WeakMap,K=new WeakMap;var f,M,V,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,$,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,M);r(this,V);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,$);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,$,()=>{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,M)),clearTimeout(e(this,V)),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),b(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,V,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,$)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,$).call(this)):(b(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,M)),clearTimeout(e(this,V)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,$)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),b(this,P,I).call(this)}};f=new WeakMap,M=new WeakMap,V=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)}},$=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;N.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,_;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"))});N.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=>{console.log(this.hasAttribute("keydown-disabled")),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(b(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`)}b(this,k,_).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{b(this,k,_).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);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"),b(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,_=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")))};N.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
|
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),b=(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"),N=require("../index-Cqw2NKev.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs"),ie=require("../url-lnBE_6yf.cjs"),re=require("../window-resizer/index.cjs"),F=require("../device/index.cjs");var u,y,J,K;class le{constructor(){r(this,u,new Map);r(this,y,[]);r(this,J,o=>{var s;const t=[...e(this,y)].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,y)].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,y)}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,y).push(t),s.push(t)}remove(o,t){if(n(this,y,e(this,y).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,y=new WeakMap,J=new WeakMap,K=new WeakMap;var f,M,V,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,$,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,M);r(this,V);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,$);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,$,()=>{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,M)),clearTimeout(e(this,V)),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),b(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,V,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,$)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,$).call(this)):(b(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,M)),clearTimeout(e(this,V)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,$)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),b(this,P,I).call(this)}};f=new WeakMap,M=new WeakMap,V=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)}},$=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;N.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,_;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"))});N.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=>{console.log(this.hasAttribute("keydown-disabled")),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(b(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`)}b(this,k,_).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{b(this,k,_).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);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"),b(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,_=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")))};N.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
|
package/lib/popover/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { i as _ } from "../index-euf5anj6.js";
|
|
|
9
9
|
import { d as Y } 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
|
-
import { u as nt, p as ct } from "../url-
|
|
12
|
+
import { u as nt, p as ct } from "../url-Cc-RVfii.js";
|
|
13
13
|
import { windowResizer as it } from "../window-resizer/index.js";
|
|
14
14
|
import { viewport as j } from "../device/index.js";
|
|
15
15
|
var u, b, J, K;
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var B=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../index-Cqw2NKev.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-
|
|
1
|
+
"use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var B=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../index-Cqw2NKev.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-lnBE_6yf.cjs"),ot=require("../object-CCiXnER2.cjs");var R,O,A,p,m,v,k,L,b,E,M,et;class ct{constructor(e,s){r(this,M);r(this,R);r(this,O);r(this,A);r(this,p);r(this,m);r(this,v);r(this,k);r(this,L,null);r(this,b,[]);r(this,E,[]);a(this,R,e),a(this,O,s),a(this,A,new URLPattern({pathname:t(this,R)})),a(this,p,null),a(this,m,null),a(this,v,!1),a(this,k,null),tt.isBrowser&&a(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,v)}get element(){return t(this,m)}get nest(){return t(this,k)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return B(this,null,function*(){var i,h;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(a(this,E,[...t(this,b)]),typeof o.default=="function"&&(a(this,p,o.default),ot.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield W(this,M,et).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),d={pathnameParams:c,searchParams:f};a(this,m,new(t(this,p))(d)),e.appendChild(t(this,m)),a(this,k,t(this,m).querySelector("[data-nest]")||((h=t(this,m).shadowRoot)==null?void 0:h.querySelector("[data-nest]"))||t(this,m).shadowRoot||t(this,m)),a(this,v,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,m))==null||e.remove(),a(this,v,!1),t(this,E).forEach(s=>document.head.removeChild(s)),a(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,m)&&(e=[...t(this,m).querySelectorAll("a")]),(s=t(this,m))!=null&&s.shadowRoot&&(e=[...e,...t(this,m).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,m=new WeakMap,v=new WeakMap,k=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,M=new WeakSet,et=function(){return B(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=Y(e),i,h,o;i=!(h=yield s.next()).done;i=!1){const c=h.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(h){o=[h]}finally{try{i&&(h=s.return)&&(yield h.call(s))}finally{if(o)throw o[0]}}})};var S,u,P,U,q,j;class lt{constructor(e,s){r(this,S);r(this,u);r(this,P);r(this,U);r(this,q);r(this,j,e=>{e.preventDefault(),t(this,S).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,u).classList.add("clicked"):t(s,u).classList.remove("clicked")}),t(this,S).navigate(t(this,P),t(this,U))});var o,c;a(this,S,e),a(this,u,s),a(this,P,t(this,u).getAttribute("href")||"/"),a(this,U,t(this,u).getAttribute("data-history-action")||"push"),t(this,u).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),h=e.normalizePath(location.pathname);a(this,q,(o=t(this,u).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,u).hasAttribute("data-include")?h.pathname.includes(i.pathname)&&t(this,u).classList.add("current"):i.pathname===h.pathname||(c=t(this,q))!=null&&c.includes(h.pathname)?(t(this,u).classList.add("current"),t(this,u).classList.add("clicked")):t(this,u).classList.remove("clicked")}destroy(){t(this,u).removeEventListener("click",t(this,j)),t(this,u).classList.remove("current")}}S=new WeakMap,u=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=at.URLPattern;var N,C,g,z,T,y,H,x,_,I,st,D;class ut{constructor(e){r(this,I);r(this,N,null);r(this,C,null);r(this,g,[]);r(this,z,null);r(this,T,[]);r(this,y);r(this,H,null);r(this,x,new rt.Notifier);r(this,_,ht.debounce(()=>{const e=s=>s.split("/").length;a(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));r(this,D,e=>{var s;(s=e.state)!=null&&s.path&&this.navigate(e.state.path,"none")});tt.isBrowser&&(e!=null&&e.base?a(this,C,F.normalizeBase(e.base)):a(this,C,"/"),a(this,N,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,D)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,x).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,_).call(this)}navigate(e,s="push"){return B(this,null,function*(){var Q,V;const i=this.normalizePath(e);let{pathname:h,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===h||t(this,H)===h)return;a(this,y,h);const d=t(this,g).filter(l=>l.isActive),w=t(this,g).filter(l=>!d.includes(l)&&l.testPathname(f)),it=d.filter(l=>!l.testPathname(f)),G=d.filter(l=>l.testPathname(f));let J=!0;if(this.preprocessor)try{yield new Promise((l,nt)=>{var X;(X=this.preprocessor)==null||X.call(this,{path:i,resolve:l,reject:nt})})}catch(l){l?console.error(l):console.log("Route change canceled"),J=!1}if(J&&t(this,y)===h){a(this,z,G[G.length-1]),it.forEach(l=>{l.close()}),a(this,H,h),F.changeHistory({action:s,pathname:h,searchParameters:c,hash:o});try{for(var ft=Y(w),pt,gt,Pt;pt=!(gt=yield ft.next()).done;pt=!1){const l=gt.value;yield l.render(((Q=t(this,z))==null?void 0:Q.nest)||t(this,N),h),a(this,z,l)}}catch(gt){Pt=[gt]}finally{try{pt&&(gt=ft.return)&&(yield gt.call(ft))}finally{if(Pt)throw Pt[0]}}W(this,I,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,x).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,{base:t(this,C)})}}N=new WeakMap,C=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,x=new WeakMap,_=new WeakMap,I=new WeakSet,st=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,N).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var h;return(h=i.getAttribute("href"))==null?void 0:h.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),a(this,T,s.map(i=>new lt(this,i)))},D=new WeakMap;exports.Router=ut;
|
package/lib/router/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { URLPattern as at } from "urlpattern-polyfill";
|
|
|
24
24
|
import { Notifier as nt } from "../notifier/index.js";
|
|
25
25
|
import { i as _ } from "../index-euf5anj6.js";
|
|
26
26
|
import { d as ht } from "../function-C10DGppn.js";
|
|
27
|
-
import { n as rt, c as ot, s as ct } from "../url-
|
|
27
|
+
import { n as rt, c as ot, s as ct } from "../url-Cc-RVfii.js";
|
|
28
28
|
import { i as lt } from "../object-D6MVWB4l.js";
|
|
29
29
|
var y, U, A, p, d, L, k, v, E, R, M, tt;
|
|
30
30
|
class ut {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var W = Object.defineProperty,
|
|
2
|
-
var
|
|
1
|
+
var W = Object.defineProperty, u = Object.defineProperties;
|
|
2
|
+
var P = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var h = Object.getOwnPropertySymbols;
|
|
4
|
-
var S = Object.prototype.hasOwnProperty,
|
|
4
|
+
var S = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var c = (t, s, a) => s in t ? W(t, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[s] = a, o = (t, s) => {
|
|
6
6
|
for (var a in s || (s = {}))
|
|
7
7
|
S.call(s, a) && c(t, a, s[a]);
|
|
8
8
|
if (h)
|
|
9
9
|
for (var a of h(s))
|
|
10
|
-
|
|
10
|
+
y.call(s, a) && c(t, a, s[a]);
|
|
11
11
|
return t;
|
|
12
|
-
}, i = (t, s) =>
|
|
13
|
-
function
|
|
12
|
+
}, i = (t, s) => u(t, P(s));
|
|
13
|
+
function p(t, { base: s = "", trailingSlash: a = !1 } = {}) {
|
|
14
14
|
s = s.endsWith("/") ? s.slice(0, -1) : s, t = t.replace(s, ""), t.startsWith("/") && (t = t.slice(1));
|
|
15
15
|
const n = t.split("#"), e = n[0].split("?");
|
|
16
16
|
let r = e[0].startsWith("/") ? e[0] : "/" + e[0];
|
|
@@ -27,6 +27,8 @@ function $(t = "/") {
|
|
|
27
27
|
return t.endsWith("/") || (t += "/"), t.startsWith("/") || (t += "/"), t;
|
|
28
28
|
}
|
|
29
29
|
function g(t) {
|
|
30
|
+
if (t.action === "none")
|
|
31
|
+
return;
|
|
30
32
|
const s = t == null ? void 0 : t.searchParameters, a = t.hash ? t.hash.startsWith("#") ? t.hash : "#" + t.hash : "", n = s ? s.startsWith("?") ? s : "?" + s : "", e = `${t.pathname}${a}${n}`, r = i(o({}, t.state), { path: e });
|
|
31
33
|
t.action === "push" ? history.pushState(r, "", e) : t.action === "replace" && history.replaceState(r, "", e);
|
|
32
34
|
}
|
|
@@ -44,6 +46,6 @@ export {
|
|
|
44
46
|
g as c,
|
|
45
47
|
$ as n,
|
|
46
48
|
w as p,
|
|
47
|
-
|
|
49
|
+
p as s,
|
|
48
50
|
L as u
|
|
49
51
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var P=Object.defineProperty,u=Object.defineProperties;var S=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var c=(t,s,r)=>s in t?P(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,i=(t,s)=>{for(var r in s||(s={}))W.call(s,r)&&c(t,r,s[r]);if(h)for(var r of h(s))y.call(s,r)&&c(t,r,s[r]);return t},o=(t,s)=>u(t,S(s));function d(t,{base:s="",trailingSlash:r=!1}={}){s=s.endsWith("/")?s.slice(0,-1):s,t=t.replace(s,""),t.startsWith("/")&&(t=t.slice(1));const n=t.split("#"),a=n[0].split("?");let e=a[0].startsWith("/")?a[0]:"/"+a[0];r?e=!e.endsWith("/")&&e!=="/"?e+"/":e:e=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;const f=s+e,m=a==null?void 0:a[1],l=n==null?void 0:n[1];return{leaf:e,pathname:f,parameters:m,hash:l}}function p(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function g(t){if(t.action==="none")return;const s=t==null?void 0:t.searchParameters,r=t.hash?t.hash.startsWith("#")?t.hash:"#"+t.hash:"",n=s?s.startsWith("?")?s:"?"+s:"",a=`${t.pathname}${r}${n}`,e=o(i({},t.state),{path:a});t.action==="push"?history.pushState(e,"",a):t.action==="replace"&&history.replaceState(e,"",a)}function $(t){const s=new URLSearchParams(t),r={};for(const[n,a]of s)r[n]=a;return r}function w(t,s){const r=new URL(location.href),n=(s==null?void 0:s.toString())||"";r.searchParams.set(t,n),history.replaceState(history.state,"",r.href)}exports.changeHistory=g;exports.normalizeBase=p;exports.parseSearchParameters=$;exports.splitPath=d;exports.updateSearchParameter=w;
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../attributes-Bf2svn4j.cjs"),O=require("../index-Cqw2NKev.cjs"),b=require("../canvas-CU5Xjahf.cjs"),C=require("../coordinates-D8Np3cPD.cjs"),g=require("../dom-JBOkFLTh.cjs"),i=require("../easings-GegIwET5.cjs"),Q=require("../events-KVanG9sR.cjs"),E=require("../file-DSpfWdd9.cjs"),S=require("../function-MthRj-GJ.cjs"),A=require("../gestures-C7gbKx11.cjs"),T=require("../jss-CRBgdvJ3.cjs"),h=require("../layout-Ctc2p3uz.cjs"),a=require("../math-GDWEqu7y.cjs"),m=require("../number-DyefJ5a1.cjs"),c=require("../object-CCiXnER2.cjs"),v=require("../polyfills-Df4r-ETT.cjs"),P=require("../scroll-DAhSpkhR.cjs"),l=require("../string-DUXXtU8v.cjs"),w=require("../style-At6aDoqG.cjs"),p=require("../url-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../attributes-Bf2svn4j.cjs"),O=require("../index-Cqw2NKev.cjs"),b=require("../canvas-CU5Xjahf.cjs"),C=require("../coordinates-D8Np3cPD.cjs"),g=require("../dom-JBOkFLTh.cjs"),i=require("../easings-GegIwET5.cjs"),Q=require("../events-KVanG9sR.cjs"),E=require("../file-DSpfWdd9.cjs"),S=require("../function-MthRj-GJ.cjs"),A=require("../gestures-C7gbKx11.cjs"),T=require("../jss-CRBgdvJ3.cjs"),h=require("../layout-Ctc2p3uz.cjs"),a=require("../math-GDWEqu7y.cjs"),m=require("../number-DyefJ5a1.cjs"),c=require("../object-CCiXnER2.cjs"),v=require("../polyfills-Df4r-ETT.cjs"),P=require("../scroll-DAhSpkhR.cjs"),l=require("../string-DUXXtU8v.cjs"),w=require("../style-At6aDoqG.cjs"),p=require("../url-lnBE_6yf.cjs");function B(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function D(t,e){const n=t.length;e=e%n;const o=new Array(n);for(let s=0;s<n;s++){const r=(s+e)%n;o[r]=t[s]}return o}function R(t,e=2){if(!+t)return"0 Bytes";const n=1024,o=e<0?0:e,s=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,r)).toFixed(o))} ${s[r]}`}function N(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 j(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function z(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function M(t,e){let n=!1;const{x:o,y:s}=t;for(let r=0,u=e.length-1;r<e.length;u=r++){const f=e[r].x,d=e[r].y,y=e[u].x,I=e[u].y;d>s!=I>s&&o<(y-f)*(s-d)/(I-d)+f&&(n=!n)}return n}function q(t,e){const n=t.style.getPropertyValue(e);if(n){const o=n.toString();return o.startsWith("var")?q(t,o.slice(4,-1)):o}}function V(...t){const e={};return Array.from(document.styleSheets).forEach(n=>{Array.from(n.cssRules).forEach(o=>{o instanceof CSSStyleRule&&o.selectorText===":root"&&t.forEach(s=>{const r=q(o,s);r&&(e[s]=r)})})}),t.forEach(n=>{e[n]||console.warn(`variable named ${n} not found`)}),e}function k(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function F(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}function $(t){const e=window.getComputedStyle(t);return e.width!=="0"&&e.height!=="0"&&e.opacity!=="0"&&e.display!=="none"&&e.visibility!=="hidden"}const H=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,U=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function K(t){let e,n;return U.test(t)?(e=`mailto:${t.trim()}`,n="email"):H.test(t)&&(e=`tel:${t.replace(/[^0-9\\.\\+]+/g,"")}`,n="phone"),{href:e,type:n,contact:t}}function W(t,e){if(t){const o=t.content.cloneNode(!0).firstElementChild;return o&&(e==null||e(o)),o}return null}function Z(t,e,n,o){let s,r=!1,u=0;const f=()=>{clearInterval(s),o!=null&&o.restartCounter&&(u=0),r&&(s=setInterval(()=>{n(u++)},e))},d=O.intersector.subscribe(t,y=>{r=y.isIntersecting,f()});return()=>{d(),clearInterval(s)}}exports.parseAttribute=x.parseAttribute;exports.parseAttributeValue=x.parseAttributeValue;exports.isBrowser=O.isBrowser;exports.contain=b.contain;exports.cover=b.cover;exports.fixPosition=b.fixPosition;exports.measureText=b.measureText;exports.getPointerPosition=C.getPointerPosition;exports.normalize=C.normalize;exports.screenToCartesian=C.screenToCartesian;exports.findParentElement=g.findParentElement;exports.findScrollParentElement=g.findScrollParentElement;exports.getAllParentElements=g.getAllParentElements;exports.getElement=g.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.dispatchEvent=Q.dispatchEvent;exports.createJSONAndSave=E.createJSONAndSave;exports.downloadURI=E.downloadURI;exports.debounce=S.debounce;exports.throttle=S.throttle;exports.setupDrag=A.setupDrag;exports.createStylesheet=T.createStylesheet;exports.styleToString=T.styleToString;exports.getCumulativeOffsetLeft=h.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=h.getCumulativeOffsetTop;exports.getCumulativePosition=h.getCumulativePosition;exports.getStickyOffset=h.getStickyOffset;exports.calculateDistance=a.calculateDistance;exports.calculateDistanceWithRadius=a.calculateDistanceWithRadius;exports.clamp=a.clamp;exports.damp=a.damp;exports.lerp=a.lerp;exports.mapRange=a.mapRange;exports.round=a.round;exports.smootherstep=a.smootherstep;exports.smoothstep=a.smoothstep;exports.step=a.step;exports.beautifyNumber=m.beautifyNumber;exports.loopNumber=m.loopNumber;exports.preciseNumber=m.preciseNumber;exports.roundNumberTo=m.roundNumberTo;exports.toStep=m.toStep;exports.cloneDeep=c.cloneDeep;exports.compareObjects=c.compareObjects;exports.isESClass=c.isESClass;exports.isNullish=c.isNullish;exports.isObject=c.isObject;exports.mergeDeep=c.mergeDeep;exports.mixin=c.mixin;exports.omit=c.omit;exports.pick=c.pick;exports.nullishCoalescing=v.nullishCoalescing;exports.requestIdleCallback=v.requestIdleCallback;exports.scrollToElement=P.scrollToElement;exports.wait=P.wait;exports.camelToKebab=l.camelToKebab;exports.capitalize=l.capitalize;exports.declension=l.declension;exports.decodeHtmlEntities=l.decodeHtmlEntities;exports.generateId=l.generateId;exports.isUppercase=l.isUppercase;exports.kebabToCamel=l.kebabToCamel;exports.snakeToDotted=l.snakeToDotted;exports.toPascalCase=l.toPascalCase;exports.uncapitalize=l.uncapitalize;exports.getElementTransitionDurationMS=w.getElementTransitionDurationMS;exports.getElementTransitionDurationS=w.getElementTransitionDurationS;exports.changeHistory=p.changeHistory;exports.normalizeBase=p.normalizeBase;exports.parseSearchParameters=p.parseSearchParameters;exports.splitPath=p.splitPath;exports.updateSearchParameter=p.updateSearchParameter;exports.cloneTemplateContent=W;exports.copyTextToClipboard=N;exports.decode=F;exports.dotCircleCollision=z;exports.dotPolygonCollision=M;exports.dotRectCollision=j;exports.encode=k;exports.formatBytes=R;exports.getRootVariables=V;exports.insert=B;exports.isElementVisible=$;exports.setIntervalOnIntersection=Z;exports.shiftArray=D;exports.tryCreateHrefFromContact=K;
|
package/lib/utils/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { n as nt, r as it } from "../polyfills-DJrTJQky.js";
|
|
|
18
18
|
import { s as lt, w as ut } from "../scroll-Benkuq-t.js";
|
|
19
19
|
import { c as dt, a as pt, b as mt, d as xt, g as ht, i as gt, k as bt, s as yt, t as Ct, u as It } from "../string-BlMQbe8b.js";
|
|
20
20
|
import { g as vt, a as Et } from "../style-j2TwriJ_.js";
|
|
21
|
-
import { c as Tt, n as Ot, p as Pt, s as Bt, u as At } from "../url-
|
|
21
|
+
import { c as Tt, n as Ot, p as Pt, s as Bt, u as At } from "../url-Cc-RVfii.js";
|
|
22
22
|
function g(t, e, ...s) {
|
|
23
23
|
return [...t.slice(0, e), ...s, ...t.slice(e)];
|
|
24
24
|
}
|
package/package.json
CHANGED
package/lib/url-D1CgmwZ_.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var P=Object.defineProperty,S=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var n=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var c=(t,s,r)=>s in t?P(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,i=(t,s)=>{for(var r in s||(s={}))u.call(s,r)&&c(t,r,s[r]);if(n)for(var r of n(s))p.call(s,r)&&c(t,r,s[r]);return t},o=(t,s)=>S(t,W(s));function y(t,{base:s="",trailingSlash:r=!1}={}){s=s.endsWith("/")?s.slice(0,-1):s,t=t.replace(s,""),t.startsWith("/")&&(t=t.slice(1));const h=t.split("#"),e=h[0].split("?");let a=e[0].startsWith("/")?e[0]:"/"+e[0];r?a=!a.endsWith("/")&&a!=="/"?a+"/":a:a=a.endsWith("/")&&a!=="/"?a.slice(0,-1):a;const f=s+a,m=e==null?void 0:e[1],l=h==null?void 0:h[1];return{leaf:a,pathname:f,parameters:m,hash:l}}function d(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function g(t){const s=t==null?void 0:t.searchParameters,r=t.hash?t.hash.startsWith("#")?t.hash:"#"+t.hash:"",h=s?s.startsWith("?")?s:"?"+s:"",e=`${t.pathname}${r}${h}`,a=o(i({},t.state),{path:e});t.action==="push"?history.pushState(a,"",e):t.action==="replace"&&history.replaceState(a,"",e)}function $(t){const s=new URLSearchParams(t),r={};for(const[h,e]of s)r[h]=e;return r}function w(t,s){const r=new URL(location.href),h=(s==null?void 0:s.toString())||"";r.searchParams.set(t,h),history.replaceState(history.state,"",r.href)}exports.changeHistory=g;exports.normalizeBase=d;exports.parseSearchParameters=$;exports.splitPath=y;exports.updateSearchParameter=w;
|