aptechka 0.71.9 → 0.71.10
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 +1 -0
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +110 -108
- package/package.json +1 -1
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export interface MorphEvents {
|
|
|
50
50
|
morphScroll: CustomEvent<MorphScrollDetail>;
|
|
51
51
|
morphBeforeNavigationScroll: CustomEvent<MorphRouteScrollState>;
|
|
52
52
|
morphURLParametersChange: CustomEvent<MorphURLParametersChangeEntry>;
|
|
53
|
+
morphSamePath: CustomEvent;
|
|
53
54
|
}
|
|
54
55
|
export interface MorphGetRouteOptions {
|
|
55
56
|
searchParameters?: string;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $t=Object.defineProperty,Gt=Object.defineProperties;var Jt=Object.getOwnPropertyDescriptors;var qt=Object.getOwnPropertySymbols;var Qt=Object.prototype.hasOwnProperty,Zt=Object.prototype.propertyIsEnumerable;var Dt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),zt=n=>{throw TypeError(n)};var Ut=(n,t,s)=>t in n?$t(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s,Et=(n,t)=>{for(var s in t||(t={}))Qt.call(t,s)&&Ut(n,s,t[s]);if(qt)for(var s of qt(t))Zt.call(t,s)&&Ut(n,s,t[s]);return n},gt=(n,t)=>Gt(n,Jt(t));var vt=(n,t,s)=>t.has(n)||zt("Cannot "+s);var e=(n,t,s)=>(vt(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),r=(n,t,s,i)=>(vt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),p=(n,t,s)=>(vt(n,t,"access private method"),s);var O=(n,t,s)=>new Promise((i,u)=>{var w=g=>{try{S(s.next(g))}catch(V){u(V)}},b=g=>{try{S(s.throw(g))}catch(V){u(V)}},S=g=>g.done?i(g.value):Promise.resolve(g.value).then(w,b);S((s=s.apply(n,t)).next())});var It=(n,t,s)=>(t=n[Dt("asyncIterator")])?t.call(n):(n=n[Dt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=w=>new Promise((b,S,g)=>(w=u.call(n,w),g=w.done,Promise.resolve(w.value).then(V=>b({value:V,done:g}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("../index-DekP7OZe.cjs"),R=require("../events-KVanG9sR.cjs"),_t=require("../polyfills-Df4r-ETT.cjs"),Vt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),te=require("../css-value-parser/index.cjs");class Ot 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)}}Bt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Ot);var C,h,N,nt,G;class St{constructor(t,s){o(this,C);o(this,h);o(this,N);o(this,nt,t=>{var i;if(t.preventDefault(),e(this,h).hasAttribute("data-back")&&e(this,C).previousURL)history.back();else{r(this,N,e(this,h).getAttribute("href")||"/");const u=e(this,h).getAttribute("data-history-action")||"push",w=e(this,h).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),S=b?te.cssValueParser.parse(b):void 0,g=e(this,h).hasAttribute("data-revalidate"),V=e(this,h).hasAttribute("data-keep-search-parameters"),l=(i=e(this,h).getAttribute("data-submorph"))==null?void 0:i.split(",").map(lt=>lt.trim()),ot=e(this,h).hasAttribute("data-clear-state");e(this,C).navigate(e(this,N),{historyAction:u,centerScroll:w,offsetScroll:S,revalidate:g,keepSearchParameters:V,submorph:l,clearState:ot})}});o(this,G,()=>{const t=e(this,h).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,N),t),e(this,h).removeEventListener("pointerenter",e(this,G))});r(this,C,s),r(this,h,t),r(this,N,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,G))}get element(){return e(this,h)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,N));e(this,h).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,h).classList.add("current"):i.pathname===s.pathname?e(this,h).classList.add("current"):e(this,h).classList.remove("current")}destroy(){e(this,h).removeEventListener("click",e(this,nt)),e(this,h).removeEventListener("pointerenter",e(this,G)),e(this,h).classList.remove("current")}}C=new WeakMap,h=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const ee=new DOMParser;var H,W,y,P,Y,q,J,X,D,Q;class Ft{constructor(t,s){o(this,H);o(this,W);o(this,y,{x:0,y:0});o(this,P,null);o(this,Y,null);o(this,q,null);o(this,J,null);o(this,X,null);o(this,D,null);o(this,Q);r(this,H,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,q)}setInitialDocument(t){r(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,X))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s){return O(this,null,function*(){return e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!s||e(this,Q)!==t)||e(this,P)&&e(this,H).isPopstateNavigation?e(this,D):(r(this,Q,t),r(this,D,new Promise(i=>O(this,null,function*(){try{r(this,X,new AbortController);const w=yield(yield fetch(t,{signal:e(this,X).signal})).text(),b=ee.parseFromString(w,"text/html");this.setInitialDocument(b)}catch(u){console.warn(u)}finally{r(this,X,null),r(this,D,null),i()}}))),e(this,D))})}cloneDocument(){r(this,q,(e(this,Y)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,q).title)t=e(this,q).title;else{const s=e(this,q).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,Y,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,H).scrollValue.left,e(this,y).y=e(this,H).scrollValue.top)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?r(this,Y,null):r(this,Y,document.cloneNode(!0))}renewScrollPosition(){e(this,H).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}}H=new WeakMap,W=new WeakMap,y=new WeakMap,P=new WeakMap,Y=new WeakMap,q=new WeakMap,J=new WeakMap,X=new WeakMap,D=new WeakMap,Q=new WeakMap;var A,Z,E,U,m,j,z,I,L,rt,M,K,_,tt,c,yt,at,ut,Lt,Wt,bt,Pt,At,kt,dt,et;const it=class it{constructor(t){o(this,c);o(this,A,null);o(this,Z,null);o(this,E,[]);o(this,U);o(this,m,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,L,null);o(this,rt,!1);o(this,M,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,at,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,dt,t=>O(this,null,function*(){t.preventDefault(),r(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),r(this,I,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),u=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",u>0),document.documentElement.classList.toggle("scroll-x-backward",u<0),R.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Bt.isBrowser&&!it.instance){it.instance=this,r(this,A,{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,p(this,c,Lt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);r(this,m,s);const i=new Ft(this,e(this,m).pathname);i.setInitialDocument(document),e(this,M).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,dt)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,K,new Ot),p(this,c,At).call(this,document)}}get currentURL(){return e(this,m)}get previousURL(){return e(this,j)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,rt)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,M).get(e(this,m).path);s&&s.saveState(t)}getState(){const t=e(this,M).get(e(this,m).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return O(this,null,function*(){if(e(this,z).length)return;const i=p(this,c,ut).call(this,t);i==null||i.fetch(t,s)})}excludeHeadChild(t){return!1}navigate(V){return O(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:w,keepSearchParameters:b,submorph:S,clearState:g}={}){var ot,lt,Ct,Ht;if(e(this,z).length)return;const l=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(((lt=e(this,U))==null?void 0:lt.pathname)===l.pathname||e(this,m).pathname===l.pathname){p(this,c,kt).call(this,l.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"}),((Ct=e(this,m))==null?void 0:Ct.parameters)!==l.parameters&&(r(this,j,e(this,m)),r(this,m,l),st.changeHistory({action:((Ht=e(this,m))==null?void 0:Ht.hash)!==l.hash?"replace":s,pathname:l.pathname,searchParameters:l.parameters,hash:l.hash}),R.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,m),previousURL:e(this,j)}}));return}r(this,U,l),e(this,E).forEach($=>{$.checkCurrent(l.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var T;(T=this.preprocessor)==null||T.call(this,{url:l,resolve:a,reject:k,submorph:S})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==l.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,m).pathname)});return}const Mt={url:l,submorph:S};R.dispatchEvent(document,"morphNavigation",{detail:Mt});const mt=p(this,c,ut).call(this,e(this,m).pathname),f=p(this,c,ut).call(this,l.pathname);if(e(this,M).forEach(a=>{a.pathname!==l.pathname&&a.abort()}),yield f==null?void 0:f.fetch(t,w),e(this,U).pathname!==l.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,m).path)});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),g&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const ft=gt(Et({},Mt),{document:f.document});R.dispatchEvent(document,"morphStart",{detail:ft});const Tt=Array.from(document.head.children),xt=Array.from(f.document.head.children),Rt=p(this,c,Wt).call(this,Tt,xt),Yt=p(this,c,bt).call(this,Tt,Rt),ht=p(this,c,bt).call(this,xt,Rt).filter(a=>!this.excludeHeadChild(a));ht.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ht[k]=p(this,c,yt).call(this,a))}),ht.forEach(a=>{document.head.appendChild(a)});const pt=ht.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,c,Pt).call(this,a))return!0});e(this,A).waitForHeadToLoad&&pt.length&&(yield new Promise(a=>O(this,null,function*(){let k=0;try{for(var T=It(pt),jt,F,B;jt=!(F=yield T.next()).done;jt=!1){const ct=F.value;ct.onload=()=>{k++,k===pt.length&&a()}}}catch(F){B=[F]}finally{try{jt&&(F=T.return)&&(yield F.call(T))}finally{if(B)throw B[0]}}}))),yield Vt.wait(10);const Nt=[];Yt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,c,Pt).call(this,a)?Nt.push(a):a.remove())});const Xt=p(this,c,Lt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,c,At).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",l.pathname),document.documentElement.setAttribute("data-current-leaf",l.leaf),st.changeHistory({action:s,pathname:l.pathname,searchParameters:l.parameters||(b?location.search:""),hash:l.hash}),e(this,K).remove(),r(this,j,e(this,m)),r(this,m,l),e(this,Z).forEach((a,k)=>{const T=Xt[k],jt=getComputedStyle(a).getPropertyValue("--morph-duration");let F=[],B=[];S?S.forEach(d=>{const v=a.querySelector(d),x=T.querySelector(d);v&&x&&(B.push(v),F.push(x))}):(F.push(...T.childNodes),B.push(...a.childNodes)),B.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"))}),S?F.forEach((d,v)=>{var x;(x=B[v].parentElement)==null||x.insertBefore(d,B[v])}):a.prepend(...F),_t.requestIdleCallback(()=>{B.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),F.forEach(d=>{var v;d instanceof HTMLElement&&((v=d.parentElement)==null||v.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})});const ct=gt(Et({},ft),{morphElement:a});R.dispatchEvent(document,"morphNewChildrenAdded",{detail:ct});const Kt=new Promise(d=>{setTimeout(()=>{B.forEach(v=>v.remove()),F.forEach(v=>{var x;v instanceof HTMLElement&&((x=v.parentElement)==null||x.style.removeProperty("--new-content-height"),v.classList.remove("new-idle","new"))}),R.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ct}),d()},(parseFloat(jt)||0)*1e3+10)});e(this,z).push(Kt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),R.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),l.hash?(f.clearScrollState(),p(this,c,kt).call(this,l.hash,{centerScroll:i,offsetScroll:u})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),Nt.forEach(a=>a.remove()),r(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(T=>{T.replaceWith(p(this,c,yt).call(this,T))})}),R.dispatchEvent(document,"morphComplete",{detail:ft}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}r(this,U,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){r(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){r(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,at));e(this,E).push(...s.map(i=>new St(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,at));e(this,E).forEach(s=>s.destroy()),r(this,E,t.map(s=>new St(s,this)))}};A=new WeakMap,Z=new WeakMap,E=new WeakMap,U=new WeakMap,m=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,L=new WeakMap,rt=new WeakMap,M=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,c=new WeakSet,yt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const u=t.attributes[i];s.setAttribute(u.name,u.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},at=new WeakMap,ut=function(t){const s=this.normalizePath(t);let i=e(this,M).get(s.pathname);return i||(i=new Ft(this,s.pathname),e(this,M).set(s.pathname,i)),i},Lt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Wt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},bt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},Pt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},At=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,et)),r(this,tt,0),r(this,_,0),r(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),r(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},kt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Vt.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},dt=new WeakMap,et=new WeakMap,it.instance=null;let wt=it;exports.Morph=wt;
|
|
1
|
+
"use strict";var $t=Object.defineProperty,Gt=Object.defineProperties;var Jt=Object.getOwnPropertyDescriptors;var qt=Object.getOwnPropertySymbols;var Qt=Object.prototype.hasOwnProperty,Zt=Object.prototype.propertyIsEnumerable;var Dt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),zt=n=>{throw TypeError(n)};var Ut=(n,t,s)=>t in n?$t(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s,Et=(n,t)=>{for(var s in t||(t={}))Qt.call(t,s)&&Ut(n,s,t[s]);if(qt)for(var s of qt(t))Zt.call(t,s)&&Ut(n,s,t[s]);return n},gt=(n,t)=>Gt(n,Jt(t));var vt=(n,t,s)=>t.has(n)||zt("Cannot "+s);var e=(n,t,s)=>(vt(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),r=(n,t,s,i)=>(vt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),p=(n,t,s)=>(vt(n,t,"access private method"),s);var O=(n,t,s)=>new Promise((i,u)=>{var w=g=>{try{S(s.next(g))}catch(V){u(V)}},b=g=>{try{S(s.throw(g))}catch(V){u(V)}},S=g=>g.done?i(g.value):Promise.resolve(g.value).then(w,b);S((s=s.apply(n,t)).next())});var It=(n,t,s)=>(t=n[Dt("asyncIterator")])?t.call(n):(n=n[Dt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=w=>new Promise((b,S,g)=>(w=u.call(n,w),g=w.done,Promise.resolve(w.value).then(V=>b({value:V,done:g}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("../index-DekP7OZe.cjs"),C=require("../events-KVanG9sR.cjs"),_t=require("../polyfills-Df4r-ETT.cjs"),Vt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),te=require("../css-value-parser/index.cjs");class Ot 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)}}Bt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Ot);var H,h,N,nt,G;class St{constructor(t,s){o(this,H);o(this,h);o(this,N);o(this,nt,t=>{var i;if(t.preventDefault(),e(this,h).hasAttribute("data-back")&&e(this,H).previousURL)history.back();else{r(this,N,e(this,h).getAttribute("href")||"/");const u=e(this,h).getAttribute("data-history-action")||"push",w=e(this,h).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),S=b?te.cssValueParser.parse(b):void 0,g=e(this,h).hasAttribute("data-revalidate"),V=e(this,h).hasAttribute("data-keep-search-parameters"),l=(i=e(this,h).getAttribute("data-submorph"))==null?void 0:i.split(",").map(lt=>lt.trim()),ot=e(this,h).hasAttribute("data-clear-state");e(this,H).navigate(e(this,N),{historyAction:u,centerScroll:w,offsetScroll:S,revalidate:g,keepSearchParameters:V,submorph:l,clearState:ot})}});o(this,G,()=>{const t=e(this,h).hasAttribute("data-revalidate");e(this,H).prefetch(e(this,N),t),e(this,h).removeEventListener("pointerenter",e(this,G))});r(this,H,s),r(this,h,t),r(this,N,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,G))}get element(){return e(this,h)}checkCurrent(t){const s=e(this,H).normalizePath(t),i=e(this,H).normalizePath(e(this,N));e(this,h).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,h).classList.add("current"):i.pathname===s.pathname?e(this,h).classList.add("current"):e(this,h).classList.remove("current")}destroy(){e(this,h).removeEventListener("click",e(this,nt)),e(this,h).removeEventListener("pointerenter",e(this,G)),e(this,h).classList.remove("current")}}H=new WeakMap,h=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const ee=new DOMParser;var M,W,y,P,Y,q,J,X,D,Q;class Ft{constructor(t,s){o(this,M);o(this,W);o(this,y,{x:0,y:0});o(this,P,null);o(this,Y,null);o(this,q,null);o(this,J,null);o(this,X,null);o(this,D,null);o(this,Q);r(this,M,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,q)}setInitialDocument(t){r(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,X))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s){return O(this,null,function*(){return e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!s||e(this,Q)!==t)||e(this,P)&&e(this,M).isPopstateNavigation?e(this,D):(r(this,Q,t),r(this,D,new Promise(i=>O(this,null,function*(){try{r(this,X,new AbortController);const w=yield(yield fetch(t,{signal:e(this,X).signal})).text(),b=ee.parseFromString(w,"text/html");this.setInitialDocument(b)}catch(u){console.warn(u)}finally{r(this,X,null),r(this,D,null),i()}}))),e(this,D))})}cloneDocument(){r(this,q,(e(this,Y)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,q).title)t=e(this,q).title;else{const s=e(this,q).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,Y,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,M).scrollValue.left,e(this,y).y=e(this,M).scrollValue.top)}restoreScrollPosition(){e(this,M).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?r(this,Y,null):r(this,Y,document.cloneNode(!0))}renewScrollPosition(){e(this,M).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}}M=new WeakMap,W=new WeakMap,y=new WeakMap,P=new WeakMap,Y=new WeakMap,q=new WeakMap,J=new WeakMap,X=new WeakMap,D=new WeakMap,Q=new WeakMap;var A,Z,E,U,m,j,z,I,L,rt,T,K,_,tt,c,yt,at,ut,Lt,Wt,bt,Pt,At,kt,dt,et;const it=class it{constructor(t){o(this,c);o(this,A,null);o(this,Z,null);o(this,E,[]);o(this,U);o(this,m,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,L,null);o(this,rt,!1);o(this,T,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,at,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,dt,t=>O(this,null,function*(){t.preventDefault(),r(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),r(this,I,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),u=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",u>0),document.documentElement.classList.toggle("scroll-x-backward",u<0),C.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Bt.isBrowser&&!it.instance){it.instance=this,r(this,A,{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,p(this,c,Lt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);r(this,m,s);const i=new Ft(this,e(this,m).pathname);i.setInitialDocument(document),e(this,T).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,dt)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,K,new Ot),p(this,c,At).call(this,document)}}get currentURL(){return e(this,m)}get previousURL(){return e(this,j)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,rt)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,T).get(e(this,m).path);s&&s.saveState(t)}getState(){const t=e(this,T).get(e(this,m).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return O(this,null,function*(){if(e(this,z).length)return;const i=p(this,c,ut).call(this,t);i==null||i.fetch(t,s)})}excludeHeadChild(t){return!1}navigate(V){return O(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:w,keepSearchParameters:b,submorph:S,clearState:g}={}){var ot,lt,Ct,Ht;if(e(this,z).length)return;const l=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(((lt=e(this,U))==null?void 0:lt.pathname)===l.pathname||e(this,m).pathname===l.pathname){p(this,c,kt).call(this,l.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"}),C.dispatchEvent(document,"morphSamePath",{custom:!0}),((Ct=e(this,m))==null?void 0:Ct.parameters)!==l.parameters&&(r(this,j,e(this,m)),r(this,m,l),st.changeHistory({action:((Ht=e(this,m))==null?void 0:Ht.hash)!==l.hash?"replace":s,pathname:l.pathname,searchParameters:l.parameters,hash:l.hash}),C.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,m),previousURL:e(this,j)}}));return}r(this,U,l),e(this,E).forEach($=>{$.checkCurrent(l.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var x;(x=this.preprocessor)==null||x.call(this,{url:l,resolve:a,reject:k,submorph:S})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==l.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,m).pathname)});return}const Mt={url:l,submorph:S};C.dispatchEvent(document,"morphNavigation",{detail:Mt});const mt=p(this,c,ut).call(this,e(this,m).pathname),f=p(this,c,ut).call(this,l.pathname);if(e(this,T).forEach(a=>{a.pathname!==l.pathname&&a.abort()}),yield f==null?void 0:f.fetch(t,w),e(this,U).pathname!==l.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,m).path)});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),g&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const ft=gt(Et({},Mt),{document:f.document});C.dispatchEvent(document,"morphStart",{detail:ft});const Tt=Array.from(document.head.children),xt=Array.from(f.document.head.children),Rt=p(this,c,Wt).call(this,Tt,xt),Yt=p(this,c,bt).call(this,Tt,Rt),ht=p(this,c,bt).call(this,xt,Rt).filter(a=>!this.excludeHeadChild(a));ht.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ht[k]=p(this,c,yt).call(this,a))}),ht.forEach(a=>{document.head.appendChild(a)});const pt=ht.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,c,Pt).call(this,a))return!0});e(this,A).waitForHeadToLoad&&pt.length&&(yield new Promise(a=>O(this,null,function*(){let k=0;try{for(var x=It(pt),jt,F,B;jt=!(F=yield x.next()).done;jt=!1){const ct=F.value;ct.onload=()=>{k++,k===pt.length&&a()}}}catch(F){B=[F]}finally{try{jt&&(F=x.return)&&(yield F.call(x))}finally{if(B)throw B[0]}}}))),yield Vt.wait(10);const Nt=[];Yt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,c,Pt).call(this,a)?Nt.push(a):a.remove())});const Xt=p(this,c,Lt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,c,At).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",l.pathname),document.documentElement.setAttribute("data-current-leaf",l.leaf),st.changeHistory({action:s,pathname:l.pathname,searchParameters:l.parameters||(b?location.search:""),hash:l.hash}),e(this,K).remove(),r(this,j,e(this,m)),r(this,m,l),e(this,Z).forEach((a,k)=>{const x=Xt[k],jt=getComputedStyle(a).getPropertyValue("--morph-duration");let F=[],B=[];S?S.forEach(d=>{const v=a.querySelector(d),R=x.querySelector(d);v&&R&&(B.push(v),F.push(R))}):(F.push(...x.childNodes),B.push(...a.childNodes)),B.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"))}),S?F.forEach((d,v)=>{var R;(R=B[v].parentElement)==null||R.insertBefore(d,B[v])}):a.prepend(...F),_t.requestIdleCallback(()=>{B.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),F.forEach(d=>{var v;d instanceof HTMLElement&&((v=d.parentElement)==null||v.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})});const ct=gt(Et({},ft),{morphElement:a});C.dispatchEvent(document,"morphNewChildrenAdded",{detail:ct});const Kt=new Promise(d=>{setTimeout(()=>{B.forEach(v=>v.remove()),F.forEach(v=>{var R;v instanceof HTMLElement&&((R=v.parentElement)==null||R.style.removeProperty("--new-content-height"),v.classList.remove("new-idle","new"))}),C.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ct}),d()},(parseFloat(jt)||0)*1e3+10)});e(this,z).push(Kt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),C.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),l.hash?(f.clearScrollState(),p(this,c,kt).call(this,l.hash,{centerScroll:i,offsetScroll:u})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),Nt.forEach(a=>a.remove()),r(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(x=>{x.replaceWith(p(this,c,yt).call(this,x))})}),C.dispatchEvent(document,"morphComplete",{detail:ft}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}r(this,U,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){r(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){r(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,at));e(this,E).push(...s.map(i=>new St(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,at));e(this,E).forEach(s=>s.destroy()),r(this,E,t.map(s=>new St(s,this)))}};A=new WeakMap,Z=new WeakMap,E=new WeakMap,U=new WeakMap,m=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,L=new WeakMap,rt=new WeakMap,T=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,c=new WeakSet,yt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const u=t.attributes[i];s.setAttribute(u.name,u.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},at=new WeakMap,ut=function(t){const s=this.normalizePath(t);let i=e(this,T).get(s.pathname);return i||(i=new Ft(this,s.pathname),e(this,T).set(s.pathname,i)),i},Lt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Wt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},bt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},Pt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},At=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,et)),r(this,tt,0),r(this,_,0),r(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),r(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},kt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Vt.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},dt=new WeakMap,et=new WeakMap,it.instance=null;let wt=it;exports.Morph=wt;
|
package/lib/morph/index.js
CHANGED
|
@@ -2,20 +2,20 @@ var Kt = Object.defineProperty, $t = Object.defineProperties;
|
|
|
2
2
|
var Gt = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Nt = Object.getOwnPropertySymbols;
|
|
4
4
|
var Jt = Object.prototype.hasOwnProperty, Qt = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Dt = (
|
|
6
|
-
throw TypeError(
|
|
5
|
+
var Dt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), zt = (r) => {
|
|
6
|
+
throw TypeError(r);
|
|
7
7
|
};
|
|
8
|
-
var Ut = (
|
|
8
|
+
var Ut = (r, t, s) => t in r ? Kt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s, pt = (r, t) => {
|
|
9
9
|
for (var s in t || (t = {}))
|
|
10
|
-
Jt.call(t, s) && Ut(
|
|
10
|
+
Jt.call(t, s) && Ut(r, s, t[s]);
|
|
11
11
|
if (Nt)
|
|
12
12
|
for (var s of Nt(t))
|
|
13
|
-
Qt.call(t, s) && Ut(
|
|
14
|
-
return
|
|
15
|
-
}, Et = (
|
|
16
|
-
var gt = (
|
|
17
|
-
var e = (
|
|
18
|
-
var O = (
|
|
13
|
+
Qt.call(t, s) && Ut(r, s, t[s]);
|
|
14
|
+
return r;
|
|
15
|
+
}, Et = (r, t) => $t(r, Gt(t));
|
|
16
|
+
var gt = (r, t, s) => t.has(r) || zt("Cannot " + s);
|
|
17
|
+
var e = (r, t, s) => (gt(r, t, "read from private field"), s ? s.call(r) : t.get(r)), o = (r, t, s) => t.has(r) ? zt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), n = (r, t, s, i) => (gt(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), p = (r, t, s) => (gt(r, t, "access private method"), s);
|
|
18
|
+
var O = (r, t, s) => new Promise((i, u) => {
|
|
19
19
|
var v = (g) => {
|
|
20
20
|
try {
|
|
21
21
|
w(s.next(g));
|
|
@@ -29,11 +29,11 @@ var O = (n, t, s) => new Promise((i, u) => {
|
|
|
29
29
|
u(q);
|
|
30
30
|
}
|
|
31
31
|
}, w = (g) => g.done ? i(g.value) : Promise.resolve(g.value).then(v, b);
|
|
32
|
-
w((s = s.apply(
|
|
32
|
+
w((s = s.apply(r, t)).next());
|
|
33
33
|
});
|
|
34
|
-
var It = (
|
|
34
|
+
var It = (r, t, s) => (t = r[Dt("asyncIterator")]) ? t.call(r) : (r = r[Dt("iterator")](), t = {}, s = (i, u) => (u = r[i]) && (t[i] = (v) => new Promise((b, w, g) => (v = u.call(r, v), g = v.done, Promise.resolve(v.value).then((q) => b({ value: q, done: g }), w)))), s("next"), s("return"), t);
|
|
35
35
|
import { i as Ft } from "../index-Bv9zgfdb.js";
|
|
36
|
-
import { d as
|
|
36
|
+
import { d as C } from "../events-CsVF98U6.js";
|
|
37
37
|
import { r as Zt } from "../polyfills-DJrTJQky.js";
|
|
38
38
|
import { w as _t, s as te } from "../scroll-DPkCFTxg.js";
|
|
39
39
|
import "construct-style-sheets-polyfill";
|
|
@@ -51,24 +51,24 @@ class Bt extends HTMLElement {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
Ft && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Bt);
|
|
54
|
-
var
|
|
54
|
+
var H, h, N, it, G;
|
|
55
55
|
class wt {
|
|
56
56
|
constructor(t, s) {
|
|
57
|
-
o(this,
|
|
57
|
+
o(this, H);
|
|
58
58
|
o(this, h);
|
|
59
59
|
o(this, N);
|
|
60
60
|
o(this, it, (t) => {
|
|
61
61
|
var i;
|
|
62
|
-
if (t.preventDefault(), e(this, h).hasAttribute("data-back") && e(this,
|
|
62
|
+
if (t.preventDefault(), e(this, h).hasAttribute("data-back") && e(this, H).previousURL)
|
|
63
63
|
history.back();
|
|
64
64
|
else {
|
|
65
|
-
|
|
65
|
+
n(this, N, e(this, h).getAttribute("href") || "/");
|
|
66
66
|
const u = e(this, h).getAttribute(
|
|
67
67
|
"data-history-action"
|
|
68
68
|
) || "push", v = e(this, h).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, h)).getPropertyValue("--offset-scroll").trim(), w = b ? ie.parse(b) : void 0, g = e(this, h).hasAttribute("data-revalidate"), q = e(this, h).hasAttribute(
|
|
69
69
|
"data-keep-search-parameters"
|
|
70
70
|
), l = (i = e(this, h).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((ot) => ot.trim()), at = e(this, h).hasAttribute("data-clear-state");
|
|
71
|
-
e(this,
|
|
71
|
+
e(this, H).navigate(e(this, N), {
|
|
72
72
|
historyAction: u,
|
|
73
73
|
centerScroll: v,
|
|
74
74
|
offsetScroll: w,
|
|
@@ -81,27 +81,27 @@ class wt {
|
|
|
81
81
|
});
|
|
82
82
|
o(this, G, () => {
|
|
83
83
|
const t = e(this, h).hasAttribute("data-revalidate");
|
|
84
|
-
e(this,
|
|
84
|
+
e(this, H).prefetch(e(this, N), t), e(this, h).removeEventListener("pointerenter", e(this, G));
|
|
85
85
|
});
|
|
86
|
-
|
|
86
|
+
n(this, H, s), n(this, h, t), n(this, N, e(this, h).getAttribute("href") || "/"), e(this, h).addEventListener("click", e(this, it)), this.checkCurrent(location.pathname), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, G));
|
|
87
87
|
}
|
|
88
88
|
get element() {
|
|
89
89
|
return e(this, h);
|
|
90
90
|
}
|
|
91
91
|
checkCurrent(t) {
|
|
92
|
-
const s = e(this,
|
|
92
|
+
const s = e(this, H).normalizePath(t), i = e(this, H).normalizePath(e(this, N));
|
|
93
93
|
e(this, h).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? e(this, h).classList.add("current") : i.pathname === s.pathname ? e(this, h).classList.add("current") : e(this, h).classList.remove("current");
|
|
94
94
|
}
|
|
95
95
|
destroy() {
|
|
96
96
|
e(this, h).removeEventListener("click", e(this, it)), e(this, h).removeEventListener("pointerenter", e(this, G)), e(this, h).classList.remove("current");
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
var
|
|
99
|
+
H = new WeakMap(), h = new WeakMap(), N = new WeakMap(), it = new WeakMap(), G = new WeakMap();
|
|
100
|
+
const re = new DOMParser();
|
|
101
|
+
var T, W, L, A, Y, D, J, X, U, Q;
|
|
102
102
|
class Vt {
|
|
103
103
|
constructor(t, s) {
|
|
104
|
-
o(this,
|
|
104
|
+
o(this, T);
|
|
105
105
|
o(this, W);
|
|
106
106
|
o(this, L, { x: 0, y: 0 });
|
|
107
107
|
o(this, A, null);
|
|
@@ -111,7 +111,7 @@ class Vt {
|
|
|
111
111
|
o(this, X, null);
|
|
112
112
|
o(this, U, null);
|
|
113
113
|
o(this, Q);
|
|
114
|
-
|
|
114
|
+
n(this, T, t), n(this, W, s), n(this, Q, s);
|
|
115
115
|
}
|
|
116
116
|
get pathname() {
|
|
117
117
|
return e(this, W);
|
|
@@ -123,7 +123,7 @@ class Vt {
|
|
|
123
123
|
return e(this, D);
|
|
124
124
|
}
|
|
125
125
|
setInitialDocument(t) {
|
|
126
|
-
|
|
126
|
+
n(this, A, t.cloneNode(!0));
|
|
127
127
|
}
|
|
128
128
|
abort() {
|
|
129
129
|
var t;
|
|
@@ -133,23 +133,23 @@ class Vt {
|
|
|
133
133
|
}
|
|
134
134
|
fetch(t, s) {
|
|
135
135
|
return O(this, null, function* () {
|
|
136
|
-
return e(this, U) || e(this, A) && e(this, A).documentElement.hasAttribute("data-cache") && (!s || e(this, Q) !== t) || e(this, A) && e(this,
|
|
136
|
+
return e(this, U) || e(this, A) && e(this, A).documentElement.hasAttribute("data-cache") && (!s || e(this, Q) !== t) || e(this, A) && e(this, T).isPopstateNavigation ? e(this, U) : (n(this, Q, t), n(this, U, new Promise((i) => O(this, null, function* () {
|
|
137
137
|
try {
|
|
138
|
-
|
|
138
|
+
n(this, X, new AbortController());
|
|
139
139
|
const v = yield (yield fetch(t, {
|
|
140
140
|
signal: e(this, X).signal
|
|
141
|
-
})).text(), b =
|
|
141
|
+
})).text(), b = re.parseFromString(v, "text/html");
|
|
142
142
|
this.setInitialDocument(b);
|
|
143
143
|
} catch (u) {
|
|
144
144
|
console.warn(u);
|
|
145
145
|
} finally {
|
|
146
|
-
|
|
146
|
+
n(this, X, null), n(this, U, null), i();
|
|
147
147
|
}
|
|
148
148
|
}))), e(this, U));
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
cloneDocument() {
|
|
152
|
-
|
|
152
|
+
n(this, D, (e(this, Y) || e(this, A)).cloneNode(!0));
|
|
153
153
|
}
|
|
154
154
|
get title() {
|
|
155
155
|
let t = "";
|
|
@@ -165,15 +165,15 @@ class Vt {
|
|
|
165
165
|
e(this, L).x = 0, e(this, L).y = 0;
|
|
166
166
|
}
|
|
167
167
|
clearDocumentState() {
|
|
168
|
-
|
|
168
|
+
n(this, Y, null);
|
|
169
169
|
}
|
|
170
170
|
saveScrollState() {
|
|
171
171
|
e(this, A).documentElement.hasAttribute(
|
|
172
172
|
"data-no-scroll-restoration"
|
|
173
|
-
) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this,
|
|
173
|
+
) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, T).scrollValue.left, e(this, L).y = e(this, T).scrollValue.top);
|
|
174
174
|
}
|
|
175
175
|
restoreScrollPosition() {
|
|
176
|
-
e(this,
|
|
176
|
+
e(this, T).scrollElement.scroll({
|
|
177
177
|
top: e(this, L).y,
|
|
178
178
|
left: e(this, L).x,
|
|
179
179
|
behavior: "instant"
|
|
@@ -182,29 +182,29 @@ class Vt {
|
|
|
182
182
|
saveDocumentState() {
|
|
183
183
|
e(this, A).documentElement.hasAttribute(
|
|
184
184
|
"data-no-page-restoration"
|
|
185
|
-
) ?
|
|
185
|
+
) ? n(this, Y, null) : n(this, Y, document.cloneNode(!0));
|
|
186
186
|
}
|
|
187
187
|
renewScrollPosition() {
|
|
188
|
-
e(this,
|
|
188
|
+
e(this, T).scrollElement.scroll({
|
|
189
189
|
top: 0,
|
|
190
190
|
left: 0,
|
|
191
191
|
behavior: "instant"
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
saveState(t) {
|
|
195
|
-
|
|
195
|
+
n(this, J, t);
|
|
196
196
|
}
|
|
197
197
|
clearState() {
|
|
198
198
|
const t = e(this, J);
|
|
199
|
-
return
|
|
199
|
+
return n(this, J, null), t;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
|
|
203
|
-
var
|
|
202
|
+
T = new WeakMap(), W = new WeakMap(), L = new WeakMap(), A = new WeakMap(), Y = new WeakMap(), D = new WeakMap(), J = new WeakMap(), X = new WeakMap(), U = new WeakMap(), Q = new WeakMap();
|
|
203
|
+
var P, Z, E, z, m, j, I, V, y, rt, x, K, _, tt, c, vt, nt, ct, Lt, Ot, yt, bt, At, Pt, ut, et;
|
|
204
204
|
const st = class st {
|
|
205
205
|
constructor(t) {
|
|
206
206
|
o(this, c);
|
|
207
|
-
o(this,
|
|
207
|
+
o(this, P, null);
|
|
208
208
|
o(this, Z, null);
|
|
209
209
|
o(this, E, []);
|
|
210
210
|
o(this, z);
|
|
@@ -213,23 +213,23 @@ const st = class st {
|
|
|
213
213
|
o(this, I, []);
|
|
214
214
|
o(this, V, !1);
|
|
215
215
|
o(this, y, null);
|
|
216
|
-
o(this,
|
|
217
|
-
o(this,
|
|
216
|
+
o(this, rt, !1);
|
|
217
|
+
o(this, x, /* @__PURE__ */ new Map());
|
|
218
218
|
o(this, K, null);
|
|
219
219
|
o(this, _, 0);
|
|
220
220
|
o(this, tt, 0);
|
|
221
|
-
o(this,
|
|
221
|
+
o(this, nt, (t) => {
|
|
222
222
|
var s;
|
|
223
223
|
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";
|
|
224
224
|
});
|
|
225
225
|
o(this, ut, (t) => O(this, null, function* () {
|
|
226
|
-
t.preventDefault(),
|
|
226
|
+
t.preventDefault(), n(this, V, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
227
227
|
historyAction: "none"
|
|
228
|
-
}),
|
|
228
|
+
}), n(this, V, !1);
|
|
229
229
|
}));
|
|
230
230
|
o(this, et, () => {
|
|
231
231
|
const { left: t, top: s } = this.scrollValue, i = s - e(this, tt), u = t - e(this, _);
|
|
232
|
-
|
|
232
|
+
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(
|
|
233
233
|
"scroll-y-forward",
|
|
234
234
|
i > 0
|
|
235
235
|
), document.documentElement.classList.toggle(
|
|
@@ -241,7 +241,7 @@ const st = class st {
|
|
|
241
241
|
), document.documentElement.classList.toggle(
|
|
242
242
|
"scroll-x-backward",
|
|
243
243
|
u < 0
|
|
244
|
-
),
|
|
244
|
+
), C(document, "morphScroll", {
|
|
245
245
|
detail: {
|
|
246
246
|
left: t,
|
|
247
247
|
top: s
|
|
@@ -249,19 +249,19 @@ const st = class st {
|
|
|
249
249
|
});
|
|
250
250
|
});
|
|
251
251
|
if (Ft && !st.instance) {
|
|
252
|
-
st.instance = this,
|
|
252
|
+
st.instance = this, n(this, P, {
|
|
253
253
|
base: ee(t == null ? void 0 : t.base),
|
|
254
254
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
255
255
|
trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
|
|
256
256
|
scrollSelector: t == null ? void 0 : t.scrollSelector,
|
|
257
257
|
morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
|
|
258
|
-
}),
|
|
258
|
+
}), n(this, Z, p(this, c, Lt).call(this, document.body));
|
|
259
259
|
const s = this.normalizePath(
|
|
260
260
|
location.pathname + location.hash + location.search
|
|
261
261
|
);
|
|
262
|
-
|
|
262
|
+
n(this, m, s);
|
|
263
263
|
const i = new Vt(this, e(this, m).pathname);
|
|
264
|
-
i.setInitialDocument(document), e(this,
|
|
264
|
+
i.setInitialDocument(document), e(this, x).set(e(this, m).pathname, i), document.documentElement.setAttribute(
|
|
265
265
|
"data-current-pathname",
|
|
266
266
|
e(this, m).pathname
|
|
267
267
|
), document.documentElement.setAttribute(
|
|
@@ -272,7 +272,7 @@ const st = class st {
|
|
|
272
272
|
pathname: s.pathname,
|
|
273
273
|
searchParameters: s.parameters,
|
|
274
274
|
hash: s.hash
|
|
275
|
-
}),
|
|
275
|
+
}), n(this, K, new Bt()), p(this, c, At).call(this, document);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
get currentURL() {
|
|
@@ -292,20 +292,20 @@ const st = class st {
|
|
|
292
292
|
}
|
|
293
293
|
get scrollValue() {
|
|
294
294
|
let t = 0, s = 0;
|
|
295
|
-
return e(this,
|
|
295
|
+
return e(this, rt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, y).scrollTop, s = e(this, y).scrollLeft), { top: t, left: s };
|
|
296
296
|
}
|
|
297
297
|
saveState(t) {
|
|
298
|
-
const s = e(this,
|
|
298
|
+
const s = e(this, x).get(e(this, m).path);
|
|
299
299
|
s && s.saveState(t);
|
|
300
300
|
}
|
|
301
301
|
getState() {
|
|
302
|
-
const t = e(this,
|
|
302
|
+
const t = e(this, x).get(e(this, m).path);
|
|
303
303
|
return t == null ? void 0 : t.clearState();
|
|
304
304
|
}
|
|
305
305
|
normalizePath(t) {
|
|
306
306
|
return se(t, {
|
|
307
|
-
base: e(this,
|
|
308
|
-
trailingSlash: e(this,
|
|
307
|
+
base: e(this, P).base,
|
|
308
|
+
trailingSlash: e(this, P).trailingSlash
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
prefetch(t, s) {
|
|
@@ -329,23 +329,25 @@ const st = class st {
|
|
|
329
329
|
submorph: w,
|
|
330
330
|
clearState: g
|
|
331
331
|
} = {}) {
|
|
332
|
-
var at, ot,
|
|
332
|
+
var at, ot, kt, Ct;
|
|
333
333
|
if (e(this, I).length)
|
|
334
334
|
return;
|
|
335
335
|
const l = this.normalizePath(
|
|
336
336
|
((at = this.pathnameModifier) == null ? void 0 : at.call(this, t)) || t
|
|
337
337
|
);
|
|
338
338
|
if (((ot = e(this, z)) == null ? void 0 : ot.pathname) === l.pathname || e(this, m).pathname === l.pathname) {
|
|
339
|
-
p(this, c,
|
|
339
|
+
p(this, c, Pt).call(this, l.hash || 0, {
|
|
340
340
|
centerScroll: i,
|
|
341
341
|
offsetScroll: u,
|
|
342
342
|
behavior: "smooth"
|
|
343
|
-
}), (
|
|
343
|
+
}), C(document, "morphSamePath", {
|
|
344
|
+
custom: !0
|
|
345
|
+
}), ((kt = e(this, m)) == null ? void 0 : kt.parameters) !== l.parameters && (n(this, j, e(this, m)), n(this, m, l), St({
|
|
344
346
|
action: ((Ct = e(this, m)) == null ? void 0 : Ct.hash) !== l.hash ? "replace" : s,
|
|
345
347
|
pathname: l.pathname,
|
|
346
348
|
searchParameters: l.parameters,
|
|
347
349
|
hash: l.hash
|
|
348
|
-
}),
|
|
350
|
+
}), C(document, "morphURLParametersChange", {
|
|
349
351
|
detail: {
|
|
350
352
|
newURL: e(this, m),
|
|
351
353
|
previousURL: e(this, j)
|
|
@@ -353,19 +355,19 @@ const st = class st {
|
|
|
353
355
|
}));
|
|
354
356
|
return;
|
|
355
357
|
}
|
|
356
|
-
|
|
358
|
+
n(this, z, l), e(this, E).forEach(($) => {
|
|
357
359
|
$.checkCurrent(l.pathname);
|
|
358
360
|
});
|
|
359
361
|
try {
|
|
360
362
|
let $ = !0;
|
|
361
363
|
if (this.preprocessor)
|
|
362
364
|
try {
|
|
363
|
-
yield new Promise((a,
|
|
364
|
-
var
|
|
365
|
-
(
|
|
365
|
+
yield new Promise((a, k) => {
|
|
366
|
+
var M;
|
|
367
|
+
(M = this.preprocessor) == null || M.call(this, {
|
|
366
368
|
url: l,
|
|
367
369
|
resolve: a,
|
|
368
|
-
reject:
|
|
370
|
+
reject: k,
|
|
369
371
|
submorph: w
|
|
370
372
|
});
|
|
371
373
|
});
|
|
@@ -382,11 +384,11 @@ const st = class st {
|
|
|
382
384
|
url: l,
|
|
383
385
|
submorph: w
|
|
384
386
|
};
|
|
385
|
-
|
|
387
|
+
C(document, "morphNavigation", {
|
|
386
388
|
detail: Ht
|
|
387
389
|
});
|
|
388
390
|
const dt = p(this, c, ct).call(this, e(this, m).pathname), f = p(this, c, ct).call(this, l.pathname);
|
|
389
|
-
if (e(this,
|
|
391
|
+
if (e(this, x).forEach((a) => {
|
|
390
392
|
a.pathname !== l.pathname && a.abort();
|
|
391
393
|
}), yield f == null ? void 0 : f.fetch(t, v), e(this, z).pathname !== l.pathname) {
|
|
392
394
|
e(this, E).forEach((a) => {
|
|
@@ -398,12 +400,12 @@ const st = class st {
|
|
|
398
400
|
const mt = Et(pt({}, Ht), {
|
|
399
401
|
document: f.document
|
|
400
402
|
});
|
|
401
|
-
|
|
403
|
+
C(document, "morphStart", {
|
|
402
404
|
detail: mt
|
|
403
405
|
});
|
|
404
406
|
const Tt = Array.from(document.head.children), xt = Array.from(f.document.head.children), Mt = p(this, c, Ot).call(this, Tt, xt), Wt = p(this, c, yt).call(this, Tt, Mt), lt = p(this, c, yt).call(this, xt, Mt).filter((a) => !this.excludeHeadChild(a));
|
|
405
|
-
lt.forEach((a,
|
|
406
|
-
a.tagName === "SCRIPT" && (lt[
|
|
407
|
+
lt.forEach((a, k) => {
|
|
408
|
+
a.tagName === "SCRIPT" && (lt[k] = p(this, c, vt).call(this, a));
|
|
407
409
|
}), lt.forEach((a) => {
|
|
408
410
|
document.head.appendChild(a);
|
|
409
411
|
});
|
|
@@ -413,20 +415,20 @@ const st = class st {
|
|
|
413
415
|
if (p(this, c, bt).call(this, a))
|
|
414
416
|
return !0;
|
|
415
417
|
});
|
|
416
|
-
e(this,
|
|
417
|
-
let
|
|
418
|
+
e(this, P).waitForHeadToLoad && ft.length && (yield new Promise((a) => O(this, null, function* () {
|
|
419
|
+
let k = 0;
|
|
418
420
|
try {
|
|
419
|
-
for (var
|
|
421
|
+
for (var M = It(ft), Xt, F, B; Xt = !(F = yield M.next()).done; Xt = !1) {
|
|
420
422
|
const ht = F.value;
|
|
421
423
|
ht.onload = () => {
|
|
422
|
-
|
|
424
|
+
k++, k === ft.length && a();
|
|
423
425
|
};
|
|
424
426
|
}
|
|
425
427
|
} catch (F) {
|
|
426
428
|
B = [F];
|
|
427
429
|
} finally {
|
|
428
430
|
try {
|
|
429
|
-
Xt && (F =
|
|
431
|
+
Xt && (F = M.return) && (yield F.call(M));
|
|
430
432
|
} finally {
|
|
431
433
|
if (B)
|
|
432
434
|
throw B[0];
|
|
@@ -438,7 +440,7 @@ const st = class st {
|
|
|
438
440
|
a.hasAttribute("data-permanent") || (p(this, c, bt).call(this, a) ? Rt.push(a) : a.remove());
|
|
439
441
|
});
|
|
440
442
|
const Yt = p(this, c, Lt).call(this, f.document.body);
|
|
441
|
-
e(this,
|
|
443
|
+
e(this, P).morphInsideScrollContainer || p(this, c, At).call(this, f.document), document.documentElement.setAttribute(
|
|
442
444
|
"data-current-pathname",
|
|
443
445
|
l.pathname
|
|
444
446
|
), document.documentElement.setAttribute(
|
|
@@ -449,19 +451,19 @@ const st = class st {
|
|
|
449
451
|
pathname: l.pathname,
|
|
450
452
|
searchParameters: l.parameters || (b ? location.search : ""),
|
|
451
453
|
hash: l.hash
|
|
452
|
-
}), e(this, K).remove(),
|
|
453
|
-
const
|
|
454
|
+
}), e(this, K).remove(), n(this, j, e(this, m)), n(this, m, l), e(this, Z).forEach((a, k) => {
|
|
455
|
+
const M = Yt[k], Xt = getComputedStyle(a).getPropertyValue("--morph-duration");
|
|
454
456
|
let F = [], B = [];
|
|
455
457
|
w ? w.forEach((d) => {
|
|
456
|
-
const S = a.querySelector(d),
|
|
457
|
-
S &&
|
|
458
|
-
}) : (F.push(...
|
|
458
|
+
const S = a.querySelector(d), R = M.querySelector(d);
|
|
459
|
+
S && R && (B.push(S), F.push(R));
|
|
460
|
+
}) : (F.push(...M.childNodes), B.push(...a.childNodes)), B.forEach((d) => {
|
|
459
461
|
d instanceof HTMLElement && (this.destroyOldLinks(d), d.classList.add("old"));
|
|
460
462
|
}), F.forEach((d) => {
|
|
461
463
|
d instanceof HTMLElement && (this.findNewLinks(d), d.classList.add("new"));
|
|
462
464
|
}), w ? F.forEach((d, S) => {
|
|
463
|
-
var
|
|
464
|
-
(
|
|
465
|
+
var R;
|
|
466
|
+
(R = B[S].parentElement) == null || R.insertBefore(
|
|
465
467
|
d,
|
|
466
468
|
B[S]
|
|
467
469
|
);
|
|
@@ -479,17 +481,17 @@ const st = class st {
|
|
|
479
481
|
const ht = Et(pt({}, mt), {
|
|
480
482
|
morphElement: a
|
|
481
483
|
});
|
|
482
|
-
|
|
484
|
+
C(document, "morphNewChildrenAdded", {
|
|
483
485
|
detail: ht
|
|
484
486
|
});
|
|
485
487
|
const jt = new Promise((d) => {
|
|
486
488
|
setTimeout(() => {
|
|
487
489
|
B.forEach((S) => S.remove()), F.forEach((S) => {
|
|
488
|
-
var
|
|
489
|
-
S instanceof HTMLElement && ((
|
|
490
|
+
var R;
|
|
491
|
+
S instanceof HTMLElement && ((R = S.parentElement) == null || R.style.removeProperty(
|
|
490
492
|
"--new-content-height"
|
|
491
493
|
), S.classList.remove("new-idle", "new"));
|
|
492
|
-
}),
|
|
494
|
+
}), C(document, "morphOldChildrenRemoved", {
|
|
493
495
|
detail: ht
|
|
494
496
|
}), d();
|
|
495
497
|
}, (parseFloat(Xt) || 0) * 1e3 + 10);
|
|
@@ -501,16 +503,16 @@ const st = class st {
|
|
|
501
503
|
) : document.documentElement.style.setProperty(
|
|
502
504
|
"--new-document-scroll-position",
|
|
503
505
|
this.scrollValue.top + "px"
|
|
504
|
-
),
|
|
506
|
+
), C(document, "morphBeforeNavigationScroll", {
|
|
505
507
|
detail: f.scrollState
|
|
506
|
-
}), l.hash ? (f.clearScrollState(), p(this, c,
|
|
508
|
+
}), l.hash ? (f.clearScrollState(), p(this, c, Pt).call(this, l.hash, {
|
|
507
509
|
centerScroll: i,
|
|
508
510
|
offsetScroll: u
|
|
509
|
-
})) : e(this, V) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, I)), Rt.forEach((a) => a.remove()),
|
|
510
|
-
a.querySelectorAll("script").forEach((
|
|
511
|
-
|
|
511
|
+
})) : e(this, V) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, I)), Rt.forEach((a) => a.remove()), n(this, I, []), e(this, Z).forEach((a) => {
|
|
512
|
+
a.querySelectorAll("script").forEach((M) => {
|
|
513
|
+
M.replaceWith(p(this, c, vt).call(this, M));
|
|
512
514
|
});
|
|
513
|
-
}),
|
|
515
|
+
}), C(document, "morphComplete", {
|
|
514
516
|
detail: mt
|
|
515
517
|
}), document.documentElement.style.removeProperty(
|
|
516
518
|
"--new-document-scroll-position"
|
|
@@ -518,7 +520,7 @@ const st = class st {
|
|
|
518
520
|
} catch ($) {
|
|
519
521
|
console.error($);
|
|
520
522
|
}
|
|
521
|
-
|
|
523
|
+
n(this, z, void 0);
|
|
522
524
|
});
|
|
523
525
|
}
|
|
524
526
|
addLink(t) {
|
|
@@ -530,14 +532,14 @@ const st = class st {
|
|
|
530
532
|
});
|
|
531
533
|
}
|
|
532
534
|
removeLink(t) {
|
|
533
|
-
|
|
535
|
+
n(this, E, e(this, E).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
534
536
|
}
|
|
535
537
|
destroyOldLinks(t) {
|
|
536
|
-
|
|
538
|
+
n(this, E, e(this, E).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
537
539
|
}
|
|
538
540
|
findNewLinks(t) {
|
|
539
541
|
const s = [...t.querySelectorAll("a")].filter(
|
|
540
|
-
e(this,
|
|
542
|
+
e(this, nt)
|
|
541
543
|
);
|
|
542
544
|
e(this, E).push(
|
|
543
545
|
...s.map((i) => new wt(i, this))
|
|
@@ -546,21 +548,21 @@ const st = class st {
|
|
|
546
548
|
findLinks() {
|
|
547
549
|
const t = [
|
|
548
550
|
...document.documentElement.querySelectorAll("a")
|
|
549
|
-
].filter(e(this,
|
|
550
|
-
e(this, E).forEach((s) => s.destroy()),
|
|
551
|
+
].filter(e(this, nt));
|
|
552
|
+
e(this, E).forEach((s) => s.destroy()), n(this, E, t.map((s) => new wt(s, this)));
|
|
551
553
|
}
|
|
552
554
|
};
|
|
553
|
-
|
|
555
|
+
P = new WeakMap(), Z = new WeakMap(), E = new WeakMap(), z = new WeakMap(), m = new WeakMap(), j = new WeakMap(), I = new WeakMap(), V = new WeakMap(), y = new WeakMap(), rt = new WeakMap(), x = new WeakMap(), K = new WeakMap(), _ = new WeakMap(), tt = new WeakMap(), c = new WeakSet(), vt = function(t) {
|
|
554
556
|
const s = document.createElement("script");
|
|
555
557
|
for (let i = 0; i < t.attributes.length; i++) {
|
|
556
558
|
const u = t.attributes[i];
|
|
557
559
|
s.setAttribute(u.name, u.value);
|
|
558
560
|
}
|
|
559
561
|
return t.hasAttribute("src") || (s.innerHTML = t.innerHTML), s;
|
|
560
|
-
},
|
|
562
|
+
}, nt = new WeakMap(), ct = function(t) {
|
|
561
563
|
const s = this.normalizePath(t);
|
|
562
|
-
let i = e(this,
|
|
563
|
-
return i || (i = new Vt(this, s.pathname), e(this,
|
|
564
|
+
let i = e(this, x).get(s.pathname);
|
|
565
|
+
return i || (i = new Vt(this, s.pathname), e(this, x).set(s.pathname, i)), i;
|
|
564
566
|
}, Lt = function(t) {
|
|
565
567
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
566
568
|
return s.length ? s : [t];
|
|
@@ -583,8 +585,8 @@ k = new WeakMap(), Z = new WeakMap(), E = new WeakMap(), z = new WeakMap(), m =
|
|
|
583
585
|
(s = e(this, y)) == null || s.removeEventListener(
|
|
584
586
|
"scroll",
|
|
585
587
|
e(this, et)
|
|
586
|
-
),
|
|
587
|
-
},
|
|
588
|
+
), n(this, tt, 0), n(this, _, 0), n(this, y, e(this, P).scrollSelector && t.querySelector(e(this, P).scrollSelector) || window), n(this, rt, e(this, y) === window), (i = e(this, y)) == null || i.addEventListener("scroll", e(this, et)), e(this, et).call(this);
|
|
589
|
+
}, Pt = function(t, s) {
|
|
588
590
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
589
591
|
(typeof i == "number" || i) && te(i, {
|
|
590
592
|
scrollElement: e(this, y),
|