aptechka 0.71.31 → 0.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +283 -267
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Jt=Object.defineProperty,Qt=Object.defineProperties;var Zt=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var _t=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var zt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),Vt=r=>{throw TypeError(r)};var It=(r,t,s)=>t in r?Jt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,dt=(r,t)=>{for(var s in t||(t={}))_t.call(t,s)&&It(r,s,t[s]);if(Ut)for(var s of Ut(t))te.call(t,s)&&It(r,s,t[s]);return r},vt=(r,t)=>Qt(r,Zt(t));var St=(r,t,s)=>t.has(r)||Vt("Cannot "+s);var e=(r,t,s)=>(St(r,t,"read from private field"),s?s.call(r):t.get(r)),o=(r,t,s)=>t.has(r)?Vt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(St(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(St(r,t,"access private method"),s);var B=(r,t,s)=>new Promise((i,h)=>{var g=S=>{try{v(s.next(S))}catch(V){h(V)}},b=S=>{try{v(s.throw(S))}catch(V){h(V)}},v=S=>S.done?i(S.value):Promise.resolve(S.value).then(g,b);v((s=s.apply(r,t)).next())});var Ot=(r,t,s)=>(t=r[zt("asyncIterator")])?t.call(r):(r=r[zt("iterator")](),t={},s=(i,h)=>(h=r[i])&&(t[i]=g=>new Promise((b,v,S)=>(g=h.call(r,g),S=g.done,Promise.resolve(g.value).then(V=>b({value:V,done:S}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Wt=require("../index-DekP7OZe.cjs"),C=require("../events-KVanG9sR.cjs"),ee=require("../polyfills-Df4r-ETT.cjs"),Ft=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),se=require("../css-value-parser/index.cjs");class Xt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Wt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Xt);var H,l,N,nt,G;class wt{constructor(t,s){o(this,H);o(this,l);o(this,N);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,H).previousURL)history.back();else{n(this,N,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",g=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=b?se.cssValueParser.parse(b):void 0,S=e(this,l).hasAttribute("data-revalidate"),V=e(this,l).hasAttribute("data-keep-search-parameters"),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");e(this,H).navigate(e(this,N),{historyAction:h,centerScroll:g,offsetScroll:v,revalidate:S,keepSearchParameters:V,submorph:lt,clearState:c})}});o(this,G,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,H).prefetch(e(this,N),t),e(this,l).removeEventListener("pointerenter",e(this,G))});n(this,H,s),n(this,l,t),n(this,N,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),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,H).normalizePath(t),i=e(this,H).normalizePath(e(this,N));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")}destroy(){e(this,l).removeEventListener("click",e(this,nt)),e(this,l).removeEventListener("pointerenter",e(this,G)),e(this,l).classList.remove("current")}}H=new WeakMap,l=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const ie=new DOMParser;var M,W,L,P,X,q,J,Y,D,Q,rt;class Bt{constructor(t,s){o(this,M);o(this,W);o(this,L,{x:0,y:0});o(this,P,null);o(this,X,null);o(this,q,null);o(this,J,null);o(this,Y,null);o(this,D,null);o(this,Q);o(this,rt);n(this,M,t),n(this,W,s),n(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,L)}get document(){return e(this,q)}setHeaders(t){n(this,rt,t)}setInitialDocument(t){n(this,P,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 e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!i||e(this,Q)!==t)||e(this,P)&&e(this,M).isPopstateNavigation?e(this,D):(n(this,Q,t),n(this,D,new Promise(h=>B(this,null,function*(){try{n(this,Y,new AbortController);const b=yield(yield fetch(t,{signal:e(this,Y).signal,headers:dt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":s,"X-MORPH-NEW-PATH":t},e(this,rt))})).text(),v=ie.parseFromString(b,"text/html");this.setInitialDocument(v)}catch(g){console.warn(g)}finally{n(this,Y,null),n(this,D,null),h()}}))),e(this,D))})}cloneDocument(){n(this,q,(e(this,X)||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,L).x=0,e(this,L).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,L).x=0,e(this,L).y=0):(e(this,L).x=e(this,M).scrollValue.left,e(this,L).y=e(this,M).scrollValue.top)}restoreScrollPosition(){e(this,M).scrollElement.scroll({top:e(this,L).y,left:e(this,L).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,M).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}}M=new WeakMap,W=new WeakMap,L=new WeakMap,P=new WeakMap,X=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakMap,D=new WeakMap,Q=new WeakMap,rt=new WeakMap;var A,Z,E,U,d,j,z,I,y,at,R,K,_,tt,u,yt,ot,mt,bt,Yt,Pt,At,kt,Ct,ft,et;const it=class it{constructor(t){o(this,u);o(this,A,null);o(this,Z,null);o(this,E,[]);o(this,U);o(this,d,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,y,null);o(this,at,!1);o(this,R,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,ot,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,ft,t=>B(this,null,function*(){t.preventDefault(),n(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),n(this,I,!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),C.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Wt.isBrowser&&!it.instance){it.instance=this,n(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}),n(this,Z,p(this,u,bt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,d,s);const i=new Bt(this,e(this,d).pathname);i.setInitialDocument(document),e(this,R).set(e(this,d).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,d).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ft)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new Xt),p(this,u,kt).call(this,document)}}get currentURL(){return e(this,d)}get previousURL(){return e(this,j)}get links(){return e(this,E)}get scrollElement(){return e(this,y)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,y).scrollTop,s=e(this,y).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,R).get(e(this,d).path);s&&s.saveState(t)}getState(){const t=e(this,R).get(e(this,d).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 B(this,null,function*(){var h;if(e(this,z).length)return;t=((h=this.pathnameModifier)==null?void 0:h.call(this,t))||t;const i=p(this,u,mt).call(this,t);i==null||i.fetch(t,e(this,d).path,s)})}excludeHeadChild(t){return!1}setHeaders(t){}navigate(V){return B(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:g,keepSearchParameters:b,submorph:v,clearState:S}={}){var ht,Ht,Mt,Rt;if(e(this,z).length)return;const lt=((ht=this.pathnameModifier)==null?void 0:ht.call(this,t))||t,c=this.normalizePath(lt);if(((Ht=e(this,U))==null?void 0:Ht.pathname)===c.pathname||e(this,d).pathname===c.pathname){p(this,u,Ct).call(this,c.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"}),C.dispatchEvent(document,"morphSamePath",{custom:!0}),((Mt=e(this,d))==null?void 0:Mt.parameters)!==c.parameters&&(n(this,j,e(this,d)),n(this,d,c),st.changeHistory({action:((Rt=e(this,d))==null?void 0:Rt.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),C.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,d),previousURL:e(this,j)}}));return}n(this,U,c),e(this,E).forEach($=>{$.checkCurrent(c.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var T;(T=this.preprocessor)==null||T.call(this,{url:c,resolve:a,reject:k,submorph:v})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==c.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,d).pathname)});return}const Tt={url:c,submorph:v};C.dispatchEvent(document,"morphNavigation",{detail:Tt});const pt=p(this,u,mt).call(this,e(this,d).pathname),f=p(this,u,mt).call(this,c.pathname);if(e(this,R).forEach(a=>{a.pathname!==c.pathname&&a.abort()}),yield f==null?void 0:f.fetch(lt,e(this,d).path,g),e(this,U).pathname!==c.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,d).path)});return}pt.clearState(),pt.saveScrollState(),pt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),S&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const Et=vt(dt({},Tt),{document:f.document});C.dispatchEvent(document,"morphStart",{detail:Et});const xt=Array.from(document.head.children),Nt=Array.from(f.document.head.children),qt=p(this,u,Yt).call(this,xt,Nt),jt=p(this,u,Pt).call(this,xt,qt),ct=p(this,u,Pt).call(this,Nt,qt).filter(a=>!this.excludeHeadChild(a));ct.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ct[k]=p(this,u,yt).call(this,a))}),ct.forEach(a=>{document.head.appendChild(a)});const gt=ct.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,u,At).call(this,a))return!0});e(this,A).waitForHeadToLoad&>.length&&(yield new Promise(a=>B(this,null,function*(){let k=0;try{for(var T=Ot(gt),$t,O,F;$t=!(O=yield T.next()).done;$t=!1){const ut=O.value;ut.onload=()=>{k++,k===gt.length&&a()}}}catch(O){F=[O]}finally{try{$t&&(O=T.return)&&(yield O.call(T))}finally{if(F)throw F[0]}}}))),yield Ft.wait(10);const Dt=[];jt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,u,At).call(this,a)?Dt.push(a):a.remove())});const Kt=p(this,u,bt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,u,kt).call(this,f.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,d)),n(this,d,c),e(this,Z).forEach((a,k)=>{const T=Kt[k],$t=getComputedStyle(a).getPropertyValue("--morph-duration");let O=[],F=[];v?v.forEach(m=>{const w=a.querySelector(m),x=T.querySelector(m);w&&x&&(F.push(w),O.push(x))}):(O.push(...T.childNodes),F.push(...a.childNodes)),F.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"))}),O.forEach(m=>{m instanceof HTMLElement&&(this.findNewLinks(m),m.classList.add("new"))}),v?O.forEach((m,w)=>{var x;(x=F[w].parentElement)==null||x.insertBefore(m,F[w])}):a.prepend(...O),ee.requestIdleCallback(()=>{F.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var w;m instanceof HTMLElement&&((w=m.parentElement)==null||w.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})});const ut=vt(dt({},Et),{morphElement:a});C.dispatchEvent(document,"morphNewChildrenAdded",{detail:ut});const Gt=new Promise(m=>{setTimeout(()=>{F.forEach(w=>w.remove()),O.forEach(w=>{var x;w instanceof HTMLElement&&((x=w.parentElement)==null||x.style.removeProperty("--new-content-height"),w.classList.remove("new-idle","new"))}),C.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ut}),m()},(parseFloat($t)||0)*1e3+10)});e(this,z).push(Gt)}),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}),c.hash?(f.clearScrollState(),p(this,u,Ct).call(this,c.hash,{centerScroll:i,offsetScroll:h})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),Dt.forEach(a=>a.remove()),n(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(T=>{T.replaceWith(p(this,u,yt).call(this,T))})}),e(this,E).forEach(a=>{a.checkCurrent(e(this,d).path)}),C.dispatchEvent(document,"morphComplete",{detail:Et}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}n(this,U,void 0)})}addLink(t){e(this,E).push(new wt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(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,ot));e(this,E).push(...s.map(i=>new wt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,ot));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new wt(s,this)))}};A=new WeakMap,Z=new WeakMap,E=new WeakMap,U=new WeakMap,d=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,y=new WeakMap,at=new WeakMap,R=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,u=new WeakSet,yt=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},ot=new WeakMap,mt=function(t){const s=this.normalizePath(t);let i=e(this,R).get(s.pathname);return i||(i=new Bt(this,s.pathname),e(this,R).set(s.pathname,i)),i},bt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Yt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},Pt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},At=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},kt=function(t){var s,i;(s=e(this,y))==null||s.removeEventListener("scroll",e(this,et)),n(this,tt,0),n(this,_,0),n(this,y,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,at,e(this,y)===window),(i=e(this,y))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},Ct=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ft.scrollToElement(i,{scrollElement:e(this,y),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ft=new WeakMap,et=new WeakMap,it.instance=null;let Lt=it;exports.Morph=Lt;
|
|
1
|
+
"use strict";var Zt=Object.defineProperty,_t=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var It=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,se=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?Zt(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,ft=(a,t)=>{for(var s in t||(t={}))ee.call(t,s)&&Ot(a,s,t[s]);if(It)for(var s of It(t))se.call(t,s)&&Ot(a,s,t[s]);return a},Lt=(a,t)=>_t(a,te(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),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);var B=(a,t,s)=>new Promise((i,h)=>{var v=L=>{try{f(s.next(L))}catch(O){h(O)}},A=L=>{try{f(s.throw(L))}catch(O){h(O)}},f=L=>L.done?i(L.value):Promise.resolve(L.value).then(v,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]=v=>new Promise((A,f,L)=>(v=h.call(a,v),L=v.done,Promise.resolve(v.value).then(O=>A({value:O,done:L}),f)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Yt=require("../index-DekP7OZe.cjs"),H=require("../events-KVanG9sR.cjs"),ie=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,q,rt,G;class yt{constructor(t,s){o(this,M);o(this,l);o(this,q);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,q,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",v=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"),O=e(this,l).hasAttribute("data-keep-search-parameters"),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,q),{historyAction:h,centerScroll:v,offsetScroll:f,revalidate:L,keepSearchParameters:O,submorph:ht,clearState:c})}});o(this,G,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,M).prefetch(e(this,q),t),e(this,l).removeEventListener("pointerenter",e(this,G))});n(this,M,s),n(this,l,t),n(this,q,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,rt)),this.checkCurrent(location.pathname),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,q));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")}destroy(){e(this,l).removeEventListener("click",e(this,rt)),e(this,l).removeEventListener("pointerenter",e(this,G)),e(this,l).classList.remove("current")}}M=new WeakMap,l=new WeakMap,q=new WeakMap,rt=new WeakMap,G=new WeakMap;const ne=new DOMParser;var R,W,y,k,X,D,J,Y,U,Q,nt;class Xt{constructor(t,s){o(this,R);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,U,null);o(this,Q);o(this,nt);n(this,R,t),n(this,W,s),n(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,y)}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 B(this,null,function*(){return e(this,U)||e(this,k)&&e(this,k).documentElement.hasAttribute("data-cache")&&(!i||e(this,Q)!==t)||e(this,k)&&e(this,R).isPopstateNavigation?e(this,U):(n(this,Q,t),n(this,U,new Promise(h=>B(this,null,function*(){try{n(this,Y,new AbortController);const A=yield(yield fetch(t,{signal:e(this,Y).signal,headers:ft({"X-MORPH":"true","X-MORPH-CURRENT-PATH":s,"X-MORPH-NEW-PATH":t},e(this,nt))})).text(),f=ne.parseFromString(A,"text/html");this.setInitialDocument(f)}catch(v){console.warn(v)}finally{n(this,Y,null),n(this,U,null),h()}}))),e(this,U))})}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,y).x=0,e(this,y).y=0}clearDocumentState(){n(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,R).scrollValue.left,e(this,y).y=e(this,R).scrollValue.top)}restoreScrollPosition(){e(this,R).scrollElement.scroll({top:e(this,y).y,left:e(this,y).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,R).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}}R=new WeakMap,W=new WeakMap,y=new WeakMap,k=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,Y=new WeakMap,U=new WeakMap,Q=new WeakMap,nt=new WeakMap;var C,Z,g,z,m,j,I,V,P,at,T,K,_,tt,ot,u,Pt,lt,pt,At,Kt,kt,Ct,Ht,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,I,[]);o(this,V,!1);o(this,P,null);o(this,at,!1);o(this,T,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(),n(this,V,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:e(this,ot)||void 0}),n(this,V,!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),H.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Yt.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,At).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,m,s);const i=new Xt(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,Et)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(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,g)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,V)}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,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,C).base,trailingSlash:e(this,C).trailingSlash})}prefetch(t,s){return B(this,null,function*(){var h;if(e(this,I).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(O){return B(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:v,keepSearchParameters:A,submorph:f,clearState:L}={}){var ct,Rt,Tt,xt;if(e(this,I).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(((Rt=e(this,z))==null?void 0:Rt.pathname)===c.pathname||e(this,m).pathname===c.pathname){E(this,u,Mt).call(this,c.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"}),H.dispatchEvent(document,"morphSamePath",{custom:!0}),((Tt=e(this,m))==null?void 0:Tt.parameters)!==c.parameters&&(n(this,j,e(this,m)),n(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}),H.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,m),previousURL:e(this,j)}}));return}n(this,z,c),e(this,g).forEach($=>{$.checkCurrent(c.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((r,S)=>{var b;(b=this.preprocessor)==null||b.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).pathname)});return}const Nt={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,b;(S=r.firstElementChild)==null||S.classList.add("out"),(b=r.firstElementChild)==null||b.setAttribute("data-morph-out","")}),H.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,T).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield p==null?void 0:p.fetch(ht,e(this,m).path,v),e(this,z).pathname!==c.pathname){e(this,g).forEach(r=>{r.checkCurrent(e(this,m).path)});return}gt.clearState(),gt.saveScrollState(),gt.saveDocumentState(),e(this,V)||(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(r=>{r.classList.remove("out")}),H.dispatchEvent(document,"morphStart",{detail:ut});const qt=Array.from(document.head.children),Dt=Array.from(p.document.head.children),Ut=E(this,u,Kt).call(this,qt,Dt),$t=E(this,u,kt).call(this,qt,Ut),dt=E(this,u,kt).call(this,Dt,Ut).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 vt=dt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,u,Ct).call(this,r))return!0});e(this,C).waitForHeadToLoad&&vt.length&&(yield new Promise(r=>B(this,null,function*(){let S=0;try{for(var b=Bt(vt),Jt,F,x;Jt=!(F=yield b.next()).done;Jt=!1){const mt=F.value;mt.onload=()=>{S++,S===vt.length&&r()}}}catch(F){x=[F]}finally{try{Jt&&(F=b.return)&&(yield F.call(b))}finally{if(x)throw x[0]}}}))),yield Wt.wait(10);const zt=[];$t.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,u,Ct).call(this,r)?zt.push(r):r.remove())});const Gt=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(),n(this,j,e(this,m)),n(this,m,c);const St=[];e(this,Z).forEach((r,S)=>{const b=Gt[S],Jt=getComputedStyle(r).getPropertyValue("--morph-duration");let F=[],x=[];f?(f.forEach(d=>{const w=r.querySelector(d),N=b.querySelector(d);w&&N&&(x.push(w),F.push(N))}),x.forEach(d=>{d.parentElement&&St.push(d.parentElement)})):(F.push(...b.childNodes),x.push(...r.childNodes),St.push(r)),x.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 N;(N=x[w].parentElement)==null||N.insertBefore(d,x[w])}):r.prepend(...F),ie.requestIdleCallback(()=>{x.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:r});H.dispatchEvent(document,"morphNewChildrenAdded",{detail:mt});const Qt=new Promise(d=>{setTimeout(()=>{x.forEach(w=>w.remove()),F.forEach(w=>{var N;w instanceof HTMLElement&&((N=w.parentElement)==null||N.style.removeProperty("--new-content-height"),w.classList.remove("new-idle","new"))}),H.dispatchEvent(document,"morphOldChildrenRemoved",{detail:mt}),d()},(parseFloat(Jt)||0)*1e3+10)});e(this,I).push(Qt)}),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"),H.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:p.scrollState}),c.hash?(p.clearScrollState(),E(this,u,Mt).call(this,c.hash,{centerScroll:i,offsetScroll:h})):e(this,V)?p.restoreScrollPosition():p.renewScrollPosition(),yield Promise.all(e(this,I)),zt.forEach(r=>r.remove()),n(this,I,[]),St.forEach(r=>{r.querySelectorAll("script").forEach(b=>{b.replaceWith(E(this,u,Pt).call(this,b))})}),e(this,g).forEach(r=>{r.checkCurrent(e(this,m).path)}),H.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 yt(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 yt(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 yt(s,this)))}};C=new WeakMap,Z=new WeakMap,g=new WeakMap,z=new WeakMap,m=new WeakMap,j=new WeakMap,I=new WeakMap,V=new WeakMap,P=new WeakMap,at=new WeakMap,T=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,T).get(s.pathname);return i||(i=new Xt(this,s.pathname),e(this,T).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)),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)&&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;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
throw TypeError(
|
|
1
|
+
var Qt = Object.defineProperty, Zt = Object.defineProperties;
|
|
2
|
+
var _t = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var zt = Object.getOwnPropertySymbols;
|
|
4
|
+
var te = Object.prototype.hasOwnProperty, ee = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var It = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Ot = (a) => {
|
|
6
|
+
throw TypeError(a);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var Vt = (a, t, s) => t in a ? Qt(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
|
-
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var e = (
|
|
18
|
-
var W = (
|
|
19
|
-
var
|
|
10
|
+
te.call(t, s) && Vt(a, s, t[s]);
|
|
11
|
+
if (zt)
|
|
12
|
+
for (var s of zt(t))
|
|
13
|
+
ee.call(t, s) && Vt(a, s, t[s]);
|
|
14
|
+
return a;
|
|
15
|
+
}, Lt = (a, t) => Zt(a, _t(t));
|
|
16
|
+
var wt = (a, t, s) => t.has(a) || Ot("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) ? Ot("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 W = (a, t, s) => new Promise((i, h) => {
|
|
19
|
+
var S = (w) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
h(
|
|
21
|
+
f(s.next(w));
|
|
22
|
+
} catch (O) {
|
|
23
|
+
h(O);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, P = (w) => {
|
|
26
26
|
try {
|
|
27
|
-
|
|
28
|
-
} catch (
|
|
29
|
-
h(
|
|
27
|
+
f(s.throw(w));
|
|
28
|
+
} catch (O) {
|
|
29
|
+
h(O);
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
}, f = (w) => w.done ? i(w.value) : Promise.resolve(w.value).then(S, P);
|
|
32
|
+
f((s = s.apply(a, t)).next());
|
|
33
33
|
});
|
|
34
|
-
var
|
|
35
|
-
import { i as
|
|
36
|
-
import { d as
|
|
37
|
-
import { r as
|
|
38
|
-
import { w as
|
|
34
|
+
var Ft = (a, t, s) => (t = a[It("asyncIterator")]) ? t.call(a) : (a = a[It("iterator")](), t = {}, s = (i, h) => (h = a[i]) && (t[i] = (S) => new Promise((P, f, w) => (S = h.call(a, S), w = S.done, Promise.resolve(S.value).then((O) => P({ value: O, done: w }), f)))), s("next"), s("return"), t);
|
|
35
|
+
import { i as Bt } from "../index-Bv9zgfdb.js";
|
|
36
|
+
import { d as H } from "../events-CsVF98U6.js";
|
|
37
|
+
import { r as se } from "../polyfills-DJrTJQky.js";
|
|
38
|
+
import { w as ie, s as re } 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 ne, c as vt, s as ae } from "../url-UL9zSCHb.js";
|
|
41
|
+
import { cssValueParser as oe } from "../css-value-parser/index.js";
|
|
42
|
+
class Yt extends HTMLElement {
|
|
43
43
|
connectedCallback() {
|
|
44
44
|
const t = {
|
|
45
45
|
"aria-live": "assertive",
|
|
@@ -50,87 +50,87 @@ class Xt extends HTMLElement {
|
|
|
50
50
|
this.setAttribute(s, i);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
class
|
|
53
|
+
Bt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Yt);
|
|
54
|
+
var R, l, D, it, G;
|
|
55
|
+
class yt {
|
|
56
56
|
constructor(t, s) {
|
|
57
|
-
o(this,
|
|
57
|
+
o(this, R);
|
|
58
58
|
o(this, l);
|
|
59
|
-
o(this,
|
|
59
|
+
o(this, D);
|
|
60
60
|
o(this, it, (t) => {
|
|
61
61
|
var i;
|
|
62
62
|
if (t.preventDefault(), document.documentElement.classList.contains("click-disabled"))
|
|
63
63
|
return;
|
|
64
|
-
if (e(this, l).hasAttribute("data-back") && e(this,
|
|
64
|
+
if (e(this, l).hasAttribute("data-back") && e(this, R).previousURL)
|
|
65
65
|
history.back();
|
|
66
66
|
else {
|
|
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"), P = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), f = P ? oe.parse(P) : void 0, w = e(this, l).hasAttribute("data-revalidate"), O = e(this, l).hasAttribute(
|
|
71
71
|
"data-keep-search-parameters"
|
|
72
|
-
),
|
|
73
|
-
e(this,
|
|
72
|
+
), 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");
|
|
73
|
+
e(this, R).navigate(e(this, D), {
|
|
74
74
|
historyAction: h,
|
|
75
|
-
centerScroll:
|
|
76
|
-
offsetScroll:
|
|
75
|
+
centerScroll: S,
|
|
76
|
+
offsetScroll: f,
|
|
77
77
|
revalidate: w,
|
|
78
|
-
keepSearchParameters:
|
|
79
|
-
submorph:
|
|
78
|
+
keepSearchParameters: O,
|
|
79
|
+
submorph: lt,
|
|
80
80
|
clearState: c
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
o(this, G, () => {
|
|
85
85
|
const t = e(this, l).hasAttribute("data-revalidate");
|
|
86
|
-
e(this,
|
|
86
|
+
e(this, R).prefetch(e(this, D), t), e(this, l).removeEventListener("pointerenter", e(this, G));
|
|
87
87
|
});
|
|
88
|
-
|
|
88
|
+
n(this, R, s), n(this, l, t), n(this, D, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, it)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, G));
|
|
89
89
|
}
|
|
90
90
|
get element() {
|
|
91
91
|
return e(this, l);
|
|
92
92
|
}
|
|
93
93
|
checkCurrent(t) {
|
|
94
94
|
var h;
|
|
95
|
-
const s = e(this,
|
|
96
|
-
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((
|
|
95
|
+
const s = e(this, R).normalizePath(t), i = e(this, R).normalizePath(e(this, D));
|
|
96
|
+
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");
|
|
97
97
|
}
|
|
98
98
|
destroy() {
|
|
99
99
|
e(this, l).removeEventListener("click", e(this, it)), e(this, l).removeEventListener("pointerenter", e(this, G)), e(this, l).classList.remove("current");
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
var
|
|
105
|
-
class
|
|
102
|
+
R = new WeakMap(), l = new WeakMap(), D = new WeakMap(), it = new WeakMap(), G = new WeakMap();
|
|
103
|
+
const le = new DOMParser();
|
|
104
|
+
var M, X, y, k, B, U, J, Y, q, Q, rt;
|
|
105
|
+
class Wt {
|
|
106
106
|
constructor(t, s) {
|
|
107
|
-
o(this,
|
|
107
|
+
o(this, M);
|
|
108
108
|
o(this, X);
|
|
109
|
-
o(this,
|
|
110
|
-
o(this,
|
|
109
|
+
o(this, y, { x: 0, y: 0 });
|
|
110
|
+
o(this, k, null);
|
|
111
111
|
o(this, B, null);
|
|
112
|
-
o(this,
|
|
112
|
+
o(this, U, null);
|
|
113
113
|
o(this, J, null);
|
|
114
114
|
o(this, Y, null);
|
|
115
|
-
o(this,
|
|
115
|
+
o(this, q, null);
|
|
116
116
|
o(this, Q);
|
|
117
117
|
o(this, rt);
|
|
118
|
-
|
|
118
|
+
n(this, M, t), n(this, X, s), n(this, Q, s);
|
|
119
119
|
}
|
|
120
120
|
get pathname() {
|
|
121
121
|
return e(this, X);
|
|
122
122
|
}
|
|
123
123
|
get scrollState() {
|
|
124
|
-
return e(this,
|
|
124
|
+
return e(this, y);
|
|
125
125
|
}
|
|
126
126
|
get document() {
|
|
127
|
-
return e(this,
|
|
127
|
+
return e(this, U);
|
|
128
128
|
}
|
|
129
129
|
setHeaders(t) {
|
|
130
|
-
|
|
130
|
+
n(this, rt, t);
|
|
131
131
|
}
|
|
132
132
|
setInitialDocument(t) {
|
|
133
|
-
|
|
133
|
+
n(this, k, t.cloneNode(!0));
|
|
134
134
|
}
|
|
135
135
|
abort() {
|
|
136
136
|
var t;
|
|
@@ -140,108 +140,110 @@ class Ot {
|
|
|
140
140
|
}
|
|
141
141
|
fetch(t, s, i) {
|
|
142
142
|
return W(this, null, function* () {
|
|
143
|
-
return e(this,
|
|
143
|
+
return e(this, q) || e(this, k) && e(this, k).documentElement.hasAttribute("data-cache") && (!i || e(this, Q) !== t) || e(this, k) && e(this, M).isPopstateNavigation ? e(this, q) : (n(this, Q, t), n(this, q, new Promise((h) => W(this, null, function* () {
|
|
144
144
|
try {
|
|
145
|
-
|
|
146
|
-
const
|
|
145
|
+
n(this, Y, new AbortController());
|
|
146
|
+
const P = yield (yield fetch(t, {
|
|
147
147
|
signal: e(this, Y).signal,
|
|
148
|
-
headers:
|
|
148
|
+
headers: mt({
|
|
149
149
|
"X-MORPH": "true",
|
|
150
150
|
"X-MORPH-CURRENT-PATH": s,
|
|
151
151
|
"X-MORPH-NEW-PATH": t
|
|
152
152
|
}, e(this, rt))
|
|
153
|
-
})).text(),
|
|
154
|
-
this.setInitialDocument(
|
|
155
|
-
} catch (
|
|
156
|
-
console.warn(
|
|
153
|
+
})).text(), f = le.parseFromString(P, "text/html");
|
|
154
|
+
this.setInitialDocument(f);
|
|
155
|
+
} catch (S) {
|
|
156
|
+
console.warn(S);
|
|
157
157
|
} finally {
|
|
158
|
-
|
|
158
|
+
n(this, Y, null), n(this, q, null), h();
|
|
159
159
|
}
|
|
160
|
-
}))), e(this,
|
|
160
|
+
}))), e(this, q));
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
cloneDocument() {
|
|
164
|
-
|
|
164
|
+
n(this, U, (e(this, B) || e(this, k)).cloneNode(!0));
|
|
165
165
|
}
|
|
166
166
|
get title() {
|
|
167
167
|
let t = "";
|
|
168
|
-
if (e(this,
|
|
169
|
-
t = e(this,
|
|
168
|
+
if (e(this, U).title)
|
|
169
|
+
t = e(this, U).title;
|
|
170
170
|
else {
|
|
171
|
-
const s = e(this,
|
|
171
|
+
const s = e(this, U).querySelector("h1");
|
|
172
172
|
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, X);
|
|
173
173
|
}
|
|
174
174
|
return t;
|
|
175
175
|
}
|
|
176
176
|
clearScrollState() {
|
|
177
|
-
e(this,
|
|
177
|
+
e(this, y).x = 0, e(this, y).y = 0;
|
|
178
178
|
}
|
|
179
179
|
clearDocumentState() {
|
|
180
|
-
|
|
180
|
+
n(this, B, null);
|
|
181
181
|
}
|
|
182
182
|
saveScrollState() {
|
|
183
|
-
e(this,
|
|
183
|
+
e(this, k).documentElement.hasAttribute(
|
|
184
184
|
"data-no-scroll-restoration"
|
|
185
|
-
) ? (e(this,
|
|
185
|
+
) ? (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);
|
|
186
186
|
}
|
|
187
187
|
restoreScrollPosition() {
|
|
188
|
-
e(this,
|
|
189
|
-
top: e(this,
|
|
190
|
-
left: e(this,
|
|
188
|
+
e(this, M).scrollElement.scroll({
|
|
189
|
+
top: e(this, y).y,
|
|
190
|
+
left: e(this, y).x,
|
|
191
191
|
behavior: "instant"
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
saveDocumentState() {
|
|
195
|
-
e(this,
|
|
195
|
+
e(this, k).documentElement.hasAttribute(
|
|
196
196
|
"data-no-page-restoration"
|
|
197
|
-
) ?
|
|
197
|
+
) ? n(this, B, null) : n(this, B, document.cloneNode(!0));
|
|
198
198
|
}
|
|
199
199
|
renewScrollPosition() {
|
|
200
|
-
e(this,
|
|
200
|
+
e(this, M).scrollElement.scroll({
|
|
201
201
|
top: 0,
|
|
202
202
|
left: 0,
|
|
203
203
|
behavior: "instant"
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
saveState(t) {
|
|
207
|
-
|
|
207
|
+
n(this, J, t);
|
|
208
208
|
}
|
|
209
209
|
clearState() {
|
|
210
210
|
const t = e(this, J);
|
|
211
|
-
return
|
|
211
|
+
return n(this, J, null), t;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
var
|
|
214
|
+
M = new WeakMap(), X = new WeakMap(), y = new WeakMap(), k = new WeakMap(), B = new WeakMap(), U = new WeakMap(), J = new WeakMap(), Y = new WeakMap(), q = new WeakMap(), Q = new WeakMap(), rt = new WeakMap();
|
|
215
|
+
var C, Z, g, z, m, j, I, V, A, nt, T, K, _, tt, at, u, bt, ot, ft, At, jt, Pt, kt, Ct, Ht, pt, et;
|
|
216
216
|
const st = class st {
|
|
217
217
|
constructor(t) {
|
|
218
218
|
o(this, u);
|
|
219
|
-
o(this,
|
|
219
|
+
o(this, C, null);
|
|
220
220
|
o(this, Z, null);
|
|
221
|
-
o(this,
|
|
221
|
+
o(this, g, []);
|
|
222
222
|
o(this, z);
|
|
223
|
-
o(this,
|
|
223
|
+
o(this, m, null);
|
|
224
224
|
o(this, j);
|
|
225
225
|
o(this, I, []);
|
|
226
226
|
o(this, V, !1);
|
|
227
|
-
o(this,
|
|
227
|
+
o(this, A, null);
|
|
228
228
|
o(this, nt, !1);
|
|
229
|
-
o(this,
|
|
229
|
+
o(this, T, /* @__PURE__ */ new Map());
|
|
230
230
|
o(this, K, null);
|
|
231
231
|
o(this, _, 0);
|
|
232
232
|
o(this, tt, 0);
|
|
233
|
-
o(this, at,
|
|
233
|
+
o(this, at, null);
|
|
234
|
+
o(this, ot, (t) => {
|
|
234
235
|
var s;
|
|
235
236
|
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";
|
|
236
237
|
});
|
|
237
|
-
o(this,
|
|
238
|
-
t.preventDefault(),
|
|
239
|
-
historyAction: "none"
|
|
240
|
-
|
|
238
|
+
o(this, pt, (t) => W(this, null, function* () {
|
|
239
|
+
t.preventDefault(), n(this, V, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
240
|
+
historyAction: "none",
|
|
241
|
+
submorph: e(this, at) || void 0
|
|
242
|
+
}), n(this, V, !1);
|
|
241
243
|
}));
|
|
242
244
|
o(this, et, () => {
|
|
243
245
|
const { left: t, top: s } = this.scrollValue, i = s - e(this, tt), h = t - e(this, _);
|
|
244
|
-
|
|
246
|
+
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(
|
|
245
247
|
"scroll-y-forward",
|
|
246
248
|
i > 0
|
|
247
249
|
), document.documentElement.classList.toggle(
|
|
@@ -253,71 +255,71 @@ const st = class st {
|
|
|
253
255
|
), document.documentElement.classList.toggle(
|
|
254
256
|
"scroll-x-backward",
|
|
255
257
|
h < 0
|
|
256
|
-
),
|
|
258
|
+
), H(document, "morphScroll", {
|
|
257
259
|
detail: {
|
|
258
260
|
left: t,
|
|
259
261
|
top: s
|
|
260
262
|
}
|
|
261
263
|
});
|
|
262
264
|
});
|
|
263
|
-
if (
|
|
264
|
-
st.instance = this,
|
|
265
|
-
base:
|
|
265
|
+
if (Bt && !st.instance) {
|
|
266
|
+
st.instance = this, n(this, C, {
|
|
267
|
+
base: ne(t == null ? void 0 : t.base),
|
|
266
268
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
267
269
|
trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
|
|
268
270
|
scrollSelector: t == null ? void 0 : t.scrollSelector,
|
|
269
271
|
morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
|
|
270
|
-
}),
|
|
272
|
+
}), n(this, Z, E(this, u, At).call(this, document.body));
|
|
271
273
|
const s = this.normalizePath(
|
|
272
274
|
location.pathname + location.hash + location.search
|
|
273
275
|
);
|
|
274
|
-
|
|
275
|
-
const i = new
|
|
276
|
-
i.setInitialDocument(document), e(this,
|
|
276
|
+
n(this, m, s);
|
|
277
|
+
const i = new Wt(this, e(this, m).pathname);
|
|
278
|
+
i.setInitialDocument(document), e(this, T).set(e(this, m).pathname, i), document.documentElement.setAttribute(
|
|
277
279
|
"data-current-pathname",
|
|
278
|
-
e(this,
|
|
280
|
+
e(this, m).pathname
|
|
279
281
|
), document.documentElement.setAttribute(
|
|
280
282
|
"data-current-leaf",
|
|
281
283
|
s.leaf
|
|
282
|
-
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this,
|
|
284
|
+
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, pt)), vt({
|
|
283
285
|
action: "replace",
|
|
284
286
|
pathname: s.pathname,
|
|
285
287
|
searchParameters: s.parameters,
|
|
286
288
|
hash: s.hash
|
|
287
|
-
}),
|
|
289
|
+
}), n(this, K, new Yt()), E(this, u, Ct).call(this, document);
|
|
288
290
|
}
|
|
289
291
|
}
|
|
290
292
|
get currentURL() {
|
|
291
|
-
return e(this,
|
|
293
|
+
return e(this, m);
|
|
292
294
|
}
|
|
293
295
|
get previousURL() {
|
|
294
296
|
return e(this, j);
|
|
295
297
|
}
|
|
296
298
|
get links() {
|
|
297
|
-
return e(this,
|
|
299
|
+
return e(this, g);
|
|
298
300
|
}
|
|
299
301
|
get scrollElement() {
|
|
300
|
-
return e(this,
|
|
302
|
+
return e(this, A);
|
|
301
303
|
}
|
|
302
304
|
get isPopstateNavigation() {
|
|
303
305
|
return e(this, V);
|
|
304
306
|
}
|
|
305
307
|
get scrollValue() {
|
|
306
308
|
let t = 0, s = 0;
|
|
307
|
-
return e(this, nt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this,
|
|
309
|
+
return e(this, nt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, A).scrollTop, s = e(this, A).scrollLeft), { top: t, left: s };
|
|
308
310
|
}
|
|
309
311
|
saveState(t) {
|
|
310
|
-
const s = e(this,
|
|
312
|
+
const s = e(this, T).get(e(this, m).path);
|
|
311
313
|
s && s.saveState(t);
|
|
312
314
|
}
|
|
313
315
|
getState() {
|
|
314
|
-
const t = e(this,
|
|
316
|
+
const t = e(this, T).get(e(this, m).path);
|
|
315
317
|
return t == null ? void 0 : t.clearState();
|
|
316
318
|
}
|
|
317
319
|
normalizePath(t) {
|
|
318
|
-
return
|
|
319
|
-
base: e(this,
|
|
320
|
-
trailingSlash: e(this,
|
|
320
|
+
return ae(t, {
|
|
321
|
+
base: e(this, C).base,
|
|
322
|
+
trailingSlash: e(this, C).trailingSlash
|
|
321
323
|
});
|
|
322
324
|
}
|
|
323
325
|
prefetch(t, s) {
|
|
@@ -326,8 +328,8 @@ const st = class st {
|
|
|
326
328
|
if (e(this, I).length)
|
|
327
329
|
return;
|
|
328
330
|
t = ((h = this.pathnameModifier) == null ? void 0 : h.call(this, t)) || t;
|
|
329
|
-
const i =
|
|
330
|
-
i == null || i.fetch(t, e(this,
|
|
331
|
+
const i = E(this, u, ft).call(this, t);
|
|
332
|
+
i == null || i.fetch(t, e(this, m).path, s);
|
|
331
333
|
});
|
|
332
334
|
}
|
|
333
335
|
excludeHeadChild(t) {
|
|
@@ -335,212 +337,226 @@ const st = class st {
|
|
|
335
337
|
}
|
|
336
338
|
setHeaders(t) {
|
|
337
339
|
}
|
|
338
|
-
navigate(
|
|
340
|
+
navigate(O) {
|
|
339
341
|
return W(this, arguments, function* (t, {
|
|
340
342
|
historyAction: s = "push",
|
|
341
343
|
centerScroll: i,
|
|
342
344
|
offsetScroll: h,
|
|
343
|
-
revalidate:
|
|
344
|
-
keepSearchParameters:
|
|
345
|
-
submorph:
|
|
345
|
+
revalidate: S,
|
|
346
|
+
keepSearchParameters: P,
|
|
347
|
+
submorph: f,
|
|
346
348
|
clearState: w
|
|
347
349
|
} = {}) {
|
|
348
|
-
var
|
|
350
|
+
var ht, Rt, Mt, Tt;
|
|
349
351
|
if (e(this, I).length)
|
|
350
352
|
return;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
n(this, at, f || null);
|
|
354
|
+
const lt = ((ht = this.pathnameModifier) == null ? void 0 : ht.call(this, t)) || t, c = this.normalizePath(lt);
|
|
355
|
+
if (((Rt = e(this, z)) == null ? void 0 : Rt.pathname) === c.pathname || e(this, m).pathname === c.pathname) {
|
|
356
|
+
E(this, u, Ht).call(this, c.hash || 0, {
|
|
354
357
|
centerScroll: i,
|
|
355
358
|
offsetScroll: h,
|
|
356
359
|
behavior: "smooth"
|
|
357
|
-
}),
|
|
360
|
+
}), H(document, "morphSamePath", {
|
|
358
361
|
custom: !0
|
|
359
|
-
}), ((
|
|
360
|
-
action: ((
|
|
362
|
+
}), ((Mt = e(this, m)) == null ? void 0 : Mt.parameters) !== c.parameters && (n(this, j, e(this, m)), n(this, m, c), vt({
|
|
363
|
+
action: ((Tt = e(this, m)) == null ? void 0 : Tt.hash) !== c.hash ? "replace" : s,
|
|
361
364
|
pathname: c.pathname,
|
|
362
365
|
searchParameters: c.parameters,
|
|
363
366
|
hash: c.hash
|
|
364
|
-
}),
|
|
367
|
+
}), H(document, "morphURLParametersChange", {
|
|
365
368
|
detail: {
|
|
366
|
-
newURL: e(this,
|
|
369
|
+
newURL: e(this, m),
|
|
367
370
|
previousURL: e(this, j)
|
|
368
371
|
}
|
|
369
372
|
}));
|
|
370
373
|
return;
|
|
371
374
|
}
|
|
372
|
-
|
|
375
|
+
n(this, z, c), e(this, g).forEach(($) => {
|
|
373
376
|
$.checkCurrent(c.pathname);
|
|
374
377
|
});
|
|
375
378
|
try {
|
|
376
379
|
let $ = !0;
|
|
377
380
|
if (this.preprocessor)
|
|
378
381
|
try {
|
|
379
|
-
yield new Promise((
|
|
380
|
-
var
|
|
381
|
-
(
|
|
382
|
+
yield new Promise((r, L) => {
|
|
383
|
+
var b;
|
|
384
|
+
(b = this.preprocessor) == null || b.call(this, {
|
|
382
385
|
url: c,
|
|
383
|
-
resolve:
|
|
384
|
-
reject:
|
|
385
|
-
submorph:
|
|
386
|
+
resolve: r,
|
|
387
|
+
reject: L,
|
|
388
|
+
submorph: f
|
|
386
389
|
});
|
|
387
390
|
});
|
|
388
|
-
} catch (
|
|
389
|
-
|
|
391
|
+
} catch (r) {
|
|
392
|
+
r ? console.error(r) : console.log("Route change canceled"), $ = !1;
|
|
390
393
|
}
|
|
391
394
|
if (!$ || e(this, z).pathname !== c.pathname) {
|
|
392
|
-
e(this,
|
|
393
|
-
|
|
395
|
+
e(this, g).forEach((r) => {
|
|
396
|
+
r.checkCurrent(e(this, m).pathname);
|
|
394
397
|
});
|
|
395
398
|
return;
|
|
396
399
|
}
|
|
397
|
-
const
|
|
400
|
+
const xt = {
|
|
398
401
|
url: c,
|
|
399
|
-
submorph:
|
|
402
|
+
submorph: f
|
|
400
403
|
};
|
|
401
|
-
|
|
402
|
-
|
|
404
|
+
f ? f.forEach((r) => {
|
|
405
|
+
document.querySelectorAll(r).forEach((L) => {
|
|
406
|
+
L.classList.add("out"), L.setAttribute("data-morph-out", "");
|
|
407
|
+
});
|
|
408
|
+
}) : e(this, Z).forEach((r) => {
|
|
409
|
+
var L, b;
|
|
410
|
+
(L = r.firstElementChild) == null || L.classList.add("out"), (b = r.firstElementChild) == null || b.setAttribute("data-morph-out", "");
|
|
411
|
+
}), H(document, "morphNavigation", {
|
|
412
|
+
detail: xt
|
|
403
413
|
});
|
|
404
|
-
const
|
|
405
|
-
if (e(this,
|
|
406
|
-
|
|
407
|
-
}), yield
|
|
408
|
-
e(this,
|
|
409
|
-
|
|
414
|
+
const Et = E(this, u, ft).call(this, e(this, m).pathname), p = E(this, u, ft).call(this, c.pathname);
|
|
415
|
+
if (e(this, T).forEach((r) => {
|
|
416
|
+
r.pathname !== c.pathname && r.abort();
|
|
417
|
+
}), yield p == null ? void 0 : p.fetch(lt, e(this, m).path, S), e(this, z).pathname !== c.pathname) {
|
|
418
|
+
e(this, g).forEach((r) => {
|
|
419
|
+
r.checkCurrent(e(this, m).path);
|
|
410
420
|
});
|
|
411
421
|
return;
|
|
412
422
|
}
|
|
413
|
-
|
|
414
|
-
const
|
|
415
|
-
document:
|
|
423
|
+
Et.clearState(), Et.saveScrollState(), Et.saveDocumentState(), e(this, V) || (p.clearScrollState(), p.clearDocumentState()), w && p.clearState(), p.cloneDocument(), e(this, K).textContent = p.title, document.body.appendChild(e(this, K));
|
|
424
|
+
const ct = Lt(mt({}, xt), {
|
|
425
|
+
document: p.document
|
|
416
426
|
});
|
|
417
|
-
|
|
418
|
-
|
|
427
|
+
ct.document.querySelectorAll("[data-morph-out]").forEach((r) => {
|
|
428
|
+
r.classList.remove("out");
|
|
429
|
+
}), H(document, "morphStart", {
|
|
430
|
+
detail: ct
|
|
419
431
|
});
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}),
|
|
424
|
-
document.head.appendChild(
|
|
432
|
+
const Nt = Array.from(document.head.children), Dt = Array.from(p.document.head.children), Ut = E(this, u, jt).call(this, Nt, Dt), Kt = E(this, u, Pt).call(this, Nt, Ut), ut = E(this, u, Pt).call(this, Dt, Ut).filter((r) => !this.excludeHeadChild(r));
|
|
433
|
+
ut.forEach((r, L) => {
|
|
434
|
+
r.tagName === "SCRIPT" && (ut[L] = E(this, u, bt).call(this, r));
|
|
435
|
+
}), ut.forEach((r) => {
|
|
436
|
+
document.head.appendChild(r);
|
|
425
437
|
});
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
438
|
+
const gt = ut.filter((r) => {
|
|
439
|
+
if (r.hasAttribute("data-no-waiting"))
|
|
428
440
|
return !1;
|
|
429
|
-
if (
|
|
441
|
+
if (E(this, u, kt).call(this, r))
|
|
430
442
|
return !0;
|
|
431
443
|
});
|
|
432
|
-
e(this,
|
|
433
|
-
let
|
|
444
|
+
e(this, C).waitForHeadToLoad && gt.length && (yield new Promise((r) => W(this, null, function* () {
|
|
445
|
+
let L = 0;
|
|
434
446
|
try {
|
|
435
|
-
for (var
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
447
|
+
for (var b = Ft(gt), Gt, F, x; Gt = !(F = yield b.next()).done; Gt = !1) {
|
|
448
|
+
const dt = F.value;
|
|
449
|
+
dt.onload = () => {
|
|
450
|
+
L++, L === gt.length && r();
|
|
439
451
|
};
|
|
440
452
|
}
|
|
441
|
-
} catch (
|
|
442
|
-
|
|
453
|
+
} catch (F) {
|
|
454
|
+
x = [F];
|
|
443
455
|
} finally {
|
|
444
456
|
try {
|
|
445
|
-
|
|
457
|
+
Gt && (F = b.return) && (yield F.call(b));
|
|
446
458
|
} finally {
|
|
447
|
-
if (
|
|
448
|
-
throw
|
|
459
|
+
if (x)
|
|
460
|
+
throw x[0];
|
|
449
461
|
}
|
|
450
462
|
}
|
|
451
|
-
}))), yield
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
463
|
+
}))), yield ie(10);
|
|
464
|
+
const qt = [];
|
|
465
|
+
Kt.forEach((r) => {
|
|
466
|
+
r.hasAttribute("data-permanent") || (E(this, u, kt).call(this, r) ? qt.push(r) : r.remove());
|
|
455
467
|
});
|
|
456
|
-
const
|
|
457
|
-
e(this,
|
|
468
|
+
const $t = E(this, u, At).call(this, p.document.body);
|
|
469
|
+
!e(this, C).morphInsideScrollContainer && !f && E(this, u, Ct).call(this, p.document), document.documentElement.setAttribute(
|
|
458
470
|
"data-current-pathname",
|
|
459
471
|
c.pathname
|
|
460
472
|
), document.documentElement.setAttribute(
|
|
461
473
|
"data-current-leaf",
|
|
462
474
|
c.leaf
|
|
463
|
-
),
|
|
475
|
+
), vt({
|
|
464
476
|
action: s,
|
|
465
477
|
pathname: c.pathname,
|
|
466
|
-
searchParameters: c.parameters || (
|
|
478
|
+
searchParameters: c.parameters || (P ? location.search : ""),
|
|
467
479
|
hash: c.hash
|
|
468
|
-
}), e(this, K).remove(),
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}),
|
|
477
|
-
|
|
478
|
-
}),
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
480
|
+
}), e(this, K).remove(), n(this, j, e(this, m)), n(this, m, c);
|
|
481
|
+
const St = [];
|
|
482
|
+
e(this, Z).forEach((r, L) => {
|
|
483
|
+
const b = $t[L], Gt = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
484
|
+
let F = [], x = [];
|
|
485
|
+
f ? (f.forEach((d) => {
|
|
486
|
+
const v = r.querySelector(d), N = b.querySelector(d);
|
|
487
|
+
v && N && (x.push(v), F.push(N));
|
|
488
|
+
}), x.forEach((d) => {
|
|
489
|
+
d.parentElement && St.push(d.parentElement);
|
|
490
|
+
})) : (F.push(...b.childNodes), x.push(...r.childNodes), St.push(r)), x.forEach((d) => {
|
|
491
|
+
d instanceof HTMLElement && (this.destroyOldLinks(d), d.classList.add("old"));
|
|
492
|
+
}), F.forEach((d) => {
|
|
493
|
+
d instanceof HTMLElement && (this.findNewLinks(d), d.classList.add("new"));
|
|
494
|
+
}), f ? F.forEach((d, v) => {
|
|
495
|
+
var N;
|
|
496
|
+
(N = x[v].parentElement) == null || N.insertBefore(
|
|
497
|
+
d,
|
|
498
|
+
x[v]
|
|
483
499
|
);
|
|
484
|
-
}) :
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}),
|
|
488
|
-
var
|
|
489
|
-
|
|
500
|
+
}) : r.prepend(...F), se(() => {
|
|
501
|
+
x.forEach((d) => {
|
|
502
|
+
d instanceof HTMLElement && d.classList.add("old-idle");
|
|
503
|
+
}), F.forEach((d) => {
|
|
504
|
+
var v;
|
|
505
|
+
d instanceof HTMLElement && ((v = d.parentElement) == null || v.style.setProperty(
|
|
490
506
|
"--new-content-height",
|
|
491
|
-
|
|
492
|
-
),
|
|
507
|
+
d.offsetHeight + "px"
|
|
508
|
+
), d.classList.add("new-idle"));
|
|
493
509
|
});
|
|
494
510
|
});
|
|
495
|
-
const
|
|
496
|
-
morphElement:
|
|
511
|
+
const dt = Lt(mt({}, ct), {
|
|
512
|
+
morphElement: r
|
|
497
513
|
});
|
|
498
|
-
|
|
499
|
-
detail:
|
|
514
|
+
H(document, "morphNewChildrenAdded", {
|
|
515
|
+
detail: dt
|
|
500
516
|
});
|
|
501
|
-
const
|
|
517
|
+
const Jt = new Promise((d) => {
|
|
502
518
|
setTimeout(() => {
|
|
503
|
-
|
|
504
|
-
var
|
|
505
|
-
|
|
519
|
+
x.forEach((v) => v.remove()), F.forEach((v) => {
|
|
520
|
+
var N;
|
|
521
|
+
v instanceof HTMLElement && ((N = v.parentElement) == null || N.style.removeProperty(
|
|
506
522
|
"--new-content-height"
|
|
507
|
-
),
|
|
508
|
-
}),
|
|
509
|
-
detail:
|
|
510
|
-
}),
|
|
511
|
-
}, (parseFloat(
|
|
523
|
+
), v.classList.remove("new-idle", "new"));
|
|
524
|
+
}), H(document, "morphOldChildrenRemoved", {
|
|
525
|
+
detail: dt
|
|
526
|
+
}), d();
|
|
527
|
+
}, (parseFloat(Gt) || 0) * 1e3 + 10);
|
|
512
528
|
});
|
|
513
|
-
e(this, I).push(
|
|
529
|
+
e(this, I).push(Jt);
|
|
514
530
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
515
531
|
"--new-document-scroll-position",
|
|
516
|
-
(this.scrollValue.top -
|
|
532
|
+
(this.scrollValue.top - p.scrollState.y) * 1 + "px"
|
|
517
533
|
) : document.documentElement.style.setProperty(
|
|
518
534
|
"--new-document-scroll-position",
|
|
519
535
|
this.scrollValue.top + "px"
|
|
520
|
-
),
|
|
521
|
-
detail:
|
|
522
|
-
}), c.hash ? (
|
|
536
|
+
), H(document, "morphBeforeNavigationScroll", {
|
|
537
|
+
detail: p.scrollState
|
|
538
|
+
}), c.hash ? (p.clearScrollState(), E(this, u, Ht).call(this, c.hash, {
|
|
523
539
|
centerScroll: i,
|
|
524
540
|
offsetScroll: h
|
|
525
|
-
})) : e(this, V) ?
|
|
526
|
-
|
|
527
|
-
|
|
541
|
+
})) : e(this, V) ? p.restoreScrollPosition() : p.renewScrollPosition(), yield Promise.all(e(this, I)), qt.forEach((r) => r.remove()), n(this, I, []), St.forEach((r) => {
|
|
542
|
+
r.querySelectorAll("script").forEach((b) => {
|
|
543
|
+
b.replaceWith(E(this, u, bt).call(this, b));
|
|
528
544
|
});
|
|
529
|
-
}), e(this,
|
|
530
|
-
|
|
531
|
-
}),
|
|
532
|
-
detail:
|
|
545
|
+
}), e(this, g).forEach((r) => {
|
|
546
|
+
r.checkCurrent(e(this, m).path);
|
|
547
|
+
}), H(document, "morphComplete", {
|
|
548
|
+
detail: ct
|
|
533
549
|
}), document.documentElement.style.removeProperty(
|
|
534
550
|
"--new-document-scroll-position"
|
|
535
551
|
), window.dispatchEvent(new Event("resize"));
|
|
536
552
|
} catch ($) {
|
|
537
553
|
console.error($);
|
|
538
554
|
}
|
|
539
|
-
|
|
555
|
+
n(this, z, void 0);
|
|
540
556
|
});
|
|
541
557
|
}
|
|
542
558
|
addLink(t) {
|
|
543
|
-
e(this,
|
|
559
|
+
e(this, g).push(new yt(t, this));
|
|
544
560
|
}
|
|
545
561
|
addLinks(t) {
|
|
546
562
|
t.forEach((s) => {
|
|
@@ -548,70 +564,70 @@ const st = class st {
|
|
|
548
564
|
});
|
|
549
565
|
}
|
|
550
566
|
removeLink(t) {
|
|
551
|
-
|
|
567
|
+
n(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
552
568
|
}
|
|
553
569
|
destroyOldLinks(t) {
|
|
554
|
-
|
|
570
|
+
n(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
555
571
|
}
|
|
556
572
|
findNewLinks(t) {
|
|
557
573
|
const s = [...t.querySelectorAll("a")].filter(
|
|
558
|
-
e(this,
|
|
574
|
+
e(this, ot)
|
|
559
575
|
);
|
|
560
|
-
e(this,
|
|
561
|
-
...s.map((i) => new
|
|
576
|
+
e(this, g).push(
|
|
577
|
+
...s.map((i) => new yt(i, this))
|
|
562
578
|
);
|
|
563
579
|
}
|
|
564
580
|
findLinks() {
|
|
565
581
|
const t = [
|
|
566
582
|
...document.documentElement.querySelectorAll("a")
|
|
567
|
-
].filter(e(this,
|
|
568
|
-
e(this,
|
|
583
|
+
].filter(e(this, ot));
|
|
584
|
+
e(this, g).forEach((s) => s.destroy()), n(this, g, t.map((s) => new yt(s, this)));
|
|
569
585
|
}
|
|
570
586
|
};
|
|
571
|
-
|
|
587
|
+
C = new WeakMap(), Z = new WeakMap(), g = new WeakMap(), z = new WeakMap(), m = new WeakMap(), j = new WeakMap(), I = new WeakMap(), V = new WeakMap(), A = new WeakMap(), nt = new WeakMap(), T = new WeakMap(), K = new WeakMap(), _ = new WeakMap(), tt = new WeakMap(), at = new WeakMap(), u = new WeakSet(), bt = function(t) {
|
|
572
588
|
const s = document.createElement("script");
|
|
573
589
|
for (let i = 0; i < t.attributes.length; i++) {
|
|
574
590
|
const h = t.attributes[i];
|
|
575
591
|
s.setAttribute(h.name, h.value);
|
|
576
592
|
}
|
|
577
593
|
return t.hasAttribute("src") || (s.innerHTML = t.innerHTML), s;
|
|
578
|
-
},
|
|
594
|
+
}, ot = new WeakMap(), ft = function(t) {
|
|
579
595
|
const s = this.normalizePath(t);
|
|
580
|
-
let i = e(this,
|
|
581
|
-
return i || (i = new
|
|
582
|
-
},
|
|
596
|
+
let i = e(this, T).get(s.pathname);
|
|
597
|
+
return i || (i = new Wt(this, s.pathname), e(this, T).set(s.pathname, i)), i;
|
|
598
|
+
}, At = function(t) {
|
|
583
599
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
584
600
|
return s.length ? s : [t];
|
|
585
|
-
},
|
|
601
|
+
}, jt = function(t, s) {
|
|
586
602
|
return t.filter(
|
|
587
603
|
(i) => s.find(
|
|
588
604
|
(h) => h.outerHTML === i.outerHTML
|
|
589
605
|
)
|
|
590
606
|
);
|
|
591
|
-
},
|
|
607
|
+
}, Pt = function(t, s) {
|
|
592
608
|
return t.filter(
|
|
593
609
|
(i) => !s.find(
|
|
594
610
|
(h) => h.outerHTML === i.outerHTML
|
|
595
611
|
)
|
|
596
612
|
);
|
|
597
|
-
},
|
|
613
|
+
}, kt = function(t) {
|
|
598
614
|
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
599
|
-
},
|
|
615
|
+
}, Ct = function(t) {
|
|
600
616
|
var s, i;
|
|
601
|
-
(s = e(this,
|
|
617
|
+
(s = e(this, A)) == null || s.removeEventListener(
|
|
602
618
|
"scroll",
|
|
603
619
|
e(this, et)
|
|
604
|
-
),
|
|
605
|
-
},
|
|
620
|
+
), n(this, tt, 0), n(this, _, 0), n(this, A, e(this, C).scrollSelector && t.querySelector(e(this, C).scrollSelector) || window), n(this, nt, e(this, A) === window), (i = e(this, A)) == null || i.addEventListener("scroll", e(this, et)), e(this, et).call(this);
|
|
621
|
+
}, Ht = function(t, s) {
|
|
606
622
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
607
|
-
(typeof i == "number" || i) &&
|
|
608
|
-
scrollElement: e(this,
|
|
623
|
+
(typeof i == "number" || i) && re(i, {
|
|
624
|
+
scrollElement: e(this, A),
|
|
609
625
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
610
626
|
center: s == null ? void 0 : s.centerScroll,
|
|
611
627
|
offset: s == null ? void 0 : s.offsetScroll
|
|
612
628
|
});
|
|
613
|
-
},
|
|
614
|
-
let
|
|
629
|
+
}, pt = new WeakMap(), et = new WeakMap(), st.instance = null;
|
|
630
|
+
let Xt = st;
|
|
615
631
|
export {
|
|
616
|
-
|
|
632
|
+
Xt as Morph
|
|
617
633
|
};
|