aptechka 0.66.5 → 0.67.0
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/en3/index.cjs +2 -2
- package/lib/en3/index.js +73 -81
- package/lib/morph/MorphRoute.d.ts +5 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +297 -272
- package/package.json +1 -1
package/lib/morph/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var xt = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Mt = (a) => {
|
|
2
|
+
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (
|
|
6
|
-
var z = (
|
|
7
|
-
var
|
|
4
|
+
var gt = (a, t, s) => t.has(a) || Mt("Cannot " + s);
|
|
5
|
+
var e = (a, t, s) => (gt(a, t, "read from private field"), s ? s.call(a) : t.get(a)), o = (a, t, s) => t.has(a) ? Mt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s), r = (a, t, s, i) => (gt(a, t, "write to private field"), i ? i.call(a, s) : t.set(a, s), s), p = (a, t, s) => (gt(a, t, "access private method"), s);
|
|
6
|
+
var z = (a, t, s) => new Promise((i, c) => {
|
|
7
|
+
var y = (E) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
9
|
+
w(s.next(E));
|
|
10
10
|
} catch (V) {
|
|
11
|
-
|
|
11
|
+
c(V);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, x = (E) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
15
|
+
w(s.throw(E));
|
|
16
16
|
} catch (V) {
|
|
17
|
-
|
|
17
|
+
c(V);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, w = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(y, x);
|
|
20
|
+
w((s = s.apply(a, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var
|
|
23
|
-
import { i as
|
|
24
|
-
import { d as
|
|
25
|
-
import { r as
|
|
26
|
-
import { w as
|
|
22
|
+
var Nt = (a, t, s) => (t = a[xt("asyncIterator")]) ? t.call(a) : (a = a[xt("iterator")](), t = {}, s = (i, c) => (c = a[i]) && (t[i] = (y) => new Promise((x, w, E) => (y = c.call(a, y), E = y.done, Promise.resolve(y.value).then((V) => x({ value: V, done: E }), w)))), s("next"), s("return"), t);
|
|
23
|
+
import { i as Rt } from "../index-Bv9zgfdb.js";
|
|
24
|
+
import { d as B } from "../events-CsVF98U6.js";
|
|
25
|
+
import { r as Wt } from "../polyfills-DJrTJQky.js";
|
|
26
|
+
import { w as Yt, s as Xt } from "../scroll-DPkCFTxg.js";
|
|
27
27
|
import "construct-style-sheets-polyfill";
|
|
28
|
-
import { n as
|
|
29
|
-
import { cssValueParser as
|
|
30
|
-
class
|
|
28
|
+
import { n as $t, c as Ht, s as Ut } from "../url-Cc-RVfii.js";
|
|
29
|
+
import { cssValueParser as jt } from "../css-value-parser/index.js";
|
|
30
|
+
class Vt extends HTMLElement {
|
|
31
31
|
connectedCallback() {
|
|
32
32
|
const t = {
|
|
33
33
|
"aria-live": "assertive",
|
|
@@ -38,156 +38,195 @@ class Rt extends HTMLElement {
|
|
|
38
38
|
this.setAttribute(s, i);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
class
|
|
41
|
+
Rt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Vt);
|
|
42
|
+
var k, l, N, it, K;
|
|
43
|
+
class Et {
|
|
44
44
|
constructor(t, s) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
o(this, k);
|
|
46
|
+
o(this, l);
|
|
47
|
+
o(this, N);
|
|
48
|
+
o(this, it, (t) => {
|
|
49
49
|
var i;
|
|
50
|
-
if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this,
|
|
50
|
+
if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, k).previousPathname)
|
|
51
51
|
history.back();
|
|
52
52
|
else {
|
|
53
|
-
|
|
54
|
-
const
|
|
53
|
+
r(this, N, e(this, l).getAttribute("href") || "/");
|
|
54
|
+
const c = e(this, l).getAttribute(
|
|
55
55
|
"data-history-action"
|
|
56
|
-
) || "push",
|
|
56
|
+
) || "push", y = e(this, l).hasAttribute("data-center-scroll"), x = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), w = x ? jt.parse(x) : void 0, E = e(this, l).hasAttribute("data-revalidate"), V = e(this, l).hasAttribute(
|
|
57
57
|
"data-keep-search-parameters"
|
|
58
|
-
),
|
|
59
|
-
e(this,
|
|
60
|
-
historyAction:
|
|
61
|
-
centerScroll:
|
|
62
|
-
offsetScroll:
|
|
58
|
+
), dt = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map(($) => $.trim()), m = e(this, l).hasAttribute("data-clear-state");
|
|
59
|
+
e(this, k).navigate(e(this, N), {
|
|
60
|
+
historyAction: c,
|
|
61
|
+
centerScroll: y,
|
|
62
|
+
offsetScroll: w,
|
|
63
63
|
revalidate: E,
|
|
64
64
|
keepSearchParameters: V,
|
|
65
|
-
submorph:
|
|
66
|
-
clearState:
|
|
65
|
+
submorph: dt,
|
|
66
|
+
clearState: m
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
|
|
70
|
+
o(this, K, () => {
|
|
71
71
|
const t = e(this, l).hasAttribute("data-revalidate");
|
|
72
|
-
e(this,
|
|
72
|
+
e(this, k).prefetch(e(this, N), t), e(this, l).removeEventListener("pointerenter", e(this, K));
|
|
73
73
|
});
|
|
74
|
-
|
|
74
|
+
r(this, k, s), r(this, l, t), r(this, N, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, it)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, K));
|
|
75
75
|
}
|
|
76
76
|
get element() {
|
|
77
77
|
return e(this, l);
|
|
78
78
|
}
|
|
79
79
|
checkCurrent(t) {
|
|
80
|
-
const s = e(this,
|
|
80
|
+
const s = e(this, k).normalizePath(t), i = e(this, k).normalizePath(e(this, N));
|
|
81
81
|
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");
|
|
82
82
|
}
|
|
83
83
|
destroy() {
|
|
84
|
-
e(this, l).removeEventListener("click", e(this,
|
|
84
|
+
e(this, l).removeEventListener("click", e(this, it)), e(this, l).removeEventListener("pointerenter", e(this, K)), e(this, l).classList.remove("current");
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
k = new WeakMap(), l = new WeakMap(), N = new WeakMap(), it = new WeakMap(), K = new WeakMap();
|
|
88
|
+
const Kt = new DOMParser();
|
|
89
|
+
var H, G, rt, b, D, F, I, J, O, W;
|
|
90
|
+
class Dt {
|
|
90
91
|
constructor(t, s, i) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
o(this, H);
|
|
93
|
+
o(this, G);
|
|
94
|
+
o(this, rt);
|
|
95
|
+
o(this, b, { x: 0, y: 0 });
|
|
96
|
+
o(this, D, null);
|
|
97
|
+
o(this, F, null);
|
|
98
|
+
o(this, I, null);
|
|
99
|
+
o(this, J, null);
|
|
100
|
+
o(this, O, null);
|
|
101
|
+
o(this, W, null);
|
|
102
|
+
r(this, H, t), r(this, G, s), r(this, rt, i);
|
|
99
103
|
}
|
|
100
104
|
get pathname() {
|
|
101
|
-
return e(this,
|
|
105
|
+
return e(this, G);
|
|
106
|
+
}
|
|
107
|
+
get searchParameters() {
|
|
108
|
+
return e(this, rt);
|
|
102
109
|
}
|
|
103
110
|
get scrollState() {
|
|
104
|
-
return e(this,
|
|
111
|
+
return e(this, b);
|
|
105
112
|
}
|
|
106
113
|
get document() {
|
|
107
|
-
return e(this,
|
|
114
|
+
return e(this, I);
|
|
115
|
+
}
|
|
116
|
+
setInitialDocument(t) {
|
|
117
|
+
r(this, D, t.cloneNode(!0));
|
|
118
|
+
}
|
|
119
|
+
abort() {
|
|
120
|
+
var t;
|
|
121
|
+
return (t = e(this, O)) == null ? void 0 : t.abort(
|
|
122
|
+
`[${this.pathname}] page loading cancelled`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
fetch(t) {
|
|
126
|
+
return z(this, null, function* () {
|
|
127
|
+
if (!(e(this, D) && !t)) {
|
|
128
|
+
if (e(this, W))
|
|
129
|
+
return e(this, W);
|
|
130
|
+
r(this, W, new Promise((s) => z(this, null, function* () {
|
|
131
|
+
try {
|
|
132
|
+
r(this, O, new AbortController());
|
|
133
|
+
const c = yield (yield fetch(
|
|
134
|
+
`${this.pathname}${this.searchParameters ? "?" + this.searchParameters : ""}`,
|
|
135
|
+
{
|
|
136
|
+
signal: e(this, O).signal
|
|
137
|
+
}
|
|
138
|
+
)).text(), y = Kt.parseFromString(c, "text/html");
|
|
139
|
+
this.setInitialDocument(y);
|
|
140
|
+
} catch (i) {
|
|
141
|
+
console.warn(i);
|
|
142
|
+
} finally {
|
|
143
|
+
r(this, O, null), r(this, W, null), s();
|
|
144
|
+
}
|
|
145
|
+
})));
|
|
146
|
+
}
|
|
147
|
+
});
|
|
108
148
|
}
|
|
109
149
|
cloneDocument() {
|
|
110
|
-
|
|
150
|
+
r(this, I, (e(this, F) || e(this, D)).cloneNode(!0));
|
|
111
151
|
}
|
|
112
152
|
get title() {
|
|
113
153
|
let t = "";
|
|
114
|
-
if (e(this,
|
|
115
|
-
t = e(this,
|
|
154
|
+
if (e(this, I).title)
|
|
155
|
+
t = e(this, I).title;
|
|
116
156
|
else {
|
|
117
|
-
const s = e(this,
|
|
118
|
-
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this,
|
|
157
|
+
const s = e(this, I).querySelector("h1");
|
|
158
|
+
t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, G);
|
|
119
159
|
}
|
|
120
160
|
return t;
|
|
121
161
|
}
|
|
122
162
|
clearScrollState() {
|
|
123
|
-
e(this,
|
|
163
|
+
e(this, b).x = 0, e(this, b).y = 0;
|
|
124
164
|
}
|
|
125
165
|
clearDocumentState() {
|
|
126
|
-
|
|
166
|
+
r(this, F, null);
|
|
127
167
|
}
|
|
128
168
|
saveScrollState() {
|
|
129
|
-
e(this,
|
|
169
|
+
e(this, D).documentElement.hasAttribute(
|
|
130
170
|
"data-no-scroll-restoration"
|
|
131
|
-
) ? (e(this,
|
|
171
|
+
) ? (e(this, b).x = 0, e(this, b).y = 0) : (e(this, b).x = e(this, H).scrollValue.left, e(this, b).y = e(this, H).scrollValue.top);
|
|
132
172
|
}
|
|
133
173
|
restoreScrollPosition() {
|
|
134
|
-
e(this,
|
|
135
|
-
top: e(this,
|
|
136
|
-
left: e(this,
|
|
174
|
+
e(this, H).scrollElement.scroll({
|
|
175
|
+
top: e(this, b).y,
|
|
176
|
+
left: e(this, b).x,
|
|
137
177
|
behavior: "instant"
|
|
138
178
|
});
|
|
139
179
|
}
|
|
140
180
|
saveDocumentState() {
|
|
141
|
-
e(this,
|
|
181
|
+
e(this, D).documentElement.hasAttribute(
|
|
142
182
|
"data-no-page-restoration"
|
|
143
|
-
) ?
|
|
183
|
+
) ? r(this, F, null) : r(this, F, document.cloneNode(!0));
|
|
144
184
|
}
|
|
145
185
|
renewScrollPosition() {
|
|
146
|
-
e(this,
|
|
186
|
+
e(this, H).scrollElement.scroll({
|
|
147
187
|
top: 0,
|
|
148
188
|
left: 0,
|
|
149
189
|
behavior: "instant"
|
|
150
190
|
});
|
|
151
191
|
}
|
|
152
192
|
saveState(t) {
|
|
153
|
-
|
|
193
|
+
r(this, J, t);
|
|
154
194
|
}
|
|
155
195
|
clearState() {
|
|
156
|
-
const t = e(this,
|
|
157
|
-
return
|
|
196
|
+
const t = e(this, J);
|
|
197
|
+
return r(this, J, null), t;
|
|
158
198
|
}
|
|
159
199
|
}
|
|
160
|
-
|
|
161
|
-
var
|
|
162
|
-
const
|
|
200
|
+
H = new WeakMap(), G = new WeakMap(), rt = new WeakMap(), b = new WeakMap(), D = new WeakMap(), F = new WeakMap(), I = new WeakMap(), J = new WeakMap(), O = new WeakMap(), W = new WeakMap();
|
|
201
|
+
var P, Q, g, R, d, nt, Y, C, L, ot, T, X, Z, _, at, h, ht, St, qt, wt, yt, vt, bt, ut, tt;
|
|
202
|
+
const st = class st {
|
|
163
203
|
constructor(t) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
a(this, rt, (t) => {
|
|
204
|
+
o(this, h);
|
|
205
|
+
o(this, P, null);
|
|
206
|
+
o(this, Q, null);
|
|
207
|
+
o(this, g, []);
|
|
208
|
+
o(this, R);
|
|
209
|
+
o(this, d, null);
|
|
210
|
+
o(this, nt);
|
|
211
|
+
o(this, Y, []);
|
|
212
|
+
o(this, C, !1);
|
|
213
|
+
o(this, L, null);
|
|
214
|
+
o(this, ot, !1);
|
|
215
|
+
o(this, T, /* @__PURE__ */ new Map());
|
|
216
|
+
o(this, X, null);
|
|
217
|
+
o(this, Z, 0);
|
|
218
|
+
o(this, _, 0);
|
|
219
|
+
o(this, at, (t) => {
|
|
181
220
|
var s;
|
|
182
221
|
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";
|
|
183
222
|
});
|
|
184
|
-
|
|
223
|
+
o(this, ut, (t) => z(this, null, function* () {
|
|
185
224
|
var s;
|
|
186
|
-
(s = t.state) != null && s.path && (t.preventDefault(),
|
|
225
|
+
(s = t.state) != null && s.path && (t.preventDefault(), r(this, C, !0), yield this.navigate(t.state.path, { historyAction: "none" }), r(this, C, !1));
|
|
187
226
|
}));
|
|
188
|
-
|
|
189
|
-
const { left: t, top: s } = this.scrollValue, i = s - e(this,
|
|
190
|
-
|
|
227
|
+
o(this, tt, () => {
|
|
228
|
+
const { left: t, top: s } = this.scrollValue, i = s - e(this, _), c = t - e(this, Z);
|
|
229
|
+
r(this, _, s), r(this, Z, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
|
|
191
230
|
"scroll-y-forward",
|
|
192
231
|
i > 0
|
|
193
232
|
), document.documentElement.classList.toggle(
|
|
@@ -195,272 +234,267 @@ const tt = class tt {
|
|
|
195
234
|
i < 0
|
|
196
235
|
), document.documentElement.classList.toggle(
|
|
197
236
|
"scroll-x-forward",
|
|
198
|
-
|
|
237
|
+
c > 0
|
|
199
238
|
), document.documentElement.classList.toggle(
|
|
200
239
|
"scroll-x-backward",
|
|
201
|
-
|
|
202
|
-
),
|
|
240
|
+
c < 0
|
|
241
|
+
), B(document, "morphScroll", {
|
|
203
242
|
detail: {
|
|
204
243
|
left: t,
|
|
205
244
|
top: s
|
|
206
245
|
}
|
|
207
246
|
});
|
|
208
247
|
});
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
base:
|
|
248
|
+
if (Rt && !st.instance) {
|
|
249
|
+
st.instance = this, r(this, P, {
|
|
250
|
+
base: $t(t == null ? void 0 : t.base),
|
|
212
251
|
waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
|
|
213
252
|
cachePages: (t == null ? void 0 : t.cachePages) !== !1,
|
|
214
253
|
trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
|
|
215
254
|
scrollSelector: t == null ? void 0 : t.scrollSelector,
|
|
216
255
|
morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
|
|
217
|
-
}),
|
|
256
|
+
}), r(this, Q, p(this, h, St).call(this, document.body));
|
|
218
257
|
const s = this.normalizePath(
|
|
219
258
|
location.pathname + location.hash
|
|
220
259
|
);
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
), document.documentElement.setAttribute(
|
|
260
|
+
r(this, d, s.pathname);
|
|
261
|
+
const i = new Dt(this, e(this, d));
|
|
262
|
+
i.setInitialDocument(document), e(this, T).set(e(this, d), i), document.documentElement.setAttribute(
|
|
225
263
|
"data-current-pathname",
|
|
226
264
|
e(this, d)
|
|
227
265
|
), document.documentElement.setAttribute(
|
|
228
266
|
"data-current-leaf",
|
|
229
267
|
s.leaf
|
|
230
|
-
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this,
|
|
268
|
+
), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, ut)), Ht({
|
|
231
269
|
action: "replace",
|
|
232
270
|
pathname: e(this, d),
|
|
233
271
|
searchParameters: s.parameters || location.search,
|
|
234
272
|
hash: s.hash
|
|
235
|
-
}),
|
|
273
|
+
}), r(this, X, new Vt()), p(this, h, vt).call(this, document);
|
|
236
274
|
}
|
|
237
275
|
}
|
|
238
276
|
get currentPathname() {
|
|
239
277
|
return e(this, d);
|
|
240
278
|
}
|
|
241
279
|
get previousPathname() {
|
|
242
|
-
return e(this,
|
|
280
|
+
return e(this, nt);
|
|
243
281
|
}
|
|
244
282
|
get links() {
|
|
245
|
-
return e(this,
|
|
283
|
+
return e(this, g);
|
|
246
284
|
}
|
|
247
285
|
get scrollElement() {
|
|
248
|
-
return e(this,
|
|
286
|
+
return e(this, L);
|
|
249
287
|
}
|
|
250
288
|
get isPopstateNavigation() {
|
|
251
|
-
return e(this,
|
|
289
|
+
return e(this, C);
|
|
252
290
|
}
|
|
253
291
|
get scrollValue() {
|
|
254
292
|
let t = 0, s = 0;
|
|
255
|
-
return e(this,
|
|
293
|
+
return e(this, ot) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, L).scrollTop, s = e(this, L).scrollLeft), { top: t, left: s };
|
|
256
294
|
}
|
|
257
295
|
saveState(t) {
|
|
258
|
-
const s = e(this,
|
|
296
|
+
const s = e(this, T).get(e(this, d));
|
|
259
297
|
s && s.saveState(t);
|
|
260
298
|
}
|
|
261
299
|
getState() {
|
|
262
|
-
const t = e(this,
|
|
300
|
+
const t = e(this, T).get(e(this, d));
|
|
263
301
|
return t == null ? void 0 : t.clearState();
|
|
264
302
|
}
|
|
265
303
|
normalizePath(t) {
|
|
266
304
|
return Ut(t, {
|
|
267
|
-
base: e(this,
|
|
268
|
-
trailingSlash: e(this,
|
|
305
|
+
base: e(this, P).base,
|
|
306
|
+
trailingSlash: e(this, P).trailingSlash
|
|
269
307
|
});
|
|
270
308
|
}
|
|
271
309
|
prefetch(t, s) {
|
|
272
310
|
return z(this, null, function* () {
|
|
273
|
-
const i = this.normalizePath(t);
|
|
274
|
-
|
|
275
|
-
searchParameters: i.parameters,
|
|
276
|
-
revalidate: s
|
|
277
|
-
});
|
|
311
|
+
const i = this.normalizePath(t), c = p(this, h, ht).call(this, i.pathname, i.parameters);
|
|
312
|
+
c == null || c.fetch(s);
|
|
278
313
|
});
|
|
279
314
|
}
|
|
280
315
|
navigate(V) {
|
|
281
316
|
return z(this, arguments, function* (t, {
|
|
282
317
|
historyAction: s = "push",
|
|
283
318
|
centerScroll: i,
|
|
284
|
-
offsetScroll:
|
|
285
|
-
revalidate:
|
|
286
|
-
keepSearchParameters:
|
|
287
|
-
submorph:
|
|
319
|
+
offsetScroll: c,
|
|
320
|
+
revalidate: y,
|
|
321
|
+
keepSearchParameters: x,
|
|
322
|
+
submorph: w,
|
|
288
323
|
clearState: E
|
|
289
324
|
} = {}) {
|
|
290
|
-
var
|
|
291
|
-
if (e(this,
|
|
325
|
+
var Pt;
|
|
326
|
+
if (e(this, Y).length)
|
|
292
327
|
return;
|
|
293
|
-
const
|
|
294
|
-
let { pathname:
|
|
295
|
-
if (e(this,
|
|
296
|
-
e(this,
|
|
328
|
+
const dt = this.normalizePath(((Pt = this.pathnameModifier) == null ? void 0 : Pt.call(this, t)) || t);
|
|
329
|
+
let { pathname: m, hash: $, parameters: Lt, leaf: zt } = dt;
|
|
330
|
+
if (e(this, R) === m || e(this, d) === m) {
|
|
331
|
+
e(this, C) || p(this, h, bt).call(this, $ || 0, {
|
|
297
332
|
centerScroll: i,
|
|
298
|
-
offsetScroll:
|
|
333
|
+
offsetScroll: c,
|
|
299
334
|
behavior: "smooth"
|
|
300
335
|
});
|
|
301
336
|
return;
|
|
302
337
|
}
|
|
303
|
-
|
|
304
|
-
|
|
338
|
+
r(this, R, m), e(this, g).forEach((U) => {
|
|
339
|
+
U.checkCurrent(m);
|
|
305
340
|
});
|
|
306
341
|
try {
|
|
307
|
-
let
|
|
342
|
+
let U = !0;
|
|
308
343
|
if (this.preprocessor)
|
|
309
344
|
try {
|
|
310
|
-
yield new Promise((
|
|
311
|
-
var
|
|
312
|
-
(
|
|
313
|
-
pathname:
|
|
314
|
-
resolve:
|
|
315
|
-
reject:
|
|
316
|
-
submorph:
|
|
345
|
+
yield new Promise((n, A) => {
|
|
346
|
+
var v;
|
|
347
|
+
(v = this.preprocessor) == null || v.call(this, {
|
|
348
|
+
pathname: m,
|
|
349
|
+
resolve: n,
|
|
350
|
+
reject: A,
|
|
351
|
+
submorph: w
|
|
317
352
|
});
|
|
318
353
|
});
|
|
319
|
-
} catch (
|
|
320
|
-
|
|
354
|
+
} catch (n) {
|
|
355
|
+
n ? console.error(n) : console.log("Route change canceled"), U = !1;
|
|
321
356
|
}
|
|
322
|
-
if (!
|
|
323
|
-
e(this,
|
|
324
|
-
|
|
357
|
+
if (!U || e(this, R) !== m) {
|
|
358
|
+
e(this, g).forEach((n) => {
|
|
359
|
+
n.checkCurrent(e(this, d));
|
|
325
360
|
});
|
|
326
361
|
return;
|
|
327
362
|
}
|
|
328
|
-
const
|
|
329
|
-
pathname:
|
|
330
|
-
submorph:
|
|
363
|
+
const mt = {
|
|
364
|
+
pathname: m,
|
|
365
|
+
submorph: w
|
|
331
366
|
};
|
|
332
|
-
|
|
333
|
-
detail:
|
|
367
|
+
B(document, "morphNavigation", {
|
|
368
|
+
detail: mt
|
|
334
369
|
});
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
})
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
r.checkCurrent(e(this, d));
|
|
370
|
+
const ft = p(this, h, ht).call(this, e(this, d)), f = p(this, h, ht).call(this, m, Lt);
|
|
371
|
+
if (e(this, T).forEach((n) => {
|
|
372
|
+
n.pathname !== m && n.abort();
|
|
373
|
+
}), yield f == null ? void 0 : f.fetch(y), e(this, R) !== m) {
|
|
374
|
+
e(this, g).forEach((n) => {
|
|
375
|
+
n.checkCurrent(e(this, d));
|
|
342
376
|
});
|
|
343
377
|
return;
|
|
344
378
|
}
|
|
345
|
-
|
|
346
|
-
detail:
|
|
379
|
+
ft.clearState(), ft.saveScrollState(), ft.saveDocumentState(), e(this, C) || (f.clearScrollState(), f.clearDocumentState()), E && f.clearState(), f.cloneDocument(), e(this, X).textContent = f.title, document.body.appendChild(e(this, X)), B(document, "morphStart", {
|
|
380
|
+
detail: mt
|
|
347
381
|
});
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
if (
|
|
351
|
-
const
|
|
352
|
-
|
|
382
|
+
const At = Array.from(document.head.children), kt = Array.from(f.document.head.children), Ct = p(this, h, qt).call(this, At, kt), Bt = p(this, h, wt).call(this, At, Ct), lt = p(this, h, wt).call(this, kt, Ct);
|
|
383
|
+
lt.forEach((n, A) => {
|
|
384
|
+
if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
|
|
385
|
+
const v = document.createElement("script");
|
|
386
|
+
v.type = "module", v.src = n.getAttribute("src"), lt[A] = v;
|
|
353
387
|
}
|
|
354
|
-
}),
|
|
355
|
-
document.head.appendChild(
|
|
388
|
+
}), lt.forEach((n) => {
|
|
389
|
+
document.head.appendChild(n);
|
|
356
390
|
});
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
391
|
+
const pt = lt.filter((n) => {
|
|
392
|
+
if (n.hasAttribute("data-no-waiting"))
|
|
359
393
|
return !1;
|
|
360
|
-
if (
|
|
394
|
+
if (p(this, h, yt).call(this, n))
|
|
361
395
|
return !0;
|
|
362
396
|
});
|
|
363
|
-
e(this,
|
|
364
|
-
let
|
|
397
|
+
e(this, P).waitForHeadToLoad && pt.length && (yield new Promise((n) => z(this, null, function* () {
|
|
398
|
+
let A = 0;
|
|
365
399
|
try {
|
|
366
|
-
for (var
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
400
|
+
for (var v = Nt(pt), et, q, j; et = !(q = yield v.next()).done; et = !1) {
|
|
401
|
+
const ct = q.value;
|
|
402
|
+
ct.onload = () => {
|
|
403
|
+
A++, A === pt.length && n();
|
|
370
404
|
};
|
|
371
405
|
}
|
|
372
406
|
} catch (q) {
|
|
373
|
-
|
|
407
|
+
j = [q];
|
|
374
408
|
} finally {
|
|
375
409
|
try {
|
|
376
|
-
|
|
410
|
+
et && (q = v.return) && (yield q.call(v));
|
|
377
411
|
} finally {
|
|
378
|
-
if (
|
|
379
|
-
throw
|
|
412
|
+
if (j)
|
|
413
|
+
throw j[0];
|
|
380
414
|
}
|
|
381
415
|
}
|
|
382
|
-
}))), yield
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
416
|
+
}))), yield Yt(10);
|
|
417
|
+
const Tt = [];
|
|
418
|
+
Bt.forEach((n) => {
|
|
419
|
+
n.hasAttribute("data-permanent") || (p(this, h, yt).call(this, n) ? Tt.push(n) : n.remove());
|
|
386
420
|
});
|
|
387
|
-
const
|
|
388
|
-
e(this,
|
|
421
|
+
const Ft = p(this, h, St).call(this, f.document.body);
|
|
422
|
+
e(this, P).morphInsideScrollContainer || p(this, h, vt).call(this, f.document), document.documentElement.setAttribute("data-current-pathname", m), document.documentElement.setAttribute("data-current-leaf", zt), Ht({
|
|
389
423
|
action: s,
|
|
390
|
-
pathname:
|
|
391
|
-
searchParameters:
|
|
392
|
-
hash:
|
|
393
|
-
}), e(this,
|
|
394
|
-
const
|
|
395
|
-
let q = [],
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
}) : (q.push(...
|
|
424
|
+
pathname: m,
|
|
425
|
+
searchParameters: Lt || (x ? location.search : ""),
|
|
426
|
+
hash: $
|
|
427
|
+
}), e(this, X).remove(), r(this, nt, e(this, d)), r(this, d, m), e(this, Q).forEach((n, A) => {
|
|
428
|
+
const v = Ft[A], et = getComputedStyle(n).getPropertyValue("--morph-duration");
|
|
429
|
+
let q = [], j = [];
|
|
430
|
+
w ? w.forEach((u) => {
|
|
431
|
+
const S = n.querySelector(u), M = v.querySelector(u);
|
|
432
|
+
S && M && (j.push(S), q.push(M));
|
|
433
|
+
}) : (q.push(...v.childNodes), j.push(...n.childNodes)), j.forEach((u) => {
|
|
400
434
|
u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
|
|
401
435
|
}), q.forEach((u) => {
|
|
402
436
|
u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
|
|
403
|
-
}),
|
|
404
|
-
var
|
|
405
|
-
(
|
|
437
|
+
}), w ? q.forEach((u, S) => {
|
|
438
|
+
var M;
|
|
439
|
+
(M = j[S].parentElement) == null || M.insertBefore(
|
|
406
440
|
u,
|
|
407
|
-
|
|
441
|
+
j[S]
|
|
408
442
|
);
|
|
409
|
-
}) :
|
|
443
|
+
}) : n.prepend(...q), Wt(() => {
|
|
410
444
|
q.forEach((u) => {
|
|
411
|
-
var
|
|
412
|
-
u instanceof HTMLElement && ((
|
|
445
|
+
var S;
|
|
446
|
+
u instanceof HTMLElement && ((S = u.parentElement) == null || S.style.setProperty(
|
|
413
447
|
"--new-content-height",
|
|
414
448
|
u.offsetHeight + "px"
|
|
415
449
|
), u.classList.add("in"));
|
|
416
450
|
});
|
|
417
451
|
});
|
|
418
|
-
const
|
|
419
|
-
morphElement:
|
|
420
|
-
pathname:
|
|
452
|
+
const ct = {
|
|
453
|
+
morphElement: n,
|
|
454
|
+
pathname: m
|
|
421
455
|
};
|
|
422
|
-
|
|
423
|
-
detail:
|
|
456
|
+
B(document, "morphNewChildrenAdded", {
|
|
457
|
+
detail: ct
|
|
424
458
|
});
|
|
425
|
-
const
|
|
459
|
+
const Ot = new Promise((u) => {
|
|
426
460
|
setTimeout(() => {
|
|
427
|
-
|
|
428
|
-
var
|
|
429
|
-
|
|
461
|
+
j.forEach((S) => S.remove()), q.forEach((S) => {
|
|
462
|
+
var M;
|
|
463
|
+
S instanceof HTMLElement && ((M = S.parentElement) == null || M.style.removeProperty(
|
|
430
464
|
"--new-content-height"
|
|
431
|
-
),
|
|
432
|
-
}),
|
|
433
|
-
detail:
|
|
465
|
+
), S.classList.remove("in", "new"));
|
|
466
|
+
}), B(document, "morphOldChildrenRemoved", {
|
|
467
|
+
detail: ct
|
|
434
468
|
}), u();
|
|
435
|
-
}, (parseFloat(
|
|
469
|
+
}, (parseFloat(et) || 0) * 1e3 + 10);
|
|
436
470
|
});
|
|
437
|
-
e(this,
|
|
471
|
+
e(this, Y).push(Ot);
|
|
438
472
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
439
473
|
"--new-document-scroll-position",
|
|
440
|
-
(this.scrollValue.top -
|
|
474
|
+
(this.scrollValue.top - f.scrollState.y) * 1 + "px"
|
|
441
475
|
) : document.documentElement.style.setProperty(
|
|
442
476
|
"--new-document-scroll-position",
|
|
443
477
|
this.scrollValue.top + "px"
|
|
444
|
-
),
|
|
445
|
-
detail:
|
|
446
|
-
}),
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
|
|
478
|
+
), B(document, "morphBeforeNavigationScroll", {
|
|
479
|
+
detail: f.scrollState
|
|
480
|
+
}), $ ? (f.clearScrollState(), p(this, h, bt).call(this, $, { centerScroll: i, offsetScroll: c })) : e(this, C) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, Y)), Tt.forEach((n) => n.remove()), r(this, Y, []), e(this, Q).forEach((n) => {
|
|
481
|
+
n.querySelectorAll("script").forEach((v) => {
|
|
482
|
+
const et = document.createElement("script");
|
|
483
|
+
et.type = "module", et.src = v.getAttribute("src"), v.replaceWith(et);
|
|
450
484
|
});
|
|
451
|
-
}),
|
|
452
|
-
detail:
|
|
485
|
+
}), B(document, "morphComplete", {
|
|
486
|
+
detail: mt
|
|
453
487
|
}), document.documentElement.style.removeProperty(
|
|
454
488
|
"--new-document-scroll-position"
|
|
455
489
|
), window.dispatchEvent(new Event("resize"));
|
|
456
|
-
} catch (
|
|
457
|
-
console.error(
|
|
490
|
+
} catch (U) {
|
|
491
|
+
console.error(U);
|
|
458
492
|
}
|
|
459
|
-
|
|
493
|
+
r(this, R, void 0);
|
|
460
494
|
});
|
|
461
495
|
}
|
|
462
496
|
addLink(t) {
|
|
463
|
-
e(this,
|
|
497
|
+
e(this, g).push(new Et(t, this));
|
|
464
498
|
}
|
|
465
499
|
addLinks(t) {
|
|
466
500
|
t.forEach((s) => {
|
|
@@ -468,71 +502,62 @@ const tt = class tt {
|
|
|
468
502
|
});
|
|
469
503
|
}
|
|
470
504
|
removeLink(t) {
|
|
471
|
-
|
|
505
|
+
r(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
472
506
|
}
|
|
473
507
|
destroyOldLinks(t) {
|
|
474
|
-
|
|
508
|
+
r(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
475
509
|
}
|
|
476
510
|
findNewLinks(t) {
|
|
477
511
|
const s = [...t.querySelectorAll("a")].filter(
|
|
478
|
-
e(this,
|
|
512
|
+
e(this, at)
|
|
479
513
|
);
|
|
480
|
-
e(this,
|
|
481
|
-
...s.map((i) => new
|
|
514
|
+
e(this, g).push(
|
|
515
|
+
...s.map((i) => new Et(i, this))
|
|
482
516
|
);
|
|
483
517
|
}
|
|
484
518
|
findLinks() {
|
|
485
519
|
const t = [
|
|
486
520
|
...document.documentElement.querySelectorAll("a")
|
|
487
|
-
].filter(e(this,
|
|
488
|
-
e(this,
|
|
521
|
+
].filter(e(this, at));
|
|
522
|
+
e(this, g).forEach((s) => s.destroy()), r(this, g, t.map((s) => new Et(s, this)));
|
|
489
523
|
}
|
|
490
524
|
};
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
});
|
|
496
|
-
}, Vt = function(t, s) {
|
|
497
|
-
return z(this, null, function* () {
|
|
498
|
-
const h = yield (yield fetch(
|
|
499
|
-
`${t}${s ? "?" + s : ""}`
|
|
500
|
-
)).text(), v = e(this, lt).parseFromString(h, "text/html"), b = new Nt(this, t, v);
|
|
501
|
-
return e(this, R).set(t, b), b;
|
|
502
|
-
});
|
|
503
|
-
}, Et = function(t) {
|
|
525
|
+
P = new WeakMap(), Q = new WeakMap(), g = new WeakMap(), R = new WeakMap(), d = new WeakMap(), nt = new WeakMap(), Y = new WeakMap(), C = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), T = new WeakMap(), X = new WeakMap(), Z = new WeakMap(), _ = new WeakMap(), at = new WeakMap(), h = new WeakSet(), ht = function(t, s) {
|
|
526
|
+
let i = e(this, T).get(t);
|
|
527
|
+
return i || (i = new Dt(this, t, s), e(this, T).set(t, i)), i;
|
|
528
|
+
}, St = function(t) {
|
|
504
529
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
505
530
|
return s.length ? s : [t];
|
|
506
531
|
}, qt = function(t, s) {
|
|
507
532
|
return t.filter(
|
|
508
533
|
(i) => s.find(
|
|
509
|
-
(
|
|
534
|
+
(c) => c.outerHTML === i.outerHTML
|
|
510
535
|
)
|
|
511
536
|
);
|
|
512
|
-
},
|
|
537
|
+
}, wt = function(t, s) {
|
|
513
538
|
return t.filter(
|
|
514
539
|
(i) => !s.find(
|
|
515
|
-
(
|
|
540
|
+
(c) => c.outerHTML === i.outerHTML
|
|
516
541
|
)
|
|
517
542
|
);
|
|
518
|
-
},
|
|
543
|
+
}, yt = function(t) {
|
|
519
544
|
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
520
|
-
},
|
|
545
|
+
}, vt = function(t) {
|
|
521
546
|
var s, i;
|
|
522
|
-
(s = e(this,
|
|
547
|
+
(s = e(this, L)) == null || s.removeEventListener(
|
|
523
548
|
"scroll",
|
|
524
|
-
e(this,
|
|
525
|
-
),
|
|
526
|
-
},
|
|
549
|
+
e(this, tt)
|
|
550
|
+
), r(this, _, 0), r(this, Z, 0), r(this, L, e(this, P).scrollSelector && t.querySelector(e(this, P).scrollSelector) || window), r(this, ot, e(this, L) === window), (i = e(this, L)) == null || i.addEventListener("scroll", e(this, tt)), e(this, tt).call(this);
|
|
551
|
+
}, bt = function(t, s) {
|
|
527
552
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
528
|
-
(typeof i == "number" || i) &&
|
|
529
|
-
scrollElement: e(this,
|
|
553
|
+
(typeof i == "number" || i) && Xt(i, {
|
|
554
|
+
scrollElement: e(this, L),
|
|
530
555
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
531
556
|
center: s == null ? void 0 : s.centerScroll,
|
|
532
557
|
offset: s == null ? void 0 : s.offsetScroll
|
|
533
558
|
});
|
|
534
|
-
},
|
|
535
|
-
let
|
|
559
|
+
}, ut = new WeakMap(), tt = new WeakMap(), st.instance = null;
|
|
560
|
+
let It = st;
|
|
536
561
|
export {
|
|
537
|
-
|
|
562
|
+
It as Morph
|
|
538
563
|
};
|