aptechka 0.72.6 → 0.72.8
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 +155 -150
- 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-UL9zSCHb.js → url-CFnGU6md.js} +1 -1
- package/lib/{url-YEESIcRn.cjs → url-DGcX4fGV.cjs} +1 -1
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +1 -1
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface MorphNavigateOptions {
|
|
|
32
32
|
historyAction?: ChangeHistoryAction;
|
|
33
33
|
centerScroll?: boolean;
|
|
34
34
|
offsetScroll?: number | ElementOrSelector<HTMLElement>;
|
|
35
|
+
scrollBehaviour?: ScrollBehavior;
|
|
35
36
|
revalidate?: boolean;
|
|
36
37
|
keepSearchParameters?: boolean;
|
|
37
38
|
submorph?: Array<string>;
|
|
@@ -96,7 +97,7 @@ export declare class Morph {
|
|
|
96
97
|
prefetch(path: string, revalidate?: boolean): Promise<void>;
|
|
97
98
|
excludeHeadChild(child: Node): boolean;
|
|
98
99
|
setHeaders(path: string): void;
|
|
99
|
-
navigate(path: string, { historyAction, centerScroll, offsetScroll, revalidate, keepSearchParameters, submorph, clearState, keepScrollPosition, }?: MorphNavigateOptions): Promise<void>;
|
|
100
|
+
navigate(path: string, { historyAction, centerScroll, offsetScroll, scrollBehaviour, revalidate, keepSearchParameters, submorph, clearState, keepScrollPosition, }?: MorphNavigateOptions): Promise<void>;
|
|
100
101
|
addLink(element: HTMLAnchorElement): void;
|
|
101
102
|
addLinks(elements: Array<HTMLAnchorElement>): void;
|
|
102
103
|
removeLink(element: HTMLAnchorElement): void;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _t=Object.defineProperty,te=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var zt=Object.getOwnPropertySymbols;var se=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var Vt=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),Ft=a=>{throw TypeError(a)};var Ot=(a,t,s)=>t in a?_t(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,ft=(a,t)=>{for(var s in t||(t={}))se.call(t,s)&&Ot(a,s,t[s]);if(zt)for(var s of zt(t))ie.call(t,s)&&Ot(a,s,t[s]);return a},Lt=(a,t)=>te(a,ee(t));var wt=(a,t,s)=>t.has(a)||Ft("Cannot "+s);var e=(a,t,s)=>(wt(a,t,"read from private field"),s?s.call(a):t.get(a)),o=(a,t,s)=>t.has(a)?Ft("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,s),r=(a,t,s,i)=>(wt(a,t,"write to private field"),i?i.call(a,s):t.set(a,s),s),E=(a,t,s)=>(wt(a,t,"access private method"),s);var B=(a,t,s)=>new Promise((i,h)=>{var g=L=>{try{f(s.next(L))}catch(H){h(H)}},A=L=>{try{f(s.throw(L))}catch(H){h(H)}},f=L=>L.done?i(L.value):Promise.resolve(L.value).then(g,A);f((s=s.apply(a,t)).next())});var Bt=(a,t,s)=>(t=a[Vt("asyncIterator")])?t.call(a):(a=a[Vt("iterator")](),t={},s=(i,h)=>(h=a[i])&&(t[i]=g=>new Promise((A,f,L)=>(g=h.call(a,g),L=g.done,Promise.resolve(g.value).then(H=>A({value:H,done:L}),f)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Yt=require("../index-DekP7OZe.cjs"),R=require("../events-KVanG9sR.cjs"),ne=require("../polyfills-Df4r-ETT.cjs"),Wt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),re=require("../css-value-parser/index.cjs");class jt 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)}}Yt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",jt);var M,l,U,nt,G;class yt{constructor(t,s){o(this,M);o(this,l);o(this,U);o(this,nt,t=>{var i;if(t.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(e(this,l).hasAttribute("data-back")&&e(this,M).previousURL)history.back();else{r(this,U,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",g=e(this,l).hasAttribute("data-center-scroll"),A=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),f=A?re.cssValueParser.parse(A):void 0,L=e(this,l).hasAttribute("data-revalidate"),H=e(this,l).hasAttribute("data-keep-search-parameters"),$t=e(this,l).hasAttribute("data-keep-scroll-position"),ht=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(ct=>ct.trim()),c=e(this,l).hasAttribute("data-clear-state");e(this,M).navigate(e(this,U),{historyAction:h,centerScroll:g,offsetScroll:f,revalidate:L,keepSearchParameters:H,submorph:ht,clearState:c,keepScrollPosition:$t})}});o(this,G,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,M).prefetch(e(this,U),t),e(this,l).removeEventListener("pointerenter",e(this,G))});r(this,M,s),r(this,l,t),r(this,U,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,nt)),this.checkCurrent(location.href.replace(location.origin,"")),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,G))}get element(){return e(this,l)}checkCurrent(t){var h;const s=e(this,M).normalizePath(t),i=e(this,M).normalizePath(e(this,U));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"):(h=e(this,l).getAttribute("data-associated-paths"))!=null&&h.split(",").find(g=>s.pathname.includes(g))?e(this,l).classList.add("current"):e(this,l).classList.remove("current"),s.path===i.path?e(this,l).classList.add("exact"):e(this,l).classList.remove("exact")}destroy(){e(this,l).removeEventListener("click",e(this,nt)),e(this,l).removeEventListener("pointerenter",e(this,G)),e(this,l).classList.remove("current")}}M=new WeakMap,l=new WeakMap,U=new WeakMap,nt=new WeakMap,G=new WeakMap;const ae=new DOMParser;var T,W,y,k,X,D,J,Y,I,Q,rt;class Xt{constructor(t,s){o(this,T);o(this,W);o(this,y,{x:0,y:0});o(this,k,null);o(this,X,null);o(this,D,null);o(this,J,null);o(this,Y,null);o(this,I,null);o(this,Q);o(this,rt);r(this,T,t),r(this,W,s),r(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,y)}get document(){return e(this,D)}setHeaders(t){r(this,rt,t)}setInitialDocument(t){r(this,k,t.cloneNode(!0))}abort(){var t;return(t=e(this,Y))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s,i){return B(this,null,function*(){return!i&&(e(this,I)||e(this,k)&&e(this,k).documentElement.hasAttribute("data-cache")&&e(this,Q)!==t||e(this,k)&&e(this,T).isPopstateNavigation)?e(this,I):(r(this,Q,t),r(this,I,new Promise(h=>B(this,null,function*(){try{r(this,Y,new AbortController);const A=yield(yield fetch(t,{signal:e(this,Y).signal,headers:ft({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(t)},e(this,rt))})).text(),f=ae.parseFromString(A,"text/html");this.setInitialDocument(f)}catch(g){console.warn(g)}finally{r(this,Y,null),r(this,I,null),h()}}))),e(this,I))})}cloneDocument(){r(this,D,(e(this,X)||e(this,k)).cloneNode(!0))}get title(){let t="";if(e(this,D).title)t=e(this,D).title;else{const s=e(this,D).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,W)}return t}clearScrollState(){e(this,y).x=0,e(this,y).y=0}clearDocumentState(){r(this,X,null)}saveScrollState(){e(this,k).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,T).scrollValue.left,e(this,y).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,k).documentElement.hasAttribute("data-no-page-restoration")?r(this,X,null):r(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){r(this,J,t)}clearState(){const t=e(this,J);return r(this,J,null),t}}T=new WeakMap,W=new WeakMap,y=new WeakMap,k=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,Y=new WeakMap,I=new WeakMap,Q=new WeakMap,rt=new WeakMap;var C,Z,v,z,m,j,V,O,P,at,x,K,_,tt,ot,u,Pt,lt,pt,At,Kt,kt,Ct,Ht,Rt,Et,et;const it=class it{constructor(t){o(this,u);o(this,C,null);o(this,Z,null);o(this,v,[]);o(this,z);o(this,m,null);o(this,j);o(this,V,[]);o(this,O,!1);o(this,P,null);o(this,at,!1);o(this,x,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,ot,null);o(this,lt,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"});o(this,Et,t=>B(this,null,function*(){t.preventDefault(),r(this,O,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:e(this,ot)||void 0}),r(this,O,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),h=t-e(this,_);r(this,tt,s),r(this,_,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),R.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Yt.isBrowser&&!it.instance){it.instance=this,r(this,C,{base:st.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),r(this,Z,E(this,u,At).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);r(this,m,s);const i=new Xt(this,e(this,m).pathname);i.setInitialDocument(document),e(this,x).set(e(this,m).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,Et)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,K,new jt),E(this,u,Ht).call(this,document)}}get currentURL(){return e(this,m)}get previousURL(){return e(this,j)}get links(){return e(this,v)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,O)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,P).scrollTop,s=e(this,P).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,x).get(e(this,m).path);s&&s.saveState(t)}getState(){const t=e(this,x).get(e(this,m).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,C).base,trailingSlash:e(this,C).trailingSlash})}prefetch(t,s){return B(this,null,function*(){var h;if(e(this,V).length)return;t=((h=this.pathnameModifier)==null?void 0:h.call(this,t))||t;const i=E(this,u,pt).call(this,t);i==null||i.fetch(t,e(this,m).path,s)})}excludeHeadChild(t){return!1}setHeaders(t){}navigate($t){return B(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:g,keepSearchParameters:A,submorph:f,clearState:L,keepScrollPosition:H}={}){var ct,Mt,Tt,xt;if(e(this,V).length)return;r(this,ot,f||null);const ht=((ct=this.pathnameModifier)==null?void 0:ct.call(this,t))||t,c=this.normalizePath(ht);if(e(this,v).forEach($=>{$.checkCurrent(c.path)}),!g&&(((Mt=e(this,z))==null?void 0:Mt.pathname)===c.pathname||e(this,m).pathname===c.pathname)){E(this,u,Rt).call(this,c.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"}),R.dispatchEvent(document,"morphSamePath",{custom:!0}),((Tt=e(this,m))==null?void 0:Tt.parameters)!==c.parameters&&(r(this,j,e(this,m)),r(this,m,c),st.changeHistory({action:((xt=e(this,m))==null?void 0:xt.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),R.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,m),previousURL:e(this,j)}}));return}r(this,z,c);try{let $=!0;if(this.preprocessor)try{yield new Promise((n,S)=>{var b;(b=this.preprocessor)==null||b.call(this,{url:c,resolve:n,reject:S,submorph:f})})}catch(n){n?console.error(n):console.log("Route change canceled"),$=!1}if(!$||e(this,z).pathname!==c.pathname){e(this,v).forEach(n=>{n.checkCurrent(e(this,m).path)});return}const Nt={url:c,submorph:f};f?f.forEach(n=>{document.querySelectorAll(n).forEach(S=>{S.classList.add("out"),S.setAttribute("data-morph-out","")})}):e(this,Z).forEach(n=>{var S,b;(S=n.firstElementChild)==null||S.classList.add("out"),(b=n.firstElementChild)==null||b.setAttribute("data-morph-out","")}),R.dispatchEvent(document,"morphNavigation",{detail:Nt});const gt=E(this,u,pt).call(this,e(this,m).pathname),p=E(this,u,pt).call(this,c.pathname);if(e(this,x).forEach(n=>{n.pathname!==c.pathname&&n.abort()}),yield p==null?void 0:p.fetch(ht,e(this,m).path,g),e(this,z).pathname!==c.pathname){e(this,v).forEach(n=>{n.checkCurrent(e(this,m).path)});return}gt.clearState(),gt.saveScrollState(),gt.saveDocumentState(),e(this,O)||(p.clearScrollState(),p.clearDocumentState()),L&&p.clearState(),p.cloneDocument(),e(this,K).textContent=p.title,document.body.appendChild(e(this,K));const ut=Lt(ft({},Nt),{document:p.document});ut.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),R.dispatchEvent(document,"morphStart",{detail:ut});const qt=Array.from(document.head.children),Ut=Array.from(p.document.head.children),Dt=E(this,u,Kt).call(this,qt,Ut),Gt=E(this,u,kt).call(this,qt,Dt),dt=E(this,u,kt).call(this,Ut,Dt).filter(n=>!this.excludeHeadChild(n));dt.forEach((n,S)=>{n.tagName==="SCRIPT"&&(dt[S]=E(this,u,Pt).call(this,n))}),dt.forEach(n=>{document.head.appendChild(n)});const vt=dt.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(E(this,u,Ct).call(this,n))return!0});e(this,C).waitForHeadToLoad&&vt.length&&(yield new Promise(n=>B(this,null,function*(){let S=0;try{for(var b=Bt(vt),Qt,F,N;Qt=!(F=yield b.next()).done;Qt=!1){const mt=F.value;mt.onload=()=>{S++,S===vt.length&&n()}}}catch(F){N=[F]}finally{try{Qt&&(F=b.return)&&(yield F.call(b))}finally{if(N)throw N[0]}}}))),yield Wt.wait(10);const It=[];Gt.forEach(n=>{n.hasAttribute("data-permanent")||(E(this,u,Ct).call(this,n)?It.push(n):n.remove())});const Jt=E(this,u,At).call(this,p.document.body);!e(this,C).morphInsideScrollContainer&&!f&&E(this,u,Ht).call(this,p.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),st.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(A?location.search:""),hash:c.hash}),e(this,K).remove(),r(this,j,e(this,m)),r(this,m,c);const St=[];e(this,Z).forEach((n,S)=>{const b=Jt[S],Qt=getComputedStyle(n).getPropertyValue("--morph-duration");let F=[],N=[];f?(f.forEach(d=>{const w=n.querySelector(d),q=b.querySelector(d);w&&q&&(N.push(w),F.push(q))}),N.forEach(d=>{d.parentElement&&St.push(d.parentElement)})):(F.push(...b.childNodes),N.push(...n.childNodes),St.push(n)),N.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),F.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),f?F.forEach((d,w)=>{var q;(q=N[w].parentElement)==null||q.insertBefore(d,N[w])}):n.prepend(...F),ne.requestIdleCallback(()=>{N.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),F.forEach(d=>{var w;d instanceof HTMLElement&&((w=d.parentElement)==null||w.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})});const mt=Lt(ft({},ut),{morphElement:n});R.dispatchEvent(document,"morphNewChildrenAdded",{detail:mt});const Zt=new Promise(d=>{setTimeout(()=>{N.forEach(w=>w.remove()),F.forEach(w=>{var q;w instanceof HTMLElement&&((q=w.parentElement)==null||q.style.removeProperty("--new-content-height"),w.classList.remove("new-idle","new"))}),R.dispatchEvent(document,"morphOldChildrenRemoved",{detail:mt}),d()},(parseFloat(Qt)||0)*1e3+10)});e(this,V).push(Zt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-p.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),R.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:p.scrollState}),c.hash?(p.clearScrollState(),E(this,u,Rt).call(this,c.hash,{centerScroll:i,offsetScroll:h})):e(this,O)?p.restoreScrollPosition():H||p.renewScrollPosition(),yield Promise.all(e(this,V)),It.forEach(n=>n.remove()),r(this,V,[]),St.forEach(n=>{n.querySelectorAll("script").forEach(b=>{b.replaceWith(E(this,u,Pt).call(this,b))})}),e(this,v).forEach(n=>{n.checkCurrent(e(this,m).path)}),R.dispatchEvent(document,"morphComplete",{detail:ut}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}r(this,z,void 0)})}addLink(t){e(this,v).push(new yt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){r(this,v,e(this,v).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){r(this,v,e(this,v).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,lt));e(this,v).push(...s.map(i=>new yt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,lt));e(this,v).forEach(s=>s.destroy()),r(this,v,t.map(s=>new yt(s,this)))}};C=new WeakMap,Z=new WeakMap,v=new WeakMap,z=new WeakMap,m=new WeakMap,j=new WeakMap,V=new WeakMap,O=new WeakMap,P=new WeakMap,at=new WeakMap,x=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,ot=new WeakMap,u=new WeakSet,Pt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const h=t.attributes[i];s.setAttribute(h.name,h.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},lt=new WeakMap,pt=function(t){const s=this.normalizePath(t);let i=e(this,x).get(s.pathname);return i||(i=new Xt(this,s.pathname),e(this,x).set(s.pathname,i)),i},At=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Kt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},kt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},Ct=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},Ht=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,et)),r(this,tt,0),r(this,_,0),r(this,P,e(this,C).scrollSelector&&t.querySelector(e(this,C).scrollSelector)||window),r(this,at,e(this,P)===window),(i=e(this,P))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},Rt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Wt.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})},Et=new WeakMap,et=new WeakMap,it.instance=null;let bt=it;exports.Morph=bt;
|
|
1
|
+
"use strict";var te=Object.defineProperty,ee=Object.defineProperties;var se=Object.getOwnPropertyDescriptors;var Vt=Object.getOwnPropertySymbols;var ie=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var Ot=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),Ft=a=>{throw TypeError(a)};var Bt=(a,t,s)=>t in a?te(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,ft=(a,t)=>{for(var s in t||(t={}))ie.call(t,s)&&Bt(a,s,t[s]);if(Vt)for(var s of Vt(t))re.call(t,s)&&Bt(a,s,t[s]);return a},wt=(a,t)=>ee(a,se(t));var yt=(a,t,s)=>t.has(a)||Ft("Cannot "+s);var e=(a,t,s)=>(yt(a,t,"read from private field"),s?s.call(a):t.get(a)),o=(a,t,s)=>t.has(a)?Ft("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,s),n=(a,t,s,i)=>(yt(a,t,"write to private field"),i?i.call(a,s):t.set(a,s),s),E=(a,t,s)=>(yt(a,t,"access private method"),s);var F=(a,t,s)=>new Promise((i,h)=>{var v=f=>{try{b(s.next(f))}catch(H){h(H)}},y=f=>{try{b(s.throw(f))}catch(H){h(H)}},b=f=>f.done?i(f.value):Promise.resolve(f.value).then(v,y);b((s=s.apply(a,t)).next())});var Wt=(a,t,s)=>(t=a[Ot("asyncIterator")])?t.call(a):(a=a[Ot("iterator")](),t={},s=(i,h)=>(h=a[i])&&(t[i]=v=>new Promise((y,b,f)=>(v=h.call(a,v),f=v.done,Promise.resolve(v.value).then(H=>y({value:H,done:f}),b)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jt=require("../index-DekP7OZe.cjs"),R=require("../events-KVanG9sR.cjs"),ne=require("../polyfills-Df4r-ETT.cjs"),Xt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-DGcX4fGV.cjs"),ae=require("../css-value-parser/index.cjs");class Kt 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)}}jt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Kt);var M,l,U,rt,G;class bt{constructor(t,s){o(this,M);o(this,l);o(this,U);o(this,rt,t=>{var i;if(t.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(e(this,l).hasAttribute("data-back")&&e(this,M).previousURL)history.back();else{n(this,U,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),y=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),b=y?ae.cssValueParser.parse(y):void 0,f=e(this,l).hasAttribute("data-revalidate"),H=e(this,l).hasAttribute("data-keep-search-parameters"),gt=e(this,l).hasAttribute("data-keep-scroll-position"),Gt=e(this,l).getAttribute("data-scroll-behaviour"),ht=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(ct=>ct.trim()),c=e(this,l).hasAttribute("data-clear-state");e(this,M).navigate(e(this,U),{historyAction:h,centerScroll:v,offsetScroll:b,revalidate:f,keepSearchParameters:H,submorph:ht,clearState:c,keepScrollPosition:gt,scrollBehaviour:Gt})}});o(this,G,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,M).prefetch(e(this,U),t),e(this,l).removeEventListener("pointerenter",e(this,G))});n(this,M,s),n(this,l,t),n(this,U,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,rt)),this.checkCurrent(location.href.replace(location.origin,"")),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,G))}get element(){return e(this,l)}checkCurrent(t){var h;const s=e(this,M).normalizePath(t),i=e(this,M).normalizePath(e(this,U));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"):(h=e(this,l).getAttribute("data-associated-paths"))!=null&&h.split(",").find(v=>s.pathname.includes(v))?e(this,l).classList.add("current"):e(this,l).classList.remove("current"),s.path===i.path?e(this,l).classList.add("exact"):e(this,l).classList.remove("exact")}destroy(){e(this,l).removeEventListener("click",e(this,rt)),e(this,l).removeEventListener("pointerenter",e(this,G)),e(this,l).classList.remove("current","exact")}}M=new WeakMap,l=new WeakMap,U=new WeakMap,rt=new WeakMap,G=new WeakMap;const oe=new DOMParser;var T,W,w,k,X,D,J,Y,I,Q,nt;class Yt{constructor(t,s){o(this,T);o(this,W);o(this,w,{x:0,y:0});o(this,k,null);o(this,X,null);o(this,D,null);o(this,J,null);o(this,Y,null);o(this,I,null);o(this,Q);o(this,nt);n(this,T,t),n(this,W,s),n(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,w)}get document(){return e(this,D)}setHeaders(t){n(this,nt,t)}setInitialDocument(t){n(this,k,t.cloneNode(!0))}abort(){var t;return(t=e(this,Y))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s,i){return F(this,null,function*(){return!i&&(e(this,I)||e(this,k)&&e(this,k).documentElement.hasAttribute("data-cache")&&e(this,Q)!==t||e(this,k)&&e(this,T).isPopstateNavigation)?e(this,I):(n(this,Q,t),n(this,I,new Promise(h=>F(this,null,function*(){try{n(this,Y,new AbortController);const y=yield(yield fetch(t,{signal:e(this,Y).signal,headers:ft({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(t)},e(this,nt))})).text(),b=oe.parseFromString(y,"text/html");this.setInitialDocument(b)}catch(v){console.warn(v)}finally{n(this,Y,null),n(this,I,null),h()}}))),e(this,I))})}cloneDocument(){n(this,D,(e(this,X)||e(this,k)).cloneNode(!0))}get title(){let t="";if(e(this,D).title)t=e(this,D).title;else{const s=e(this,D).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,W)}return t}clearScrollState(){e(this,w).x=0,e(this,w).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,k).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,w).x=0,e(this,w).y=0):(e(this,w).x=e(this,T).scrollValue.left,e(this,w).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,w).y,left:e(this,w).x,behavior:"instant"})}saveDocumentState(){e(this,k).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,J,t)}clearState(){const t=e(this,J);return n(this,J,null),t}}T=new WeakMap,W=new WeakMap,w=new WeakMap,k=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,Y=new WeakMap,I=new WeakMap,Q=new WeakMap,nt=new WeakMap;var C,Z,g,z,m,j,V,O,P,at,x,K,_,tt,ot,u,Pt,lt,pt,kt,$t,Ct,Ht,Rt,Mt,Et,et;const it=class it{constructor(t){o(this,u);o(this,C,null);o(this,Z,null);o(this,g,[]);o(this,z);o(this,m,null);o(this,j);o(this,V,[]);o(this,O,!1);o(this,P,null);o(this,at,!1);o(this,x,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,ot,null);o(this,lt,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"});o(this,Et,t=>F(this,null,function*(){t.preventDefault(),n(this,O,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:e(this,ot)||void 0}),n(this,O,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),h=t-e(this,_);n(this,tt,s),n(this,_,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),R.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(jt.isBrowser&&!it.instance){it.instance=this,n(this,C,{base:st.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,Z,E(this,u,kt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);n(this,m,s);const i=new Yt(this,e(this,m).pathname);i.setInitialDocument(document),e(this,x).set(e(this,m).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,Et)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new Kt),E(this,u,Rt).call(this,document)}}get currentURL(){return e(this,m)}get previousURL(){return e(this,j)}get links(){return e(this,g)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,O)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,P).scrollTop,s=e(this,P).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,x).get(e(this,m).path);s&&s.saveState(t)}getState(){const t=e(this,x).get(e(this,m).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,C).base,trailingSlash:e(this,C).trailingSlash})}prefetch(t,s){return F(this,null,function*(){var h;if(e(this,V).length)return;t=((h=this.pathnameModifier)==null?void 0:h.call(this,t))||t;const i=E(this,u,pt).call(this,t);i==null||i.fetch(t,e(this,m).path,s)})}excludeHeadChild(t){return!1}setHeaders(t){}navigate(Gt){return F(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,scrollBehaviour:v,revalidate:y,keepSearchParameters:b,submorph:f,clearState:H,keepScrollPosition:gt}={}){var ct,Tt,xt,Nt;if(e(this,V).length)return;n(this,ot,f||null);const ht=((ct=this.pathnameModifier)==null?void 0:ct.call(this,t))||t,c=this.normalizePath(ht);if(e(this,g).forEach($=>{$.checkCurrent(c.path)}),!y&&(((Tt=e(this,z))==null?void 0:Tt.pathname)===c.pathname||e(this,m).pathname===c.pathname)){E(this,u,Mt).call(this,c.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"}),R.dispatchEvent(document,"morphSamePath",{custom:!0}),((xt=e(this,m))==null?void 0:xt.parameters)!==c.parameters&&(n(this,j,e(this,m)),n(this,m,c),st.changeHistory({action:((Nt=e(this,m))==null?void 0:Nt.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),R.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,m),previousURL:e(this,j)}}));return}n(this,z,c);try{let $=!0;if(this.preprocessor)try{yield new Promise((r,S)=>{var A;(A=this.preprocessor)==null||A.call(this,{url:c,resolve:r,reject:S,submorph:f})})}catch(r){r?console.error(r):console.log("Route change canceled"),$=!1}if(!$||e(this,z).pathname!==c.pathname){e(this,g).forEach(r=>{r.checkCurrent(e(this,m).path)});return}const qt={url:c,submorph:f};f?f.forEach(r=>{document.querySelectorAll(r).forEach(S=>{S.classList.add("out"),S.setAttribute("data-morph-out","")})}):e(this,Z).forEach(r=>{var S,A;(S=r.firstElementChild)==null||S.classList.add("out"),(A=r.firstElementChild)==null||A.setAttribute("data-morph-out","")}),R.dispatchEvent(document,"morphNavigation",{detail:qt});const vt=E(this,u,pt).call(this,e(this,m).pathname),p=E(this,u,pt).call(this,c.pathname);if(e(this,x).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield p==null?void 0:p.fetch(ht,e(this,m).path,y),e(this,z).pathname!==c.pathname){e(this,g).forEach(r=>{r.checkCurrent(e(this,m).path)});return}vt.clearState(),vt.saveScrollState(),vt.saveDocumentState(),e(this,O)||(p.clearScrollState(),p.clearDocumentState()),H&&p.clearState(),p.cloneDocument(),e(this,K).textContent=p.title,document.body.appendChild(e(this,K));const ut=wt(ft({},qt),{document:p.document});ut.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),R.dispatchEvent(document,"morphStart",{detail:ut});const Ut=Array.from(document.head.children),Dt=Array.from(p.document.head.children),It=E(this,u,$t).call(this,Ut,Dt),Jt=E(this,u,Ct).call(this,Ut,It),dt=E(this,u,Ct).call(this,Dt,It).filter(r=>!this.excludeHeadChild(r));dt.forEach((r,S)=>{r.tagName==="SCRIPT"&&(dt[S]=E(this,u,Pt).call(this,r))}),dt.forEach(r=>{document.head.appendChild(r)});const St=dt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,u,Ht).call(this,r))return!0});e(this,C).waitForHeadToLoad&&St.length&&(yield new Promise(r=>F(this,null,function*(){let S=0;try{for(var A=Wt(St),Zt,B,N;Zt=!(B=yield A.next()).done;Zt=!1){const mt=B.value;mt.onload=()=>{S++,S===St.length&&r()}}}catch(B){N=[B]}finally{try{Zt&&(B=A.return)&&(yield B.call(A))}finally{if(N)throw N[0]}}}))),yield Xt.wait(10);const zt=[];Jt.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,u,Ht).call(this,r)?zt.push(r):r.remove())});const Qt=E(this,u,kt).call(this,p.document.body);!e(this,C).morphInsideScrollContainer&&!f&&E(this,u,Rt).call(this,p.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),st.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(b?location.search:""),hash:c.hash}),e(this,K).remove(),n(this,j,e(this,m)),n(this,m,c);const Lt=[];e(this,Z).forEach((r,S)=>{const A=Qt[S],Zt=getComputedStyle(r).getPropertyValue("--morph-duration");let B=[],N=[];f?(f.forEach(d=>{const L=r.querySelector(d),q=A.querySelector(d);L&&q&&(N.push(L),B.push(q))}),N.forEach(d=>{d.parentElement&&Lt.push(d.parentElement)})):(B.push(...A.childNodes),N.push(...r.childNodes),Lt.push(r)),N.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),B.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),f?B.forEach((d,L)=>{var q;(q=N[L].parentElement)==null||q.insertBefore(d,N[L])}):r.prepend(...B),ne.requestIdleCallback(()=>{N.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),B.forEach(d=>{var L;d instanceof HTMLElement&&((L=d.parentElement)==null||L.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})});const mt=wt(ft({},ut),{morphElement:r});R.dispatchEvent(document,"morphNewChildrenAdded",{detail:mt});const _t=new Promise(d=>{setTimeout(()=>{N.forEach(L=>L.remove()),B.forEach(L=>{var q;L instanceof HTMLElement&&((q=L.parentElement)==null||q.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),R.dispatchEvent(document,"morphOldChildrenRemoved",{detail:mt}),d()},(parseFloat(Zt)||0)*1e3+10)});e(this,V).push(_t)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-p.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),R.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:p.scrollState}),c.hash?(p.clearScrollState(),E(this,u,Mt).call(this,c.hash,{centerScroll:i,offsetScroll:h,behavior:v})):e(this,O)?p.restoreScrollPosition():gt||p.renewScrollPosition(),yield Promise.all(e(this,V)),zt.forEach(r=>r.remove()),n(this,V,[]),Lt.forEach(r=>{r.querySelectorAll("script").forEach(A=>{A.replaceWith(E(this,u,Pt).call(this,A))})}),e(this,g).forEach(r=>{r.checkCurrent(e(this,m).path)}),R.dispatchEvent(document,"morphComplete",{detail:ut}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}n(this,z,void 0)})}addLink(t){e(this,g).push(new bt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,g,e(this,g).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,g,e(this,g).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,lt));e(this,g).push(...s.map(i=>new bt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,lt));e(this,g).forEach(s=>s.destroy()),n(this,g,t.map(s=>new bt(s,this)))}};C=new WeakMap,Z=new WeakMap,g=new WeakMap,z=new WeakMap,m=new WeakMap,j=new WeakMap,V=new WeakMap,O=new WeakMap,P=new WeakMap,at=new WeakMap,x=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,ot=new WeakMap,u=new WeakSet,Pt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const h=t.attributes[i];s.setAttribute(h.name,h.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},lt=new WeakMap,pt=function(t){const s=this.normalizePath(t);let i=e(this,x).get(s.pathname);return i||(i=new Yt(this,s.pathname),e(this,x).set(s.pathname,i)),i},kt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},$t=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},Ct=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},Ht=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},Rt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,et)),n(this,tt,0),n(this,_,0),n(this,P,e(this,C).scrollSelector&&t.querySelector(e(this,C).scrollSelector)||window),n(this,at,e(this,P)===window),(i=e(this,P))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},Mt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Xt.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})},Et=new WeakMap,et=new WeakMap,it.instance=null;let At=it;exports.Morph=At;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var _t = Object.defineProperty, te = Object.defineProperties;
|
|
2
|
+
var ee = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var zt = Object.getOwnPropertySymbols;
|
|
4
|
+
var se = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Vt = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Ft = (a) => {
|
|
6
6
|
throw TypeError(a);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var Ot = (a, t, s) => t in a ? _t(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s, mt = (a, t) => {
|
|
9
9
|
for (var s in t || (t = {}))
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var s of
|
|
13
|
-
|
|
10
|
+
se.call(t, s) && Ot(a, s, t[s]);
|
|
11
|
+
if (zt)
|
|
12
|
+
for (var s of zt(t))
|
|
13
|
+
ie.call(t, s) && Ot(a, s, t[s]);
|
|
14
14
|
return a;
|
|
15
|
-
},
|
|
16
|
-
var wt = (a, t, s) => t.has(a) ||
|
|
17
|
-
var e = (a, t, s) => (wt(a, t, "read from private field"), s ? s.call(a) : t.get(a)), o = (a, t, s) => t.has(a) ?
|
|
18
|
-
var
|
|
19
|
-
var
|
|
15
|
+
}, vt = (a, t) => te(a, ee(t));
|
|
16
|
+
var wt = (a, t, s) => t.has(a) || Ft("Cannot " + s);
|
|
17
|
+
var e = (a, t, s) => (wt(a, t, "read from private field"), s ? s.call(a) : t.get(a)), o = (a, t, s) => t.has(a) ? Ft("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s), n = (a, t, s, i) => (wt(a, t, "write to private field"), i ? i.call(a, s) : t.set(a, s), s), E = (a, t, s) => (wt(a, t, "access private method"), s);
|
|
18
|
+
var B = (a, t, s) => new Promise((i, h) => {
|
|
19
|
+
var S = (f) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
b(s.next(f));
|
|
22
22
|
} catch (H) {
|
|
23
23
|
h(H);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, y = (f) => {
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
b(s.throw(f));
|
|
28
28
|
} catch (H) {
|
|
29
29
|
h(H);
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
}, b = (f) => f.done ? i(f.value) : Promise.resolve(f.value).then(S, y);
|
|
32
|
+
b((s = s.apply(a, t)).next());
|
|
33
33
|
});
|
|
34
|
-
var
|
|
35
|
-
import { i as
|
|
34
|
+
var Bt = (a, t, s) => (t = a[Vt("asyncIterator")]) ? t.call(a) : (a = a[Vt("iterator")](), t = {}, s = (i, h) => (h = a[i]) && (t[i] = (S) => new Promise((y, b, f) => (S = h.call(a, S), f = S.done, Promise.resolve(S.value).then((H) => y({ value: H, done: f }), b)))), s("next"), s("return"), t);
|
|
35
|
+
import { i as Yt } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as R } from "../events-CsVF98U6.js";
|
|
37
|
-
import { r as
|
|
38
|
-
import { w as
|
|
37
|
+
import { r as re } from "../polyfills-DJrTJQky.js";
|
|
38
|
+
import { w as ne, s as ae } from "../scroll-DPkCFTxg.js";
|
|
39
39
|
import "construct-style-sheets-polyfill";
|
|
40
|
-
import { n as
|
|
41
|
-
import { cssValueParser as
|
|
42
|
-
class
|
|
40
|
+
import { n as oe, c as yt, s as le } from "../url-CFnGU6md.js";
|
|
41
|
+
import { cssValueParser as he } from "../css-value-parser/index.js";
|
|
42
|
+
class jt extends HTMLElement {
|
|
43
43
|
connectedCallback() {
|
|
44
44
|
const t = {
|
|
45
45
|
"aria-live": "assertive",
|
|
@@ -50,9 +50,9 @@ class Yt extends HTMLElement {
|
|
|
50
50
|
this.setAttribute(s, i);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
Yt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", jt);
|
|
54
54
|
var M, l, D, it, G;
|
|
55
|
-
class
|
|
55
|
+
class bt {
|
|
56
56
|
constructor(t, s) {
|
|
57
57
|
o(this, M);
|
|
58
58
|
o(this, l);
|
|
@@ -67,20 +67,23 @@ class yt {
|
|
|
67
67
|
n(this, D, e(this, l).getAttribute("href") || "/");
|
|
68
68
|
const h = e(this, l).getAttribute(
|
|
69
69
|
"data-history-action"
|
|
70
|
-
) || "push",
|
|
70
|
+
) || "push", S = e(this, l).hasAttribute("data-center-scroll"), y = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), b = y ? he.parse(y) : void 0, f = e(this, l).hasAttribute("data-revalidate"), H = e(this, l).hasAttribute(
|
|
71
71
|
"data-keep-search-parameters"
|
|
72
|
-
),
|
|
72
|
+
), Et = e(this, l).hasAttribute(
|
|
73
73
|
"data-keep-scroll-position"
|
|
74
|
+
), $t = e(this, l).getAttribute(
|
|
75
|
+
"data-scroll-behaviour"
|
|
74
76
|
), lt = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((ht) => ht.trim()), c = e(this, l).hasAttribute("data-clear-state");
|
|
75
77
|
e(this, M).navigate(e(this, D), {
|
|
76
78
|
historyAction: h,
|
|
77
|
-
centerScroll:
|
|
78
|
-
offsetScroll:
|
|
79
|
-
revalidate:
|
|
79
|
+
centerScroll: S,
|
|
80
|
+
offsetScroll: b,
|
|
81
|
+
revalidate: f,
|
|
80
82
|
keepSearchParameters: H,
|
|
81
83
|
submorph: lt,
|
|
82
84
|
clearState: c,
|
|
83
|
-
keepScrollPosition:
|
|
85
|
+
keepScrollPosition: Et,
|
|
86
|
+
scrollBehaviour: $t
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
});
|
|
@@ -96,35 +99,35 @@ class yt {
|
|
|
96
99
|
checkCurrent(t) {
|
|
97
100
|
var h;
|
|
98
101
|
const s = e(this, M).normalizePath(t), i = e(this, M).normalizePath(e(this, D));
|
|
99
|
-
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") : (h = e(this, l).getAttribute("data-associated-paths")) != null && h.split(",").find((
|
|
102
|
+
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") : (h = e(this, l).getAttribute("data-associated-paths")) != null && h.split(",").find((S) => s.pathname.includes(S)) ? e(this, l).classList.add("current") : e(this, l).classList.remove("current"), s.path === i.path ? e(this, l).classList.add("exact") : e(this, l).classList.remove("exact");
|
|
100
103
|
}
|
|
101
104
|
destroy() {
|
|
102
|
-
e(this, l).removeEventListener("click", e(this, it)), e(this, l).removeEventListener("pointerenter", e(this, G)), e(this, l).classList.remove("current");
|
|
105
|
+
e(this, l).removeEventListener("click", e(this, it)), e(this, l).removeEventListener("pointerenter", e(this, G)), e(this, l).classList.remove("current", "exact");
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
M = new WeakMap(), l = new WeakMap(), D = new WeakMap(), it = new WeakMap(), G = new WeakMap();
|
|
106
|
-
const
|
|
107
|
-
var T,
|
|
109
|
+
const ce = new DOMParser();
|
|
110
|
+
var T, W, w, k, X, I, J, Y, q, Q, rt;
|
|
108
111
|
class Wt {
|
|
109
112
|
constructor(t, s) {
|
|
110
113
|
o(this, T);
|
|
111
|
-
o(this,
|
|
112
|
-
o(this,
|
|
114
|
+
o(this, W);
|
|
115
|
+
o(this, w, { x: 0, y: 0 });
|
|
113
116
|
o(this, k, null);
|
|
114
|
-
o(this,
|
|
117
|
+
o(this, X, null);
|
|
115
118
|
o(this, I, null);
|
|
116
119
|
o(this, J, null);
|
|
117
120
|
o(this, Y, null);
|
|
118
121
|
o(this, q, null);
|
|
119
122
|
o(this, Q);
|
|
120
123
|
o(this, rt);
|
|
121
|
-
n(this, T, t), n(this,
|
|
124
|
+
n(this, T, t), n(this, W, s), n(this, Q, s);
|
|
122
125
|
}
|
|
123
126
|
get pathname() {
|
|
124
|
-
return e(this,
|
|
127
|
+
return e(this, W);
|
|
125
128
|
}
|
|
126
129
|
get scrollState() {
|
|
127
|
-
return e(this,
|
|
130
|
+
return e(this, w);
|
|
128
131
|
}
|
|
129
132
|
get document() {
|
|
130
133
|
return e(this, I);
|
|
@@ -138,25 +141,25 @@ class Wt {
|
|
|
138
141
|
abort() {
|
|
139
142
|
var t;
|
|
140
143
|
return (t = e(this, Y)) == null ? void 0 : t.abort(
|
|
141
|
-
`[${e(this,
|
|
144
|
+
`[${e(this, W)}] page loading cancelled`
|
|
142
145
|
);
|
|
143
146
|
}
|
|
144
147
|
fetch(t, s, i) {
|
|
145
|
-
return
|
|
146
|
-
return !i && (e(this, q) || e(this, k) && e(this, k).documentElement.hasAttribute("data-cache") && e(this, Q) !== t || e(this, k) && e(this, T).isPopstateNavigation) ? e(this, q) : (n(this, Q, t), n(this, q, new Promise((h) =>
|
|
148
|
+
return B(this, null, function* () {
|
|
149
|
+
return !i && (e(this, q) || e(this, k) && e(this, k).documentElement.hasAttribute("data-cache") && e(this, Q) !== t || e(this, k) && e(this, T).isPopstateNavigation) ? e(this, q) : (n(this, Q, t), n(this, q, new Promise((h) => B(this, null, function* () {
|
|
147
150
|
try {
|
|
148
151
|
n(this, Y, new AbortController());
|
|
149
|
-
const
|
|
152
|
+
const y = yield (yield fetch(t, {
|
|
150
153
|
signal: e(this, Y).signal,
|
|
151
154
|
headers: mt({
|
|
152
155
|
"X-MORPH": "true",
|
|
153
156
|
"X-MORPH-CURRENT-PATH": encodeURIComponent(s),
|
|
154
157
|
"X-MORPH-NEW-PATH": encodeURIComponent(t)
|
|
155
158
|
}, e(this, rt))
|
|
156
|
-
})).text(),
|
|
157
|
-
this.setInitialDocument(
|
|
158
|
-
} catch (
|
|
159
|
-
console.warn(
|
|
159
|
+
})).text(), b = ce.parseFromString(y, "text/html");
|
|
160
|
+
this.setInitialDocument(b);
|
|
161
|
+
} catch (S) {
|
|
162
|
+
console.warn(S);
|
|
160
163
|
} finally {
|
|
161
164
|
n(this, Y, null), n(this, q, null), h();
|
|
162
165
|
}
|
|
@@ -164,7 +167,7 @@ class Wt {
|
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
169
|
cloneDocument() {
|
|
167
|
-
n(this, I, (e(this,
|
|
170
|
+
n(this, I, (e(this, X) || e(this, k)).cloneNode(!0));
|
|
168
171
|
}
|
|
169
172
|
get title() {
|
|
170
173
|
let t = "";
|
|
@@ -172,32 +175,32 @@ class Wt {
|
|
|
172
175
|
t = e(this, I).title;
|
|
173
176
|
else {
|
|
174
177
|
const s = e(this, I).querySelector("h1");
|
|
175
|
-
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this,
|
|
178
|
+
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, W);
|
|
176
179
|
}
|
|
177
180
|
return t;
|
|
178
181
|
}
|
|
179
182
|
clearScrollState() {
|
|
180
|
-
e(this,
|
|
183
|
+
e(this, w).x = 0, e(this, w).y = 0;
|
|
181
184
|
}
|
|
182
185
|
clearDocumentState() {
|
|
183
|
-
n(this,
|
|
186
|
+
n(this, X, null);
|
|
184
187
|
}
|
|
185
188
|
saveScrollState() {
|
|
186
189
|
e(this, k).documentElement.hasAttribute(
|
|
187
190
|
"data-no-scroll-restoration"
|
|
188
|
-
) ? (e(this,
|
|
191
|
+
) ? (e(this, w).x = 0, e(this, w).y = 0) : (e(this, w).x = e(this, T).scrollValue.left, e(this, w).y = e(this, T).scrollValue.top);
|
|
189
192
|
}
|
|
190
193
|
restoreScrollPosition() {
|
|
191
194
|
e(this, T).scrollElement.scroll({
|
|
192
|
-
top: e(this,
|
|
193
|
-
left: e(this,
|
|
195
|
+
top: e(this, w).y,
|
|
196
|
+
left: e(this, w).x,
|
|
194
197
|
behavior: "instant"
|
|
195
198
|
});
|
|
196
199
|
}
|
|
197
200
|
saveDocumentState() {
|
|
198
201
|
e(this, k).documentElement.hasAttribute(
|
|
199
202
|
"data-no-page-restoration"
|
|
200
|
-
) ? n(this,
|
|
203
|
+
) ? n(this, X, null) : n(this, X, document.cloneNode(!0));
|
|
201
204
|
}
|
|
202
205
|
renewScrollPosition() {
|
|
203
206
|
e(this, T).scrollElement.scroll({
|
|
@@ -214,20 +217,20 @@ class Wt {
|
|
|
214
217
|
return n(this, J, null), t;
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
|
-
T = new WeakMap(),
|
|
218
|
-
var C, Z,
|
|
220
|
+
T = new WeakMap(), W = new WeakMap(), w = new WeakMap(), k = new WeakMap(), X = new WeakMap(), I = new WeakMap(), J = new WeakMap(), Y = new WeakMap(), q = new WeakMap(), Q = new WeakMap(), rt = new WeakMap();
|
|
221
|
+
var C, Z, g, z, m, j, V, O, P, nt, x, K, _, tt, at, u, At, ot, ft, Pt, Kt, kt, Ct, Ht, Rt, pt, et;
|
|
219
222
|
const st = class st {
|
|
220
223
|
constructor(t) {
|
|
221
224
|
o(this, u);
|
|
222
225
|
o(this, C, null);
|
|
223
226
|
o(this, Z, null);
|
|
224
|
-
o(this,
|
|
227
|
+
o(this, g, []);
|
|
225
228
|
o(this, z);
|
|
226
229
|
o(this, m, null);
|
|
227
230
|
o(this, j);
|
|
228
231
|
o(this, V, []);
|
|
229
232
|
o(this, O, !1);
|
|
230
|
-
o(this,
|
|
233
|
+
o(this, P, null);
|
|
231
234
|
o(this, nt, !1);
|
|
232
235
|
o(this, x, /* @__PURE__ */ new Map());
|
|
233
236
|
o(this, K, null);
|
|
@@ -238,7 +241,7 @@ const st = class st {
|
|
|
238
241
|
var s;
|
|
239
242
|
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";
|
|
240
243
|
});
|
|
241
|
-
o(this, pt, (t) =>
|
|
244
|
+
o(this, pt, (t) => B(this, null, function* () {
|
|
242
245
|
t.preventDefault(), n(this, O, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
243
246
|
historyAction: "none",
|
|
244
247
|
submorph: e(this, at) || void 0
|
|
@@ -265,16 +268,16 @@ const st = class st {
|
|
|
265
268
|
}
|
|
266
269
|
});
|
|
267
270
|
});
|
|
268
|
-
if (
|
|
271
|
+
if (Yt && !st.instance) {
|
|
269
272
|
st.instance = this, n(this, C, {
|
|
270
|
-
base:
|
|
273
|
+
base: oe(t == null ? void 0 : t.base),
|
|
271
274
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
272
275
|
trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
|
|
273
276
|
scrollSelector: t == null ? void 0 : t.scrollSelector,
|
|
274
277
|
morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
|
|
275
|
-
}), n(this, Z, E(this, u,
|
|
278
|
+
}), n(this, Z, E(this, u, Pt).call(this, document.body));
|
|
276
279
|
const s = this.normalizePath(
|
|
277
|
-
location.pathname + location.
|
|
280
|
+
location.pathname + location.search + location.hash
|
|
278
281
|
);
|
|
279
282
|
n(this, m, s);
|
|
280
283
|
const i = new Wt(this, e(this, m).pathname);
|
|
@@ -284,12 +287,12 @@ const st = class st {
|
|
|
284
287
|
), document.documentElement.setAttribute(
|
|
285
288
|
"data-current-leaf",
|
|
286
289
|
s.leaf
|
|
287
|
-
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, pt)),
|
|
290
|
+
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, pt)), yt({
|
|
288
291
|
action: "replace",
|
|
289
292
|
pathname: s.pathname,
|
|
290
293
|
searchParameters: s.parameters,
|
|
291
294
|
hash: s.hash
|
|
292
|
-
}), n(this, K, new
|
|
295
|
+
}), n(this, K, new jt()), E(this, u, Ht).call(this, document);
|
|
293
296
|
}
|
|
294
297
|
}
|
|
295
298
|
get currentURL() {
|
|
@@ -299,17 +302,17 @@ const st = class st {
|
|
|
299
302
|
return e(this, j);
|
|
300
303
|
}
|
|
301
304
|
get links() {
|
|
302
|
-
return e(this,
|
|
305
|
+
return e(this, g);
|
|
303
306
|
}
|
|
304
307
|
get scrollElement() {
|
|
305
|
-
return e(this,
|
|
308
|
+
return e(this, P);
|
|
306
309
|
}
|
|
307
310
|
get isPopstateNavigation() {
|
|
308
311
|
return e(this, O);
|
|
309
312
|
}
|
|
310
313
|
get scrollValue() {
|
|
311
314
|
let t = 0, s = 0;
|
|
312
|
-
return e(this, nt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this,
|
|
315
|
+
return e(this, nt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, P).scrollTop, s = e(this, P).scrollLeft), { top: t, left: s };
|
|
313
316
|
}
|
|
314
317
|
saveState(t) {
|
|
315
318
|
const s = e(this, x).get(e(this, m).path);
|
|
@@ -320,13 +323,13 @@ const st = class st {
|
|
|
320
323
|
return t == null ? void 0 : t.clearState();
|
|
321
324
|
}
|
|
322
325
|
normalizePath(t) {
|
|
323
|
-
return
|
|
326
|
+
return le(t, {
|
|
324
327
|
base: e(this, C).base,
|
|
325
328
|
trailingSlash: e(this, C).trailingSlash
|
|
326
329
|
});
|
|
327
330
|
}
|
|
328
331
|
prefetch(t, s) {
|
|
329
|
-
return
|
|
332
|
+
return B(this, null, function* () {
|
|
330
333
|
var h;
|
|
331
334
|
if (e(this, V).length)
|
|
332
335
|
return;
|
|
@@ -340,33 +343,34 @@ const st = class st {
|
|
|
340
343
|
}
|
|
341
344
|
setHeaders(t) {
|
|
342
345
|
}
|
|
343
|
-
navigate(
|
|
344
|
-
return
|
|
346
|
+
navigate($t) {
|
|
347
|
+
return B(this, arguments, function* (t, {
|
|
345
348
|
historyAction: s = "push",
|
|
346
349
|
centerScroll: i,
|
|
347
350
|
offsetScroll: h,
|
|
348
|
-
|
|
349
|
-
|
|
351
|
+
scrollBehaviour: S,
|
|
352
|
+
revalidate: y,
|
|
353
|
+
keepSearchParameters: b,
|
|
350
354
|
submorph: f,
|
|
351
|
-
clearState:
|
|
352
|
-
keepScrollPosition:
|
|
355
|
+
clearState: H,
|
|
356
|
+
keepScrollPosition: Et
|
|
353
357
|
} = {}) {
|
|
354
|
-
var ht,
|
|
358
|
+
var ht, Mt, Tt, xt;
|
|
355
359
|
if (e(this, V).length)
|
|
356
360
|
return;
|
|
357
361
|
n(this, at, f || null);
|
|
358
362
|
const lt = ((ht = this.pathnameModifier) == null ? void 0 : ht.call(this, t)) || t, c = this.normalizePath(lt);
|
|
359
|
-
if (e(this,
|
|
363
|
+
if (e(this, g).forEach(($) => {
|
|
360
364
|
$.checkCurrent(c.path);
|
|
361
|
-
}), !
|
|
362
|
-
E(this, u,
|
|
365
|
+
}), !y && (((Mt = e(this, z)) == null ? void 0 : Mt.pathname) === c.pathname || e(this, m).pathname === c.pathname)) {
|
|
366
|
+
E(this, u, Rt).call(this, c.hash || 0, {
|
|
363
367
|
centerScroll: i,
|
|
364
368
|
offsetScroll: h,
|
|
365
369
|
behavior: "smooth"
|
|
366
370
|
}), R(document, "morphSamePath", {
|
|
367
371
|
custom: !0
|
|
368
|
-
}), ((
|
|
369
|
-
action: ((
|
|
372
|
+
}), ((Tt = e(this, m)) == null ? void 0 : Tt.parameters) !== c.parameters && (n(this, j, e(this, m)), n(this, m, c), yt({
|
|
373
|
+
action: ((xt = e(this, m)) == null ? void 0 : xt.hash) !== c.hash ? "replace" : s,
|
|
370
374
|
pathname: c.pathname,
|
|
371
375
|
searchParameters: c.parameters,
|
|
372
376
|
hash: c.hash
|
|
@@ -384,8 +388,8 @@ const st = class st {
|
|
|
384
388
|
if (this.preprocessor)
|
|
385
389
|
try {
|
|
386
390
|
yield new Promise((r, L) => {
|
|
387
|
-
var
|
|
388
|
-
(
|
|
391
|
+
var A;
|
|
392
|
+
(A = this.preprocessor) == null || A.call(this, {
|
|
389
393
|
url: c,
|
|
390
394
|
resolve: r,
|
|
391
395
|
reject: L,
|
|
@@ -396,12 +400,12 @@ const st = class st {
|
|
|
396
400
|
r ? console.error(r) : console.log("Route change canceled"), $ = !1;
|
|
397
401
|
}
|
|
398
402
|
if (!$ || e(this, z).pathname !== c.pathname) {
|
|
399
|
-
e(this,
|
|
403
|
+
e(this, g).forEach((r) => {
|
|
400
404
|
r.checkCurrent(e(this, m).path);
|
|
401
405
|
});
|
|
402
406
|
return;
|
|
403
407
|
}
|
|
404
|
-
const
|
|
408
|
+
const Nt = {
|
|
405
409
|
url: c,
|
|
406
410
|
submorph: f
|
|
407
411
|
};
|
|
@@ -410,22 +414,22 @@ const st = class st {
|
|
|
410
414
|
L.classList.add("out"), L.setAttribute("data-morph-out", "");
|
|
411
415
|
});
|
|
412
416
|
}) : e(this, Z).forEach((r) => {
|
|
413
|
-
var L,
|
|
414
|
-
(L = r.firstElementChild) == null || L.classList.add("out"), (
|
|
417
|
+
var L, A;
|
|
418
|
+
(L = r.firstElementChild) == null || L.classList.add("out"), (A = r.firstElementChild) == null || A.setAttribute("data-morph-out", "");
|
|
415
419
|
}), R(document, "morphNavigation", {
|
|
416
|
-
detail:
|
|
420
|
+
detail: Nt
|
|
417
421
|
});
|
|
418
|
-
const
|
|
422
|
+
const gt = E(this, u, ft).call(this, e(this, m).pathname), p = E(this, u, ft).call(this, c.pathname);
|
|
419
423
|
if (e(this, x).forEach((r) => {
|
|
420
424
|
r.pathname !== c.pathname && r.abort();
|
|
421
|
-
}), yield p == null ? void 0 : p.fetch(lt, e(this, m).path,
|
|
422
|
-
e(this,
|
|
425
|
+
}), yield p == null ? void 0 : p.fetch(lt, e(this, m).path, y), e(this, z).pathname !== c.pathname) {
|
|
426
|
+
e(this, g).forEach((r) => {
|
|
423
427
|
r.checkCurrent(e(this, m).path);
|
|
424
428
|
});
|
|
425
429
|
return;
|
|
426
430
|
}
|
|
427
|
-
|
|
428
|
-
const ct =
|
|
431
|
+
gt.clearState(), gt.saveScrollState(), gt.saveDocumentState(), e(this, O) || (p.clearScrollState(), p.clearDocumentState()), H && p.clearState(), p.cloneDocument(), e(this, K).textContent = p.title, document.body.appendChild(e(this, K));
|
|
432
|
+
const ct = vt(mt({}, Nt), {
|
|
429
433
|
document: p.document
|
|
430
434
|
});
|
|
431
435
|
ct.document.querySelectorAll("[data-morph-out]").forEach((r) => {
|
|
@@ -433,65 +437,65 @@ const st = class st {
|
|
|
433
437
|
}), R(document, "morphStart", {
|
|
434
438
|
detail: ct
|
|
435
439
|
});
|
|
436
|
-
const
|
|
440
|
+
const Ut = Array.from(document.head.children), Dt = Array.from(p.document.head.children), It = E(this, u, Kt).call(this, Ut, Dt), Gt = E(this, u, kt).call(this, Ut, It), ut = E(this, u, kt).call(this, Dt, It).filter((r) => !this.excludeHeadChild(r));
|
|
437
441
|
ut.forEach((r, L) => {
|
|
438
|
-
r.tagName === "SCRIPT" && (ut[L] = E(this, u,
|
|
442
|
+
r.tagName === "SCRIPT" && (ut[L] = E(this, u, At).call(this, r));
|
|
439
443
|
}), ut.forEach((r) => {
|
|
440
444
|
document.head.appendChild(r);
|
|
441
445
|
});
|
|
442
|
-
const
|
|
446
|
+
const St = ut.filter((r) => {
|
|
443
447
|
if (r.hasAttribute("data-no-waiting"))
|
|
444
448
|
return !1;
|
|
445
|
-
if (E(this, u,
|
|
449
|
+
if (E(this, u, Ct).call(this, r))
|
|
446
450
|
return !0;
|
|
447
451
|
});
|
|
448
|
-
e(this, C).waitForHeadToLoad &&
|
|
452
|
+
e(this, C).waitForHeadToLoad && St.length && (yield new Promise((r) => B(this, null, function* () {
|
|
449
453
|
let L = 0;
|
|
450
454
|
try {
|
|
451
|
-
for (var
|
|
455
|
+
for (var A = Bt(St), Qt, F, N; Qt = !(F = yield A.next()).done; Qt = !1) {
|
|
452
456
|
const dt = F.value;
|
|
453
457
|
dt.onload = () => {
|
|
454
|
-
L++, L ===
|
|
458
|
+
L++, L === St.length && r();
|
|
455
459
|
};
|
|
456
460
|
}
|
|
457
461
|
} catch (F) {
|
|
458
462
|
N = [F];
|
|
459
463
|
} finally {
|
|
460
464
|
try {
|
|
461
|
-
|
|
465
|
+
Qt && (F = A.return) && (yield F.call(A));
|
|
462
466
|
} finally {
|
|
463
467
|
if (N)
|
|
464
468
|
throw N[0];
|
|
465
469
|
}
|
|
466
470
|
}
|
|
467
|
-
}))), yield
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
r.hasAttribute("data-permanent") || (E(this, u,
|
|
471
|
+
}))), yield ne(10);
|
|
472
|
+
const qt = [];
|
|
473
|
+
Gt.forEach((r) => {
|
|
474
|
+
r.hasAttribute("data-permanent") || (E(this, u, Ct).call(this, r) ? qt.push(r) : r.remove());
|
|
471
475
|
});
|
|
472
|
-
const
|
|
473
|
-
!e(this, C).morphInsideScrollContainer && !f && E(this, u,
|
|
476
|
+
const Jt = E(this, u, Pt).call(this, p.document.body);
|
|
477
|
+
!e(this, C).morphInsideScrollContainer && !f && E(this, u, Ht).call(this, p.document), document.documentElement.setAttribute(
|
|
474
478
|
"data-current-pathname",
|
|
475
479
|
c.pathname
|
|
476
480
|
), document.documentElement.setAttribute(
|
|
477
481
|
"data-current-leaf",
|
|
478
482
|
c.leaf
|
|
479
|
-
),
|
|
483
|
+
), yt({
|
|
480
484
|
action: s,
|
|
481
485
|
pathname: c.pathname,
|
|
482
|
-
searchParameters: c.parameters || (
|
|
486
|
+
searchParameters: c.parameters || (b ? location.search : ""),
|
|
483
487
|
hash: c.hash
|
|
484
488
|
}), e(this, K).remove(), n(this, j, e(this, m)), n(this, m, c);
|
|
485
|
-
const
|
|
489
|
+
const Lt = [];
|
|
486
490
|
e(this, Z).forEach((r, L) => {
|
|
487
|
-
const
|
|
491
|
+
const A = Jt[L], Qt = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
488
492
|
let F = [], N = [];
|
|
489
493
|
f ? (f.forEach((d) => {
|
|
490
|
-
const v = r.querySelector(d), U =
|
|
494
|
+
const v = r.querySelector(d), U = A.querySelector(d);
|
|
491
495
|
v && U && (N.push(v), F.push(U));
|
|
492
496
|
}), N.forEach((d) => {
|
|
493
|
-
d.parentElement &&
|
|
494
|
-
})) : (F.push(...
|
|
497
|
+
d.parentElement && Lt.push(d.parentElement);
|
|
498
|
+
})) : (F.push(...A.childNodes), N.push(...r.childNodes), Lt.push(r)), N.forEach((d) => {
|
|
495
499
|
d instanceof HTMLElement && (this.destroyOldLinks(d), d.classList.add("old"));
|
|
496
500
|
}), F.forEach((d) => {
|
|
497
501
|
d instanceof HTMLElement && (this.findNewLinks(d), d.classList.add("new"));
|
|
@@ -501,7 +505,7 @@ const st = class st {
|
|
|
501
505
|
d,
|
|
502
506
|
N[v]
|
|
503
507
|
);
|
|
504
|
-
}) : r.prepend(...F),
|
|
508
|
+
}) : r.prepend(...F), re(() => {
|
|
505
509
|
N.forEach((d) => {
|
|
506
510
|
d instanceof HTMLElement && d.classList.add("old-idle");
|
|
507
511
|
}), F.forEach((d) => {
|
|
@@ -512,13 +516,13 @@ const st = class st {
|
|
|
512
516
|
), d.classList.add("new-idle"));
|
|
513
517
|
});
|
|
514
518
|
});
|
|
515
|
-
const dt =
|
|
519
|
+
const dt = vt(mt({}, ct), {
|
|
516
520
|
morphElement: r
|
|
517
521
|
});
|
|
518
522
|
R(document, "morphNewChildrenAdded", {
|
|
519
523
|
detail: dt
|
|
520
524
|
});
|
|
521
|
-
const
|
|
525
|
+
const Zt = new Promise((d) => {
|
|
522
526
|
setTimeout(() => {
|
|
523
527
|
N.forEach((v) => v.remove()), F.forEach((v) => {
|
|
524
528
|
var U;
|
|
@@ -528,9 +532,9 @@ const st = class st {
|
|
|
528
532
|
}), R(document, "morphOldChildrenRemoved", {
|
|
529
533
|
detail: dt
|
|
530
534
|
}), d();
|
|
531
|
-
}, (parseFloat(
|
|
535
|
+
}, (parseFloat(Qt) || 0) * 1e3 + 10);
|
|
532
536
|
});
|
|
533
|
-
e(this, V).push(
|
|
537
|
+
e(this, V).push(Zt);
|
|
534
538
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
535
539
|
"--new-document-scroll-position",
|
|
536
540
|
(this.scrollValue.top - p.scrollState.y) * 1 + "px"
|
|
@@ -539,14 +543,15 @@ const st = class st {
|
|
|
539
543
|
this.scrollValue.top + "px"
|
|
540
544
|
), R(document, "morphBeforeNavigationScroll", {
|
|
541
545
|
detail: p.scrollState
|
|
542
|
-
}), c.hash ? (p.clearScrollState(), E(this, u,
|
|
546
|
+
}), c.hash ? (p.clearScrollState(), E(this, u, Rt).call(this, c.hash, {
|
|
543
547
|
centerScroll: i,
|
|
544
|
-
offsetScroll: h
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
+
offsetScroll: h,
|
|
549
|
+
behavior: S
|
|
550
|
+
})) : e(this, O) ? p.restoreScrollPosition() : Et || p.renewScrollPosition(), yield Promise.all(e(this, V)), qt.forEach((r) => r.remove()), n(this, V, []), Lt.forEach((r) => {
|
|
551
|
+
r.querySelectorAll("script").forEach((A) => {
|
|
552
|
+
A.replaceWith(E(this, u, At).call(this, A));
|
|
548
553
|
});
|
|
549
|
-
}), e(this,
|
|
554
|
+
}), e(this, g).forEach((r) => {
|
|
550
555
|
r.checkCurrent(e(this, m).path);
|
|
551
556
|
}), R(document, "morphComplete", {
|
|
552
557
|
detail: ct
|
|
@@ -560,7 +565,7 @@ const st = class st {
|
|
|
560
565
|
});
|
|
561
566
|
}
|
|
562
567
|
addLink(t) {
|
|
563
|
-
e(this,
|
|
568
|
+
e(this, g).push(new bt(t, this));
|
|
564
569
|
}
|
|
565
570
|
addLinks(t) {
|
|
566
571
|
t.forEach((s) => {
|
|
@@ -568,27 +573,27 @@ const st = class st {
|
|
|
568
573
|
});
|
|
569
574
|
}
|
|
570
575
|
removeLink(t) {
|
|
571
|
-
n(this,
|
|
576
|
+
n(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
572
577
|
}
|
|
573
578
|
destroyOldLinks(t) {
|
|
574
|
-
n(this,
|
|
579
|
+
n(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
575
580
|
}
|
|
576
581
|
findNewLinks(t) {
|
|
577
582
|
const s = [...t.querySelectorAll("a")].filter(
|
|
578
583
|
e(this, ot)
|
|
579
584
|
);
|
|
580
|
-
e(this,
|
|
581
|
-
...s.map((i) => new
|
|
585
|
+
e(this, g).push(
|
|
586
|
+
...s.map((i) => new bt(i, this))
|
|
582
587
|
);
|
|
583
588
|
}
|
|
584
589
|
findLinks() {
|
|
585
590
|
const t = [
|
|
586
591
|
...document.documentElement.querySelectorAll("a")
|
|
587
592
|
].filter(e(this, ot));
|
|
588
|
-
e(this,
|
|
593
|
+
e(this, g).forEach((s) => s.destroy()), n(this, g, t.map((s) => new bt(s, this)));
|
|
589
594
|
}
|
|
590
595
|
};
|
|
591
|
-
C = new WeakMap(), Z = new WeakMap(),
|
|
596
|
+
C = new WeakMap(), Z = new WeakMap(), g = new WeakMap(), z = new WeakMap(), m = new WeakMap(), j = new WeakMap(), V = new WeakMap(), O = new WeakMap(), P = new WeakMap(), nt = new WeakMap(), x = new WeakMap(), K = new WeakMap(), _ = new WeakMap(), tt = new WeakMap(), at = new WeakMap(), u = new WeakSet(), At = function(t) {
|
|
592
597
|
const s = document.createElement("script");
|
|
593
598
|
for (let i = 0; i < t.attributes.length; i++) {
|
|
594
599
|
const h = t.attributes[i];
|
|
@@ -599,33 +604,33 @@ C = new WeakMap(), Z = new WeakMap(), S = new WeakMap(), z = new WeakMap(), m =
|
|
|
599
604
|
const s = this.normalizePath(t);
|
|
600
605
|
let i = e(this, x).get(s.pathname);
|
|
601
606
|
return i || (i = new Wt(this, s.pathname), e(this, x).set(s.pathname, i)), i;
|
|
602
|
-
},
|
|
607
|
+
}, Pt = function(t) {
|
|
603
608
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
604
609
|
return s.length ? s : [t];
|
|
605
|
-
},
|
|
610
|
+
}, Kt = function(t, s) {
|
|
606
611
|
return t.filter(
|
|
607
612
|
(i) => s.find(
|
|
608
613
|
(h) => h.outerHTML === i.outerHTML
|
|
609
614
|
)
|
|
610
615
|
);
|
|
611
|
-
},
|
|
616
|
+
}, kt = function(t, s) {
|
|
612
617
|
return t.filter(
|
|
613
618
|
(i) => !s.find(
|
|
614
619
|
(h) => h.outerHTML === i.outerHTML
|
|
615
620
|
)
|
|
616
621
|
);
|
|
617
|
-
}, kt = function(t) {
|
|
618
|
-
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
619
622
|
}, Ct = function(t) {
|
|
623
|
+
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
624
|
+
}, Ht = function(t) {
|
|
620
625
|
var s, i;
|
|
621
|
-
(s = e(this,
|
|
626
|
+
(s = e(this, P)) == null || s.removeEventListener(
|
|
622
627
|
"scroll",
|
|
623
628
|
e(this, et)
|
|
624
|
-
), n(this, tt, 0), n(this, _, 0), n(this,
|
|
625
|
-
},
|
|
629
|
+
), n(this, tt, 0), n(this, _, 0), n(this, P, e(this, C).scrollSelector && t.querySelector(e(this, C).scrollSelector) || window), n(this, nt, e(this, P) === window), (i = e(this, P)) == null || i.addEventListener("scroll", e(this, et)), e(this, et).call(this);
|
|
630
|
+
}, Rt = function(t, s) {
|
|
626
631
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
627
|
-
(typeof i == "number" || i) &&
|
|
628
|
-
scrollElement: e(this,
|
|
632
|
+
(typeof i == "number" || i) && ae(i, {
|
|
633
|
+
scrollElement: e(this, P),
|
|
629
634
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
630
635
|
center: s == null ? void 0 : s.centerScroll,
|
|
631
636
|
offset: s == null ? void 0 : s.offsetScroll
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var oe=l=>{throw TypeError(l)};var ee=(l,n,t)=>n.has(l)||oe("Cannot "+t);var e=(l,n,t)=>(ee(l,n,"read from private field"),t?t.call(l):n.get(l)),r=(l,n,t)=>n.has(l)?oe("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(l):n.set(l,t),o=(l,n,t,s)=>(ee(l,n,"write to private field"),s?s.call(l,t):n.set(l,t),t),p=(l,n,t)=>(ee(l,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("../element-linked-store/index.cjs"),E=require("../css-property/index.cjs"),ie=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),pe=require("../function-MthRj-GJ.cjs"),ne=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const he=require("../url-YEESIcRn.cjs"),le=require("../window-resizer/index.cjs"),Q=require("../Viewport-DB0qAZPJ.cjs");var d,w,_,N;class de{constructor(){r(this,d,new Map);r(this,w,[]);r(this,_,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(re=>re instanceof HTMLElement&&re.hasAttribute("data-popover-content")))return;const c=i[0],f=c instanceof Node&&(t.contains(c)||((s=t.shadowRoot)==null?void 0:s.contains(c))),F=c instanceof HTMLElement&&c.hasAttribute("data-outside");(!f||F)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,_)),addEventListener("keydown",e(this,N))}get groups(){return e(this,d)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,d).forEach(i=>{i.forEach(c=>{c.close()})});else if(t.closeRestInGroup.current){let i=e(this,d).get(n);i==null||i.forEach(c=>{c.close()})}let s=e(this,d).get(n);s!=null&&s.length||(s=[],e(this,d).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,d).forEach(i=>{i.forEach(c=>s.push(c))}),e(this,d).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,d).get(n);e(this,d).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,d).get(n);s&&(s=s.filter(i=>i!==t),e(this,d).set(n,s))}}}d=new WeakMap,w=new WeakMap,_=new WeakMap,N=new WeakMap;var v,z,B,k,H,m,T,A,x,b,R,q,C,y,$,a,V,W,u,ce,L,Z,G,O,j,X,D;const S=class S extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,z);r(this,B);r(this,k);r(this,H);r(this,m);r(this,T);r(this,A);r(this,x);r(this,b);r(this,R);r(this,q);r(this,C);r(this,y);r(this,$);r(this,a);r(this,V);r(this,W);r(this,G);r(this,O);r(this,j);r(this,X);r(this,D);this.urlValue="",o(this,v,!1),o(this,m,new E.CSSProperty(this,"--history",!1)),o(this,T,new E.CSSProperty(this,"--restore",!1)),o(this,A,new E.CSSProperty(this,"--close-rest",!1)),o(this,x,new E.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new E.CSSProperty(this,"--group","")),o(this,R,new E.CSSProperty(this,"--click-outside",!1)),o(this,q,new E.CSSProperty(this,"--escape",!1)),o(this,C,new E.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,y,!0),o(this,a,new ue.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,V,[]),o(this,W,[]),o(this,G,()=>{o(this,y,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)}),o(this,O,()=>{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,j).call(this)}),o(this,j,pe.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,C).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Q.viewport.width?s=Q.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Q.viewport.height?i=Q.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")}}),o(this,D,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(S.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=S.stack.groups.get(this.group.current),i=s==null?void 0:s.find(c=>c.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,b)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,v)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&he.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,z)),clearTimeout(e(this,B)),p(this,u,L).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),M.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,m).current&&e(this,y)&&history.pushState(history.state,"",e(this,u,ce)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{S.stack.add(e(this,b).current,this),e(this,W).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,L).call(this,!0,this.openClass),e(this,a).set("opened",!0),M.dispatchEvent(window,"resize"),M.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,k,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0),M.dispatchEvent(this,"popoverTransitionend")},ne.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,k,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,k)),clearTimeout(e(this,H)),S.stack.remove(e(this,b).current,this),p(this,u,Z).call(this),o(this,z,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!0,this.closingClass),M.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,L).call(this,!1,this.closingClass),M.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},ne.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,V,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,V).forEach(t=>{t.addEventListener("click",e(this,D))}),o(this,W,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,A).observe(),e(this,x).observe(),e(this,b).observe(),e(this,R).observe(),e(this,q).observe(),e(this,C).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,G)),setTimeout(()=>{e(this,T).current?(o(this,y,!1),this.urlValue=he.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)):(p(this,u,Z).call(this),o(this,y,!0))},0),e(this,C).subscribe(()=>{e(this,O).call(this)}),le.windowResizer.subscribe(e(this,O))}disconnectedCallback(){e(this,V).forEach(t=>{t.removeEventListener("click",e(this,D))}),S.stack.remove(e(this,b).current,this),le.windowResizer.unsubscribe(e(this,O)),e(this,m).close(),e(this,T).close(),e(this,A).close(),e(this,x).close(),e(this,b).close(),e(this,R).close(),e(this,q).close(),e(this,C).close(),this.removeAttribute("role"),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!1,this.closingClass),clearTimeout(e(this,z)),clearTimeout(e(this,B)),clearTimeout(e(this,k)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,G)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,Z).call(this)}};v=new WeakMap,z=new WeakMap,B=new WeakMap,k=new WeakMap,H=new WeakMap,m=new WeakMap,T=new WeakMap,A=new WeakMap,x=new WeakMap,b=new WeakMap,R=new WeakMap,q=new WeakMap,C=new WeakMap,y=new WeakMap,$=new WeakMap,a=new WeakMap,V=new WeakMap,W=new WeakMap,u=new WeakSet,ce=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},L=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},Z=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},G=new WeakMap,O=new WeakMap,j=new WeakMap,X=new WeakMap,D=new WeakMap,S.stack=new de;let U=S;ie.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",U);var h,g,P,te,Y,I,J,K,se;class ae extends HTMLElement{constructor(){super();r(this,P);r(this,h);r(this,g,new E.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,I,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});ie.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,P,te).call(this),t){let i=null;if(t==="parent"){const c=this.closest("[data-popover]");if(c)i=c;else{const f=this.getRootNode();f instanceof ShadowRoot?i=f.host.closest("[data-popover]"):f instanceof HTMLElement&&(i=f.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const c=f=>{if(!f)return null;let F=f.querySelector("[data-popover]");return!F&&(f!=null&&f.parentElement)&&(F=c(f.parentElement)),F};i=c(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,I)),e(this,h).addEventListener("popoverClosing",e(this,J)),e(this,h).addEventListener("popoverClosed",e(this,K))):console.warn(this,`target ${t} not found`)}p(this,P,se).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,P,se).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,P,te).call(this)}}h=new WeakMap,g=new WeakMap,P=new WeakSet,te=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,I)),e(this,h).removeEventListener("popoverClosing",e(this,J)),e(this,h).removeEventListener("popoverClosed",e(this,K)))},Y=new WeakMap,I=new WeakMap,J=new WeakMap,K=new WeakMap,se=function(t){e(this,h)instanceof U&&(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")))};ie.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ae);exports.PopoverButtonElement=ae;exports.PopoverElement=U;
|
|
1
|
+
"use strict";var oe=l=>{throw TypeError(l)};var ee=(l,n,t)=>n.has(l)||oe("Cannot "+t);var e=(l,n,t)=>(ee(l,n,"read from private field"),t?t.call(l):n.get(l)),r=(l,n,t)=>n.has(l)?oe("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(l):n.set(l,t),o=(l,n,t,s)=>(ee(l,n,"write to private field"),s?s.call(l,t):n.set(l,t),t),p=(l,n,t)=>(ee(l,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("../element-linked-store/index.cjs"),E=require("../css-property/index.cjs"),ie=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),pe=require("../function-MthRj-GJ.cjs"),ne=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const he=require("../url-DGcX4fGV.cjs"),le=require("../window-resizer/index.cjs"),Q=require("../Viewport-DB0qAZPJ.cjs");var d,w,_,N;class de{constructor(){r(this,d,new Map);r(this,w,[]);r(this,_,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(re=>re instanceof HTMLElement&&re.hasAttribute("data-popover-content")))return;const c=i[0],f=c instanceof Node&&(t.contains(c)||((s=t.shadowRoot)==null?void 0:s.contains(c))),F=c instanceof HTMLElement&&c.hasAttribute("data-outside");(!f||F)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,_)),addEventListener("keydown",e(this,N))}get groups(){return e(this,d)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,d).forEach(i=>{i.forEach(c=>{c.close()})});else if(t.closeRestInGroup.current){let i=e(this,d).get(n);i==null||i.forEach(c=>{c.close()})}let s=e(this,d).get(n);s!=null&&s.length||(s=[],e(this,d).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,d).forEach(i=>{i.forEach(c=>s.push(c))}),e(this,d).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,d).get(n);e(this,d).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,d).get(n);s&&(s=s.filter(i=>i!==t),e(this,d).set(n,s))}}}d=new WeakMap,w=new WeakMap,_=new WeakMap,N=new WeakMap;var v,z,B,k,H,m,T,A,x,b,R,q,C,y,$,a,V,W,u,ce,L,Z,G,O,j,X,D;const S=class S extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,z);r(this,B);r(this,k);r(this,H);r(this,m);r(this,T);r(this,A);r(this,x);r(this,b);r(this,R);r(this,q);r(this,C);r(this,y);r(this,$);r(this,a);r(this,V);r(this,W);r(this,G);r(this,O);r(this,j);r(this,X);r(this,D);this.urlValue="",o(this,v,!1),o(this,m,new E.CSSProperty(this,"--history",!1)),o(this,T,new E.CSSProperty(this,"--restore",!1)),o(this,A,new E.CSSProperty(this,"--close-rest",!1)),o(this,x,new E.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new E.CSSProperty(this,"--group","")),o(this,R,new E.CSSProperty(this,"--click-outside",!1)),o(this,q,new E.CSSProperty(this,"--escape",!1)),o(this,C,new E.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,y,!0),o(this,a,new ue.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,V,[]),o(this,W,[]),o(this,G,()=>{o(this,y,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)}),o(this,O,()=>{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,j).call(this)}),o(this,j,pe.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,C).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Q.viewport.width?s=Q.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Q.viewport.height?i=Q.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")}}),o(this,D,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(S.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=S.stack.groups.get(this.group.current),i=s==null?void 0:s.find(c=>c.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,b)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,v)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&he.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,z)),clearTimeout(e(this,B)),p(this,u,L).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),M.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,m).current&&e(this,y)&&history.pushState(history.state,"",e(this,u,ce)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{S.stack.add(e(this,b).current,this),e(this,W).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,L).call(this,!0,this.openClass),e(this,a).set("opened",!0),M.dispatchEvent(window,"resize"),M.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,k,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0),M.dispatchEvent(this,"popoverTransitionend")},ne.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,k,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,k)),clearTimeout(e(this,H)),S.stack.remove(e(this,b).current,this),p(this,u,Z).call(this),o(this,z,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!0,this.closingClass),M.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,L).call(this,!1,this.closingClass),M.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},ne.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,V,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,V).forEach(t=>{t.addEventListener("click",e(this,D))}),o(this,W,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,A).observe(),e(this,x).observe(),e(this,b).observe(),e(this,R).observe(),e(this,q).observe(),e(this,C).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,G)),setTimeout(()=>{e(this,T).current?(o(this,y,!1),this.urlValue=he.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)):(p(this,u,Z).call(this),o(this,y,!0))},0),e(this,C).subscribe(()=>{e(this,O).call(this)}),le.windowResizer.subscribe(e(this,O))}disconnectedCallback(){e(this,V).forEach(t=>{t.removeEventListener("click",e(this,D))}),S.stack.remove(e(this,b).current,this),le.windowResizer.unsubscribe(e(this,O)),e(this,m).close(),e(this,T).close(),e(this,A).close(),e(this,x).close(),e(this,b).close(),e(this,R).close(),e(this,q).close(),e(this,C).close(),this.removeAttribute("role"),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!1,this.closingClass),clearTimeout(e(this,z)),clearTimeout(e(this,B)),clearTimeout(e(this,k)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,G)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,Z).call(this)}};v=new WeakMap,z=new WeakMap,B=new WeakMap,k=new WeakMap,H=new WeakMap,m=new WeakMap,T=new WeakMap,A=new WeakMap,x=new WeakMap,b=new WeakMap,R=new WeakMap,q=new WeakMap,C=new WeakMap,y=new WeakMap,$=new WeakMap,a=new WeakMap,V=new WeakMap,W=new WeakMap,u=new WeakSet,ce=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},L=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},Z=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},G=new WeakMap,O=new WeakMap,j=new WeakMap,X=new WeakMap,D=new WeakMap,S.stack=new de;let U=S;ie.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",U);var h,g,P,te,Y,I,J,K,se;class ae extends HTMLElement{constructor(){super();r(this,P);r(this,h);r(this,g,new E.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,I,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});ie.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,P,te).call(this),t){let i=null;if(t==="parent"){const c=this.closest("[data-popover]");if(c)i=c;else{const f=this.getRootNode();f instanceof ShadowRoot?i=f.host.closest("[data-popover]"):f instanceof HTMLElement&&(i=f.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const c=f=>{if(!f)return null;let F=f.querySelector("[data-popover]");return!F&&(f!=null&&f.parentElement)&&(F=c(f.parentElement)),F};i=c(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,I)),e(this,h).addEventListener("popoverClosing",e(this,J)),e(this,h).addEventListener("popoverClosed",e(this,K))):console.warn(this,`target ${t} not found`)}p(this,P,se).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,P,se).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,P,te).call(this)}}h=new WeakMap,g=new WeakMap,P=new WeakSet,te=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,I)),e(this,h).removeEventListener("popoverClosing",e(this,J)),e(this,h).removeEventListener("popoverClosed",e(this,K)))},Y=new WeakMap,I=new WeakMap,J=new WeakMap,K=new WeakMap,se=function(t){e(this,h)instanceof U&&(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")))};ie.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ae);exports.PopoverButtonElement=ae;exports.PopoverElement=U;
|
package/lib/popover/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { d as q } from "../events-CsVF98U6.js";
|
|
|
10
10
|
import { d as at } from "../function-C10DGppn.js";
|
|
11
11
|
import { g as ht } from "../style-j2TwriJ_.js";
|
|
12
12
|
import "construct-style-sheets-polyfill";
|
|
13
|
-
import { u as ut, p as pt } from "../url-
|
|
13
|
+
import { u as ut, p as pt } from "../url-CFnGU6md.js";
|
|
14
14
|
import { windowResizer as nt } from "../window-resizer/index.js";
|
|
15
15
|
import { v as K } from "../Viewport-DA10iWAO.js";
|
|
16
16
|
var d, w, N, _;
|
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-DekP7OZe.cjs"),ht=require("../function-MthRj-GJ.cjs");require("construct-style-sheets-polyfill");const 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-DekP7OZe.cjs"),ht=require("../function-MthRj-GJ.cjs");require("construct-style-sheets-polyfill");const F=require("../url-DGcX4fGV.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
|
@@ -25,7 +25,7 @@ import { Notifier as nt } from "../notifier/index.js";
|
|
|
25
25
|
import { i as _ } from "../index-Bv9zgfdb.js";
|
|
26
26
|
import { d as ht } from "../function-C10DGppn.js";
|
|
27
27
|
import "construct-style-sheets-polyfill";
|
|
28
|
-
import { n as rt, c as ot, s as ct } from "../url-
|
|
28
|
+
import { n as rt, c as ot, s as ct } from "../url-CFnGU6md.js";
|
|
29
29
|
import { i as lt } from "../object-D6MVWB4l.js";
|
|
30
30
|
var y, U, A, p, d, L, k, v, E, R, M, tt;
|
|
31
31
|
class ut {
|
|
@@ -30,7 +30,7 @@ function g(t = "/") {
|
|
|
30
30
|
function w(t) {
|
|
31
31
|
if (t.action === "none")
|
|
32
32
|
return;
|
|
33
|
-
const s = t == null ? void 0 : t.searchParameters, a = t.hash ? t.hash.startsWith("#") ? t.hash : "#" + t.hash : "", e = s ? s.startsWith("?") ? s : "?" + s : "", n = `${t.pathname}${
|
|
33
|
+
const s = t == null ? void 0 : t.searchParameters, a = t.hash ? t.hash.startsWith("#") ? t.hash : "#" + t.hash : "", e = s ? s.startsWith("?") ? s : "?" + s : "", n = `${t.pathname}${e}${a}`, r = m(f({}, t.state), { path: n });
|
|
34
34
|
t.action === "push" ? history.pushState(r, "", n) : t.action === "replace" && history.replaceState(r, "", n);
|
|
35
35
|
}
|
|
36
36
|
function L(t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty,S=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var i=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var o=(t,s,r)=>s in t?u(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,f=(t,s)=>{for(var r in s||(s={}))p.call(s,r)&&o(t,r,s[r]);if(i)for(var r of i(s))y.call(s,r)&&o(t,r,s[r]);return t},m=(t,s)=>S(t,W(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("#"),e=n[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 c=s+a,h=(e==null?void 0:e[1])||"",l=n==null?void 0:n[1],P=`${c}${h?"?"+h:""}`;return{leaf:a,pathname:c,parameters:h,hash:l,path:P}}function $(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:"",e=`${t.pathname}${
|
|
1
|
+
"use strict";var u=Object.defineProperty,S=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var i=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var o=(t,s,r)=>s in t?u(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r,f=(t,s)=>{for(var r in s||(s={}))p.call(s,r)&&o(t,r,s[r]);if(i)for(var r of i(s))y.call(s,r)&&o(t,r,s[r]);return t},m=(t,s)=>S(t,W(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("#"),e=n[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 c=s+a,h=(e==null?void 0:e[1])||"",l=n==null?void 0:n[1],P=`${c}${h?"?"+h:""}`;return{leaf:a,pathname:c,parameters:h,hash:l,path:P}}function $(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:"",e=`${t.pathname}${n}${r}`,a=m(f({},t.state),{path:e});t.action==="push"?history.pushState(a,"",e):t.action==="replace"&&history.replaceState(a,"",e)}function w(t){const s=new URLSearchParams(t),r={};for(const[n,e]of s)r[n]=e;return r}function z(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=$;exports.parseSearchParameters=w;exports.splitPath=d;exports.updateSearchParameter=z;
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../attributes-Bf2svn4j.cjs"),E=require("../index-DekP7OZe.cjs"),b=require("../canvas-CU5Xjahf.cjs"),C=require("../coordinates-D8Np3cPD.cjs"),D=require("../custom-elements-Dh4TWRDJ.cjs"),g=require("../dom-JBOkFLTh.cjs"),s=require("../easings-GegIwET5.cjs"),Q=require("../element-yhcBhsho.cjs"),A=require("../events-KVanG9sR.cjs"),O=require("../file-DSpfWdd9.cjs"),T=require("../function-MthRj-GJ.cjs"),B=require("../gestures-C7gbKx11.cjs"),S=require("../stylesheet-HWF2a3nr.cjs"),h=require("../layout-Ctc2p3uz.cjs"),a=require("../math-GDWEqu7y.cjs"),m=require("../number-ChAm68cm.cjs"),c=require("../object-CCiXnER2.cjs"),v=require("../polyfills-Df4r-ETT.cjs"),P=require("../scroll-CIdNtj3G.cjs"),l=require("../string-DUXXtU8v.cjs"),q=require("../style-At6aDoqG.cjs"),f=require("../url-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../attributes-Bf2svn4j.cjs"),E=require("../index-DekP7OZe.cjs"),b=require("../canvas-CU5Xjahf.cjs"),C=require("../coordinates-D8Np3cPD.cjs"),D=require("../custom-elements-Dh4TWRDJ.cjs"),g=require("../dom-JBOkFLTh.cjs"),s=require("../easings-GegIwET5.cjs"),Q=require("../element-yhcBhsho.cjs"),A=require("../events-KVanG9sR.cjs"),O=require("../file-DSpfWdd9.cjs"),T=require("../function-MthRj-GJ.cjs"),B=require("../gestures-C7gbKx11.cjs"),S=require("../stylesheet-HWF2a3nr.cjs"),h=require("../layout-Ctc2p3uz.cjs"),a=require("../math-GDWEqu7y.cjs"),m=require("../number-ChAm68cm.cjs"),c=require("../object-CCiXnER2.cjs"),v=require("../polyfills-Df4r-ETT.cjs"),P=require("../scroll-CIdNtj3G.cjs"),l=require("../string-DUXXtU8v.cjs"),q=require("../style-At6aDoqG.cjs"),f=require("../url-DGcX4fGV.cjs");function R(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function N(t,e){const n=t.length;e=e%n;const o=new Array(n);for(let r=0;r<n;r++){const i=(r+e)%n;o[i]=t[r]}return o}function z(t,e=2){if(!+t)return"0 Bytes";const n=1024,o=e<0?0:e,r=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,i)).toFixed(o))} ${r[i]}`}function j(t){if(navigator.clipboard)navigator.clipboard.writeText(t).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(e=>{console.error("Failed to copy text to clipboard:",e)});else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.top="0",e.style.left="0",document.body.appendChild(e),e.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(n){console.error("Failed to copy text to clipboard:",n)}document.body.removeChild(e)}}function M(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function V(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function k(t,e){let n=!1;const{x:o,y:r}=t;for(let i=0,u=e.length-1;i<e.length;u=i++){const p=e[i].x,d=e[i].y,y=e[u].x,I=e[u].y;d>r!=I>r&&o<(y-p)*(r-d)/(I-d)+p&&(n=!n)}return n}function w(t,e){const n=t.style.getPropertyValue(e);if(n){const o=n.toString();return o.startsWith("var")?w(t,o.slice(4,-1)):o}}function F(...t){const e={};return Array.from(document.styleSheets).forEach(n=>{Array.from(n.cssRules).forEach(o=>{o instanceof CSSStyleRule&&o.selectorText===":root"&&t.forEach(r=>{const i=w(o,r);i&&(e[r]=i)})})}),t.forEach(n=>{e[n]||console.warn(`variable named ${n} not found`)}),e}function $(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function H(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}const U=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,K=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function W(t){let e,n;return K.test(t)?(e=`mailto:${t.trim()}`,n="email"):U.test(t)&&(e=`tel:${t.replace(/[^0-9\\.\\+]+/g,"")}`,n="phone"),{href:e,type:n,contact:t}}function Z(t,e){if(t){const o=t.content.cloneNode(!0).firstElementChild;return o&&(e==null||e(o)),o}return null}function J(t,e,n,o){let r,i=!1,u=0;const p=()=>{clearInterval(r),o!=null&&o.restartCounter&&(u=0),i&&(r=setInterval(()=>{n(u++)},e))},d=E.intersector.subscribe(t,y=>{i=y.isIntersecting,p()});return()=>{d(),clearInterval(r)}}exports.parseAttribute=x.parseAttribute;exports.parseAttributeValue=x.parseAttributeValue;exports.isBrowser=E.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.whenDefined=D.whenDefined;exports.findParentElement=g.findParentElement;exports.findScrollParentElement=g.findScrollParentElement;exports.getAllParentElements=g.getAllParentElements;exports.getElement=g.getElement;exports.easeInCubic=s.easeInCubic;exports.easeInExpo=s.easeInExpo;exports.easeInOutCubic=s.easeInOutCubic;exports.easeInOutExpo=s.easeInOutExpo;exports.easeInOutQuad=s.easeInOutQuad;exports.easeInOutQuart=s.easeInOutQuart;exports.easeInOutQuint=s.easeInOutQuint;exports.easeInQuad=s.easeInQuad;exports.easeInQuart=s.easeInQuart;exports.easeInQuint=s.easeInQuint;exports.easeOutCubic=s.easeOutCubic;exports.easeOutExpo=s.easeOutExpo;exports.easeOutQuad=s.easeOutQuad;exports.easeOutQuart=s.easeOutQuart;exports.easeOutQuint=s.easeOutQuint;exports.linear=s.linear;exports.isElementVisible=Q.isElementVisible;exports.dispatchEvent=A.dispatchEvent;exports.createJSONAndSave=O.createJSONAndSave;exports.downloadURI=O.downloadURI;exports.debounce=T.debounce;exports.throttle=T.throttle;exports.setupDrag=B.setupDrag;exports.createStylesheet=S.createStylesheet;exports.styleToString=S.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=q.getElementTransitionDurationMS;exports.getElementTransitionDurationS=q.getElementTransitionDurationS;exports.changeHistory=f.changeHistory;exports.normalizeBase=f.normalizeBase;exports.parseSearchParameters=f.parseSearchParameters;exports.splitPath=f.splitPath;exports.updateSearchParameter=f.updateSearchParameter;exports.cloneTemplateContent=Z;exports.copyTextToClipboard=j;exports.decode=H;exports.dotCircleCollision=V;exports.dotPolygonCollision=k;exports.dotRectCollision=M;exports.encode=$;exports.formatBytes=z;exports.getRootVariables=F;exports.insert=R;exports.setIntervalOnIntersection=J;exports.shiftArray=N;exports.tryCreateHrefFromContact=W;
|
package/lib/utils/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { n as lt, r as ut } from "../polyfills-DJrTJQky.js";
|
|
|
20
20
|
import { s as dt, w as mt } from "../scroll-DPkCFTxg.js";
|
|
21
21
|
import { c as xt, a as ht, b as bt, d as gt, g as yt, i as Ct, k as It, s as wt, t as vt, u as Et } from "../string-BlMQbe8b.js";
|
|
22
22
|
import { g as Tt, a as Ot } from "../style-j2TwriJ_.js";
|
|
23
|
-
import { c as Bt, n as At, p as Rt, s as Dt, u as Qt } from "../url-
|
|
23
|
+
import { c as Bt, n as At, p as Rt, s as Dt, u as Qt } from "../url-CFnGU6md.js";
|
|
24
24
|
function b(t, e, ...s) {
|
|
25
25
|
return [...t.slice(0, e), ...s, ...t.slice(e)];
|
|
26
26
|
}
|