aptechka 0.69.10 → 0.69.11

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.
@@ -12,12 +12,11 @@ export interface MorphNavigationEntry {
12
12
  path: string;
13
13
  submorph?: Array<string>;
14
14
  }
15
- export interface MorphCompleteEntry extends MorphNavigationEntry {
15
+ export interface MorphNavigationDocumentFetchedEntry extends MorphNavigationEntry {
16
16
  document: Document;
17
17
  }
18
- export interface MorphChildrenActionEntry {
18
+ export interface MorphChildrenActionEntry extends MorphNavigationDocumentFetchedEntry {
19
19
  morphElement: HTMLElement;
20
- path: string;
21
20
  }
22
21
  export interface MorphPreprocessorEntry extends MorphNavigationEntry {
23
22
  resolve: () => void;
@@ -40,8 +39,8 @@ export interface MorphScrollDetail {
40
39
  }
41
40
  export interface MorphEvents {
42
41
  morphNavigation: CustomEvent<MorphNavigationEntry>;
43
- morphStart: CustomEvent<MorphNavigationEntry>;
44
- morphComplete: CustomEvent<MorphCompleteEntry>;
42
+ morphStart: CustomEvent<MorphNavigationDocumentFetchedEntry>;
43
+ morphComplete: CustomEvent<MorphNavigationDocumentFetchedEntry>;
45
44
  morphNewChildrenAdded: CustomEvent<MorphChildrenActionEntry>;
46
45
  morphOldChildrenRemoved: CustomEvent<MorphChildrenActionEntry>;
47
46
  morphScroll: CustomEvent<MorphScrollDetail>;
@@ -1 +1 @@
1
- "use strict";var Wt=Object.defineProperty,Yt=Object.defineProperties;var Xt=Object.getOwnPropertyDescriptors;var Ct=Object.getOwnPropertySymbols;var jt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var Tt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),Mt=r=>{throw TypeError(r)};var xt=(r,t,s)=>t in r?Wt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,Nt=(r,t)=>{for(var s in t||(t={}))jt.call(t,s)&&xt(r,s,t[s]);if(Ct)for(var s of Ct(t))Ut.call(t,s)&&xt(r,s,t[s]);return r},Ht=(r,t)=>Yt(r,Xt(t));var pt=(r,t,s)=>t.has(r)||Mt("Cannot "+s);var e=(r,t,s)=>(pt(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(pt(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(pt(r,t,"access private method"),s);var W=(r,t,s)=>new Promise((i,u)=>{var w=g=>{try{v(s.next(g))}catch(O){u(O)}},N=g=>{try{v(s.throw(g))}catch(O){u(O)}},v=g=>g.done?i(g.value):Promise.resolve(g.value).then(w,N);v((s=s.apply(r,t)).next())});var qt=(r,t,s)=>(t=r[Tt("asyncIterator")])?t.call(r):(r=r[Tt("iterator")](),t={},s=(i,u)=>(u=r[i])&&(t[i]=w=>new Promise((N,v,g)=>(w=u.call(r,w),g=w.done,Promise.resolve(w.value).then(O=>N({value:O,done:g}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Rt=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),Kt=require("../polyfills-Df4r-ETT.cjs"),Dt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ct=require("../url-BT4fssbO.cjs"),$t=require("../css-value-parser/index.cjs");class Vt 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)}}Rt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Vt);var C,l,D,st,$;class Et{constructor(t,s){a(this,C);a(this,l);a(this,D);a(this,st,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,D,e(this,l).getAttribute("href")||"/");const u=e(this,l).getAttribute("data-history-action")||"push",w=e(this,l).hasAttribute("data-center-scroll"),N=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=N?$t.cssValueParser.parse(N):void 0,g=e(this,l).hasAttribute("data-revalidate"),O=e(this,l).hasAttribute("data-keep-search-parameters"),h=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(H=>H.trim()),ot=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,D),{historyAction:u,centerScroll:w,offsetScroll:v,revalidate:g,keepSearchParameters:O,submorph:h,clearState:ot})}});a(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,D),t),e(this,l).removeEventListener("pointerenter",e(this,$))});n(this,C,s),n(this,l,t),n(this,D,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,st)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,$))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,D));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,st)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,D=new WeakMap,st=new WeakMap,$=new WeakMap;const Gt=new DOMParser;var T,I,b,P,X,R,G,j,V;class It{constructor(t,s){a(this,T);a(this,I);a(this,b,{x:0,y:0});a(this,P,null);a(this,X,null);a(this,R,null);a(this,G,null);a(this,j,null);a(this,V,null);n(this,T,t),n(this,I,s)}get path(){return e(this,I)}get scrollState(){return e(this,b)}get document(){return e(this,R)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,j))==null?void 0:t.abort(`[${e(this,I)}] page loading cancelled`)}fetch(t){return W(this,null,function*(){return e(this,V)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&!t||e(this,P)&&e(this,T).isPopstateNavigation?e(this,V):(n(this,V,new Promise(s=>W(this,null,function*(){try{n(this,j,new AbortController);const u=yield(yield fetch(e(this,I),{signal:e(this,j).signal})).text(),w=Gt.parseFromString(u,"text/html");this.setInitialDocument(w)}catch(i){console.warn(i)}finally{n(this,j,null),n(this,V,null),s()}}))),e(this,V))})}cloneDocument(){n(this,R,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,R).title)t=e(this,R).title;else{const s=e(this,R).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,b).x=0,e(this,b).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,b).x=0,e(this,b).y=0):(e(this,b).x=e(this,T).scrollValue.left,e(this,b).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,b).y,left:e(this,b).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,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,G,t)}clearState(){const t=e(this,G);return n(this,G,null),t}}T=new WeakMap,I=new WeakMap,b=new WeakMap,P=new WeakMap,X=new WeakMap,R=new WeakMap,G=new WeakMap,j=new WeakMap,V=new WeakMap;var A,J,E,z,f,it,B,x,L,rt,M,U,Q,Z,nt,c,ht,St,zt,vt,wt,yt,bt,ut,_;const et=class et{constructor(t){a(this,c);a(this,A,null);a(this,J,null);a(this,E,[]);a(this,z);a(this,f,null);a(this,it);a(this,B,[]);a(this,x,!1);a(this,L,null);a(this,rt,!1);a(this,M,new Map);a(this,U,null);a(this,Q,0);a(this,Z,0);a(this,nt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ut,t=>W(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,x,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,x,!1))}));a(this,_,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Z),u=t-e(this,Q);n(this,Z,s),n(this,Q,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),Y.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Rt.isBrowser&&!et.instance){et.instance=this,n(this,A,{base:ct.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,J,p(this,c,St).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,f,s.path);const i=new It(this,e(this,f));i.setInitialDocument(document),e(this,M).set(e(this,f),i),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ut)),ct.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,U,new Vt),p(this,c,yt).call(this,document)}}get currentPath(){return e(this,f)}get previousPathname(){return e(this,it)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,x)}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,f));s&&s.saveState(t)}getState(){const t=e(this,M).get(e(this,f));return t==null?void 0:t.clearState()}normalizePath(t){return ct.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return W(this,null,function*(){if(e(this,B).length)return;const i=p(this,c,ht).call(this,t);i==null||i.fetch(s)})}navigate(O){return W(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:w,keepSearchParameters:N,submorph:v,clearState:g}={}){var ot;if(e(this,B).length)return;const h=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(e(this,z)===h.path||e(this,f)===h.path){e(this,x)||p(this,c,bt).call(this,h.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}n(this,z,h.path),e(this,E).forEach(H=>{H.checkCurrent(h.path)});try{let H=!0;if(this.preprocessor)try{yield new Promise((o,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{path:t,resolve:o,reject:k,submorph:v})})}catch(o){o?console.error(o):console.log("Route change canceled"),H=!1}if(!H||e(this,z)!==h.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}const dt={path:h.path,submorph:v};Y.dispatchEvent(document,"morphNavigation",{detail:dt});const mt=p(this,c,ht).call(this,e(this,f)),m=p(this,c,ht).call(this,t);if(e(this,M).forEach(o=>{o.path!==h.path&&o.abort()}),yield m==null?void 0:m.fetch(w),e(this,z)!==h.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,x)||(m.clearScrollState(),m.clearDocumentState()),g&&m.clearState(),m.cloneDocument(),e(this,U).textContent=m.title,document.body.appendChild(e(this,U)),Y.dispatchEvent(document,"morphStart",{detail:dt});const Lt=Array.from(document.head.children),Pt=Array.from(m.document.head.children),At=p(this,c,zt).call(this,Lt,Pt),Bt=p(this,c,vt).call(this,Lt,At),at=p(this,c,vt).call(this,Pt,At);at.forEach((o,k)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=o.getAttribute("src"),at[k]=y}}),at.forEach(o=>{document.head.appendChild(o)});const ft=at.filter(o=>{if(o.hasAttribute("data-no-waiting"))return!1;if(p(this,c,wt).call(this,o))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(o=>W(this,null,function*(){let k=0;try{for(var y=qt(ft),tt,F,K;tt=!(F=yield y.next()).done;tt=!1){const lt=F.value;lt.onload=()=>{k++,k===ft.length&&o()}}}catch(F){K=[F]}finally{try{tt&&(F=y.return)&&(yield F.call(y))}finally{if(K)throw K[0]}}}))),yield Dt.wait(10);const kt=[];Bt.forEach(o=>{o.hasAttribute("data-permanent")||(p(this,c,wt).call(this,o)?kt.push(o):o.remove())});const Ot=p(this,c,St).call(this,m.document.body);e(this,A).morphInsideScrollContainer||p(this,c,yt).call(this,m.document),document.documentElement.setAttribute("data-current-pathname",h.pathname),document.documentElement.setAttribute("data-current-leaf",h.leaf),ct.changeHistory({action:s,pathname:h.pathname,searchParameters:h.parameters||(N?location.search:""),hash:h.hash}),e(this,U).remove(),n(this,it,e(this,f)),n(this,f,h.path),e(this,J).forEach((o,k)=>{const y=Ot[k],tt=getComputedStyle(o).getPropertyValue("--morph-duration");let F=[],K=[];v?v.forEach(d=>{const S=o.querySelector(d),q=y.querySelector(d);S&&q&&(K.push(S),F.push(q))}):(F.push(...y.childNodes),K.push(...o.childNodes)),K.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"))}),v?F.forEach((d,S)=>{var q;(q=K[S].parentElement)==null||q.insertBefore(d,K[S])}):o.prepend(...F),Kt.requestIdleCallback(()=>{F.forEach(d=>{var S;d instanceof HTMLElement&&((S=d.parentElement)==null||S.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("in"))})});const lt={morphElement:o,path:h.path};Y.dispatchEvent(document,"morphNewChildrenAdded",{detail:lt});const Ft=new Promise(d=>{setTimeout(()=>{K.forEach(S=>S.remove()),F.forEach(S=>{var q;S instanceof HTMLElement&&((q=S.parentElement)==null||q.style.removeProperty("--new-content-height"),S.classList.remove("in","new"))}),Y.dispatchEvent(document,"morphOldChildrenRemoved",{detail:lt}),d()},(parseFloat(tt)||0)*1e3+10)});e(this,B).push(Ft)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-m.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),Y.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:m.scrollState}),h.hash?(m.clearScrollState(),p(this,c,bt).call(this,h.hash,{centerScroll:i,offsetScroll:u})):e(this,x)?m.restoreScrollPosition():m.renewScrollPosition(),yield Promise.all(e(this,B)),kt.forEach(o=>o.remove()),n(this,B,[]),e(this,J).forEach(o=>{o.querySelectorAll("script").forEach(y=>{const tt=document.createElement("script");tt.type="module",tt.src=y.getAttribute("src"),y.replaceWith(tt)})}),Y.dispatchEvent(document,"morphComplete",{detail:Ht(Nt({},dt),{document:m.document})}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(H){console.error(H)}n(this,z,void 0)})}addLink(t){e(this,E).push(new Et(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,nt));e(this,E).push(...s.map(i=>new Et(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,nt));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new Et(s,this)))}};A=new WeakMap,J=new WeakMap,E=new WeakMap,z=new WeakMap,f=new WeakMap,it=new WeakMap,B=new WeakMap,x=new WeakMap,L=new WeakMap,rt=new WeakMap,M=new WeakMap,U=new WeakMap,Q=new WeakMap,Z=new WeakMap,nt=new WeakMap,c=new WeakSet,ht=function(t){let s=e(this,M).get(t);return s||(s=new It(this,t),e(this,M).set(t,s)),s},St=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},zt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},vt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},wt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},yt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,_)),n(this,Z,0),n(this,Q,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,_)),e(this,_).call(this)},bt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Dt.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})},ut=new WeakMap,_=new WeakMap,et.instance=null;let gt=et;exports.Morph=gt;
1
+ "use strict";var Yt=Object.defineProperty,Xt=Object.defineProperties;var jt=Object.getOwnPropertyDescriptors;var Mt=Object.getOwnPropertySymbols;var Ut=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var Nt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),qt=r=>{throw TypeError(r)};var Ht=(r,t,s)=>t in r?Yt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,pt=(r,t)=>{for(var s in t||(t={}))Ut.call(t,s)&&Ht(r,s,t[s]);if(Mt)for(var s of Mt(t))Kt.call(t,s)&&Ht(r,s,t[s]);return r},Et=(r,t)=>Xt(r,jt(t));var gt=(r,t,s)=>t.has(r)||qt("Cannot "+s);var e=(r,t,s)=>(gt(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?qt("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);var W=(r,t,s)=>new Promise((i,h)=>{var y=g=>{try{v(s.next(g))}catch(F){h(F)}},N=g=>{try{v(s.throw(g))}catch(F){h(F)}},v=g=>g.done?i(g.value):Promise.resolve(g.value).then(y,N);v((s=s.apply(r,t)).next())});var Dt=(r,t,s)=>(t=r[Nt("asyncIterator")])?t.call(r):(r=r[Nt("iterator")](),t={},s=(i,h)=>(h=r[i])&&(t[i]=y=>new Promise((N,v,g)=>(y=h.call(r,y),g=y.done,Promise.resolve(y.value).then(F=>N({value:F,done:g}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Vt=require("../index-DekP7OZe.cjs"),Y=require("../events-KVanG9sR.cjs"),$t=require("../polyfills-Df4r-ETT.cjs"),It=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ct=require("../url-BT4fssbO.cjs"),Gt=require("../css-value-parser/index.cjs");class zt 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)}}Vt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",zt);var C,l,D,st,$;class St{constructor(t,s){a(this,C);a(this,l);a(this,D);a(this,st,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,D,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",y=e(this,l).hasAttribute("data-center-scroll"),N=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=N?Gt.cssValueParser.parse(N):void 0,g=e(this,l).hasAttribute("data-revalidate"),F=e(this,l).hasAttribute("data-keep-search-parameters"),u=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(H=>H.trim()),ot=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,D),{historyAction:h,centerScroll:y,offsetScroll:v,revalidate:g,keepSearchParameters:F,submorph:u,clearState:ot})}});a(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,D),t),e(this,l).removeEventListener("pointerenter",e(this,$))});n(this,C,s),n(this,l,t),n(this,D,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,st)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,$))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,D));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,st)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,D=new WeakMap,st=new WeakMap,$=new WeakMap;const Jt=new DOMParser;var T,I,b,P,X,R,G,j,V;class Rt{constructor(t,s){a(this,T);a(this,I);a(this,b,{x:0,y:0});a(this,P,null);a(this,X,null);a(this,R,null);a(this,G,null);a(this,j,null);a(this,V,null);n(this,T,t),n(this,I,s)}get path(){return e(this,I)}get scrollState(){return e(this,b)}get document(){return e(this,R)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,j))==null?void 0:t.abort(`[${e(this,I)}] page loading cancelled`)}fetch(t){return W(this,null,function*(){return e(this,V)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&!t||e(this,P)&&e(this,T).isPopstateNavigation?e(this,V):(n(this,V,new Promise(s=>W(this,null,function*(){try{n(this,j,new AbortController);const h=yield(yield fetch(e(this,I),{signal:e(this,j).signal})).text(),y=Jt.parseFromString(h,"text/html");this.setInitialDocument(y)}catch(i){console.warn(i)}finally{n(this,j,null),n(this,V,null),s()}}))),e(this,V))})}cloneDocument(){n(this,R,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,R).title)t=e(this,R).title;else{const s=e(this,R).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,b).x=0,e(this,b).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,b).x=0,e(this,b).y=0):(e(this,b).x=e(this,T).scrollValue.left,e(this,b).y=e(this,T).scrollValue.top)}restoreScrollPosition(){e(this,T).scrollElement.scroll({top:e(this,b).y,left:e(this,b).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,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,G,t)}clearState(){const t=e(this,G);return n(this,G,null),t}}T=new WeakMap,I=new WeakMap,b=new WeakMap,P=new WeakMap,X=new WeakMap,R=new WeakMap,G=new WeakMap,j=new WeakMap,V=new WeakMap;var A,J,E,z,f,it,B,x,L,rt,M,U,Q,Z,nt,c,ht,yt,Bt,wt,bt,Lt,Pt,ut,_;const et=class et{constructor(t){a(this,c);a(this,A,null);a(this,J,null);a(this,E,[]);a(this,z);a(this,f,null);a(this,it);a(this,B,[]);a(this,x,!1);a(this,L,null);a(this,rt,!1);a(this,M,new Map);a(this,U,null);a(this,Q,0);a(this,Z,0);a(this,nt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ut,t=>W(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,x,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,x,!1))}));a(this,_,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Z),h=t-e(this,Q);n(this,Z,s),n(this,Q,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),Y.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Vt.isBrowser&&!et.instance){et.instance=this,n(this,A,{base:ct.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,J,p(this,c,yt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,f,s.path);const i=new Rt(this,e(this,f));i.setInitialDocument(document),e(this,M).set(e(this,f),i),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ut)),ct.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,U,new zt),p(this,c,Lt).call(this,document)}}get currentPath(){return e(this,f)}get previousPathname(){return e(this,it)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,x)}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,f));s&&s.saveState(t)}getState(){const t=e(this,M).get(e(this,f));return t==null?void 0:t.clearState()}normalizePath(t){return ct.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return W(this,null,function*(){if(e(this,B).length)return;const i=p(this,c,ht).call(this,t);i==null||i.fetch(s)})}navigate(F){return W(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:y,keepSearchParameters:N,submorph:v,clearState:g}={}){var ot;if(e(this,B).length)return;const u=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(e(this,z)===u.path||e(this,f)===u.path){e(this,x)||p(this,c,Pt).call(this,u.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"});return}n(this,z,u.path),e(this,E).forEach(H=>{H.checkCurrent(u.path)});try{let H=!0;if(this.preprocessor)try{yield new Promise((o,k)=>{var w;(w=this.preprocessor)==null||w.call(this,{path:t,resolve:o,reject:k,submorph:v})})}catch(o){o?console.error(o):console.log("Route change canceled"),H=!1}if(!H||e(this,z)!==u.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}const At={path:u.path,submorph:v};Y.dispatchEvent(document,"morphNavigation",{detail:At});const dt=p(this,c,ht).call(this,e(this,f)),m=p(this,c,ht).call(this,t);if(e(this,M).forEach(o=>{o.path!==u.path&&o.abort()}),yield m==null?void 0:m.fetch(y),e(this,z)!==u.path){e(this,E).forEach(o=>{o.checkCurrent(e(this,f))});return}const mt=Et(pt({},At),{document:m.document});dt.clearState(),dt.saveScrollState(),dt.saveDocumentState(),e(this,x)||(m.clearScrollState(),m.clearDocumentState()),g&&m.clearState(),m.cloneDocument(),e(this,U).textContent=m.title,document.body.appendChild(e(this,U)),Y.dispatchEvent(document,"morphStart",{detail:mt});const kt=Array.from(document.head.children),Ct=Array.from(m.document.head.children),Tt=p(this,c,Bt).call(this,kt,Ct),Ft=p(this,c,wt).call(this,kt,Tt),at=p(this,c,wt).call(this,Ct,Tt);at.forEach((o,k)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=o.getAttribute("src"),at[k]=w}}),at.forEach(o=>{document.head.appendChild(o)});const ft=at.filter(o=>{if(o.hasAttribute("data-no-waiting"))return!1;if(p(this,c,bt).call(this,o))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(o=>W(this,null,function*(){let k=0;try{for(var w=Dt(ft),tt,O,K;tt=!(O=yield w.next()).done;tt=!1){const lt=O.value;lt.onload=()=>{k++,k===ft.length&&o()}}}catch(O){K=[O]}finally{try{tt&&(O=w.return)&&(yield O.call(w))}finally{if(K)throw K[0]}}}))),yield It.wait(10);const xt=[];Ft.forEach(o=>{o.hasAttribute("data-permanent")||(p(this,c,bt).call(this,o)?xt.push(o):o.remove())});const Ot=p(this,c,yt).call(this,m.document.body);e(this,A).morphInsideScrollContainer||p(this,c,Lt).call(this,m.document),document.documentElement.setAttribute("data-current-pathname",u.pathname),document.documentElement.setAttribute("data-current-leaf",u.leaf),ct.changeHistory({action:s,pathname:u.pathname,searchParameters:u.parameters||(N?location.search:""),hash:u.hash}),e(this,U).remove(),n(this,it,e(this,f)),n(this,f,u.path),e(this,J).forEach((o,k)=>{const w=Ot[k],tt=getComputedStyle(o).getPropertyValue("--morph-duration");let O=[],K=[];v?v.forEach(d=>{const S=o.querySelector(d),q=w.querySelector(d);S&&q&&(K.push(S),O.push(q))}):(O.push(...w.childNodes),K.push(...o.childNodes)),K.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),O.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),v?O.forEach((d,S)=>{var q;(q=K[S].parentElement)==null||q.insertBefore(d,K[S])}):o.prepend(...O),$t.requestIdleCallback(()=>{O.forEach(d=>{var S;d instanceof HTMLElement&&((S=d.parentElement)==null||S.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("in"))})});const lt=Et(pt({},mt),{morphElement:o});Y.dispatchEvent(document,"morphNewChildrenAdded",{detail:lt});const Wt=new Promise(d=>{setTimeout(()=>{K.forEach(S=>S.remove()),O.forEach(S=>{var q;S instanceof HTMLElement&&((q=S.parentElement)==null||q.style.removeProperty("--new-content-height"),S.classList.remove("in","new"))}),Y.dispatchEvent(document,"morphOldChildrenRemoved",{detail:lt}),d()},(parseFloat(tt)||0)*1e3+10)});e(this,B).push(Wt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-m.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),Y.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:m.scrollState}),u.hash?(m.clearScrollState(),p(this,c,Pt).call(this,u.hash,{centerScroll:i,offsetScroll:h})):e(this,x)?m.restoreScrollPosition():m.renewScrollPosition(),yield Promise.all(e(this,B)),xt.forEach(o=>o.remove()),n(this,B,[]),e(this,J).forEach(o=>{o.querySelectorAll("script").forEach(w=>{const tt=document.createElement("script");tt.type="module",tt.src=w.getAttribute("src"),w.replaceWith(tt)})}),Y.dispatchEvent(document,"morphComplete",{detail:mt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(H){console.error(H)}n(this,z,void 0)})}addLink(t){e(this,E).push(new St(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,nt));e(this,E).push(...s.map(i=>new St(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,nt));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new St(s,this)))}};A=new WeakMap,J=new WeakMap,E=new WeakMap,z=new WeakMap,f=new WeakMap,it=new WeakMap,B=new WeakMap,x=new WeakMap,L=new WeakMap,rt=new WeakMap,M=new WeakMap,U=new WeakMap,Q=new WeakMap,Z=new WeakMap,nt=new WeakMap,c=new WeakSet,ht=function(t){let s=e(this,M).get(t);return s||(s=new Rt(this,t),e(this,M).set(t,s)),s},yt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Bt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},wt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},bt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},Lt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,_)),n(this,Z,0),n(this,Q,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,_)),e(this,_).call(this)},Pt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&It.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})},ut=new WeakMap,_=new WeakMap,et.instance=null;let vt=et;exports.Morph=vt;
@@ -1,45 +1,45 @@
1
- var Ot = Object.defineProperty, Wt = Object.defineProperties;
2
- var Yt = Object.getOwnPropertyDescriptors;
3
- var At = Object.getOwnPropertySymbols;
4
- var Xt = Object.prototype.hasOwnProperty, Ut = Object.prototype.propertyIsEnumerable;
5
- var kt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), Tt = (r) => {
1
+ var Wt = Object.defineProperty, Yt = Object.defineProperties;
2
+ var Xt = Object.getOwnPropertyDescriptors;
3
+ var Tt = Object.getOwnPropertySymbols;
4
+ var Ut = Object.prototype.hasOwnProperty, jt = Object.prototype.propertyIsEnumerable;
5
+ var xt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), Mt = (r) => {
6
6
  throw TypeError(r);
7
7
  };
8
- var Ct = (r, t, s) => t in r ? Ot(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s, xt = (r, t) => {
8
+ var Nt = (r, t, s) => t in r ? Wt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s, ft = (r, t) => {
9
9
  for (var s in t || (t = {}))
10
- Xt.call(t, s) && Ct(r, s, t[s]);
11
- if (At)
12
- for (var s of At(t))
13
- Ut.call(t, s) && Ct(r, s, t[s]);
10
+ Ut.call(t, s) && Nt(r, s, t[s]);
11
+ if (Tt)
12
+ for (var s of Tt(t))
13
+ jt.call(t, s) && Nt(r, s, t[s]);
14
14
  return r;
15
- }, Nt = (r, t) => Wt(r, Yt(t));
16
- var ft = (r, t, s) => t.has(r) || Tt("Cannot " + s);
17
- var e = (r, t, s) => (ft(r, t, "read from private field"), s ? s.call(r) : t.get(r)), a = (r, t, s) => t.has(r) ? Tt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), n = (r, t, s, i) => (ft(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), p = (r, t, s) => (ft(r, t, "access private method"), s);
18
- var W = (r, t, s) => new Promise((i, u) => {
19
- var y = (E) => {
15
+ }, pt = (r, t) => Yt(r, Xt(t));
16
+ var Et = (r, t, s) => t.has(r) || Mt("Cannot " + s);
17
+ var e = (r, t, s) => (Et(r, t, "read from private field"), s ? s.call(r) : t.get(r)), a = (r, t, s) => t.has(r) ? Mt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), n = (r, t, s, i) => (Et(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), p = (r, t, s) => (Et(r, t, "access private method"), s);
18
+ var W = (r, t, s) => new Promise((i, h) => {
19
+ var y = (g) => {
20
20
  try {
21
- w(s.next(E));
22
- } catch (F) {
23
- u(F);
21
+ w(s.next(g));
22
+ } catch (B) {
23
+ h(B);
24
24
  }
25
- }, M = (E) => {
25
+ }, M = (g) => {
26
26
  try {
27
- w(s.throw(E));
28
- } catch (F) {
29
- u(F);
27
+ w(s.throw(g));
28
+ } catch (B) {
29
+ h(B);
30
30
  }
31
- }, w = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(y, M);
31
+ }, w = (g) => g.done ? i(g.value) : Promise.resolve(g.value).then(y, M);
32
32
  w((s = s.apply(r, t)).next());
33
33
  });
34
- var Mt = (r, t, s) => (t = r[kt("asyncIterator")]) ? t.call(r) : (r = r[kt("iterator")](), t = {}, s = (i, u) => (u = r[i]) && (t[i] = (y) => new Promise((M, w, E) => (y = u.call(r, y), E = y.done, Promise.resolve(y.value).then((F) => M({ value: F, done: E }), w)))), s("next"), s("return"), t);
35
- import { i as Rt } from "../index-Bv9zgfdb.js";
34
+ var Ht = (r, t, s) => (t = r[xt("asyncIterator")]) ? t.call(r) : (r = r[xt("iterator")](), t = {}, s = (i, h) => (h = r[i]) && (t[i] = (y) => new Promise((M, w, g) => (y = h.call(r, y), g = y.done, Promise.resolve(y.value).then((B) => M({ value: B, done: g }), w)))), s("next"), s("return"), t);
35
+ import { i as Vt } from "../index-Bv9zgfdb.js";
36
36
  import { d as Y } from "../events-CsVF98U6.js";
37
- import { r as jt } from "../polyfills-DJrTJQky.js";
38
- import { w as Kt, s as $t } from "../scroll-DPkCFTxg.js";
37
+ import { r as Kt } from "../polyfills-DJrTJQky.js";
38
+ import { w as $t, s as Gt } from "../scroll-DPkCFTxg.js";
39
39
  import "construct-style-sheets-polyfill";
40
- import { n as Gt, c as Ht, s as Jt } from "../url-Cb0SFRMc.js";
41
- import { cssValueParser as Qt } from "../css-value-parser/index.js";
42
- class Vt extends HTMLElement {
40
+ import { n as Jt, c as Dt, s as Qt } from "../url-Cb0SFRMc.js";
41
+ import { cssValueParser as Zt } from "../css-value-parser/index.js";
42
+ class qt extends HTMLElement {
43
43
  connectedCallback() {
44
44
  const t = {
45
45
  "aria-live": "assertive",
@@ -50,9 +50,9 @@ class Vt extends HTMLElement {
50
50
  this.setAttribute(s, i);
51
51
  }
52
52
  }
53
- Rt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Vt);
53
+ Vt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", qt);
54
54
  var C, l, I, st, $;
55
- class pt {
55
+ class gt {
56
56
  constructor(t, s) {
57
57
  a(this, C);
58
58
  a(this, l);
@@ -63,18 +63,18 @@ class pt {
63
63
  history.back();
64
64
  else {
65
65
  n(this, I, e(this, l).getAttribute("href") || "/");
66
- const u = e(this, l).getAttribute(
66
+ const h = e(this, l).getAttribute(
67
67
  "data-history-action"
68
- ) || "push", y = e(this, l).hasAttribute("data-center-scroll"), M = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), w = M ? Qt.parse(M) : void 0, E = e(this, l).hasAttribute("data-revalidate"), F = e(this, l).hasAttribute(
68
+ ) || "push", y = e(this, l).hasAttribute("data-center-scroll"), M = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), w = M ? Zt.parse(M) : void 0, g = e(this, l).hasAttribute("data-revalidate"), B = e(this, l).hasAttribute(
69
69
  "data-keep-search-parameters"
70
- ), c = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((H) => H.trim()), ot = e(this, l).hasAttribute("data-clear-state");
70
+ ), u = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((H) => H.trim()), ot = e(this, l).hasAttribute("data-clear-state");
71
71
  e(this, C).navigate(e(this, I), {
72
- historyAction: u,
72
+ historyAction: h,
73
73
  centerScroll: y,
74
74
  offsetScroll: w,
75
- revalidate: E,
76
- keepSearchParameters: F,
77
- submorph: c,
75
+ revalidate: g,
76
+ keepSearchParameters: B,
77
+ submorph: u,
78
78
  clearState: ot
79
79
  });
80
80
  }
@@ -97,9 +97,9 @@ class pt {
97
97
  }
98
98
  }
99
99
  C = new WeakMap(), l = new WeakMap(), I = new WeakMap(), st = new WeakMap(), $ = new WeakMap();
100
- const Zt = new DOMParser();
100
+ const _t = new DOMParser();
101
101
  var T, R, b, P, X, V, G, U, q;
102
- class Dt {
102
+ class It {
103
103
  constructor(t, s) {
104
104
  a(this, T);
105
105
  a(this, R);
@@ -135,9 +135,9 @@ class Dt {
135
135
  return e(this, q) || e(this, P) && e(this, P).documentElement.hasAttribute("data-cache") && !t || e(this, P) && e(this, T).isPopstateNavigation ? e(this, q) : (n(this, q, new Promise((s) => W(this, null, function* () {
136
136
  try {
137
137
  n(this, U, new AbortController());
138
- const u = yield (yield fetch(e(this, R), {
138
+ const h = yield (yield fetch(e(this, R), {
139
139
  signal: e(this, U).signal
140
- })).text(), y = Zt.parseFromString(u, "text/html");
140
+ })).text(), y = _t.parseFromString(h, "text/html");
141
141
  this.setInitialDocument(y);
142
142
  } catch (i) {
143
143
  console.warn(i);
@@ -199,17 +199,17 @@ class Dt {
199
199
  }
200
200
  }
201
201
  T = new WeakMap(), R = new WeakMap(), b = new WeakMap(), P = new WeakMap(), X = new WeakMap(), V = new WeakMap(), G = new WeakMap(), U = new WeakMap(), q = new WeakMap();
202
- var A, J, g, z, f, it, B, x, L, rt, N, j, Q, Z, nt, h, ht, gt, qt, Et, St, wt, yt, ct, _;
202
+ var A, J, E, z, f, it, F, x, L, rt, N, j, Q, Z, nt, c, ct, St, zt, wt, yt, vt, bt, ht, _;
203
203
  const et = class et {
204
204
  constructor(t) {
205
- a(this, h);
205
+ a(this, c);
206
206
  a(this, A, null);
207
207
  a(this, J, null);
208
- a(this, g, []);
208
+ a(this, E, []);
209
209
  a(this, z);
210
210
  a(this, f, null);
211
211
  a(this, it);
212
- a(this, B, []);
212
+ a(this, F, []);
213
213
  a(this, x, !1);
214
214
  a(this, L, null);
215
215
  a(this, rt, !1);
@@ -221,12 +221,12 @@ const et = class et {
221
221
  var s;
222
222
  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";
223
223
  });
224
- a(this, ct, (t) => W(this, null, function* () {
224
+ a(this, ht, (t) => W(this, null, function* () {
225
225
  var s;
226
226
  (s = t.state) != null && s.path && (t.preventDefault(), n(this, x, !0), yield this.navigate(t.state.path, { historyAction: "none" }), n(this, x, !1));
227
227
  }));
228
228
  a(this, _, () => {
229
- const { left: t, top: s } = this.scrollValue, i = s - e(this, Z), u = t - e(this, Q);
229
+ const { left: t, top: s } = this.scrollValue, i = s - e(this, Z), h = t - e(this, Q);
230
230
  n(this, Z, s), n(this, Q, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
231
231
  "scroll-y-forward",
232
232
  i > 0
@@ -235,10 +235,10 @@ const et = class et {
235
235
  i < 0
236
236
  ), document.documentElement.classList.toggle(
237
237
  "scroll-x-forward",
238
- u > 0
238
+ h > 0
239
239
  ), document.documentElement.classList.toggle(
240
240
  "scroll-x-backward",
241
- u < 0
241
+ h < 0
242
242
  ), Y(document, "morphScroll", {
243
243
  detail: {
244
244
  left: t,
@@ -246,31 +246,31 @@ const et = class et {
246
246
  }
247
247
  });
248
248
  });
249
- if (Rt && !et.instance) {
249
+ if (Vt && !et.instance) {
250
250
  et.instance = this, n(this, A, {
251
- base: Gt(t == null ? void 0 : t.base),
251
+ base: Jt(t == null ? void 0 : t.base),
252
252
  waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
253
253
  trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
254
254
  scrollSelector: t == null ? void 0 : t.scrollSelector,
255
255
  morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
256
- }), n(this, J, p(this, h, gt).call(this, document.body));
256
+ }), n(this, J, p(this, c, St).call(this, document.body));
257
257
  const s = this.normalizePath(
258
258
  location.pathname + location.hash + location.search
259
259
  );
260
260
  n(this, f, s.path);
261
- const i = new Dt(this, e(this, f));
261
+ const i = new It(this, e(this, f));
262
262
  i.setInitialDocument(document), e(this, N).set(e(this, f), i), document.documentElement.setAttribute(
263
263
  "data-current-pathname",
264
264
  e(this, f)
265
265
  ), document.documentElement.setAttribute(
266
266
  "data-current-leaf",
267
267
  s.leaf
268
- ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, ct)), Ht({
268
+ ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, ht)), Dt({
269
269
  action: "replace",
270
270
  pathname: s.pathname,
271
271
  searchParameters: s.parameters,
272
272
  hash: s.hash
273
- }), n(this, j, new Vt()), p(this, h, wt).call(this, document);
273
+ }), n(this, j, new qt()), p(this, c, vt).call(this, document);
274
274
  }
275
275
  }
276
276
  get currentPath() {
@@ -280,7 +280,7 @@ const et = class et {
280
280
  return e(this, it);
281
281
  }
282
282
  get links() {
283
- return e(this, g);
283
+ return e(this, E);
284
284
  }
285
285
  get scrollElement() {
286
286
  return e(this, L);
@@ -301,45 +301,45 @@ const et = class et {
301
301
  return t == null ? void 0 : t.clearState();
302
302
  }
303
303
  normalizePath(t) {
304
- return Jt(t, {
304
+ return Qt(t, {
305
305
  base: e(this, A).base,
306
306
  trailingSlash: e(this, A).trailingSlash
307
307
  });
308
308
  }
309
309
  prefetch(t, s) {
310
310
  return W(this, null, function* () {
311
- if (e(this, B).length)
311
+ if (e(this, F).length)
312
312
  return;
313
- const i = p(this, h, ht).call(this, t);
313
+ const i = p(this, c, ct).call(this, t);
314
314
  i == null || i.fetch(s);
315
315
  });
316
316
  }
317
- navigate(F) {
317
+ navigate(B) {
318
318
  return W(this, arguments, function* (t, {
319
319
  historyAction: s = "push",
320
320
  centerScroll: i,
321
- offsetScroll: u,
321
+ offsetScroll: h,
322
322
  revalidate: y,
323
323
  keepSearchParameters: M,
324
324
  submorph: w,
325
- clearState: E
325
+ clearState: g
326
326
  } = {}) {
327
327
  var ot;
328
- if (e(this, B).length)
328
+ if (e(this, F).length)
329
329
  return;
330
- const c = this.normalizePath(
330
+ const u = this.normalizePath(
331
331
  ((ot = this.pathnameModifier) == null ? void 0 : ot.call(this, t)) || t
332
332
  );
333
- if (e(this, z) === c.path || e(this, f) === c.path) {
334
- e(this, x) || p(this, h, yt).call(this, c.hash || 0, {
333
+ if (e(this, z) === u.path || e(this, f) === u.path) {
334
+ e(this, x) || p(this, c, bt).call(this, u.hash || 0, {
335
335
  centerScroll: i,
336
- offsetScroll: u,
336
+ offsetScroll: h,
337
337
  behavior: "smooth"
338
338
  });
339
339
  return;
340
340
  }
341
- n(this, z, c.path), e(this, g).forEach((H) => {
342
- H.checkCurrent(c.path);
341
+ n(this, z, u.path), e(this, E).forEach((H) => {
342
+ H.checkCurrent(u.path);
343
343
  });
344
344
  try {
345
345
  let H = !0;
@@ -357,32 +357,35 @@ const et = class et {
357
357
  } catch (o) {
358
358
  o ? console.error(o) : console.log("Route change canceled"), H = !1;
359
359
  }
360
- if (!H || e(this, z) !== c.path) {
361
- e(this, g).forEach((o) => {
360
+ if (!H || e(this, z) !== u.path) {
361
+ e(this, E).forEach((o) => {
362
362
  o.checkCurrent(e(this, f));
363
363
  });
364
364
  return;
365
365
  }
366
- const ut = {
367
- path: c.path,
366
+ const Lt = {
367
+ path: u.path,
368
368
  submorph: w
369
369
  };
370
370
  Y(document, "morphNavigation", {
371
- detail: ut
371
+ detail: Lt
372
372
  });
373
- const dt = p(this, h, ht).call(this, e(this, f)), m = p(this, h, ht).call(this, t);
373
+ const ut = p(this, c, ct).call(this, e(this, f)), m = p(this, c, ct).call(this, t);
374
374
  if (e(this, N).forEach((o) => {
375
- o.path !== c.path && o.abort();
376
- }), yield m == null ? void 0 : m.fetch(y), e(this, z) !== c.path) {
377
- e(this, g).forEach((o) => {
375
+ o.path !== u.path && o.abort();
376
+ }), yield m == null ? void 0 : m.fetch(y), e(this, z) !== u.path) {
377
+ e(this, E).forEach((o) => {
378
378
  o.checkCurrent(e(this, f));
379
379
  });
380
380
  return;
381
381
  }
382
- dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), e(this, x) || (m.clearScrollState(), m.clearDocumentState()), E && m.clearState(), m.cloneDocument(), e(this, j).textContent = m.title, document.body.appendChild(e(this, j)), Y(document, "morphStart", {
383
- detail: ut
382
+ const dt = pt(ft({}, Lt), {
383
+ document: m.document
384
384
  });
385
- const vt = Array.from(document.head.children), bt = Array.from(m.document.head.children), Lt = p(this, h, qt).call(this, vt, bt), zt = p(this, h, Et).call(this, vt, Lt), at = p(this, h, Et).call(this, bt, Lt);
385
+ ut.clearState(), ut.saveScrollState(), ut.saveDocumentState(), e(this, x) || (m.clearScrollState(), m.clearDocumentState()), g && m.clearState(), m.cloneDocument(), e(this, j).textContent = m.title, document.body.appendChild(e(this, j)), Y(document, "morphStart", {
386
+ detail: dt
387
+ });
388
+ const Pt = Array.from(document.head.children), At = Array.from(m.document.head.children), kt = p(this, c, zt).call(this, Pt, At), Ft = p(this, c, wt).call(this, Pt, kt), at = p(this, c, wt).call(this, At, kt);
386
389
  at.forEach((o, k) => {
387
390
  if (o.tagName === "SCRIPT" && o.getAttribute("src")) {
388
391
  const v = document.createElement("script");
@@ -394,13 +397,13 @@ const et = class et {
394
397
  const mt = at.filter((o) => {
395
398
  if (o.hasAttribute("data-no-waiting"))
396
399
  return !1;
397
- if (p(this, h, St).call(this, o))
400
+ if (p(this, c, yt).call(this, o))
398
401
  return !0;
399
402
  });
400
403
  e(this, A).waitForHeadToLoad && mt.length && (yield new Promise((o) => W(this, null, function* () {
401
404
  let k = 0;
402
405
  try {
403
- for (var v = Mt(mt), tt, O, K; tt = !(O = yield v.next()).done; tt = !1) {
406
+ for (var v = Ht(mt), tt, O, K; tt = !(O = yield v.next()).done; tt = !1) {
404
407
  const lt = O.value;
405
408
  lt.onload = () => {
406
409
  k++, k === mt.length && o();
@@ -416,24 +419,24 @@ const et = class et {
416
419
  throw K[0];
417
420
  }
418
421
  }
419
- }))), yield Kt(10);
420
- const Pt = [];
421
- zt.forEach((o) => {
422
- o.hasAttribute("data-permanent") || (p(this, h, St).call(this, o) ? Pt.push(o) : o.remove());
422
+ }))), yield $t(10);
423
+ const Ct = [];
424
+ Ft.forEach((o) => {
425
+ o.hasAttribute("data-permanent") || (p(this, c, yt).call(this, o) ? Ct.push(o) : o.remove());
423
426
  });
424
- const Bt = p(this, h, gt).call(this, m.document.body);
425
- e(this, A).morphInsideScrollContainer || p(this, h, wt).call(this, m.document), document.documentElement.setAttribute(
427
+ const Bt = p(this, c, St).call(this, m.document.body);
428
+ e(this, A).morphInsideScrollContainer || p(this, c, vt).call(this, m.document), document.documentElement.setAttribute(
426
429
  "data-current-pathname",
427
- c.pathname
430
+ u.pathname
428
431
  ), document.documentElement.setAttribute(
429
432
  "data-current-leaf",
430
- c.leaf
431
- ), Ht({
433
+ u.leaf
434
+ ), Dt({
432
435
  action: s,
433
- pathname: c.pathname,
434
- searchParameters: c.parameters || (M ? location.search : ""),
435
- hash: c.hash
436
- }), e(this, j).remove(), n(this, it, e(this, f)), n(this, f, c.path), e(this, J).forEach((o, k) => {
436
+ pathname: u.pathname,
437
+ searchParameters: u.parameters || (M ? location.search : ""),
438
+ hash: u.hash
439
+ }), e(this, j).remove(), n(this, it, e(this, f)), n(this, f, u.path), e(this, J).forEach((o, k) => {
437
440
  const v = Bt[k], tt = getComputedStyle(o).getPropertyValue("--morph-duration");
438
441
  let O = [], K = [];
439
442
  w ? w.forEach((d) => {
@@ -449,7 +452,7 @@ const et = class et {
449
452
  d,
450
453
  K[S]
451
454
  );
452
- }) : o.prepend(...O), jt(() => {
455
+ }) : o.prepend(...O), Kt(() => {
453
456
  O.forEach((d) => {
454
457
  var S;
455
458
  d instanceof HTMLElement && ((S = d.parentElement) == null || S.style.setProperty(
@@ -458,14 +461,13 @@ const et = class et {
458
461
  ), d.classList.add("in"));
459
462
  });
460
463
  });
461
- const lt = {
462
- morphElement: o,
463
- path: c.path
464
- };
464
+ const lt = pt(ft({}, dt), {
465
+ morphElement: o
466
+ });
465
467
  Y(document, "morphNewChildrenAdded", {
466
468
  detail: lt
467
469
  });
468
- const Ft = new Promise((d) => {
470
+ const Ot = new Promise((d) => {
469
471
  setTimeout(() => {
470
472
  K.forEach((S) => S.remove()), O.forEach((S) => {
471
473
  var D;
@@ -477,7 +479,7 @@ const et = class et {
477
479
  }), d();
478
480
  }, (parseFloat(tt) || 0) * 1e3 + 10);
479
481
  });
480
- e(this, B).push(Ft);
482
+ e(this, F).push(Ot);
481
483
  }), this.isPopstateNavigation ? document.documentElement.style.setProperty(
482
484
  "--new-document-scroll-position",
483
485
  (this.scrollValue.top - m.scrollState.y) * 1 + "px"
@@ -486,18 +488,16 @@ const et = class et {
486
488
  this.scrollValue.top + "px"
487
489
  ), Y(document, "morphBeforeNavigationScroll", {
488
490
  detail: m.scrollState
489
- }), c.hash ? (m.clearScrollState(), p(this, h, yt).call(this, c.hash, {
491
+ }), u.hash ? (m.clearScrollState(), p(this, c, bt).call(this, u.hash, {
490
492
  centerScroll: i,
491
- offsetScroll: u
492
- })) : e(this, x) ? m.restoreScrollPosition() : m.renewScrollPosition(), yield Promise.all(e(this, B)), Pt.forEach((o) => o.remove()), n(this, B, []), e(this, J).forEach((o) => {
493
+ offsetScroll: h
494
+ })) : e(this, x) ? m.restoreScrollPosition() : m.renewScrollPosition(), yield Promise.all(e(this, F)), Ct.forEach((o) => o.remove()), n(this, F, []), e(this, J).forEach((o) => {
493
495
  o.querySelectorAll("script").forEach((v) => {
494
496
  const tt = document.createElement("script");
495
497
  tt.type = "module", tt.src = v.getAttribute("src"), v.replaceWith(tt);
496
498
  });
497
499
  }), Y(document, "morphComplete", {
498
- detail: Nt(xt({}, ut), {
499
- document: m.document
500
- })
500
+ detail: dt
501
501
  }), document.documentElement.style.removeProperty(
502
502
  "--new-document-scroll-position"
503
503
  ), window.dispatchEvent(new Event("resize"));
@@ -508,7 +508,7 @@ const et = class et {
508
508
  });
509
509
  }
510
510
  addLink(t) {
511
- e(this, g).push(new pt(t, this));
511
+ e(this, E).push(new gt(t, this));
512
512
  }
513
513
  addLinks(t) {
514
514
  t.forEach((s) => {
@@ -516,62 +516,62 @@ const et = class et {
516
516
  });
517
517
  }
518
518
  removeLink(t) {
519
- n(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
519
+ n(this, E, e(this, E).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
520
520
  }
521
521
  destroyOldLinks(t) {
522
- n(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
522
+ n(this, E, e(this, E).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
523
523
  }
524
524
  findNewLinks(t) {
525
525
  const s = [...t.querySelectorAll("a")].filter(
526
526
  e(this, nt)
527
527
  );
528
- e(this, g).push(
529
- ...s.map((i) => new pt(i, this))
528
+ e(this, E).push(
529
+ ...s.map((i) => new gt(i, this))
530
530
  );
531
531
  }
532
532
  findLinks() {
533
533
  const t = [
534
534
  ...document.documentElement.querySelectorAll("a")
535
535
  ].filter(e(this, nt));
536
- e(this, g).forEach((s) => s.destroy()), n(this, g, t.map((s) => new pt(s, this)));
536
+ e(this, E).forEach((s) => s.destroy()), n(this, E, t.map((s) => new gt(s, this)));
537
537
  }
538
538
  };
539
- A = new WeakMap(), J = new WeakMap(), g = new WeakMap(), z = new WeakMap(), f = new WeakMap(), it = new WeakMap(), B = new WeakMap(), x = new WeakMap(), L = new WeakMap(), rt = new WeakMap(), N = new WeakMap(), j = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), nt = new WeakMap(), h = new WeakSet(), ht = function(t) {
539
+ A = new WeakMap(), J = new WeakMap(), E = new WeakMap(), z = new WeakMap(), f = new WeakMap(), it = new WeakMap(), F = new WeakMap(), x = new WeakMap(), L = new WeakMap(), rt = new WeakMap(), N = new WeakMap(), j = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), nt = new WeakMap(), c = new WeakSet(), ct = function(t) {
540
540
  let s = e(this, N).get(t);
541
- return s || (s = new Dt(this, t), e(this, N).set(t, s)), s;
542
- }, gt = function(t) {
541
+ return s || (s = new It(this, t), e(this, N).set(t, s)), s;
542
+ }, St = function(t) {
543
543
  const s = [...t.querySelectorAll("[data-morph]")];
544
544
  return s.length ? s : [t];
545
- }, qt = function(t, s) {
545
+ }, zt = function(t, s) {
546
546
  return t.filter(
547
547
  (i) => s.find(
548
- (u) => u.outerHTML === i.outerHTML
548
+ (h) => h.outerHTML === i.outerHTML
549
549
  )
550
550
  );
551
- }, Et = function(t, s) {
551
+ }, wt = function(t, s) {
552
552
  return t.filter(
553
553
  (i) => !s.find(
554
- (u) => u.outerHTML === i.outerHTML
554
+ (h) => h.outerHTML === i.outerHTML
555
555
  )
556
556
  );
557
- }, St = function(t) {
557
+ }, yt = function(t) {
558
558
  return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
559
- }, wt = function(t) {
559
+ }, vt = function(t) {
560
560
  var s, i;
561
561
  (s = e(this, L)) == null || s.removeEventListener(
562
562
  "scroll",
563
563
  e(this, _)
564
564
  ), n(this, Z, 0), n(this, Q, 0), n(this, L, e(this, A).scrollSelector && t.querySelector(e(this, A).scrollSelector) || window), n(this, rt, e(this, L) === window), (i = e(this, L)) == null || i.addEventListener("scroll", e(this, _)), e(this, _).call(this);
565
- }, yt = function(t, s) {
565
+ }, bt = function(t, s) {
566
566
  const i = typeof t == "string" ? document.getElementById(t) : t;
567
- (typeof i == "number" || i) && $t(i, {
567
+ (typeof i == "number" || i) && Gt(i, {
568
568
  scrollElement: e(this, L),
569
569
  behavior: (s == null ? void 0 : s.behavior) || "instant",
570
570
  center: s == null ? void 0 : s.centerScroll,
571
571
  offset: s == null ? void 0 : s.offsetScroll
572
572
  });
573
- }, ct = new WeakMap(), _ = new WeakMap(), et.instance = null;
574
- let It = et;
573
+ }, ht = new WeakMap(), _ = new WeakMap(), et.instance = null;
574
+ let Rt = et;
575
575
  export {
576
- It as Morph
576
+ Rt as Morph
577
577
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.69.10",
3
+ "version": "0.69.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"