aptechka 0.61.0 → 0.61.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.
@@ -12,6 +12,7 @@ export interface MorphNavigationEntry {
12
12
  pathname: string;
13
13
  }
14
14
  export interface MorphTransitionEntry extends MorphNavigationEntry {
15
+ submorph?: Array<string>;
15
16
  }
16
17
  export interface MorphChildrenActionEntry {
17
18
  morphElement: HTMLElement;
@@ -1 +1 @@
1
- "use strict";var Pt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),At=n=>{throw TypeError(n)};var ct=(n,t,s)=>t.has(n)||At("Cannot "+s);var e=(n,t,s)=>(ct(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?At("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>(ct(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>(ct(n,t,"access private method"),s);var R=(n,t,s)=>new Promise((i,u)=>{var g=v=>{try{b(s.next(v))}catch(A){u(A)}},w=v=>{try{b(s.throw(v))}catch(A){u(A)}},b=v=>v.done?i(v.value):Promise.resolve(v.value).then(g,w);b((s=s.apply(n,t)).next())});var kt=(n,t,s)=>(t=n[Pt("asyncIterator")])?t.call(n):(n=n[Pt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=g=>new Promise((w,b,v)=>(g=u.call(n,g),v=g.done,Promise.resolve(g.value).then(A=>w({value:A,done:v}),b)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Mt=require("../index-Cqw2NKev.cjs"),U=require("../events-KVanG9sR.cjs"),It=require("../polyfills-Df4r-ETT.cjs"),Ct=require("../scroll-DAhSpkhR.cjs"),it=require("../url-D1CgmwZ_.cjs"),Ot=require("../css-value-parser/index.cjs");class Ht 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)}}Mt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Ht);var C,l,z,Z,$;class ht{constructor(t,s){o(this,C);o(this,l);o(this,z);o(this,Z,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{const u=e(this,l).getAttribute("data-history-action")||"push",g=e(this,l).hasAttribute("data-center-scroll"),w=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),b=w?Ot.cssValueParser.parse(w):void 0,v=e(this,l).hasAttribute("data-revalidate"),A=e(this,l).hasAttribute("data-keep-search-parameters"),m=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(V=>V.trim());e(this,C).navigate(e(this,z),{historyAction:u,centerScroll:g,offsetScroll:b,revalidate:v,keepSearchParameters:A,submorph:m})}});o(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,z),t),e(this,l).removeEventListener("pointerenter",e(this,$))});a(this,C,s),a(this,l,t),a(this,z,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,Z)),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,z));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,Z)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,z=new WeakMap,Z=new WeakMap,$=new WeakMap;var x,K,y,I,O,N;class Tt{constructor(t,s,i){o(this,x);o(this,K);o(this,y,{x:0,y:0});o(this,I);o(this,O,null);o(this,N,null);a(this,x,t),a(this,K,s),a(this,I,i.cloneNode(!0))}get pathname(){return e(this,K)}get scrollState(){return e(this,y)}get document(){return e(this,N)}cloneDocument(){a(this,N,(e(this,O)||e(this,I)).cloneNode(!0))}get title(){let t="";if(e(this,N).title)t=e(this,N).title;else{const s=e(this,N).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,K)}return t}clearScrollState(){e(this,y).x=0,e(this,y).y=0}clearDocumentState(){a(this,O,null)}saveScrollState(){e(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,x).scrollElement.scrollLeft,e(this,y).y=e(this,x).scrollElement.scrollTop)}saveDocumentState(){e(this,I).documentElement.hasAttribute("data-no-page-restoration")?a(this,O,null):a(this,O,document.cloneNode(!0))}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x})}renewScrollPosition(){e(this,x).scrollElement.scroll({top:0,left:0,behavior:"instant"})}}x=new WeakMap,K=new WeakMap,y=new WeakMap,I=new WeakMap,O=new WeakMap,N=new WeakMap;var T,Y,f,nt,q,p,_,B,M,P,G,F,tt,c,rt,xt,dt,Nt,mt,ft,pt,Et,ot,J;const X=class X{constructor(t){o(this,c);o(this,T,null);o(this,Y,null);o(this,f,[]);o(this,nt,new DOMParser);o(this,q);o(this,p,null);o(this,_);o(this,B,[]);o(this,M,!1);o(this,P,null);o(this,G,new Map);o(this,F,null);o(this,tt,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,ot,t=>R(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,M,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,M,!1))}));o(this,J,()=>{const t=e(this,P).scrollTop,s=e(this,P).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),U.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(Mt.isBrowser&&!X.instance){X.instance=this,a(this,T,{base:it.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),a(this,Y,d(this,c,dt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,p,s.pathname),e(this,G).set(e(this,p),new Tt(this,e(this,p),document)),document.documentElement.setAttribute("data-current-pathname",e(this,p)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,ot)),it.changeHistory({action:"replace",pathname:e(this,p),searchParameters:s.parameters||location.search,hash:s.hash}),a(this,F,new Ht),d(this,c,pt).call(this,document)}}get currentPathname(){return e(this,p)}get previousPathname(){return e(this,_)}get links(){return e(this,f)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,M)}normalizePath(t){return it.splitPath(t,{base:e(this,T).base,trailingSlash:e(this,T).trailingSlash})}prefetch(t,s){return R(this,null,function*(){const i=this.normalizePath(t);d(this,c,rt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(v){return R(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:g,keepSearchParameters:w,submorph:b}={}){var vt;if(e(this,B).length)return;const A=this.normalizePath(((vt=this.pathnameModifier)==null?void 0:vt.call(this,t))||t);let{pathname:m,hash:V,parameters:gt,leaf:qt}=A;if(e(this,q)===m||e(this,p)===m){e(this,M)||d(this,c,Et).call(this,V||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,q,m),e(this,f).forEach(W=>{W.checkCurrent(m)});try{let W=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var S;(S=this.preprocessor)==null||S.call(this,{pathname:m,resolve:r,reject:k})})}catch(r){r?console.error(r):console.log("Route change canceled"),W=!1}if(!W||e(this,q)!==m){e(this,f).forEach(r=>{r.checkCurrent(e(this,p))});return}const at={pathname:m};U.dispatchEvent(document,"morphNavigation",{detail:at});const St=yield d(this,c,rt).call(this,e(this,p)),L=yield d(this,c,rt).call(this,m,{searchParameters:gt,revalidate:g});if(e(this,q)!==m){e(this,f).forEach(r=>{r.checkCurrent(e(this,p))});return}St.saveScrollState(),St.saveDocumentState(),e(this,M)||(L.clearScrollState(),L.clearDocumentState()),L.cloneDocument(),e(this,F).textContent=L.title,document.body.appendChild(e(this,F)),U.dispatchEvent(document,"morphStart",{detail:at});const yt=Array.from(document.head.children),wt=Array.from(L.document.head.children),bt=d(this,c,Nt).call(this,yt,wt),Dt=d(this,c,mt).call(this,yt,bt),et=d(this,c,mt).call(this,wt,bt);et.forEach((r,k)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const S=document.createElement("script");S.type="module",S.src=r.getAttribute("src"),et[k]=S}}),et.forEach(r=>{document.head.appendChild(r)});const lt=et.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,c,ft).call(this,r))return!0});e(this,T).waitForHeadToLoad&&lt.length&&(yield new Promise(r=>R(this,null,function*(){let k=0;try{for(var S=kt(lt),Q,D,j;Q=!(D=yield S.next()).done;Q=!1){const st=D.value;st.onload=()=>{k++,k===lt.length&&r()}}}catch(D){j=[D]}finally{try{Q&&(D=S.return)&&(yield D.call(S))}finally{if(j)throw j[0]}}}))),yield Ct.wait(10);const Lt=[];Dt.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,c,ft).call(this,r)?Lt.push(r):r.remove())});const Rt=d(this,c,dt).call(this,L.document.body);e(this,T).morphInsideScrollContainer||d(this,c,pt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",m),document.documentElement.setAttribute("data-current-leaf",qt),it.changeHistory({action:s,pathname:m,searchParameters:gt||(w?location.search:""),hash:V}),e(this,F).remove(),a(this,_,e(this,p)),a(this,p,m),e(this,Y).forEach((r,k)=>{const S=Rt[k],Q=getComputedStyle(r).getPropertyValue("--morph-duration");let D=[],j=[];b?b.forEach(h=>{const E=r.querySelector(h),H=S.querySelector(h);E&&H&&(j.push(E),D.push(H))}):(D.push(...S.childNodes),j.push(...r.childNodes)),j.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),D.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),b?D.forEach((h,E)=>{var H;(H=j[E].parentElement)==null||H.insertBefore(h,j[E])}):r.prepend(...D),It.requestIdleCallback(()=>{D.forEach(h=>{var E;h instanceof HTMLElement&&((E=h.parentElement)==null||E.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("in"))})});const st={morphElement:r,pathname:m};U.dispatchEvent(document,"morphNewChildrenAdded",{detail:st});const zt=new Promise(h=>{setTimeout(()=>{j.forEach(E=>E.remove()),D.forEach(E=>{var H;E instanceof HTMLElement&&((H=E.parentElement)==null||H.style.removeProperty("--new-content-height"),E.classList.remove("in","new"))}),U.dispatchEvent(document,"morphOldChildrenRemoved",{detail:st}),h()},(parseFloat(Q)||0)*1e3+10)});e(this,B).push(zt)}),V?(L.clearScrollState(),d(this,c,Et).call(this,V,{centerScroll:i,offsetScroll:u})):e(this,M)?L.restoreScrollPosition():L.renewScrollPosition(),yield Promise.all(e(this,B)),Lt.forEach(r=>r.remove()),a(this,B,[]),e(this,Y).forEach(r=>{r.querySelectorAll("script").forEach(S=>{const Q=document.createElement("script");Q.type="module",Q.src=S.getAttribute("src"),S.replaceWith(Q)})}),U.dispatchEvent(document,"morphComplete",{detail:at}),window.dispatchEvent(new Event("resize"))}catch(W){console.error(W)}a(this,q,void 0)})}addLink(t){e(this,f).push(new ht(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,f,e(this,f).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){a(this,f,e(this,f).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,tt));e(this,f).push(...s.map(i=>new ht(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,tt));e(this,f).forEach(s=>s.destroy()),a(this,f,t.map(s=>new ht(s,this)))}};T=new WeakMap,Y=new WeakMap,f=new WeakMap,nt=new WeakMap,q=new WeakMap,p=new WeakMap,_=new WeakMap,B=new WeakMap,M=new WeakMap,P=new WeakMap,G=new WeakMap,F=new WeakMap,tt=new WeakMap,c=new WeakSet,rt=function(t,s){return R(this,null,function*(){let i=e(this,G).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield d(this,c,xt).call(this,t,s==null?void 0:s.searchParameters)),i})},xt=function(t,s){return R(this,null,function*(){const u=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),g=e(this,nt).parseFromString(u,"text/html"),w=new Tt(this,t,g);return e(this,G).set(t,w),w})},dt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Nt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},mt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},ft=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},pt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,J)),a(this,P,t.querySelector(e(this,T).scrollSelector)||t.documentElement),(i=e(this,P))==null||i.addEventListener("scroll",e(this,J)),e(this,J).call(this)},Et=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ct.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ot=new WeakMap,J=new WeakMap,X.instance=null;let ut=X;exports.Morph=ut;
1
+ "use strict";var Pt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),At=n=>{throw TypeError(n)};var ct=(n,t,s)=>t.has(n)||At("Cannot "+s);var e=(n,t,s)=>(ct(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?At("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>(ct(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>(ct(n,t,"access private method"),s);var R=(n,t,s)=>new Promise((i,u)=>{var g=S=>{try{v(s.next(S))}catch(A){u(A)}},L=S=>{try{v(s.throw(S))}catch(A){u(A)}},v=S=>S.done?i(S.value):Promise.resolve(S.value).then(g,L);v((s=s.apply(n,t)).next())});var kt=(n,t,s)=>(t=n[Pt("asyncIterator")])?t.call(n):(n=n[Pt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=g=>new Promise((L,v,S)=>(g=u.call(n,g),S=g.done,Promise.resolve(g.value).then(A=>L({value:A,done:S}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Mt=require("../index-Cqw2NKev.cjs"),U=require("../events-KVanG9sR.cjs"),It=require("../polyfills-Df4r-ETT.cjs"),Ct=require("../scroll-DAhSpkhR.cjs"),it=require("../url-D1CgmwZ_.cjs"),Ot=require("../css-value-parser/index.cjs");class Ht 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)}}Mt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Ht);var C,l,z,Z,$;class ht{constructor(t,s){o(this,C);o(this,l);o(this,z);o(this,Z,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{const u=e(this,l).getAttribute("data-history-action")||"push",g=e(this,l).hasAttribute("data-center-scroll"),L=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=L?Ot.cssValueParser.parse(L):void 0,S=e(this,l).hasAttribute("data-revalidate"),A=e(this,l).hasAttribute("data-keep-search-parameters"),m=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(V=>V.trim());e(this,C).navigate(e(this,z),{historyAction:u,centerScroll:g,offsetScroll:v,revalidate:S,keepSearchParameters:A,submorph:m})}});o(this,$,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,z),t),e(this,l).removeEventListener("pointerenter",e(this,$))});a(this,C,s),a(this,l,t),a(this,z,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,Z)),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,z));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,Z)),e(this,l).removeEventListener("pointerenter",e(this,$)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,z=new WeakMap,Z=new WeakMap,$=new WeakMap;var x,K,w,I,O,N;class Tt{constructor(t,s,i){o(this,x);o(this,K);o(this,w,{x:0,y:0});o(this,I);o(this,O,null);o(this,N,null);a(this,x,t),a(this,K,s),a(this,I,i.cloneNode(!0))}get pathname(){return e(this,K)}get scrollState(){return e(this,w)}get document(){return e(this,N)}cloneDocument(){a(this,N,(e(this,O)||e(this,I)).cloneNode(!0))}get title(){let t="";if(e(this,N).title)t=e(this,N).title;else{const s=e(this,N).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,K)}return t}clearScrollState(){e(this,w).x=0,e(this,w).y=0}clearDocumentState(){a(this,O,null)}saveScrollState(){e(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,w).x=0,e(this,w).y=0):(e(this,w).x=e(this,x).scrollElement.scrollLeft,e(this,w).y=e(this,x).scrollElement.scrollTop)}saveDocumentState(){e(this,I).documentElement.hasAttribute("data-no-page-restoration")?a(this,O,null):a(this,O,document.cloneNode(!0))}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,w).y,left:e(this,w).x})}renewScrollPosition(){e(this,x).scrollElement.scroll({top:0,left:0,behavior:"instant"})}}x=new WeakMap,K=new WeakMap,w=new WeakMap,I=new WeakMap,O=new WeakMap,N=new WeakMap;var T,Y,f,nt,q,p,_,B,M,P,G,F,tt,c,rt,xt,dt,Nt,mt,ft,pt,Et,ot,J;const X=class X{constructor(t){o(this,c);o(this,T,null);o(this,Y,null);o(this,f,[]);o(this,nt,new DOMParser);o(this,q);o(this,p,null);o(this,_);o(this,B,[]);o(this,M,!1);o(this,P,null);o(this,G,new Map);o(this,F,null);o(this,tt,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,ot,t=>R(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,M,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,M,!1))}));o(this,J,()=>{const t=e(this,P).scrollTop,s=e(this,P).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),U.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(Mt.isBrowser&&!X.instance){X.instance=this,a(this,T,{base:it.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),a(this,Y,d(this,c,dt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,p,s.pathname),e(this,G).set(e(this,p),new Tt(this,e(this,p),document)),document.documentElement.setAttribute("data-current-pathname",e(this,p)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,ot)),it.changeHistory({action:"replace",pathname:e(this,p),searchParameters:s.parameters||location.search,hash:s.hash}),a(this,F,new Ht),d(this,c,pt).call(this,document)}}get currentPathname(){return e(this,p)}get previousPathname(){return e(this,_)}get links(){return e(this,f)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,M)}normalizePath(t){return it.splitPath(t,{base:e(this,T).base,trailingSlash:e(this,T).trailingSlash})}prefetch(t,s){return R(this,null,function*(){const i=this.normalizePath(t);d(this,c,rt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(S){return R(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:g,keepSearchParameters:L,submorph:v}={}){var vt;if(e(this,B).length)return;const A=this.normalizePath(((vt=this.pathnameModifier)==null?void 0:vt.call(this,t))||t);let{pathname:m,hash:V,parameters:gt,leaf:qt}=A;if(e(this,q)===m||e(this,p)===m){e(this,M)||d(this,c,Et).call(this,V||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,q,m),e(this,f).forEach(W=>{W.checkCurrent(m)});try{let W=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:m,resolve:r,reject:k})})}catch(r){r?console.error(r):console.log("Route change canceled"),W=!1}if(!W||e(this,q)!==m){e(this,f).forEach(r=>{r.checkCurrent(e(this,p))});return}const at={pathname:m,submorph:v};U.dispatchEvent(document,"morphNavigation",{detail:at});const St=yield d(this,c,rt).call(this,e(this,p)),b=yield d(this,c,rt).call(this,m,{searchParameters:gt,revalidate:g});if(e(this,q)!==m){e(this,f).forEach(r=>{r.checkCurrent(e(this,p))});return}St.saveScrollState(),St.saveDocumentState(),e(this,M)||(b.clearScrollState(),b.clearDocumentState()),b.cloneDocument(),e(this,F).textContent=b.title,document.body.appendChild(e(this,F)),U.dispatchEvent(document,"morphStart",{detail:at});const yt=Array.from(document.head.children),wt=Array.from(b.document.head.children),Lt=d(this,c,Nt).call(this,yt,wt),Dt=d(this,c,mt).call(this,yt,Lt),et=d(this,c,mt).call(this,wt,Lt);et.forEach((r,k)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),et[k]=y}}),et.forEach(r=>{document.head.appendChild(r)});const lt=et.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,c,ft).call(this,r))return!0});e(this,T).waitForHeadToLoad&&lt.length&&(yield new Promise(r=>R(this,null,function*(){let k=0;try{for(var y=kt(lt),Q,D,j;Q=!(D=yield y.next()).done;Q=!1){const st=D.value;st.onload=()=>{k++,k===lt.length&&r()}}}catch(D){j=[D]}finally{try{Q&&(D=y.return)&&(yield D.call(y))}finally{if(j)throw j[0]}}}))),yield Ct.wait(10);const bt=[];Dt.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,c,ft).call(this,r)?bt.push(r):r.remove())});const Rt=d(this,c,dt).call(this,b.document.body);e(this,T).morphInsideScrollContainer||d(this,c,pt).call(this,b.document),document.documentElement.setAttribute("data-current-pathname",m),document.documentElement.setAttribute("data-current-leaf",qt),it.changeHistory({action:s,pathname:m,searchParameters:gt||(L?location.search:""),hash:V}),e(this,F).remove(),a(this,_,e(this,p)),a(this,p,m),e(this,Y).forEach((r,k)=>{const y=Rt[k],Q=getComputedStyle(r).getPropertyValue("--morph-duration");let D=[],j=[];v?v.forEach(h=>{const E=r.querySelector(h),H=y.querySelector(h);E&&H&&(j.push(E),D.push(H))}):(D.push(...y.childNodes),j.push(...r.childNodes)),j.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),D.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),v?D.forEach((h,E)=>{var H;(H=j[E].parentElement)==null||H.insertBefore(h,j[E])}):r.prepend(...D),It.requestIdleCallback(()=>{D.forEach(h=>{var E;h instanceof HTMLElement&&((E=h.parentElement)==null||E.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("in"))})});const st={morphElement:r,pathname:m};U.dispatchEvent(document,"morphNewChildrenAdded",{detail:st});const zt=new Promise(h=>{setTimeout(()=>{j.forEach(E=>E.remove()),D.forEach(E=>{var H;E instanceof HTMLElement&&((H=E.parentElement)==null||H.style.removeProperty("--new-content-height"),E.classList.remove("in","new"))}),U.dispatchEvent(document,"morphOldChildrenRemoved",{detail:st}),h()},(parseFloat(Q)||0)*1e3+10)});e(this,B).push(zt)}),V?(b.clearScrollState(),d(this,c,Et).call(this,V,{centerScroll:i,offsetScroll:u})):e(this,M)?b.restoreScrollPosition():b.renewScrollPosition(),yield Promise.all(e(this,B)),bt.forEach(r=>r.remove()),a(this,B,[]),e(this,Y).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const Q=document.createElement("script");Q.type="module",Q.src=y.getAttribute("src"),y.replaceWith(Q)})}),U.dispatchEvent(document,"morphComplete",{detail:at}),window.dispatchEvent(new Event("resize"))}catch(W){console.error(W)}a(this,q,void 0)})}addLink(t){e(this,f).push(new ht(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,f,e(this,f).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){a(this,f,e(this,f).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,tt));e(this,f).push(...s.map(i=>new ht(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,tt));e(this,f).forEach(s=>s.destroy()),a(this,f,t.map(s=>new ht(s,this)))}};T=new WeakMap,Y=new WeakMap,f=new WeakMap,nt=new WeakMap,q=new WeakMap,p=new WeakMap,_=new WeakMap,B=new WeakMap,M=new WeakMap,P=new WeakMap,G=new WeakMap,F=new WeakMap,tt=new WeakMap,c=new WeakSet,rt=function(t,s){return R(this,null,function*(){let i=e(this,G).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield d(this,c,xt).call(this,t,s==null?void 0:s.searchParameters)),i})},xt=function(t,s){return R(this,null,function*(){const u=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),g=e(this,nt).parseFromString(u,"text/html"),L=new Tt(this,t,g);return e(this,G).set(t,L),L})},dt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Nt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},mt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},ft=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},pt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,J)),a(this,P,t.querySelector(e(this,T).scrollSelector)||t.documentElement),(i=e(this,P))==null||i.addEventListener("scroll",e(this,J)),e(this,J).call(this)},Et=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ct.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ot=new WeakMap,J=new WeakMap,X.instance=null;let ut=X;exports.Morph=ut;
@@ -4,22 +4,22 @@ var Lt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), bt = (n) =>
4
4
  var lt = (n, t, s) => t.has(n) || bt("Cannot " + s);
5
5
  var e = (n, t, s) => (lt(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? bt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), a = (n, t, s, i) => (lt(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), d = (n, t, s) => (lt(n, t, "access private method"), s);
6
6
  var q = (n, t, s) => new Promise((i, u) => {
7
- var g = (S) => {
7
+ var g = (v) => {
8
8
  try {
9
- L(s.next(S));
9
+ S(s.next(v));
10
10
  } catch (A) {
11
11
  u(A);
12
12
  }
13
- }, w = (S) => {
13
+ }, L = (v) => {
14
14
  try {
15
- L(s.throw(S));
15
+ S(s.throw(v));
16
16
  } catch (A) {
17
17
  u(A);
18
18
  }
19
- }, L = (S) => S.done ? i(S.value) : Promise.resolve(S.value).then(g, w);
20
- L((s = s.apply(n, t)).next());
19
+ }, S = (v) => v.done ? i(v.value) : Promise.resolve(v.value).then(g, L);
20
+ S((s = s.apply(n, t)).next());
21
21
  });
22
- var Pt = (n, t, s) => (t = n[Lt("asyncIterator")]) ? t.call(n) : (n = n[Lt("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (g) => new Promise((w, L, S) => (g = u.call(n, g), S = g.done, Promise.resolve(g.value).then((A) => w({ value: A, done: S }), L)))), s("next"), s("return"), t);
22
+ var Pt = (n, t, s) => (t = n[Lt("asyncIterator")]) ? t.call(n) : (n = n[Lt("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (g) => new Promise((L, S, v) => (g = u.call(n, g), v = g.done, Promise.resolve(g.value).then((A) => L({ value: A, done: v }), S)))), s("next"), s("return"), t);
23
23
  import { i as Tt } from "../index-euf5anj6.js";
24
24
  import { d as $ } from "../events-CsVF98U6.js";
25
25
  import { r as zt } from "../polyfills-DJrTJQky.js";
@@ -51,14 +51,14 @@ class ht {
51
51
  else {
52
52
  const u = e(this, l).getAttribute(
53
53
  "data-history-action"
54
- ) || "push", g = e(this, l).hasAttribute("data-center-scroll"), w = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), L = w ? Vt.parse(w) : void 0, S = e(this, l).hasAttribute("data-revalidate"), A = e(this, l).hasAttribute(
54
+ ) || "push", g = e(this, l).hasAttribute("data-center-scroll"), L = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = L ? Vt.parse(L) : void 0, v = e(this, l).hasAttribute("data-revalidate"), A = e(this, l).hasAttribute(
55
55
  "data-keep-search-parameters"
56
56
  ), m = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((V) => V.trim());
57
57
  e(this, C).navigate(e(this, z), {
58
58
  historyAction: u,
59
59
  centerScroll: g,
60
- offsetScroll: L,
61
- revalidate: S,
60
+ offsetScroll: S,
61
+ revalidate: v,
62
62
  keepSearchParameters: A,
63
63
  submorph: m
64
64
  });
@@ -82,12 +82,12 @@ class ht {
82
82
  }
83
83
  }
84
84
  C = new WeakMap(), l = new WeakMap(), z = new WeakMap(), Z = new WeakMap(), j = new WeakMap();
85
- var N, K, y, I, F, x;
85
+ var N, K, w, I, F, x;
86
86
  class kt {
87
87
  constructor(t, s, i) {
88
88
  o(this, N);
89
89
  o(this, K);
90
- o(this, y, { x: 0, y: 0 });
90
+ o(this, w, { x: 0, y: 0 });
91
91
  o(this, I);
92
92
  o(this, F, null);
93
93
  o(this, x, null);
@@ -97,7 +97,7 @@ class kt {
97
97
  return e(this, K);
98
98
  }
99
99
  get scrollState() {
100
- return e(this, y);
100
+ return e(this, w);
101
101
  }
102
102
  get document() {
103
103
  return e(this, x);
@@ -116,7 +116,7 @@ class kt {
116
116
  return t;
117
117
  }
118
118
  clearScrollState() {
119
- e(this, y).x = 0, e(this, y).y = 0;
119
+ e(this, w).x = 0, e(this, w).y = 0;
120
120
  }
121
121
  clearDocumentState() {
122
122
  a(this, F, null);
@@ -124,7 +124,7 @@ class kt {
124
124
  saveScrollState() {
125
125
  e(this, I).documentElement.hasAttribute(
126
126
  "data-no-scroll-restoration"
127
- ) ? (e(this, y).x = 0, e(this, y).y = 0) : (e(this, y).x = e(this, N).scrollElement.scrollLeft, e(this, y).y = e(this, N).scrollElement.scrollTop);
127
+ ) ? (e(this, w).x = 0, e(this, w).y = 0) : (e(this, w).x = e(this, N).scrollElement.scrollLeft, e(this, w).y = e(this, N).scrollElement.scrollTop);
128
128
  }
129
129
  saveDocumentState() {
130
130
  e(this, I).documentElement.hasAttribute(
@@ -133,8 +133,8 @@ class kt {
133
133
  }
134
134
  restoreScrollPosition() {
135
135
  e(this, N).scrollElement.scroll({
136
- top: e(this, y).y,
137
- left: e(this, y).x
136
+ top: e(this, w).y,
137
+ left: e(this, w).x
138
138
  });
139
139
  }
140
140
  renewScrollPosition() {
@@ -145,7 +145,7 @@ class kt {
145
145
  });
146
146
  }
147
147
  }
148
- N = new WeakMap(), K = new WeakMap(), y = new WeakMap(), I = new WeakMap(), F = new WeakMap(), x = new WeakMap();
148
+ N = new WeakMap(), K = new WeakMap(), w = new WeakMap(), I = new WeakMap(), F = new WeakMap(), x = new WeakMap();
149
149
  var T, Y, f, rt, D, p, _, O, M, P, G, B, tt, h, it, Ht, ct, Nt, ut, dt, mt, ft, nt, J;
150
150
  const X = class X {
151
151
  constructor(t) {
@@ -238,14 +238,14 @@ const X = class X {
238
238
  });
239
239
  });
240
240
  }
241
- navigate(S) {
241
+ navigate(v) {
242
242
  return q(this, arguments, function* (t, {
243
243
  historyAction: s = "push",
244
244
  centerScroll: i,
245
245
  offsetScroll: u,
246
246
  revalidate: g,
247
- keepSearchParameters: w,
248
- submorph: L
247
+ keepSearchParameters: L,
248
+ submorph: S
249
249
  } = {}) {
250
250
  var Et;
251
251
  if (e(this, O).length)
@@ -268,8 +268,8 @@ const X = class X {
268
268
  if (this.preprocessor)
269
269
  try {
270
270
  yield new Promise((r, k) => {
271
- var v;
272
- (v = this.preprocessor) == null || v.call(this, {
271
+ var y;
272
+ (y = this.preprocessor) == null || y.call(this, {
273
273
  pathname: m,
274
274
  resolve: r,
275
275
  reject: k
@@ -285,7 +285,8 @@ const X = class X {
285
285
  return;
286
286
  }
287
287
  const ot = {
288
- pathname: m
288
+ pathname: m,
289
+ submorph: S
289
290
  };
290
291
  $(document, "morphNavigation", {
291
292
  detail: ot
@@ -306,8 +307,8 @@ const X = class X {
306
307
  const St = Array.from(document.head.children), vt = Array.from(b.document.head.children), yt = d(this, h, Nt).call(this, St, vt), Dt = d(this, h, ut).call(this, St, yt), et = d(this, h, ut).call(this, vt, yt);
307
308
  et.forEach((r, k) => {
308
309
  if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
309
- const v = document.createElement("script");
310
- v.type = "module", v.src = r.getAttribute("src"), et[k] = v;
310
+ const y = document.createElement("script");
311
+ y.type = "module", y.src = r.getAttribute("src"), et[k] = y;
311
312
  }
312
313
  }), et.forEach((r) => {
313
314
  document.head.appendChild(r);
@@ -321,7 +322,7 @@ const X = class X {
321
322
  e(this, T).waitForHeadToLoad && at.length && (yield new Promise((r) => q(this, null, function* () {
322
323
  let k = 0;
323
324
  try {
324
- for (var v = Pt(at), Q, R, U; Q = !(R = yield v.next()).done; Q = !1) {
325
+ for (var y = Pt(at), Q, R, U; Q = !(R = yield y.next()).done; Q = !1) {
325
326
  const st = R.value;
326
327
  st.onload = () => {
327
328
  k++, k === at.length && r();
@@ -331,7 +332,7 @@ const X = class X {
331
332
  U = [R];
332
333
  } finally {
333
334
  try {
334
- Q && (R = v.return) && (yield R.call(v));
335
+ Q && (R = y.return) && (yield R.call(y));
335
336
  } finally {
336
337
  if (U)
337
338
  throw U[0];
@@ -346,19 +347,19 @@ const X = class X {
346
347
  e(this, T).morphInsideScrollContainer || d(this, h, mt).call(this, b.document), document.documentElement.setAttribute("data-current-pathname", m), document.documentElement.setAttribute("data-current-leaf", xt), At({
347
348
  action: s,
348
349
  pathname: m,
349
- searchParameters: pt || (w ? location.search : ""),
350
+ searchParameters: pt || (L ? location.search : ""),
350
351
  hash: V
351
352
  }), e(this, B).remove(), a(this, _, e(this, p)), a(this, p, m), e(this, Y).forEach((r, k) => {
352
- const v = Rt[k], Q = getComputedStyle(r).getPropertyValue("--morph-duration");
353
+ const y = Rt[k], Q = getComputedStyle(r).getPropertyValue("--morph-duration");
353
354
  let R = [], U = [];
354
- L ? L.forEach((c) => {
355
- const E = r.querySelector(c), H = v.querySelector(c);
355
+ S ? S.forEach((c) => {
356
+ const E = r.querySelector(c), H = y.querySelector(c);
356
357
  E && H && (U.push(E), R.push(H));
357
- }) : (R.push(...v.childNodes), U.push(...r.childNodes)), U.forEach((c) => {
358
+ }) : (R.push(...y.childNodes), U.push(...r.childNodes)), U.forEach((c) => {
358
359
  c instanceof HTMLElement && (this.destroyOldLinks(c), c.classList.add("old"));
359
360
  }), R.forEach((c) => {
360
361
  c instanceof HTMLElement && (this.findNewLinks(c), c.classList.add("new"));
361
- }), L ? R.forEach((c, E) => {
362
+ }), S ? R.forEach((c, E) => {
362
363
  var H;
363
364
  (H = U[E].parentElement) == null || H.insertBefore(
364
365
  c,
@@ -394,9 +395,9 @@ const X = class X {
394
395
  });
395
396
  e(this, O).push(qt);
396
397
  }), V ? (b.clearScrollState(), d(this, h, ft).call(this, V, { centerScroll: i, offsetScroll: u })) : e(this, M) ? b.restoreScrollPosition() : b.renewScrollPosition(), yield Promise.all(e(this, O)), wt.forEach((r) => r.remove()), a(this, O, []), e(this, Y).forEach((r) => {
397
- r.querySelectorAll("script").forEach((v) => {
398
+ r.querySelectorAll("script").forEach((y) => {
398
399
  const Q = document.createElement("script");
399
- Q.type = "module", Q.src = v.getAttribute("src"), v.replaceWith(Q);
400
+ Q.type = "module", Q.src = y.getAttribute("src"), y.replaceWith(Q);
400
401
  });
401
402
  }), $(document, "morphComplete", {
402
403
  detail: ot
@@ -445,8 +446,8 @@ T = new WeakMap(), Y = new WeakMap(), f = new WeakMap(), rt = new WeakMap(), D =
445
446
  return q(this, null, function* () {
446
447
  const u = yield (yield fetch(
447
448
  `${t}${s ? "?" + s : ""}`
448
- )).text(), g = e(this, rt).parseFromString(u, "text/html"), w = new kt(this, t, g);
449
- return e(this, G).set(t, w), w;
449
+ )).text(), g = e(this, rt).parseFromString(u, "text/html"), L = new kt(this, t, g);
450
+ return e(this, G).set(t, L), L;
450
451
  });
451
452
  }, ct = function(t) {
452
453
  const s = [...t.querySelectorAll("[data-morph]")];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.61.0",
3
+ "version": "0.61.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"