aptechka 0.7.10 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +140 -133
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var at=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var U=(n,t,i)=>{if(!t.has(n))throw TypeError("Cannot "+i)};var e=(n,t,i)=>(U(n,t,"read from private field"),i?i.call(n):t.get(n)),r=(n,t,i)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,i)},c=(n,t,i,a)=>(U(n,t,"write to private field"),a?a.call(n,i):t.set(n,i),i);var d=(n,t,i)=>(U(n,t,"access private method"),i);var T=(n,t,i)=>new Promise((a,s)=>{var u=l=>{try{f(i.next(l))}catch(g){s(g)}},p=l=>{try{f(i.throw(l))}catch(g){s(g)}},f=l=>l.done?a(l.value):Promise.resolve(l.value).then(u,p);f((i=i.apply(n,t)).next())});var ot=(n,t,i)=>(t=n[at("asyncIterator")])?t.call(n):(n=n[at("iterator")](),t={},i=(a,s)=>(s=n[a])&&(t[a]=u=>new Promise((p,f,l)=>(u=s.call(n,u),l=u.done,Promise.resolve(u.value).then(g=>p({value:g,done:l}),f)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ht=require("../notifier/index.cjs"),mt=require("../browser-CpzFX2xg.cjs"),V=require("../url-C3dWnJQg.cjs");var w,h,m,k,P,C,A;class ft{constructor(t,i){r(this,w,void 0);r(this,h,void 0);r(this,m,void 0);r(this,k,void 0);r(this,P,void 0);r(this,C,t=>{t.preventDefault(),e(this,w).links.forEach(i=>{var a;e(this,m)===e(i,m)||(a=e(i,P))!=null&&a.includes(e(this,m))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,w).navigate(e(this,m),e(this,k))});r(this,A,()=>{e(this,w).prefetch(e(this,m)),e(this,h).removeEventListener("pointerenter",e(this,A))});var u,p;c(this,w,i),c(this,h,t),c(this,m,e(this,h).getAttribute("href")||"/"),c(this,k,e(this,h).getAttribute("data-history-action")||"push"),e(this,h).addEventListener("click",e(this,C));const a=i.normalizePath(e(this,m)),s=i.normalizePath(location.pathname);c(this,P,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(f=>i.normalizePath(f.trim()).pathname)),e(this,h).hasAttribute("data-include")?s.pathname.includes(a.pathname)&&e(this,h).classList.add("current"):a.pathname===s.pathname||(p=e(this,P))!=null&&p.includes(s.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,A))}destroy(){e(this,h).removeEventListener("click",e(this,C)),e(this,h).removeEventListener("pointerenter",e(this,A)),e(this,h).classList.remove("current")}}w=new WeakMap,h=new WeakMap,m=new WeakMap,k=new WeakMap,P=new WeakMap,C=new WeakMap,A=new WeakMap;var M,S,z,q,H,K,y,v,L,x,D,R,X,F,Z,I,$,Y,ct,O,tt,_;class pt{constructor(t){r(this,R);r(this,F);r(this,I);r(this,Y);r(this,O);r(this,M,null);r(this,S,null);r(this,z,null);r(this,q,null);r(this,H,[]);r(this,K,new DOMParser);r(this,y,new Map);r(this,v,void 0);r(this,L,null);r(this,x,new ht.Notifier);r(this,D,new ht.Notifier);r(this,_,t=>{t.state&&this.navigate(t.state,"none")});if(mt.isBrowser){t!=null&&t.base?c(this,M,V.normalizeBase(t.base)):c(this,M,"/"),c(this,S,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,z,(t==null?void 0:t.cachePages)!==!1),c(this,q,d(this,I,$).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),d(this,F,Z).call(this),addEventListener("popstate",e(this,_))}}get currentPathname(){return e(this,L)}get links(){return e(this,H)}normalizePath(t){return V.splitPath(t,e(this,M))}beforeNavigationEvent(t){return e(this,x).subscribe(t)}afterNavigationEvent(t){return e(this,D).subscribe(t)}prefetch(t){return T(this,null,function*(){const i=this.normalizePath(t);return d(this,R,X).call(this,i.pathname)})}navigate(t,i="push"){return T(this,null,function*(){var g;const a=this.normalizePath(t);let{pathname:s,hash:u,parameters:p,leaf:f}=a;if(e(this,v)===s||e(this,L)===s)return;c(this,v,s);const l=e(this,y).has(s);try{let B=!0;if(e(this,x).notify({pathname:s,isCached:l}),this.preprocessor)try{yield new Promise((o,E)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:s,resolve:o,reject:E,isCached:l})})}catch(o){o?console.error(o):console.log("Route change canceled"),B=!1}if(!B||e(this,v)!==s)return;const et=e(this,y).get(s)||(yield d(this,R,X).call(this,s));if(e(this,v)!==s)return;const it=Array.from(document.head.children),st=Array.from(et.head.cloneNode(!0).children),nt=d(this,Y,ct).call(this,it,st),lt=d(this,O,tt).call(this,it,nt),W=d(this,O,tt).call(this,st,nt);W.forEach((o,E)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=o.getAttribute("src"),W[E]=b}}),W.forEach(o=>{document.head.appendChild(o)});const G=W.filter(o=>o.tagName==="STYLE"||o.tagName==="SCRIPT"||o.tagName==="LINK");e(this,S)&&G.length&&(yield new Promise(o=>T(this,null,function*(){let E=0;try{for(var b=ot(G),dt,J,j;dt=!(J=yield b.next()).done;dt=!1){const N=J.value;N.onload=()=>{E++,E===G.length&&o()}}}catch(J){j=[J]}finally{try{dt&&(J=b.return)&&(yield J.call(b))}finally{if(j)throw j[0]}}}))),lt.forEach(o=>{o.hasAttribute("data-permanent")||o.remove()}),c(this,L,s),V.changeHistory(i,s,p,u);const ut=d(this,I,$).call(this,et.body.cloneNode(!0));e(this,q).forEach((o,E)=>{const b=ut[E];let dt=[...o.childNodes],J=[...b.childNodes];dt.forEach(j=>{if(j instanceof HTMLElement){const N=j.getAttribute("data-remain");let rt;J=J.filter(Q=>Q instanceof HTMLElement&&N&&Q.getAttribute("data-remain")===N?(rt=Q,!1):!0),N&&rt||j.remove()}else j.remove()}),o.append(...J)}),d(this,F,Z).call(this),document.documentElement.setAttribute("data-current-pathname",s),document.documentElement.setAttribute("data-current-leaf",f),(g=this.postprocessor)==null||g.call(this,{pathname:s,isCached:l}),e(this,D).notify({pathname:s,isCached:l})}catch(B){console.error(B)}c(this,v,void 0)})}}M=new WeakMap,S=new WeakMap,z=new WeakMap,q=new WeakMap,H=new WeakMap,K=new WeakMap,y=new WeakMap,v=new WeakMap,L=new WeakMap,x=new WeakMap,D=new WeakMap,R=new WeakSet,X=function(t){return T(this,null,function*(){const i=e(this,y).get(t);if(i)return i;const s=yield(yield fetch(t)).text(),u=e(this,K).parseFromString(s,"text/html");return e(this,z)&&e(this,y).set(t,u),u})},F=new WeakSet,Z=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var a;return(a=i.getAttribute("href"))==null?void 0:a.startsWith("/")});e(this,H).forEach(i=>i.destroy()),c(this,H,t.map(i=>new ft(i,this)))},I=new WeakSet,$=function(t){return[...t.querySelectorAll("[data-morph]")]},Y=new WeakSet,ct=function(t,i){return t.filter(a=>i.find(s=>s.outerHTML===a.outerHTML))},O=new WeakSet,tt=function(t,i){return t.filter(a=>!i.find(s=>s.outerHTML===a.outerHTML))},_=new WeakMap;exports.Morph=pt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,89 +1,96 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var at = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n);
|
|
2
|
+
var V = (n, t, i) => {
|
|
3
3
|
if (!t.has(n))
|
|
4
4
|
throw TypeError("Cannot " + i);
|
|
5
5
|
};
|
|
6
|
-
var e = (n, t, i) => (
|
|
6
|
+
var e = (n, t, i) => (V(n, t, "read from private field"), i ? i.call(n) : t.get(n)), a = (n, t, i) => {
|
|
7
7
|
if (t.has(n))
|
|
8
8
|
throw TypeError("Cannot add the same private member more than once");
|
|
9
9
|
t instanceof WeakSet ? t.add(n) : t.set(n, i);
|
|
10
|
-
}, c = (n, t, i,
|
|
11
|
-
var
|
|
12
|
-
var T = (n, t, i) => new Promise((
|
|
13
|
-
var
|
|
10
|
+
}, c = (n, t, i, r) => (V(n, t, "write to private field"), r ? r.call(n, i) : t.set(n, i), i);
|
|
11
|
+
var d = (n, t, i) => (V(n, t, "access private method"), i);
|
|
12
|
+
var T = (n, t, i) => new Promise((r, s) => {
|
|
13
|
+
var u = (l) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
s(
|
|
15
|
+
f(i.next(l));
|
|
16
|
+
} catch (E) {
|
|
17
|
+
s(E);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
19
|
+
}, p = (l) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
s(
|
|
21
|
+
f(i.throw(l));
|
|
22
|
+
} catch (E) {
|
|
23
|
+
s(E);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, f = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(u, p);
|
|
26
|
+
f((i = i.apply(n, t)).next());
|
|
27
27
|
});
|
|
28
|
-
var rt = (n, t, i) => (t = n[
|
|
29
|
-
import { Notifier as
|
|
30
|
-
import { i as
|
|
31
|
-
import { n as
|
|
32
|
-
var w,
|
|
33
|
-
class
|
|
28
|
+
var rt = (n, t, i) => (t = n[at("asyncIterator")]) ? t.call(n) : (n = n[at("iterator")](), t = {}, i = (r, s) => (s = n[r]) && (t[r] = (u) => new Promise((p, f, l) => (u = s.call(n, u), l = u.done, Promise.resolve(u.value).then((E) => p({ value: E, done: l }), f)))), i("next"), i("return"), t);
|
|
29
|
+
import { Notifier as ot } from "../notifier/index.js";
|
|
30
|
+
import { i as dt } from "../browser-0zX67oeU.js";
|
|
31
|
+
import { n as mt, s as ft, c as pt } from "../url-DMNfW7uN.js";
|
|
32
|
+
var w, h, m, k, y, C, A;
|
|
33
|
+
class Et {
|
|
34
34
|
constructor(t, i) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
a(this, w, void 0);
|
|
36
|
+
a(this, h, void 0);
|
|
37
|
+
a(this, m, void 0);
|
|
38
|
+
a(this, k, void 0);
|
|
39
|
+
a(this, y, void 0);
|
|
40
|
+
a(this, C, (t) => {
|
|
41
41
|
t.preventDefault(), e(this, w).links.forEach((i) => {
|
|
42
|
-
var
|
|
43
|
-
e(this,
|
|
44
|
-
}), e(this, w).navigate(e(this,
|
|
42
|
+
var r;
|
|
43
|
+
e(this, m) === e(i, m) || (r = e(i, y)) != null && r.includes(e(this, m)) ? e(i, h).classList.add("clicked") : e(i, h).classList.remove("clicked");
|
|
44
|
+
}), e(this, w).navigate(e(this, m), e(this, k));
|
|
45
45
|
});
|
|
46
|
-
|
|
47
|
-
e(this, w).prefetch(e(this,
|
|
46
|
+
a(this, A, () => {
|
|
47
|
+
e(this, w).prefetch(e(this, m)), e(this, h).removeEventListener("pointerenter", e(this, A));
|
|
48
48
|
});
|
|
49
|
-
var
|
|
50
|
-
c(this, w, i), c(this,
|
|
49
|
+
var u, p;
|
|
50
|
+
c(this, w, i), c(this, h, t), c(this, m, e(this, h).getAttribute("href") || "/"), c(this, k, e(this, h).getAttribute(
|
|
51
51
|
"data-history-action"
|
|
52
|
-
) || "push"), e(this,
|
|
53
|
-
const
|
|
54
|
-
c(this,
|
|
52
|
+
) || "push"), e(this, h).addEventListener("click", e(this, C));
|
|
53
|
+
const r = i.normalizePath(e(this, m)), s = i.normalizePath(location.pathname);
|
|
54
|
+
c(this, y, (u = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : u.split(",").map((f) => i.normalizePath(f.trim()).pathname)), e(this, h).hasAttribute("data-include") ? s.pathname.includes(r.pathname) && e(this, h).classList.add("current") : r.pathname === s.pathname || (p = e(this, y)) != null && p.includes(s.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, A));
|
|
55
55
|
}
|
|
56
56
|
destroy() {
|
|
57
|
-
e(this,
|
|
57
|
+
e(this, h).removeEventListener("click", e(this, C)), e(this, h).removeEventListener("pointerenter", e(this, A)), e(this, h).classList.remove("current");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
w = new WeakMap(),
|
|
61
|
-
var H,
|
|
62
|
-
class
|
|
60
|
+
w = new WeakMap(), h = new WeakMap(), m = new WeakMap(), k = new WeakMap(), y = new WeakMap(), C = new WeakMap(), A = new WeakMap();
|
|
61
|
+
var H, z, S, x, M, Y, P, v, b, D, R, F, X, I, Z, q, _, j, ht, B, $, G;
|
|
62
|
+
class wt {
|
|
63
63
|
constructor(t) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
a(this, F);
|
|
65
|
+
a(this, I);
|
|
66
|
+
a(this, q);
|
|
67
|
+
a(this, j);
|
|
68
|
+
a(this, B);
|
|
69
|
+
a(this, H, null);
|
|
70
|
+
a(this, z, null);
|
|
71
|
+
a(this, S, null);
|
|
72
|
+
a(this, x, null);
|
|
73
|
+
a(this, M, []);
|
|
74
|
+
a(this, Y, new DOMParser());
|
|
75
|
+
a(this, P, /* @__PURE__ */ new Map());
|
|
76
|
+
a(this, v, void 0);
|
|
77
|
+
a(this, b, null);
|
|
78
|
+
a(this, D, new ot());
|
|
79
|
+
a(this, R, new ot());
|
|
80
|
+
a(this, G, (t) => {
|
|
81
81
|
t.state && this.navigate(t.state, "none");
|
|
82
82
|
});
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
if (dt) {
|
|
84
|
+
t != null && t.base ? c(this, H, mt(t.base)) : c(this, H, "/"), c(this, z, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), c(this, S, (t == null ? void 0 : t.cachePages) !== !1), c(this, x, d(this, q, _).call(this, document.body));
|
|
85
|
+
const i = this.normalizePath(location.pathname);
|
|
86
|
+
c(this, b, i.pathname), document.documentElement.setAttribute(
|
|
87
|
+
"data-current-pathname",
|
|
88
|
+
e(this, b)
|
|
89
|
+
), document.documentElement.setAttribute(
|
|
90
|
+
"data-current-leaf",
|
|
91
|
+
i.leaf
|
|
92
|
+
), d(this, I, Z).call(this), addEventListener("popstate", e(this, G));
|
|
93
|
+
}
|
|
87
94
|
}
|
|
88
95
|
get currentPathname() {
|
|
89
96
|
return e(this, b);
|
|
@@ -92,7 +99,7 @@ class bt {
|
|
|
92
99
|
return e(this, M);
|
|
93
100
|
}
|
|
94
101
|
normalizePath(t) {
|
|
95
|
-
return
|
|
102
|
+
return ft(t, e(this, H));
|
|
96
103
|
}
|
|
97
104
|
beforeNavigationEvent(t) {
|
|
98
105
|
return e(this, D).subscribe(t);
|
|
@@ -103,126 +110,126 @@ class bt {
|
|
|
103
110
|
prefetch(t) {
|
|
104
111
|
return T(this, null, function* () {
|
|
105
112
|
const i = this.normalizePath(t);
|
|
106
|
-
return
|
|
113
|
+
return d(this, F, X).call(this, i.pathname);
|
|
107
114
|
});
|
|
108
115
|
}
|
|
109
116
|
navigate(t, i = "push") {
|
|
110
117
|
return T(this, null, function* () {
|
|
111
|
-
var
|
|
112
|
-
const
|
|
113
|
-
let { pathname: s, hash:
|
|
118
|
+
var E;
|
|
119
|
+
const r = this.normalizePath(t);
|
|
120
|
+
let { pathname: s, hash: u, parameters: p, leaf: f } = r;
|
|
114
121
|
if (e(this, v) === s || e(this, b) === s)
|
|
115
122
|
return;
|
|
116
123
|
c(this, v, s);
|
|
117
|
-
const
|
|
124
|
+
const l = e(this, P).has(s);
|
|
118
125
|
try {
|
|
119
|
-
let
|
|
126
|
+
let O = !0;
|
|
120
127
|
if (e(this, D).notify({
|
|
121
128
|
pathname: s,
|
|
122
|
-
isCached:
|
|
129
|
+
isCached: l
|
|
123
130
|
}), this.preprocessor)
|
|
124
131
|
try {
|
|
125
|
-
yield new Promise((
|
|
132
|
+
yield new Promise((o, g) => {
|
|
126
133
|
var L;
|
|
127
|
-
(L = this.preprocessor) == null || L.call(this, { pathname: s, resolve:
|
|
134
|
+
(L = this.preprocessor) == null || L.call(this, { pathname: s, resolve: o, reject: g, isCached: l });
|
|
128
135
|
});
|
|
129
|
-
} catch (
|
|
130
|
-
|
|
136
|
+
} catch (o) {
|
|
137
|
+
o ? console.error(o) : console.log("Route change canceled"), O = !1;
|
|
131
138
|
}
|
|
132
|
-
if (!
|
|
139
|
+
if (!O || e(this, v) !== s)
|
|
133
140
|
return;
|
|
134
|
-
const
|
|
141
|
+
const tt = e(this, P).get(s) || (yield d(this, F, X).call(this, s));
|
|
135
142
|
if (e(this, v) !== s)
|
|
136
143
|
return;
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
),
|
|
140
|
-
|
|
141
|
-
if (
|
|
144
|
+
const et = Array.from(document.head.children), it = Array.from(
|
|
145
|
+
tt.head.cloneNode(!0).children
|
|
146
|
+
), st = d(this, j, ht).call(this, et, it), ct = d(this, B, $).call(this, et, st), W = d(this, B, $).call(this, it, st);
|
|
147
|
+
W.forEach((o, g) => {
|
|
148
|
+
if (o.tagName === "SCRIPT" && o.getAttribute("src")) {
|
|
142
149
|
const L = document.createElement("script");
|
|
143
|
-
L.type = "module", L.src =
|
|
150
|
+
L.type = "module", L.src = o.getAttribute("src"), W[g] = L;
|
|
144
151
|
}
|
|
145
|
-
}),
|
|
146
|
-
document.head.appendChild(
|
|
152
|
+
}), W.forEach((o) => {
|
|
153
|
+
document.head.appendChild(o);
|
|
147
154
|
});
|
|
148
|
-
const
|
|
149
|
-
(
|
|
155
|
+
const J = W.filter(
|
|
156
|
+
(o) => o.tagName === "STYLE" || o.tagName === "SCRIPT" || o.tagName === "LINK"
|
|
150
157
|
);
|
|
151
|
-
e(this,
|
|
152
|
-
let
|
|
158
|
+
e(this, z) && J.length && (yield new Promise((o) => T(this, null, function* () {
|
|
159
|
+
let g = 0;
|
|
153
160
|
try {
|
|
154
|
-
for (var L = rt(
|
|
155
|
-
const N =
|
|
161
|
+
for (var L = rt(J), ut, Q, K; ut = !(Q = yield L.next()).done; ut = !1) {
|
|
162
|
+
const N = Q.value;
|
|
156
163
|
N.onload = () => {
|
|
157
|
-
|
|
164
|
+
g++, g === J.length && o();
|
|
158
165
|
};
|
|
159
166
|
}
|
|
160
|
-
} catch (
|
|
161
|
-
|
|
167
|
+
} catch (Q) {
|
|
168
|
+
K = [Q];
|
|
162
169
|
} finally {
|
|
163
170
|
try {
|
|
164
|
-
|
|
171
|
+
ut && (Q = L.return) && (yield Q.call(L));
|
|
165
172
|
} finally {
|
|
166
|
-
if (
|
|
167
|
-
throw
|
|
173
|
+
if (K)
|
|
174
|
+
throw K[0];
|
|
168
175
|
}
|
|
169
176
|
}
|
|
170
|
-
}))),
|
|
171
|
-
|
|
172
|
-
}), c(this, b, s),
|
|
173
|
-
const
|
|
174
|
-
e(this, x).forEach((
|
|
175
|
-
const L =
|
|
176
|
-
let
|
|
177
|
-
|
|
178
|
-
if (
|
|
179
|
-
const N =
|
|
180
|
-
let
|
|
181
|
-
|
|
182
|
-
(
|
|
183
|
-
), N &&
|
|
177
|
+
}))), ct.forEach((o) => {
|
|
178
|
+
o.hasAttribute("data-permanent") || o.remove();
|
|
179
|
+
}), c(this, b, s), pt(i, s, p, u);
|
|
180
|
+
const lt = d(this, q, _).call(this, tt.body.cloneNode(!0));
|
|
181
|
+
e(this, x).forEach((o, g) => {
|
|
182
|
+
const L = lt[g];
|
|
183
|
+
let ut = [...o.childNodes], Q = [...L.childNodes];
|
|
184
|
+
ut.forEach((K) => {
|
|
185
|
+
if (K instanceof HTMLElement) {
|
|
186
|
+
const N = K.getAttribute("data-remain");
|
|
187
|
+
let nt;
|
|
188
|
+
Q = Q.filter(
|
|
189
|
+
(U) => U instanceof HTMLElement && N && U.getAttribute("data-remain") === N ? (nt = U, !1) : !0
|
|
190
|
+
), N && nt || K.remove();
|
|
184
191
|
} else
|
|
185
|
-
|
|
186
|
-
}),
|
|
187
|
-
}),
|
|
188
|
-
} catch (
|
|
189
|
-
console.error(
|
|
192
|
+
K.remove();
|
|
193
|
+
}), o.append(...Q);
|
|
194
|
+
}), d(this, I, Z).call(this), document.documentElement.setAttribute("data-current-pathname", s), document.documentElement.setAttribute("data-current-leaf", f), (E = this.postprocessor) == null || E.call(this, { pathname: s, isCached: l }), e(this, R).notify({ pathname: s, isCached: l });
|
|
195
|
+
} catch (O) {
|
|
196
|
+
console.error(O);
|
|
190
197
|
}
|
|
191
198
|
c(this, v, void 0);
|
|
192
199
|
});
|
|
193
200
|
}
|
|
194
201
|
}
|
|
195
|
-
H = new WeakMap(),
|
|
202
|
+
H = new WeakMap(), z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), M = new WeakMap(), Y = new WeakMap(), P = new WeakMap(), v = new WeakMap(), b = new WeakMap(), D = new WeakMap(), R = new WeakMap(), F = new WeakSet(), X = function(t) {
|
|
196
203
|
return T(this, null, function* () {
|
|
197
|
-
const i = e(this,
|
|
204
|
+
const i = e(this, P).get(t);
|
|
198
205
|
if (i)
|
|
199
206
|
return i;
|
|
200
|
-
const s = yield (yield fetch(t)).text(),
|
|
201
|
-
return e(this,
|
|
207
|
+
const s = yield (yield fetch(t)).text(), u = e(this, Y).parseFromString(s, "text/html");
|
|
208
|
+
return e(this, S) && e(this, P).set(t, u), u;
|
|
202
209
|
});
|
|
203
|
-
}, I = new WeakSet(),
|
|
210
|
+
}, I = new WeakSet(), Z = function() {
|
|
204
211
|
const t = [
|
|
205
212
|
...document.documentElement.querySelectorAll("a")
|
|
206
213
|
].filter((i) => {
|
|
207
|
-
var
|
|
208
|
-
return (
|
|
214
|
+
var r;
|
|
215
|
+
return (r = i.getAttribute("href")) == null ? void 0 : r.startsWith("/");
|
|
209
216
|
});
|
|
210
|
-
e(this, M).forEach((i) => i.destroy()), c(this, M, t.map((i) => new
|
|
211
|
-
}, q = new WeakSet(),
|
|
217
|
+
e(this, M).forEach((i) => i.destroy()), c(this, M, t.map((i) => new Et(i, this)));
|
|
218
|
+
}, q = new WeakSet(), _ = function(t) {
|
|
212
219
|
return [...t.querySelectorAll("[data-morph]")];
|
|
213
|
-
},
|
|
220
|
+
}, j = new WeakSet(), ht = function(t, i) {
|
|
214
221
|
return t.filter(
|
|
215
|
-
(
|
|
216
|
-
(s) => s.outerHTML ===
|
|
222
|
+
(r) => i.find(
|
|
223
|
+
(s) => s.outerHTML === r.outerHTML
|
|
217
224
|
)
|
|
218
225
|
);
|
|
219
|
-
}, B = new WeakSet(),
|
|
226
|
+
}, B = new WeakSet(), $ = function(t, i) {
|
|
220
227
|
return t.filter(
|
|
221
|
-
(
|
|
222
|
-
(s) => s.outerHTML ===
|
|
228
|
+
(r) => !i.find(
|
|
229
|
+
(s) => s.outerHTML === r.outerHTML
|
|
223
230
|
)
|
|
224
231
|
);
|
|
225
|
-
},
|
|
232
|
+
}, G = new WeakMap();
|
|
226
233
|
export {
|
|
227
|
-
|
|
234
|
+
wt as Morph
|
|
228
235
|
};
|