aptechka 0.43.2 → 0.43.4
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 +109 -109
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var dt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),ut=r=>{throw TypeError(r)};var $=(r,t,s)=>t.has(r)||ut("Cannot "+s);var e=(r,t,s)=>($(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),c=(r,t,s,n)=>($(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s),y=(r,t,s)=>($(r,t,"access private method"),s);var D=(r,t,s)=>new Promise((n,l)=>{var d=m=>{try{E(s.next(m))}catch(P){l(P)}},o=m=>{try{E(s.throw(m))}catch(P){l(P)}},E=m=>m.done?n(m.value):Promise.resolve(m.value).then(d,o);E((s=s.apply(r,t)).next())});var mt=(r,t,s)=>(t=r[dt("asyncIterator")])?t.call(r):(r=r[dt("iterator")](),t={},s=(n,l)=>(l=r[n])&&(t[n]=d=>new Promise((o,E,m)=>(d=l.call(r,d),m=d.done,Promise.resolve(d.value).then(P=>o({value:P,done:m}),E)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const yt=require("../browser-CpzFX2xg.cjs"),J=require("../events-KVanG9sR.cjs"),Q=require("../url-CHQeS8b5.cjs"),ft=require("../loading/index.cjs");class gt extends HTMLElement{constructor(){super()}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,n]of Object.entries(t))this.setAttribute(s,n)}}customElements.get("morph-announcer")||customElements.define("morph-announcer",gt);var T,h,g,q,R,k,O,H;class pt{constructor(t,s){a(this,T);a(this,h);a(this,g);a(this,q);a(this,R);a(this,k);a(this,O,t=>{t.preventDefault(),e(this,T).links.forEach(s=>{var n;e(this,g)===e(s,g)||(n=e(s,k))!=null&&n.includes(e(this,g))?e(s,h).classList.add("clicked"):e(s,h).classList.remove("clicked")}),e(this,T).navigate(e(this,g),{historyAction:e(this,q),state:e(this,R)})});a(this,H,()=>{e(this,T).prefetch(e(this,g)),e(this,h).removeEventListener("pointerenter",e(this,H))});var d,o;c(this,T,s),c(this,h,t),c(this,g,e(this,h).getAttribute("href")||"/"),c(this,q,e(this,h).getAttribute("data-history-action")||"push"),c(this,R,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,O));const n=s.normalizePath(e(this,g)),l=s.normalizePath(location.pathname);c(this,k,(d=e(this,h).getAttribute("data-match-paths"))==null?void 0:d.split(",").map(E=>s.normalizePath(E.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(n.pathname)&&e(this,h).classList.add("current"):n.pathname===l.pathname||(o=e(this,k))!=null&&o.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,H))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,O)),e(this,h).removeEventListener("pointerenter",e(this,H)),e(this,h).classList.remove("current")}}T=new WeakMap,h=new WeakMap,g=new WeakMap,q=new WeakMap,R=new WeakMap,k=new WeakMap,O=new WeakMap,H=new WeakMap;var _,F,I,j,N,v,U,M,b,L,B,W,C,A,u,tt,et,Lt,st,X;class bt{constructor(t){a(this,u);a(this,_,null);a(this,F,null);a(this,I,null);a(this,j,!1);a(this,N,null);a(this,v,[]);a(this,U,new DOMParser);a(this,M,new Map);a(this,b);a(this,L,null);a(this,B);a(this,W);a(this,C,[]);a(this,A,null);a(this,X,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(yt.isBrowser){c(this,_,Q.normalizeBase(t==null?void 0:t.base)),c(this,F,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,I,(t==null?void 0:t.cachePages)!==!1),c(this,j,(t==null?void 0:t.trailingSlash)||!1),c(this,N,y(this,u,et).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);c(this,L,s.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,L)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,X)),Q.changeHistory("replace",e(this,L),s.parameters,s.hash),e(this,N).map(n=>[...n.children]).flat().forEach(n=>{n instanceof HTMLElement&&n.classList.add("current")}),c(this,A,new gt)}}get currentPathname(){return e(this,L)}get previousPathname(){return e(this,B)}get currentState(){return e(this,W)}get links(){return e(this,v)}normalizePath(t){return Q.splitPath(t,e(this,_),e(this,j))}prefetch(t){return D(this,null,function*(){const s=this.normalizePath(t);return y(this,u,tt).call(this,s.pathname)})}navigate(l){return D(this,arguments,function*(t,{historyAction:s="push",state:n}={}){var it;if(e(this,C).length)return;const d=this.normalizePath(t);let{pathname:o,hash:E,parameters:m,leaf:P}=d;if(e(this,b)===o||e(this,L)===o)return;c(this,W,n),c(this,b,o);const Y=e(this,M).has(o);try{ft.loading.add("__morph");let K=!0;if(this.preprocessor)try{yield new Promise((i,f)=>{var w;(w=this.preprocessor)==null||w.call(this,{pathname:o,resolve:i,reject:f,isCached:Y,state:n})})}catch(i){i?console.error(i):console.log("Route change canceled"),K=!1}if(!K||e(this,b)!==o)return;const S=(e(this,M).get(o)||(yield y(this,u,tt).call(this,o))).cloneNode(!0);if(e(this,b)!==o)return;if(S.title)e(this,A).textContent=S.title;else{const i=S.querySelector("h1"),f=(i==null?void 0:i.innerText)||(i==null?void 0:i.textContent)||o;e(this,A).textContent=f}document.body.appendChild(e(this,A));const nt={pathname:o,isCached:Y,state:n,newDocument:S};J.dispatchEvent(document,"morphStart",{detail:nt});const rt=Array.from(document.head.children),at=Array.from(S.head.children),ot=y(this,u,Lt).call(this,rt,at),Et=y(this,u,st).call(this,rt,ot),V=y(this,u,st).call(this,at,ot);V.forEach((i,f)=>{if(i.tagName==="SCRIPT"&&i.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=i.getAttribute("src"),V[f]=w}}),V.forEach(i=>{document.head.appendChild(i)});const Z=V.filter(i=>!i.hasAttribute("data-no-waiting")&&(i.tagName==="STYLE"||i.tagName==="SCRIPT"||i.tagName==="LINK")&&i.getAttribute("rel")!=="canonical");e(this,F)&&Z.length&&(yield new Promise(i=>D(this,null,function*(){let f=0;try{for(var w=mt(Z),ct,x,lt;ct=!(x=yield w.next()).done;ct=!1){const G=x.value;G.onload=()=>{f++,f===Z.length&&i()}}}catch(x){lt=[x]}finally{try{ct&&(x=w.return)&&(yield x.call(w))}finally{if(lt)throw lt[0]}}})));const ht=[];Et.forEach(i=>{i.hasAttribute("data-permanent")||(i.tagName==="SCRIPT"||i.tagName==="STYLE"||i.getAttribute("rel")==="stylesheet"?ht.push(i):i.remove())}),c(this,B,e(this,L)),c(this,L,o),Q.changeHistory(s,o,m,E);const vt=y(this,u,et).call(this,S.body);e(this,N).forEach((i,f)=>{const w=vt[f++],ct=getComputedStyle(i).getPropertyValue("--morph-duration"),x=[...w.childNodes];if(ct){const lt=[...i.childNodes];lt.forEach(p=>{p instanceof HTMLElement&&p.classList.add("old")}),x.forEach(p=>{p instanceof HTMLElement&&p.classList.add("new")}),i.append(...x),setTimeout(()=>{x.forEach(p=>{p instanceof HTMLElement&&p.classList.add("in")})},10);const G={element:i,pathname:o,isCached:Y,state:n};J.dispatchEvent(document,"morphNewChildrenAdded",{detail:G});const wt=new Promise(p=>{setTimeout(()=>{lt.forEach(z=>z.remove()),x.forEach(z=>{z instanceof HTMLElement&&(z.classList.remove("new","in"),z.classList.add("current"))}),J.dispatchEvent(document,"morphOldChildrenRemoved",{detail:G}),p()},(parseFloat(ct)||0)*1e3+10)});e(this,C).push(wt)}else i.innerHTML="",i.append(...x)}),yield Promise.all(e(this,C)),ht.forEach(i=>i.remove()),c(this,C,[]),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",o),document.documentElement.setAttribute("data-current-leaf",P),e(this,A).remove(),(it=this.postprocessor)==null||it.call(this,{pathname:o,isCached:Y,state:n}),J.dispatchEvent(document,"morphComplete",{detail:nt}),ft.loading.complete("__morph")}catch(K){console.error(K)}c(this,b,void 0)})}addLink(t){e(this,v).push(new pt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){c(this,v,e(this,v).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var n;return((n=s.getAttribute("href"))==null?void 0:n.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,v).forEach(s=>s.destroy()),c(this,v,t.map(s=>new pt(s,this)))}}_=new WeakMap,F=new WeakMap,I=new WeakMap,j=new WeakMap,N=new WeakMap,v=new WeakMap,U=new WeakMap,M=new WeakMap,b=new WeakMap,L=new WeakMap,B=new WeakMap,W=new WeakMap,C=new WeakMap,A=new WeakMap,u=new WeakSet,tt=function(t){return D(this,null,function*(){const s=e(this,M).get(t);if(s)return s;const l=yield(yield fetch(t)).text(),d=e(this,U).parseFromString(l,"text/html");return e(this,I)&&e(this,M).set(t,d),d})},et=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Lt=function(t,s){return t.filter(n=>s.find(l=>l.outerHTML===n.outerHTML))},st=function(t,s){return t.filter(n=>!s.find(l=>l.outerHTML===n.outerHTML))},X=new WeakMap;exports.Morph=bt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var lt = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), dt = (a) => {
|
|
2
|
+
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var Z = (
|
|
5
|
-
var e = (
|
|
6
|
-
var D = (
|
|
4
|
+
var Z = (a, t, s) => t.has(a) || dt("Cannot " + s);
|
|
5
|
+
var e = (a, t, s) => (Z(a, t, "read from private field"), s ? s.call(a) : t.get(a)), r = (a, t, s) => t.has(a) ? dt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s), c = (a, t, s, n) => (Z(a, t, "write to private field"), n ? n.call(a, s) : t.set(a, s), s), y = (a, t, s) => (Z(a, t, "access private method"), s);
|
|
6
|
+
var D = (a, t, s) => new Promise((n, l) => {
|
|
7
7
|
var d = (m) => {
|
|
8
8
|
try {
|
|
9
9
|
E(s.next(m));
|
|
@@ -17,14 +17,14 @@ var D = (r, t, s) => new Promise((n, l) => {
|
|
|
17
17
|
l(P);
|
|
18
18
|
}
|
|
19
19
|
}, E = (m) => m.done ? n(m.value) : Promise.resolve(m.value).then(d, o);
|
|
20
|
-
E((s = s.apply(
|
|
20
|
+
E((s = s.apply(a, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var
|
|
23
|
-
import { i as
|
|
22
|
+
var ut = (a, t, s) => (t = a[lt("asyncIterator")]) ? t.call(a) : (a = a[lt("iterator")](), t = {}, s = (n, l) => (l = a[n]) && (t[n] = (d) => new Promise((o, E, m) => (d = l.call(a, d), m = d.done, Promise.resolve(d.value).then((P) => o({ value: P, done: m }), E)))), s("next"), s("return"), t);
|
|
23
|
+
import { i as yt } from "../browser-0zX67oeU.js";
|
|
24
24
|
import { d as J } from "../events-CsVF98U6.js";
|
|
25
|
-
import { n as
|
|
26
|
-
import { loading as
|
|
27
|
-
class
|
|
25
|
+
import { n as At, c as mt, s as bt } from "../url-DqQuzXwT.js";
|
|
26
|
+
import { loading as ft } from "../loading/index.js";
|
|
27
|
+
class Lt extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
}
|
|
@@ -38,32 +38,32 @@ class pt extends HTMLElement {
|
|
|
38
38
|
this.setAttribute(s, n);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
customElements.get("morph-announcer") || customElements.define("morph-announcer",
|
|
42
|
-
var T, h, L,
|
|
43
|
-
class
|
|
41
|
+
customElements.get("morph-announcer") || customElements.define("morph-announcer", Lt);
|
|
42
|
+
var T, h, L, R, F, S, I, H;
|
|
43
|
+
class pt {
|
|
44
44
|
constructor(t, s) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
r(this, T);
|
|
46
|
+
r(this, h);
|
|
47
|
+
r(this, L);
|
|
48
|
+
r(this, R);
|
|
49
|
+
r(this, F);
|
|
50
|
+
r(this, S);
|
|
51
|
+
r(this, I, (t) => {
|
|
52
52
|
t.preventDefault(), e(this, T).links.forEach((s) => {
|
|
53
53
|
var n;
|
|
54
54
|
e(this, L) === e(s, L) || (n = e(s, S)) != null && n.includes(e(this, L)) ? e(s, h).classList.add("clicked") : e(s, h).classList.remove("clicked");
|
|
55
55
|
}), e(this, T).navigate(e(this, L), {
|
|
56
|
-
historyAction: e(this,
|
|
57
|
-
state: e(this,
|
|
56
|
+
historyAction: e(this, R),
|
|
57
|
+
state: e(this, F)
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
|
-
|
|
60
|
+
r(this, H, () => {
|
|
61
61
|
e(this, T).prefetch(e(this, L)), e(this, h).removeEventListener("pointerenter", e(this, H));
|
|
62
62
|
});
|
|
63
63
|
var d, o;
|
|
64
|
-
c(this, T, s), c(this, h, t), c(this, L, e(this, h).getAttribute("href") || "/"), c(this,
|
|
64
|
+
c(this, T, s), c(this, h, t), c(this, L, e(this, h).getAttribute("href") || "/"), c(this, R, e(this, h).getAttribute(
|
|
65
65
|
"data-history-action"
|
|
66
|
-
) || "push"), c(this,
|
|
66
|
+
) || "push"), c(this, F, e(this, h).getAttribute("data-state") || void 0), e(this, h).addEventListener("click", e(this, I));
|
|
67
67
|
const n = s.normalizePath(e(this, L)), l = s.normalizePath(location.pathname);
|
|
68
68
|
c(this, S, (d = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : d.split(",").map((E) => s.normalizePath(E.trim()).pathname)), e(this, h).hasAttribute("data-include") ? l.pathname.includes(n.pathname) && e(this, h).classList.add("current") : n.pathname === l.pathname || (o = e(this, S)) != null && o.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, H));
|
|
69
69
|
}
|
|
@@ -71,64 +71,66 @@ class ft {
|
|
|
71
71
|
return e(this, h);
|
|
72
72
|
}
|
|
73
73
|
destroy() {
|
|
74
|
-
e(this, h).removeEventListener("click", e(this,
|
|
74
|
+
e(this, h).removeEventListener("click", e(this, I)), e(this, h).removeEventListener("pointerenter", e(this, H)), e(this, h).classList.remove("current");
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
T = new WeakMap(), h = new WeakMap(), L = new WeakMap(),
|
|
78
|
-
var _, q, B,
|
|
79
|
-
class
|
|
77
|
+
T = new WeakMap(), h = new WeakMap(), L = new WeakMap(), R = new WeakMap(), F = new WeakMap(), S = new WeakMap(), I = new WeakMap(), H = new WeakMap();
|
|
78
|
+
var O, _, q, B, N, w, Q, C, A, g, W, Y, M, b, u, $, tt, gt, et, U;
|
|
79
|
+
class Ht {
|
|
80
80
|
constructor(t) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
r(this, u);
|
|
82
|
+
r(this, O, null);
|
|
83
|
+
r(this, _, null);
|
|
84
|
+
r(this, q, null);
|
|
85
|
+
r(this, B, !1);
|
|
86
|
+
r(this, N, null);
|
|
87
|
+
r(this, w, []);
|
|
88
|
+
r(this, Q, new DOMParser());
|
|
89
|
+
r(this, C, /* @__PURE__ */ new Map());
|
|
90
|
+
r(this, A);
|
|
91
|
+
r(this, g, null);
|
|
92
|
+
r(this, W);
|
|
93
|
+
r(this, Y);
|
|
94
|
+
r(this, M, []);
|
|
95
|
+
r(this, b, null);
|
|
96
|
+
r(this, U, (t) => {
|
|
97
97
|
t.state && this.navigate(t.state, { historyAction: "none" });
|
|
98
98
|
});
|
|
99
|
-
if (
|
|
100
|
-
c(this,
|
|
101
|
-
const s = this.normalizePath(
|
|
99
|
+
if (yt) {
|
|
100
|
+
c(this, O, At(t == null ? void 0 : t.base)), c(this, _, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), c(this, q, (t == null ? void 0 : t.cachePages) !== !1), c(this, B, (t == null ? void 0 : t.trailingSlash) || !1), c(this, N, y(this, u, tt).call(this, document.body));
|
|
101
|
+
const s = this.normalizePath(
|
|
102
|
+
location.pathname + location.hash
|
|
103
|
+
);
|
|
102
104
|
c(this, g, s.pathname), document.documentElement.setAttribute(
|
|
103
105
|
"data-current-pathname",
|
|
104
106
|
e(this, g)
|
|
105
107
|
), document.documentElement.setAttribute(
|
|
106
108
|
"data-current-leaf",
|
|
107
109
|
s.leaf
|
|
108
|
-
), this.findLinks(), addEventListener("popstate", e(this, U)),
|
|
110
|
+
), this.findLinks(), addEventListener("popstate", e(this, U)), mt(
|
|
109
111
|
"replace",
|
|
110
112
|
e(this, g),
|
|
111
113
|
s.parameters,
|
|
112
114
|
s.hash
|
|
113
115
|
), e(this, N).map((n) => [...n.children]).flat().forEach((n) => {
|
|
114
116
|
n instanceof HTMLElement && n.classList.add("current");
|
|
115
|
-
}), c(this, b, new
|
|
117
|
+
}), c(this, b, new Lt());
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
get currentPathname() {
|
|
119
121
|
return e(this, g);
|
|
120
122
|
}
|
|
121
123
|
get previousPathname() {
|
|
122
|
-
return e(this,
|
|
124
|
+
return e(this, W);
|
|
123
125
|
}
|
|
124
126
|
get currentState() {
|
|
125
|
-
return e(this,
|
|
127
|
+
return e(this, Y);
|
|
126
128
|
}
|
|
127
129
|
get links() {
|
|
128
130
|
return e(this, w);
|
|
129
131
|
}
|
|
130
132
|
normalizePath(t) {
|
|
131
|
-
return
|
|
133
|
+
return bt(t, e(this, O), e(this, B));
|
|
132
134
|
}
|
|
133
135
|
prefetch(t) {
|
|
134
136
|
return D(this, null, function* () {
|
|
@@ -145,23 +147,23 @@ class kt {
|
|
|
145
147
|
let { pathname: o, hash: E, parameters: m, leaf: P } = d;
|
|
146
148
|
if (e(this, A) === o || e(this, g) === o)
|
|
147
149
|
return;
|
|
148
|
-
c(this,
|
|
149
|
-
const
|
|
150
|
+
c(this, Y, n), c(this, A, o);
|
|
151
|
+
const j = e(this, C).has(o);
|
|
150
152
|
try {
|
|
151
|
-
|
|
153
|
+
ft.add("__morph");
|
|
152
154
|
let K = !0;
|
|
153
155
|
if (this.preprocessor)
|
|
154
156
|
try {
|
|
155
157
|
yield new Promise((i, f) => {
|
|
156
158
|
var v;
|
|
157
|
-
(v = this.preprocessor) == null || v.call(this, { pathname: o, resolve: i, reject: f, isCached:
|
|
159
|
+
(v = this.preprocessor) == null || v.call(this, { pathname: o, resolve: i, reject: f, isCached: j, state: n });
|
|
158
160
|
});
|
|
159
161
|
} catch (i) {
|
|
160
162
|
i ? console.error(i) : console.log("Route change canceled"), K = !1;
|
|
161
163
|
}
|
|
162
164
|
if (!K || e(this, A) !== o)
|
|
163
165
|
return;
|
|
164
|
-
const k = e(this, C).get(o) || (yield y(this, u, $).call(this, o));
|
|
166
|
+
const k = (e(this, C).get(o) || (yield y(this, u, $).call(this, o))).cloneNode(!0);
|
|
165
167
|
if (e(this, A) !== o)
|
|
166
168
|
return;
|
|
167
169
|
if (k.title)
|
|
@@ -170,17 +172,19 @@ class kt {
|
|
|
170
172
|
const i = k.querySelector("h1"), f = (i == null ? void 0 : i.innerText) || (i == null ? void 0 : i.textContent) || o;
|
|
171
173
|
e(this, b).textContent = f;
|
|
172
174
|
}
|
|
173
|
-
document.body.appendChild(e(this, b))
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
document.body.appendChild(e(this, b));
|
|
176
|
+
const it = {
|
|
177
|
+
pathname: o,
|
|
178
|
+
isCached: j,
|
|
179
|
+
state: n,
|
|
180
|
+
newDocument: k
|
|
181
|
+
};
|
|
182
|
+
J(document, "morphStart", {
|
|
183
|
+
detail: it
|
|
180
184
|
});
|
|
181
|
-
const
|
|
182
|
-
k.head.
|
|
183
|
-
), rt = y(this, u,
|
|
185
|
+
const nt = Array.from(document.head.children), at = Array.from(
|
|
186
|
+
k.head.children
|
|
187
|
+
), rt = y(this, u, gt).call(this, nt, at), Et = y(this, u, et).call(this, nt, rt), V = y(this, u, et).call(this, at, rt);
|
|
184
188
|
V.forEach((i, f) => {
|
|
185
189
|
if (i.tagName === "SCRIPT" && i.getAttribute("src")) {
|
|
186
190
|
const v = document.createElement("script");
|
|
@@ -192,72 +196,68 @@ class kt {
|
|
|
192
196
|
const X = V.filter(
|
|
193
197
|
(i) => !i.hasAttribute("data-no-waiting") && (i.tagName === "STYLE" || i.tagName === "SCRIPT" || i.tagName === "LINK") && i.getAttribute("rel") !== "canonical"
|
|
194
198
|
);
|
|
195
|
-
e(this,
|
|
199
|
+
e(this, _) && X.length && (yield new Promise((i) => D(this, null, function* () {
|
|
196
200
|
let f = 0;
|
|
197
201
|
try {
|
|
198
|
-
for (var v =
|
|
199
|
-
const G =
|
|
202
|
+
for (var v = ut(X), ht, x, ct; ht = !(x = yield v.next()).done; ht = !1) {
|
|
203
|
+
const G = x.value;
|
|
200
204
|
G.onload = () => {
|
|
201
205
|
f++, f === X.length && i();
|
|
202
206
|
};
|
|
203
207
|
}
|
|
204
|
-
} catch (
|
|
205
|
-
|
|
208
|
+
} catch (x) {
|
|
209
|
+
ct = [x];
|
|
206
210
|
} finally {
|
|
207
211
|
try {
|
|
208
|
-
|
|
212
|
+
ht && (x = v.return) && (yield x.call(v));
|
|
209
213
|
} finally {
|
|
210
|
-
if (
|
|
211
|
-
throw
|
|
214
|
+
if (ct)
|
|
215
|
+
throw ct[0];
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
218
|
})));
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
i.hasAttribute("data-permanent") || (i.tagName === "SCRIPT" || i.tagName === "STYLE" || i.getAttribute("rel") === "stylesheet" ?
|
|
218
|
-
}), c(this,
|
|
219
|
-
const
|
|
219
|
+
const ot = [];
|
|
220
|
+
Et.forEach((i) => {
|
|
221
|
+
i.hasAttribute("data-permanent") || (i.tagName === "SCRIPT" || i.tagName === "STYLE" || i.getAttribute("rel") === "stylesheet" ? ot.push(i) : i.remove());
|
|
222
|
+
}), c(this, W, e(this, g)), c(this, g, o), mt(s, o, m, E);
|
|
223
|
+
const wt = y(this, u, tt).call(this, k.body);
|
|
220
224
|
e(this, N).forEach((i, f) => {
|
|
221
|
-
const v =
|
|
222
|
-
if (
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
+
const v = wt[f++], ht = getComputedStyle(i).getPropertyValue("--morph-duration"), x = [...v.childNodes];
|
|
226
|
+
if (ht) {
|
|
227
|
+
const ct = [...i.childNodes];
|
|
228
|
+
ct.forEach((p) => {
|
|
225
229
|
p instanceof HTMLElement && p.classList.add("old");
|
|
226
|
-
}),
|
|
230
|
+
}), x.forEach((p) => {
|
|
227
231
|
p instanceof HTMLElement && p.classList.add("new");
|
|
228
|
-
}), i.append(...
|
|
229
|
-
|
|
232
|
+
}), i.append(...x), setTimeout(() => {
|
|
233
|
+
x.forEach((p) => {
|
|
230
234
|
p instanceof HTMLElement && p.classList.add("in");
|
|
231
235
|
});
|
|
232
236
|
}, 10);
|
|
233
237
|
const G = {
|
|
234
238
|
element: i,
|
|
235
239
|
pathname: o,
|
|
236
|
-
isCached:
|
|
240
|
+
isCached: j,
|
|
237
241
|
state: n
|
|
238
242
|
};
|
|
239
243
|
J(document, "morphNewChildrenAdded", {
|
|
240
244
|
detail: G
|
|
241
245
|
});
|
|
242
|
-
const
|
|
246
|
+
const vt = new Promise((p) => {
|
|
243
247
|
setTimeout(() => {
|
|
244
|
-
|
|
245
|
-
|
|
248
|
+
ct.forEach((z) => z.remove()), x.forEach((z) => {
|
|
249
|
+
z instanceof HTMLElement && (z.classList.remove("new", "in"), z.classList.add("current"));
|
|
246
250
|
}), J(document, "morphOldChildrenRemoved", {
|
|
247
251
|
detail: G
|
|
248
252
|
}), p();
|
|
249
|
-
}, (parseFloat(
|
|
253
|
+
}, (parseFloat(ht) || 0) * 1e3 + 10);
|
|
250
254
|
});
|
|
251
|
-
e(this, M).push(
|
|
255
|
+
e(this, M).push(vt);
|
|
252
256
|
} else
|
|
253
|
-
i.innerHTML = "", i.append(...
|
|
254
|
-
}), yield Promise.all(e(this, M)),
|
|
255
|
-
detail:
|
|
256
|
-
|
|
257
|
-
isCached: x,
|
|
258
|
-
state: n
|
|
259
|
-
}
|
|
260
|
-
}), mt.complete("__morph");
|
|
257
|
+
i.innerHTML = "", i.append(...x);
|
|
258
|
+
}), yield Promise.all(e(this, M)), ot.forEach((i) => i.remove()), c(this, M, []), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", o), document.documentElement.setAttribute("data-current-leaf", P), e(this, b).remove(), (st = this.postprocessor) == null || st.call(this, { pathname: o, isCached: j, state: n }), J(document, "morphComplete", {
|
|
259
|
+
detail: it
|
|
260
|
+
}), ft.complete("__morph");
|
|
261
261
|
} catch (K) {
|
|
262
262
|
console.error(K);
|
|
263
263
|
}
|
|
@@ -265,7 +265,7 @@ class kt {
|
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
267
|
addLink(t) {
|
|
268
|
-
e(this, w).push(new
|
|
268
|
+
e(this, w).push(new pt(t, this));
|
|
269
269
|
}
|
|
270
270
|
addLinks(t) {
|
|
271
271
|
t.forEach((s) => {
|
|
@@ -284,21 +284,21 @@ class kt {
|
|
|
284
284
|
return ((n = s.getAttribute("href")) == null ? void 0 : n.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
|
|
285
285
|
}
|
|
286
286
|
);
|
|
287
|
-
e(this, w).forEach((s) => s.destroy()), c(this, w, t.map((s) => new
|
|
287
|
+
e(this, w).forEach((s) => s.destroy()), c(this, w, t.map((s) => new pt(s, this)));
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
O = new WeakMap(), _ = new WeakMap(), q = new WeakMap(), B = new WeakMap(), N = new WeakMap(), w = new WeakMap(), Q = new WeakMap(), C = new WeakMap(), A = new WeakMap(), g = new WeakMap(), W = new WeakMap(), Y = new WeakMap(), M = new WeakMap(), b = new WeakMap(), u = new WeakSet(), $ = function(t) {
|
|
291
291
|
return D(this, null, function* () {
|
|
292
292
|
const s = e(this, C).get(t);
|
|
293
293
|
if (s)
|
|
294
294
|
return s;
|
|
295
295
|
const l = yield (yield fetch(t)).text(), d = e(this, Q).parseFromString(l, "text/html");
|
|
296
|
-
return e(this,
|
|
296
|
+
return e(this, q) && e(this, C).set(t, d), d;
|
|
297
297
|
});
|
|
298
298
|
}, tt = function(t) {
|
|
299
299
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
300
300
|
return s.length ? s : [t];
|
|
301
|
-
},
|
|
301
|
+
}, gt = function(t, s) {
|
|
302
302
|
return t.filter(
|
|
303
303
|
(n) => s.find(
|
|
304
304
|
(l) => l.outerHTML === n.outerHTML
|
|
@@ -312,5 +312,5 @@ _ = new WeakMap(), q = new WeakMap(), B = new WeakMap(), W = new WeakMap(), N =
|
|
|
312
312
|
);
|
|
313
313
|
}, U = new WeakMap();
|
|
314
314
|
export {
|
|
315
|
-
|
|
315
|
+
Ht as Morph
|
|
316
316
|
};
|