aptechka 0.41.6 → 0.41.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +68 -68
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ot=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),ht=n=>{throw TypeError(n)};var Q=(n,t,i)=>t.has(n)||ht("Cannot "+i);var e=(n,t,i)=>(Q(n,t,"read from private field"),i?i.call(n):t.get(n)),o=(n,t,i)=>t.has(n)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,i),c=(n,t,i,s)=>(Q(n,t,"write to private field"),s?s.call(n,i):t.set(n,i),i),A=(n,t,i)=>(Q(n,t,"access private method"),i);var z=(n,t,i)=>new Promise((s,l)=>{var u=f=>{try{g(i.next(f))}catch(b){l(b)}},a=f=>{try{g(i.throw(f))}catch(b){l(b)}},g=f=>f.done?s(f.value):Promise.resolve(f.value).then(u,a);g((i=i.apply(n,t)).next())});var ct=(n,t,i)=>(t=n[ot("asyncIterator")])?t.call(n):(n=n[ot("iterator")](),t={},i=(s,l)=>(l=n[s])&&(t[s]=u=>new Promise((a,g,f)=>(u=l.call(n,u),f=u.done,Promise.resolve(u.value).then(b=>a({value:b,done:f}),g)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../browser-CpzFX2xg.cjs"),K=require("../events-KVanG9sR.cjs"),V=require("../url-BiHPIsKq.cjs"),dt=require("../loading/index.cjs");var T,h,p,q,x,H,D,k;class lt{constructor(t,i){o(this,T);o(this,h);o(this,p);o(this,q);o(this,x);o(this,H);o(this,D,t=>{t.preventDefault(),e(this,T).links.forEach(i=>{var s;e(this,p)===e(i,p)||(s=e(i,H))!=null&&s.includes(e(this,p))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,T).navigate(e(this,p),{historyAction:e(this,q),state:e(this,x)})});o(this,k,()=>{e(this,T).prefetch(e(this,p)),e(this,h).removeEventListener("pointerenter",e(this,k))});var u,a;c(this,T,i),c(this,h,t),c(this,p,e(this,h).getAttribute("href")||"/"),c(this,q,e(this,h).getAttribute("data-history-action")||"push"),c(this,x,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,D));const s=i.normalizePath(e(this,p)),l=i.normalizePath(location.pathname);c(this,H,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(g=>i.normalizePath(g.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(s.pathname)&&e(this,h).classList.add("current"):s.pathname===l.pathname||(a=e(this,H))!=null&&a.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,D)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}T=new WeakMap,h=new WeakMap,p=new WeakMap,q=new WeakMap,x=new WeakMap,H=new WeakMap,D=new WeakMap,k=new WeakMap;var I,O,R,S,E,Y,M,P,L,_,B,v,m,U,X,ut,Z,G;class Lt{constructor(t){o(this,m);o(this,I,null);o(this,O,null);o(this,R,null);o(this,S,null);o(this,E,[]);o(this,Y,new DOMParser);o(this,M,new Map);o(this,P);o(this,L,null);o(this,_);o(this,B);o(this,v,[]);o(this,G,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(pt.isBrowser){c(this,I,V.normalizeBase(t==null?void 0:t.base)),c(this,O,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,R,(t==null?void 0:t.cachePages)!==!1),c(this,S,A(this,m,X).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,L,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,L)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,G)),V.changeHistory("replace",e(this,L),i.parameters,i.hash),e(this,S).map(s=>[...s.children]).flat().forEach(s=>{s instanceof HTMLElement&&s.classList.add("current")})}}get currentPathname(){return e(this,L)}get previousPathname(){return e(this,_)}get currentState(){return e(this,B)}get links(){return e(this,E)}normalizePath(t){return V.splitPath(t,e(this,I))}prefetch(t){return z(this,null,function*(){const i=this.normalizePath(t);return A(this,m,U).call(this,i.pathname)})}navigate(l){return z(this,arguments,function*(t,{historyAction:i="push",state:s}={}){var $;if(e(this,v).length)return;const u=this.normalizePath(t);let{pathname:a,hash:g,parameters:f,leaf:b}=u;if(e(this,P)===a||e(this,L)===a)return;c(this,B,s),c(this,P,a);const N=e(this,M).has(a);try{dt.loading.add("__morph");let F=!0;if(K.dispatchEvent(document,"morphBeforeNavigation",{detail:{pathname:a,isCached:N,state:s}}),this.preprocessor)try{yield new Promise((r,w)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:a,resolve:r,reject:w,isCached:N,state:s})})}catch(r){r?console.error(r):console.log("Route change canceled"),F=!1}if(!F||e(this,P)!==a)return;const tt=e(this,M).get(a)||(yield A(this,m,U).call(this,a));if(e(this,P)!==a)return;const et=Array.from(document.head.children),it=Array.from(tt.head.cloneNode(!0).children),st=A(this,m,ut).call(this,et,it),mt=A(this,m,Z).call(this,et,st),W=A(this,m,Z).call(this,it,st);W.forEach((r,w)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),W[w]=y}}),W.forEach(r=>{document.head.appendChild(r)});const J=W.filter(r=>(r.tagName==="STYLE"||r.tagName==="SCRIPT"||r.tagName==="LINK")&&r.getAttribute("rel")!=="canonical");e(this,O)&&J.length&&(yield new Promise(r=>z(this,null,function*(){let w=0;try{for(var y=ct(J),nt,C,rt;nt=!(C=yield y.next()).done;nt=!1){const j=C.value;j.onload=()=>{w++,w===J.length&&r()}}}catch(C){rt=[C]}finally{try{nt&&(C=y.return)&&(yield C.call(y))}finally{if(rt)throw rt[0]}}}))),mt.forEach(r=>{r.hasAttribute("data-permanent")||r.remove()}),c(this,_,e(this,L)),c(this,L,a),V.changeHistory(i,a,f,g);const ft=A(this,m,X).call(this,tt.body.cloneNode(!0));e(this,v).forEach(r=>clearTimeout(r)),c(this,v,[]),e(this,S).forEach((r,w)=>{const y=ft[w],nt=getComputedStyle(r).getPropertyValue("--morph-duration"),C=[...y.childNodes];if(nt){const rt=[...r.childNodes];rt.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old")}),C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("new")}),r.append(...C),setTimeout(()=>{C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("in")})},10);const j={element:r,pathname:a,isCached:N,state:s};K.dispatchEvent(document,"morphBeforeElementOut",{detail:j});const at=setTimeout(()=>{rt.forEach(d=>d.remove()),C.forEach(d=>{d instanceof HTMLElement&&(d.classList.remove("new","in"),d.classList.add("current"))}),K.dispatchEvent(document,"morphAfterElementOut",{detail:j}),c(this,v,e(this,v).filter(d=>d!==at))},(parseFloat(nt)||0)*1e3+10);e(this,v).push(at)}else r.innerHTML="",r.append(...C)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",a),document.documentElement.setAttribute("data-current-leaf",b),($=this.postprocessor)==null||$.call(this,{pathname:a,isCached:N,state:s}),K.dispatchEvent(document,"morphAfterNavigation",{detail:{pathname:a,isCached:N,state:s}}),dt.loading.complete("__morph")}catch(F){console.error(F)}c(this,P,void 0)})}addLink(t){e(this,E).push(new lt(t,this))}addLinks(t){t.forEach(i=>{this.addLink(i)})}removeLink(t){c(this,E,e(this,E).filter(i=>i.element===t?(i.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var s;return((s=i.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")});e(this,E).forEach(i=>i.destroy()),c(this,E,t.map(i=>new lt(i,this)))}}I=new WeakMap,O=new WeakMap,R=new WeakMap,S=new WeakMap,E=new WeakMap,Y=new WeakMap,M=new WeakMap,P=new WeakMap,L=new WeakMap,_=new WeakMap,B=new WeakMap,v=new WeakMap,m=new WeakSet,U=function(t){return z(this,null,function*(){const i=e(this,M).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),u=e(this,Y).parseFromString(l,"text/html");return e(this,R)&&e(this,M).set(t,u),u})},X=function(t){const i=[...t.querySelectorAll("[data-morph]")];return i.length?i:[t]},ut=function(t,i){return t.filter(s=>i.find(l=>l.outerHTML===s.outerHTML))},Z=function(t,i){return t.filter(s=>!i.find(l=>l.outerHTML===s.outerHTML))},G=new WeakMap;exports.Morph=Lt;
|
|
1
|
+
"use strict";var ot=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),ht=n=>{throw TypeError(n)};var Q=(n,t,i)=>t.has(n)||ht("Cannot "+i);var e=(n,t,i)=>(Q(n,t,"read from private field"),i?i.call(n):t.get(n)),o=(n,t,i)=>t.has(n)?ht("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,i),c=(n,t,i,s)=>(Q(n,t,"write to private field"),s?s.call(n,i):t.set(n,i),i),A=(n,t,i)=>(Q(n,t,"access private method"),i);var z=(n,t,i)=>new Promise((s,l)=>{var u=f=>{try{g(i.next(f))}catch(b){l(b)}},a=f=>{try{g(i.throw(f))}catch(b){l(b)}},g=f=>f.done?s(f.value):Promise.resolve(f.value).then(u,a);g((i=i.apply(n,t)).next())});var ct=(n,t,i)=>(t=n[ot("asyncIterator")])?t.call(n):(n=n[ot("iterator")](),t={},i=(s,l)=>(l=n[s])&&(t[s]=u=>new Promise((a,g,f)=>(u=l.call(n,u),f=u.done,Promise.resolve(u.value).then(b=>a({value:b,done:f}),g)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../browser-CpzFX2xg.cjs"),K=require("../events-KVanG9sR.cjs"),V=require("../url-BiHPIsKq.cjs"),dt=require("../loading/index.cjs");var T,h,p,q,x,H,D,k;class lt{constructor(t,i){o(this,T);o(this,h);o(this,p);o(this,q);o(this,x);o(this,H);o(this,D,t=>{t.preventDefault(),e(this,T).links.forEach(i=>{var s;e(this,p)===e(i,p)||(s=e(i,H))!=null&&s.includes(e(this,p))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,T).navigate(e(this,p),{historyAction:e(this,q),state:e(this,x)})});o(this,k,()=>{e(this,T).prefetch(e(this,p)),e(this,h).removeEventListener("pointerenter",e(this,k))});var u,a;c(this,T,i),c(this,h,t),c(this,p,e(this,h).getAttribute("href")||"/"),c(this,q,e(this,h).getAttribute("data-history-action")||"push"),c(this,x,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,D));const s=i.normalizePath(e(this,p)),l=i.normalizePath(location.pathname);c(this,H,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(g=>i.normalizePath(g.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(s.pathname)&&e(this,h).classList.add("current"):s.pathname===l.pathname||(a=e(this,H))!=null&&a.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,D)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}T=new WeakMap,h=new WeakMap,p=new WeakMap,q=new WeakMap,x=new WeakMap,H=new WeakMap,D=new WeakMap,k=new WeakMap;var I,O,R,S,E,Y,M,P,L,_,B,v,m,U,X,ut,Z,G;class Lt{constructor(t){o(this,m);o(this,I,null);o(this,O,null);o(this,R,null);o(this,S,null);o(this,E,[]);o(this,Y,new DOMParser);o(this,M,new Map);o(this,P);o(this,L,null);o(this,_);o(this,B);o(this,v,[]);o(this,G,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(pt.isBrowser){c(this,I,V.normalizeBase(t==null?void 0:t.base)),c(this,O,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,R,(t==null?void 0:t.cachePages)!==!1),c(this,S,A(this,m,X).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,L,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,L)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,G)),V.changeHistory("replace",e(this,L),i.parameters,i.hash),e(this,S).map(s=>[...s.children]).flat().forEach(s=>{s instanceof HTMLElement&&s.classList.add("current")})}}get currentPathname(){return e(this,L)}get previousPathname(){return e(this,_)}get currentState(){return e(this,B)}get links(){return e(this,E)}normalizePath(t){return V.splitPath(t,e(this,I))}prefetch(t){return z(this,null,function*(){const i=this.normalizePath(t);return A(this,m,U).call(this,i.pathname)})}navigate(l){return z(this,arguments,function*(t,{historyAction:i="push",state:s}={}){var $;if(e(this,v).length)return;const u=this.normalizePath(t);let{pathname:a,hash:g,parameters:f,leaf:b}=u;if(e(this,P)===a||e(this,L)===a)return;c(this,B,s),c(this,P,a);const N=e(this,M).has(a);try{dt.loading.add("__morph");let F=!0;if(K.dispatchEvent(document,"morphBeforeNavigation",{detail:{pathname:a,isCached:N,state:s}}),this.preprocessor)try{yield new Promise((r,w)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:a,resolve:r,reject:w,isCached:N,state:s})})}catch(r){r?console.error(r):console.log("Route change canceled"),F=!1}if(!F||e(this,P)!==a)return;const tt=e(this,M).get(a)||(yield A(this,m,U).call(this,a));if(e(this,P)!==a)return;const et=Array.from(document.head.children),it=Array.from(tt.head.cloneNode(!0).children),st=A(this,m,ut).call(this,et,it),mt=A(this,m,Z).call(this,et,st),W=A(this,m,Z).call(this,it,st);W.forEach((r,w)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),W[w]=y}}),W.forEach(r=>{document.head.appendChild(r)});const J=W.filter(r=>(r.tagName==="STYLE"||r.tagName==="SCRIPT"||r.tagName==="LINK")&&r.getAttribute("rel")!=="canonical");e(this,O)&&J.length&&(yield new Promise(r=>z(this,null,function*(){let w=0;try{for(var y=ct(J),nt,C,rt;nt=!(C=yield y.next()).done;nt=!1){const j=C.value;j.onload=()=>{w++,w===J.length&&r()}}}catch(C){rt=[C]}finally{try{nt&&(C=y.return)&&(yield C.call(y))}finally{if(rt)throw rt[0]}}}))),mt.forEach(r=>{r.hasAttribute("data-permanent")||r.remove()}),c(this,_,e(this,L)),c(this,L,a),V.changeHistory(i,a,f,g);const ft=A(this,m,X).call(this,tt.body.cloneNode(!0));e(this,v).forEach(r=>clearTimeout(r)),c(this,v,[]),e(this,S).forEach((r,w)=>{const y=ft[w],nt=getComputedStyle(r).getPropertyValue("--morph-duration"),C=[...y.childNodes];if(nt){const rt=[...r.childNodes];rt.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old")}),C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("new")}),r.append(...C),setTimeout(()=>{C.forEach(d=>{d instanceof HTMLElement&&d.classList.add("in")})},10);const j={element:r,pathname:a,isCached:N,state:s};K.dispatchEvent(document,"morphBeforeElementOut",{detail:j});const at=setTimeout(()=>{rt.forEach(d=>d.remove()),C.forEach(d=>{d instanceof HTMLElement&&(d.classList.remove("new","in"),d.classList.add("current"))}),K.dispatchEvent(document,"morphAfterElementOut",{detail:j}),c(this,v,e(this,v).filter(d=>d!==at))},(parseFloat(nt)||0)*1e3+10);e(this,v).push(at)}else r.innerHTML="",r.append(...C)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",a),document.documentElement.setAttribute("data-current-leaf",b),($=this.postprocessor)==null||$.call(this,{pathname:a,isCached:N,state:s}),K.dispatchEvent(document,"morphAfterNavigation",{detail:{pathname:a,isCached:N,state:s}}),dt.loading.complete("__morph")}catch(F){console.error(F)}c(this,P,void 0)})}addLink(t){e(this,E).push(new lt(t,this))}addLinks(t){t.forEach(i=>{this.addLink(i)})}removeLink(t){c(this,E,e(this,E).filter(i=>i.element===t?(i.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var s;return((s=i.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")&&!i.closest("[data-morph-skip]")});e(this,E).forEach(i=>i.destroy()),c(this,E,t.map(i=>new lt(i,this)))}}I=new WeakMap,O=new WeakMap,R=new WeakMap,S=new WeakMap,E=new WeakMap,Y=new WeakMap,M=new WeakMap,P=new WeakMap,L=new WeakMap,_=new WeakMap,B=new WeakMap,v=new WeakMap,m=new WeakSet,U=function(t){return z(this,null,function*(){const i=e(this,M).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),u=e(this,Y).parseFromString(l,"text/html");return e(this,R)&&e(this,M).set(t,u),u})},X=function(t){const i=[...t.querySelectorAll("[data-morph]")];return i.length?i:[t]},ut=function(t,i){return t.filter(s=>i.find(l=>l.outerHTML===s.outerHTML))},Z=function(t,i){return t.filter(s=>!i.find(l=>l.outerHTML===s.outerHTML))},G=new WeakMap;exports.Morph=Lt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
var rt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), ot = (n) => {
|
|
2
2
|
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var J = (n, t,
|
|
5
|
-
var e = (n, t,
|
|
6
|
-
var z = (n, t,
|
|
4
|
+
var J = (n, t, s) => t.has(n) || ot("Cannot " + s);
|
|
5
|
+
var e = (n, t, s) => (J(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? ot("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), c = (n, t, s, i) => (J(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), P = (n, t, s) => (J(n, t, "access private method"), s);
|
|
6
|
+
var z = (n, t, s) => new Promise((i, l) => {
|
|
7
7
|
var u = (f) => {
|
|
8
8
|
try {
|
|
9
|
-
E(
|
|
9
|
+
E(s.next(f));
|
|
10
10
|
} catch (b) {
|
|
11
11
|
l(b);
|
|
12
12
|
}
|
|
13
13
|
}, r = (f) => {
|
|
14
14
|
try {
|
|
15
|
-
E(
|
|
15
|
+
E(s.throw(f));
|
|
16
16
|
} catch (b) {
|
|
17
17
|
l(b);
|
|
18
18
|
}
|
|
19
|
-
}, E = (f) => f.done ?
|
|
20
|
-
E((
|
|
19
|
+
}, E = (f) => f.done ? i(f.value) : Promise.resolve(f.value).then(u, r);
|
|
20
|
+
E((s = s.apply(n, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var ht = (n, t,
|
|
22
|
+
var ht = (n, t, s) => (t = n[rt("asyncIterator")]) ? t.call(n) : (n = n[rt("iterator")](), t = {}, s = (i, l) => (l = n[i]) && (t[i] = (u) => new Promise((r, E, f) => (u = l.call(n, u), f = u.done, Promise.resolve(u.value).then((b) => r({ value: b, done: f }), E)))), s("next"), s("return"), t);
|
|
23
23
|
import { i as pt } from "../browser-0zX67oeU.js";
|
|
24
24
|
import { d as V } from "../events-CsVF98U6.js";
|
|
25
25
|
import { n as Lt, c as ct, s as Et } from "../url-B5eH5z6S.js";
|
|
26
26
|
import { loading as dt } from "../loading/index.js";
|
|
27
|
-
var T, h, p, x, D,
|
|
27
|
+
var T, h, p, x, D, H, I, M;
|
|
28
28
|
class lt {
|
|
29
|
-
constructor(t,
|
|
29
|
+
constructor(t, s) {
|
|
30
30
|
o(this, T);
|
|
31
31
|
o(this, h);
|
|
32
32
|
o(this, p);
|
|
33
33
|
o(this, x);
|
|
34
34
|
o(this, D);
|
|
35
|
-
o(this,
|
|
35
|
+
o(this, H);
|
|
36
36
|
o(this, I, (t) => {
|
|
37
|
-
t.preventDefault(), e(this, T).links.forEach((
|
|
38
|
-
var
|
|
39
|
-
e(this, p) === e(
|
|
37
|
+
t.preventDefault(), e(this, T).links.forEach((s) => {
|
|
38
|
+
var i;
|
|
39
|
+
e(this, p) === e(s, p) || (i = e(s, H)) != null && i.includes(e(this, p)) ? e(s, h).classList.add("clicked") : e(s, h).classList.remove("clicked");
|
|
40
40
|
}), e(this, T).navigate(e(this, p), {
|
|
41
41
|
historyAction: e(this, x),
|
|
42
42
|
state: e(this, D)
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
-
o(this,
|
|
46
|
-
e(this, T).prefetch(e(this, p)), e(this, h).removeEventListener("pointerenter", e(this,
|
|
45
|
+
o(this, M, () => {
|
|
46
|
+
e(this, T).prefetch(e(this, p)), e(this, h).removeEventListener("pointerenter", e(this, M));
|
|
47
47
|
});
|
|
48
48
|
var u, r;
|
|
49
|
-
c(this, T,
|
|
49
|
+
c(this, T, s), c(this, h, t), c(this, p, e(this, h).getAttribute("href") || "/"), c(this, x, e(this, h).getAttribute(
|
|
50
50
|
"data-history-action"
|
|
51
51
|
) || "push"), c(this, D, e(this, h).getAttribute("data-state") || void 0), e(this, h).addEventListener("click", e(this, I));
|
|
52
|
-
const
|
|
53
|
-
c(this,
|
|
52
|
+
const i = s.normalizePath(e(this, p)), l = s.normalizePath(location.pathname);
|
|
53
|
+
c(this, H, (u = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : u.split(",").map((E) => s.normalizePath(E.trim()).pathname)), e(this, h).hasAttribute("data-include") ? l.pathname.includes(i.pathname) && e(this, h).classList.add("current") : i.pathname === l.pathname || (r = e(this, H)) != null && r.includes(l.pathname) ? (e(this, h).classList.add("current"), e(this, h).classList.add("clicked")) : e(this, h).classList.remove("clicked"), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, M));
|
|
54
54
|
}
|
|
55
55
|
get element() {
|
|
56
56
|
return e(this, h);
|
|
57
57
|
}
|
|
58
58
|
destroy() {
|
|
59
|
-
e(this, h).removeEventListener("click", e(this, I)), e(this, h).removeEventListener("pointerenter", e(this,
|
|
59
|
+
e(this, h).removeEventListener("click", e(this, I)), e(this, h).removeEventListener("pointerenter", e(this, M)), e(this, h).classList.remove("current");
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
T = new WeakMap(), h = new WeakMap(), p = new WeakMap(), x = new WeakMap(), D = new WeakMap(),
|
|
63
|
-
var R, B, F, N, g, Y,
|
|
62
|
+
T = new WeakMap(), h = new WeakMap(), p = new WeakMap(), x = new WeakMap(), D = new WeakMap(), H = new WeakMap(), I = new WeakMap(), M = new WeakMap();
|
|
63
|
+
var R, B, F, N, g, Y, k, y, L, O, _, v, m, Q, U, ut, X, j;
|
|
64
64
|
class yt {
|
|
65
65
|
constructor(t) {
|
|
66
66
|
o(this, m);
|
|
@@ -70,7 +70,7 @@ class yt {
|
|
|
70
70
|
o(this, N, null);
|
|
71
71
|
o(this, g, []);
|
|
72
72
|
o(this, Y, new DOMParser());
|
|
73
|
-
o(this,
|
|
73
|
+
o(this, k, /* @__PURE__ */ new Map());
|
|
74
74
|
o(this, y);
|
|
75
75
|
o(this, L, null);
|
|
76
76
|
o(this, O);
|
|
@@ -81,20 +81,20 @@ class yt {
|
|
|
81
81
|
});
|
|
82
82
|
if (pt) {
|
|
83
83
|
c(this, R, Lt(t == null ? void 0 : t.base)), c(this, B, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), c(this, F, (t == null ? void 0 : t.cachePages) !== !1), c(this, N, P(this, m, U).call(this, document.body));
|
|
84
|
-
const
|
|
85
|
-
c(this, L,
|
|
84
|
+
const s = this.normalizePath(location.pathname);
|
|
85
|
+
c(this, L, s.pathname), document.documentElement.setAttribute(
|
|
86
86
|
"data-current-pathname",
|
|
87
87
|
e(this, L)
|
|
88
88
|
), document.documentElement.setAttribute(
|
|
89
89
|
"data-current-leaf",
|
|
90
|
-
|
|
90
|
+
s.leaf
|
|
91
91
|
), this.findLinks(), addEventListener("popstate", e(this, j)), ct(
|
|
92
92
|
"replace",
|
|
93
93
|
e(this, L),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
), e(this, N).map((
|
|
97
|
-
|
|
94
|
+
s.parameters,
|
|
95
|
+
s.hash
|
|
96
|
+
), e(this, N).map((i) => [...i.children]).flat().forEach((i) => {
|
|
97
|
+
i instanceof HTMLElement && i.classList.add("current");
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -115,12 +115,12 @@ class yt {
|
|
|
115
115
|
}
|
|
116
116
|
prefetch(t) {
|
|
117
117
|
return z(this, null, function* () {
|
|
118
|
-
const
|
|
119
|
-
return P(this, m, Q).call(this,
|
|
118
|
+
const s = this.normalizePath(t);
|
|
119
|
+
return P(this, m, Q).call(this, s.pathname);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
navigate(l) {
|
|
123
|
-
return z(this, arguments, function* (t, { historyAction:
|
|
123
|
+
return z(this, arguments, function* (t, { historyAction: s = "push", state: i } = {}) {
|
|
124
124
|
var Z;
|
|
125
125
|
if (e(this, v).length)
|
|
126
126
|
return;
|
|
@@ -128,8 +128,8 @@ class yt {
|
|
|
128
128
|
let { pathname: r, hash: E, parameters: f, leaf: b } = u;
|
|
129
129
|
if (e(this, y) === r || e(this, L) === r)
|
|
130
130
|
return;
|
|
131
|
-
c(this, _,
|
|
132
|
-
const C = e(this,
|
|
131
|
+
c(this, _, i), c(this, y, r);
|
|
132
|
+
const C = e(this, k).has(r);
|
|
133
133
|
try {
|
|
134
134
|
dt.add("__morph");
|
|
135
135
|
let q = !0;
|
|
@@ -137,25 +137,25 @@ class yt {
|
|
|
137
137
|
detail: {
|
|
138
138
|
pathname: r,
|
|
139
139
|
isCached: C,
|
|
140
|
-
state:
|
|
140
|
+
state: i
|
|
141
141
|
}
|
|
142
142
|
}), this.preprocessor)
|
|
143
143
|
try {
|
|
144
144
|
yield new Promise((a, A) => {
|
|
145
145
|
var w;
|
|
146
|
-
(w = this.preprocessor) == null || w.call(this, { pathname: r, resolve: a, reject: A, isCached: C, state:
|
|
146
|
+
(w = this.preprocessor) == null || w.call(this, { pathname: r, resolve: a, reject: A, isCached: C, state: i });
|
|
147
147
|
});
|
|
148
148
|
} catch (a) {
|
|
149
149
|
a ? console.error(a) : console.log("Route change canceled"), q = !1;
|
|
150
150
|
}
|
|
151
151
|
if (!q || e(this, y) !== r)
|
|
152
152
|
return;
|
|
153
|
-
const $ = e(this,
|
|
153
|
+
const $ = e(this, k).get(r) || (yield P(this, m, Q).call(this, r));
|
|
154
154
|
if (e(this, y) !== r)
|
|
155
155
|
return;
|
|
156
156
|
const tt = Array.from(document.head.children), et = Array.from(
|
|
157
157
|
$.head.cloneNode(!0).children
|
|
158
|
-
),
|
|
158
|
+
), st = P(this, m, ut).call(this, tt, et), mt = P(this, m, X).call(this, tt, st), W = P(this, m, X).call(this, et, st);
|
|
159
159
|
W.forEach((a, A) => {
|
|
160
160
|
if (a.tagName === "SCRIPT" && a.getAttribute("src")) {
|
|
161
161
|
const w = document.createElement("script");
|
|
@@ -170,7 +170,7 @@ class yt {
|
|
|
170
170
|
e(this, B) && G.length && (yield new Promise((a) => z(this, null, function* () {
|
|
171
171
|
let A = 0;
|
|
172
172
|
try {
|
|
173
|
-
for (var w = ht(G),
|
|
173
|
+
for (var w = ht(G), it, S, nt; it = !(S = yield w.next()).done; it = !1) {
|
|
174
174
|
const K = S.value;
|
|
175
175
|
K.onload = () => {
|
|
176
176
|
A++, A === G.length && a();
|
|
@@ -180,7 +180,7 @@ class yt {
|
|
|
180
180
|
nt = [S];
|
|
181
181
|
} finally {
|
|
182
182
|
try {
|
|
183
|
-
|
|
183
|
+
it && (S = w.return) && (yield S.call(w));
|
|
184
184
|
} finally {
|
|
185
185
|
if (nt)
|
|
186
186
|
throw nt[0];
|
|
@@ -188,11 +188,11 @@ class yt {
|
|
|
188
188
|
}
|
|
189
189
|
}))), mt.forEach((a) => {
|
|
190
190
|
a.hasAttribute("data-permanent") || a.remove();
|
|
191
|
-
}), c(this, O, e(this, L)), c(this, L, r), ct(
|
|
191
|
+
}), c(this, O, e(this, L)), c(this, L, r), ct(s, r, f, E);
|
|
192
192
|
const ft = P(this, m, U).call(this, $.body.cloneNode(!0));
|
|
193
193
|
e(this, v).forEach((a) => clearTimeout(a)), c(this, v, []), e(this, N).forEach((a, A) => {
|
|
194
|
-
const w = ft[A],
|
|
195
|
-
if (
|
|
194
|
+
const w = ft[A], it = getComputedStyle(a).getPropertyValue("--morph-duration"), S = [...w.childNodes];
|
|
195
|
+
if (it) {
|
|
196
196
|
const nt = [...a.childNodes];
|
|
197
197
|
nt.forEach((d) => {
|
|
198
198
|
d instanceof HTMLElement && d.classList.add("old");
|
|
@@ -207,7 +207,7 @@ class yt {
|
|
|
207
207
|
element: a,
|
|
208
208
|
pathname: r,
|
|
209
209
|
isCached: C,
|
|
210
|
-
state:
|
|
210
|
+
state: i
|
|
211
211
|
};
|
|
212
212
|
V(document, "morphBeforeElementOut", {
|
|
213
213
|
detail: K
|
|
@@ -218,15 +218,15 @@ class yt {
|
|
|
218
218
|
}), V(document, "morphAfterElementOut", {
|
|
219
219
|
detail: K
|
|
220
220
|
}), c(this, v, e(this, v).filter((d) => d !== at));
|
|
221
|
-
}, (parseFloat(
|
|
221
|
+
}, (parseFloat(it) || 0) * 1e3 + 10);
|
|
222
222
|
e(this, v).push(at);
|
|
223
223
|
} else
|
|
224
224
|
a.innerHTML = "", a.append(...S);
|
|
225
|
-
}), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", r), document.documentElement.setAttribute("data-current-leaf", b), (Z = this.postprocessor) == null || Z.call(this, { pathname: r, isCached: C, state:
|
|
225
|
+
}), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", r), document.documentElement.setAttribute("data-current-leaf", b), (Z = this.postprocessor) == null || Z.call(this, { pathname: r, isCached: C, state: i }), V(document, "morphAfterNavigation", {
|
|
226
226
|
detail: {
|
|
227
227
|
pathname: r,
|
|
228
228
|
isCached: C,
|
|
229
|
-
state:
|
|
229
|
+
state: i
|
|
230
230
|
}
|
|
231
231
|
}), dt.complete("__morph");
|
|
232
232
|
} catch (q) {
|
|
@@ -239,46 +239,46 @@ class yt {
|
|
|
239
239
|
e(this, g).push(new lt(t, this));
|
|
240
240
|
}
|
|
241
241
|
addLinks(t) {
|
|
242
|
-
t.forEach((
|
|
243
|
-
this.addLink(
|
|
242
|
+
t.forEach((s) => {
|
|
243
|
+
this.addLink(s);
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
removeLink(t) {
|
|
247
|
-
c(this, g, e(this, g).filter((
|
|
247
|
+
c(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
248
248
|
}
|
|
249
249
|
findLinks() {
|
|
250
250
|
const t = [
|
|
251
251
|
...document.documentElement.querySelectorAll("a")
|
|
252
252
|
].filter(
|
|
253
|
-
(
|
|
254
|
-
var
|
|
255
|
-
return ((
|
|
253
|
+
(s) => {
|
|
254
|
+
var i;
|
|
255
|
+
return ((i = s.getAttribute("href")) == null ? void 0 : i.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
|
|
256
256
|
}
|
|
257
257
|
);
|
|
258
|
-
e(this, g).forEach((
|
|
258
|
+
e(this, g).forEach((s) => s.destroy()), c(this, g, t.map((s) => new lt(s, this)));
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
R = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(), g = new WeakMap(), Y = new WeakMap(),
|
|
261
|
+
R = new WeakMap(), B = new WeakMap(), F = new WeakMap(), N = new WeakMap(), g = new WeakMap(), Y = new WeakMap(), k = new WeakMap(), y = new WeakMap(), L = new WeakMap(), O = new WeakMap(), _ = new WeakMap(), v = new WeakMap(), m = new WeakSet(), Q = function(t) {
|
|
262
262
|
return z(this, null, function* () {
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
return
|
|
263
|
+
const s = e(this, k).get(t);
|
|
264
|
+
if (s)
|
|
265
|
+
return s;
|
|
266
266
|
const l = yield (yield fetch(t)).text(), u = e(this, Y).parseFromString(l, "text/html");
|
|
267
|
-
return e(this, F) && e(this,
|
|
267
|
+
return e(this, F) && e(this, k).set(t, u), u;
|
|
268
268
|
});
|
|
269
269
|
}, U = function(t) {
|
|
270
|
-
const
|
|
271
|
-
return
|
|
272
|
-
}, ut = function(t,
|
|
270
|
+
const s = [...t.querySelectorAll("[data-morph]")];
|
|
271
|
+
return s.length ? s : [t];
|
|
272
|
+
}, ut = function(t, s) {
|
|
273
273
|
return t.filter(
|
|
274
|
-
(
|
|
275
|
-
(l) => l.outerHTML ===
|
|
274
|
+
(i) => s.find(
|
|
275
|
+
(l) => l.outerHTML === i.outerHTML
|
|
276
276
|
)
|
|
277
277
|
);
|
|
278
|
-
}, X = function(t,
|
|
278
|
+
}, X = function(t, s) {
|
|
279
279
|
return t.filter(
|
|
280
|
-
(
|
|
281
|
-
(l) => l.outerHTML ===
|
|
280
|
+
(i) => !s.find(
|
|
281
|
+
(l) => l.outerHTML === i.outerHTML
|
|
282
282
|
)
|
|
283
283
|
);
|
|
284
284
|
}, j = new WeakMap();
|