aptechka 0.66.5 → 0.67.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +308 -281
- 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
|
|
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 B = (a, t, s) => new Promise((i, c) => {
|
|
7
|
+
var y = (E) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
|
|
9
|
+
w(s.next(E));
|
|
10
|
+
} catch (q) {
|
|
11
|
+
c(q);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, x = (E) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
15
|
+
w(s.throw(E));
|
|
16
|
+
} catch (q) {
|
|
17
|
+
c(q);
|
|
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((q) => x({ value: q, done: E }), w)))), s("next"), s("return"), t);
|
|
23
|
+
import { i as Rt } from "../index-Bv9zgfdb.js";
|
|
24
|
+
import { d as F } 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"), q = 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
|
-
keepSearchParameters:
|
|
65
|
-
submorph:
|
|
66
|
-
clearState:
|
|
64
|
+
keepSearchParameters: q,
|
|
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, O, I, J, W, Y;
|
|
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, O, null);
|
|
98
|
+
o(this, I, null);
|
|
99
|
+
o(this, J, null);
|
|
100
|
+
o(this, W, null);
|
|
101
|
+
o(this, Y, 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, W)) == null ? void 0 : t.abort(
|
|
122
|
+
`[${this.pathname}] page loading cancelled`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
fetch(t) {
|
|
126
|
+
return B(this, null, function* () {
|
|
127
|
+
if (!(e(this, D) && !t)) {
|
|
128
|
+
if (e(this, Y))
|
|
129
|
+
return e(this, Y);
|
|
130
|
+
r(this, Y, new Promise((s) => B(this, null, function* () {
|
|
131
|
+
try {
|
|
132
|
+
r(this, W, new AbortController());
|
|
133
|
+
const c = yield (yield fetch(
|
|
134
|
+
`${this.pathname}${this.searchParameters ? "?" + this.searchParameters : ""}`,
|
|
135
|
+
{
|
|
136
|
+
signal: e(this, W).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, W, null), r(this, Y, null), s();
|
|
144
|
+
}
|
|
145
|
+
})));
|
|
146
|
+
}
|
|
147
|
+
});
|
|
108
148
|
}
|
|
109
149
|
cloneDocument() {
|
|
110
|
-
|
|
150
|
+
r(this, I, (e(this, O) || 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, O, 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, O, null) : r(this, O, 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(), O = new WeakMap(), I = new WeakMap(), J = new WeakMap(), W = new WeakMap(), Y = new WeakMap();
|
|
201
|
+
var P, Q, g, R, d, nt, V, 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, V, []);
|
|
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) => B(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,269 @@ 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
|
+
), F(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
|
-
return
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
310
|
+
return B(this, null, function* () {
|
|
311
|
+
if (e(this, V).length)
|
|
312
|
+
return;
|
|
313
|
+
const i = this.normalizePath(t), c = p(this, h, ht).call(this, i.pathname, i.parameters);
|
|
314
|
+
c == null || c.fetch(s);
|
|
278
315
|
});
|
|
279
316
|
}
|
|
280
|
-
navigate(
|
|
281
|
-
return
|
|
317
|
+
navigate(q) {
|
|
318
|
+
return B(this, arguments, function* (t, {
|
|
282
319
|
historyAction: s = "push",
|
|
283
320
|
centerScroll: i,
|
|
284
|
-
offsetScroll:
|
|
285
|
-
revalidate:
|
|
286
|
-
keepSearchParameters:
|
|
287
|
-
submorph:
|
|
321
|
+
offsetScroll: c,
|
|
322
|
+
revalidate: y,
|
|
323
|
+
keepSearchParameters: x,
|
|
324
|
+
submorph: w,
|
|
288
325
|
clearState: E
|
|
289
326
|
} = {}) {
|
|
290
|
-
var
|
|
291
|
-
if (e(this,
|
|
327
|
+
var Pt;
|
|
328
|
+
if (e(this, V).length)
|
|
292
329
|
return;
|
|
293
|
-
const
|
|
294
|
-
let { pathname:
|
|
295
|
-
if (e(this,
|
|
296
|
-
e(this,
|
|
330
|
+
const dt = this.normalizePath(((Pt = this.pathnameModifier) == null ? void 0 : Pt.call(this, t)) || t);
|
|
331
|
+
let { pathname: m, hash: $, parameters: Lt, leaf: zt } = dt;
|
|
332
|
+
if (e(this, R) === m || e(this, d) === m) {
|
|
333
|
+
e(this, C) || p(this, h, bt).call(this, $ || 0, {
|
|
297
334
|
centerScroll: i,
|
|
298
|
-
offsetScroll:
|
|
335
|
+
offsetScroll: c,
|
|
299
336
|
behavior: "smooth"
|
|
300
337
|
});
|
|
301
338
|
return;
|
|
302
339
|
}
|
|
303
|
-
|
|
304
|
-
|
|
340
|
+
r(this, R, m), e(this, g).forEach((U) => {
|
|
341
|
+
U.checkCurrent(m);
|
|
305
342
|
});
|
|
306
343
|
try {
|
|
307
|
-
let
|
|
344
|
+
let U = !0;
|
|
308
345
|
if (this.preprocessor)
|
|
309
346
|
try {
|
|
310
|
-
yield new Promise((
|
|
311
|
-
var
|
|
312
|
-
(
|
|
313
|
-
pathname:
|
|
314
|
-
resolve:
|
|
315
|
-
reject:
|
|
316
|
-
submorph:
|
|
347
|
+
yield new Promise((n, A) => {
|
|
348
|
+
var v;
|
|
349
|
+
(v = this.preprocessor) == null || v.call(this, {
|
|
350
|
+
pathname: m,
|
|
351
|
+
resolve: n,
|
|
352
|
+
reject: A,
|
|
353
|
+
submorph: w
|
|
317
354
|
});
|
|
318
355
|
});
|
|
319
|
-
} catch (
|
|
320
|
-
|
|
356
|
+
} catch (n) {
|
|
357
|
+
n ? console.error(n) : console.log("Route change canceled"), U = !1;
|
|
321
358
|
}
|
|
322
|
-
if (!
|
|
323
|
-
e(this,
|
|
324
|
-
|
|
359
|
+
if (!U || e(this, R) !== m) {
|
|
360
|
+
e(this, g).forEach((n) => {
|
|
361
|
+
n.checkCurrent(e(this, d));
|
|
325
362
|
});
|
|
326
363
|
return;
|
|
327
364
|
}
|
|
328
|
-
const
|
|
329
|
-
pathname:
|
|
330
|
-
submorph:
|
|
365
|
+
const mt = {
|
|
366
|
+
pathname: m,
|
|
367
|
+
submorph: w
|
|
331
368
|
};
|
|
332
|
-
|
|
333
|
-
detail:
|
|
369
|
+
F(document, "morphNavigation", {
|
|
370
|
+
detail: mt
|
|
334
371
|
});
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
})
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
r.checkCurrent(e(this, d));
|
|
372
|
+
const ft = p(this, h, ht).call(this, e(this, d)), f = p(this, h, ht).call(this, m, Lt);
|
|
373
|
+
if (e(this, T).forEach((n) => {
|
|
374
|
+
n.pathname !== m && n.abort();
|
|
375
|
+
}), yield f == null ? void 0 : f.fetch(y), e(this, R) !== m) {
|
|
376
|
+
e(this, g).forEach((n) => {
|
|
377
|
+
n.checkCurrent(e(this, d));
|
|
342
378
|
});
|
|
343
379
|
return;
|
|
344
380
|
}
|
|
345
|
-
|
|
346
|
-
detail:
|
|
381
|
+
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)), F(document, "morphStart", {
|
|
382
|
+
detail: mt
|
|
347
383
|
});
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
if (
|
|
351
|
-
const
|
|
352
|
-
|
|
384
|
+
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);
|
|
385
|
+
lt.forEach((n, A) => {
|
|
386
|
+
if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
|
|
387
|
+
const v = document.createElement("script");
|
|
388
|
+
v.type = "module", v.src = n.getAttribute("src"), lt[A] = v;
|
|
353
389
|
}
|
|
354
|
-
}),
|
|
355
|
-
document.head.appendChild(
|
|
390
|
+
}), lt.forEach((n) => {
|
|
391
|
+
document.head.appendChild(n);
|
|
356
392
|
});
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
393
|
+
const pt = lt.filter((n) => {
|
|
394
|
+
if (n.hasAttribute("data-no-waiting"))
|
|
359
395
|
return !1;
|
|
360
|
-
if (
|
|
396
|
+
if (p(this, h, yt).call(this, n))
|
|
361
397
|
return !0;
|
|
362
398
|
});
|
|
363
|
-
e(this,
|
|
364
|
-
let
|
|
399
|
+
e(this, P).waitForHeadToLoad && pt.length && (yield new Promise((n) => B(this, null, function* () {
|
|
400
|
+
let A = 0;
|
|
365
401
|
try {
|
|
366
|
-
for (var
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
402
|
+
for (var v = Nt(pt), et, z, j; et = !(z = yield v.next()).done; et = !1) {
|
|
403
|
+
const ct = z.value;
|
|
404
|
+
ct.onload = () => {
|
|
405
|
+
A++, A === pt.length && n();
|
|
370
406
|
};
|
|
371
407
|
}
|
|
372
|
-
} catch (
|
|
373
|
-
|
|
408
|
+
} catch (z) {
|
|
409
|
+
j = [z];
|
|
374
410
|
} finally {
|
|
375
411
|
try {
|
|
376
|
-
|
|
412
|
+
et && (z = v.return) && (yield z.call(v));
|
|
377
413
|
} finally {
|
|
378
|
-
if (
|
|
379
|
-
throw
|
|
414
|
+
if (j)
|
|
415
|
+
throw j[0];
|
|
380
416
|
}
|
|
381
417
|
}
|
|
382
|
-
}))), yield
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
418
|
+
}))), yield Yt(10);
|
|
419
|
+
const Tt = [];
|
|
420
|
+
Bt.forEach((n) => {
|
|
421
|
+
n.hasAttribute("data-permanent") || (p(this, h, yt).call(this, n) ? Tt.push(n) : n.remove());
|
|
386
422
|
});
|
|
387
|
-
const
|
|
388
|
-
e(this,
|
|
423
|
+
const Ft = p(this, h, St).call(this, f.document.body);
|
|
424
|
+
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
425
|
action: s,
|
|
390
|
-
pathname:
|
|
391
|
-
searchParameters:
|
|
392
|
-
hash:
|
|
393
|
-
}), e(this,
|
|
394
|
-
const
|
|
395
|
-
let
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
}) : (
|
|
426
|
+
pathname: m,
|
|
427
|
+
searchParameters: Lt || (x ? location.search : ""),
|
|
428
|
+
hash: $
|
|
429
|
+
}), e(this, X).remove(), r(this, nt, e(this, d)), r(this, d, m), e(this, Q).forEach((n, A) => {
|
|
430
|
+
const v = Ft[A], et = getComputedStyle(n).getPropertyValue("--morph-duration");
|
|
431
|
+
let z = [], j = [];
|
|
432
|
+
w ? w.forEach((u) => {
|
|
433
|
+
const S = n.querySelector(u), M = v.querySelector(u);
|
|
434
|
+
S && M && (j.push(S), z.push(M));
|
|
435
|
+
}) : (z.push(...v.childNodes), j.push(...n.childNodes)), j.forEach((u) => {
|
|
400
436
|
u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
|
|
401
|
-
}),
|
|
437
|
+
}), z.forEach((u) => {
|
|
402
438
|
u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
|
|
403
|
-
}),
|
|
404
|
-
var
|
|
405
|
-
(
|
|
439
|
+
}), w ? z.forEach((u, S) => {
|
|
440
|
+
var M;
|
|
441
|
+
(M = j[S].parentElement) == null || M.insertBefore(
|
|
406
442
|
u,
|
|
407
|
-
|
|
443
|
+
j[S]
|
|
408
444
|
);
|
|
409
|
-
}) :
|
|
410
|
-
|
|
411
|
-
var
|
|
412
|
-
u instanceof HTMLElement && ((
|
|
445
|
+
}) : n.prepend(...z), Wt(() => {
|
|
446
|
+
z.forEach((u) => {
|
|
447
|
+
var S;
|
|
448
|
+
u instanceof HTMLElement && ((S = u.parentElement) == null || S.style.setProperty(
|
|
413
449
|
"--new-content-height",
|
|
414
450
|
u.offsetHeight + "px"
|
|
415
451
|
), u.classList.add("in"));
|
|
416
452
|
});
|
|
417
453
|
});
|
|
418
|
-
const
|
|
419
|
-
morphElement:
|
|
420
|
-
pathname:
|
|
454
|
+
const ct = {
|
|
455
|
+
morphElement: n,
|
|
456
|
+
pathname: m
|
|
421
457
|
};
|
|
422
|
-
|
|
423
|
-
detail:
|
|
458
|
+
F(document, "morphNewChildrenAdded", {
|
|
459
|
+
detail: ct
|
|
424
460
|
});
|
|
425
|
-
const
|
|
461
|
+
const Ot = new Promise((u) => {
|
|
426
462
|
setTimeout(() => {
|
|
427
|
-
|
|
428
|
-
var
|
|
429
|
-
|
|
463
|
+
j.forEach((S) => S.remove()), z.forEach((S) => {
|
|
464
|
+
var M;
|
|
465
|
+
S instanceof HTMLElement && ((M = S.parentElement) == null || M.style.removeProperty(
|
|
430
466
|
"--new-content-height"
|
|
431
|
-
),
|
|
432
|
-
}),
|
|
433
|
-
detail:
|
|
467
|
+
), S.classList.remove("in", "new"));
|
|
468
|
+
}), F(document, "morphOldChildrenRemoved", {
|
|
469
|
+
detail: ct
|
|
434
470
|
}), u();
|
|
435
|
-
}, (parseFloat(
|
|
471
|
+
}, (parseFloat(et) || 0) * 1e3 + 10);
|
|
436
472
|
});
|
|
437
|
-
e(this,
|
|
473
|
+
e(this, V).push(Ot);
|
|
438
474
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
439
475
|
"--new-document-scroll-position",
|
|
440
|
-
(this.scrollValue.top -
|
|
476
|
+
(this.scrollValue.top - f.scrollState.y) * 1 + "px"
|
|
441
477
|
) : document.documentElement.style.setProperty(
|
|
442
478
|
"--new-document-scroll-position",
|
|
443
479
|
this.scrollValue.top + "px"
|
|
444
|
-
),
|
|
445
|
-
detail:
|
|
446
|
-
}),
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
|
|
480
|
+
), F(document, "morphBeforeNavigationScroll", {
|
|
481
|
+
detail: f.scrollState
|
|
482
|
+
}), $ ? (f.clearScrollState(), p(this, h, bt).call(this, $, { centerScroll: i, offsetScroll: c })) : e(this, C) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, V)), Tt.forEach((n) => n.remove()), r(this, V, []), e(this, Q).forEach((n) => {
|
|
483
|
+
n.querySelectorAll("script").forEach((v) => {
|
|
484
|
+
const et = document.createElement("script");
|
|
485
|
+
et.type = "module", et.src = v.getAttribute("src"), v.replaceWith(et);
|
|
450
486
|
});
|
|
451
|
-
}),
|
|
452
|
-
detail:
|
|
487
|
+
}), F(document, "morphComplete", {
|
|
488
|
+
detail: mt
|
|
453
489
|
}), document.documentElement.style.removeProperty(
|
|
454
490
|
"--new-document-scroll-position"
|
|
455
491
|
), window.dispatchEvent(new Event("resize"));
|
|
456
|
-
} catch (
|
|
457
|
-
console.error(
|
|
492
|
+
} catch (U) {
|
|
493
|
+
console.error(U);
|
|
458
494
|
}
|
|
459
|
-
|
|
495
|
+
r(this, R, void 0);
|
|
460
496
|
});
|
|
461
497
|
}
|
|
462
498
|
addLink(t) {
|
|
463
|
-
e(this,
|
|
499
|
+
e(this, g).push(new Et(t, this));
|
|
464
500
|
}
|
|
465
501
|
addLinks(t) {
|
|
466
502
|
t.forEach((s) => {
|
|
@@ -468,71 +504,62 @@ const tt = class tt {
|
|
|
468
504
|
});
|
|
469
505
|
}
|
|
470
506
|
removeLink(t) {
|
|
471
|
-
|
|
507
|
+
r(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
472
508
|
}
|
|
473
509
|
destroyOldLinks(t) {
|
|
474
|
-
|
|
510
|
+
r(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
475
511
|
}
|
|
476
512
|
findNewLinks(t) {
|
|
477
513
|
const s = [...t.querySelectorAll("a")].filter(
|
|
478
|
-
e(this,
|
|
514
|
+
e(this, at)
|
|
479
515
|
);
|
|
480
|
-
e(this,
|
|
481
|
-
...s.map((i) => new
|
|
516
|
+
e(this, g).push(
|
|
517
|
+
...s.map((i) => new Et(i, this))
|
|
482
518
|
);
|
|
483
519
|
}
|
|
484
520
|
findLinks() {
|
|
485
521
|
const t = [
|
|
486
522
|
...document.documentElement.querySelectorAll("a")
|
|
487
|
-
].filter(e(this,
|
|
488
|
-
e(this,
|
|
523
|
+
].filter(e(this, at));
|
|
524
|
+
e(this, g).forEach((s) => s.destroy()), r(this, g, t.map((s) => new Et(s, this)));
|
|
489
525
|
}
|
|
490
526
|
};
|
|
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) {
|
|
527
|
+
P = new WeakMap(), Q = new WeakMap(), g = new WeakMap(), R = new WeakMap(), d = new WeakMap(), nt = new WeakMap(), V = 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) {
|
|
528
|
+
let i = e(this, T).get(t);
|
|
529
|
+
return i || (i = new Dt(this, t, s), e(this, T).set(t, i)), i;
|
|
530
|
+
}, St = function(t) {
|
|
504
531
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
505
532
|
return s.length ? s : [t];
|
|
506
533
|
}, qt = function(t, s) {
|
|
507
534
|
return t.filter(
|
|
508
535
|
(i) => s.find(
|
|
509
|
-
(
|
|
536
|
+
(c) => c.outerHTML === i.outerHTML
|
|
510
537
|
)
|
|
511
538
|
);
|
|
512
|
-
},
|
|
539
|
+
}, wt = function(t, s) {
|
|
513
540
|
return t.filter(
|
|
514
541
|
(i) => !s.find(
|
|
515
|
-
(
|
|
542
|
+
(c) => c.outerHTML === i.outerHTML
|
|
516
543
|
)
|
|
517
544
|
);
|
|
518
|
-
},
|
|
545
|
+
}, yt = function(t) {
|
|
519
546
|
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
520
|
-
},
|
|
547
|
+
}, vt = function(t) {
|
|
521
548
|
var s, i;
|
|
522
|
-
(s = e(this,
|
|
549
|
+
(s = e(this, L)) == null || s.removeEventListener(
|
|
523
550
|
"scroll",
|
|
524
|
-
e(this,
|
|
525
|
-
),
|
|
526
|
-
},
|
|
551
|
+
e(this, tt)
|
|
552
|
+
), 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);
|
|
553
|
+
}, bt = function(t, s) {
|
|
527
554
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
528
|
-
(typeof i == "number" || i) &&
|
|
529
|
-
scrollElement: e(this,
|
|
555
|
+
(typeof i == "number" || i) && Xt(i, {
|
|
556
|
+
scrollElement: e(this, L),
|
|
530
557
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
531
558
|
center: s == null ? void 0 : s.centerScroll,
|
|
532
559
|
offset: s == null ? void 0 : s.offsetScroll
|
|
533
560
|
});
|
|
534
|
-
},
|
|
535
|
-
let
|
|
561
|
+
}, ut = new WeakMap(), tt = new WeakMap(), st.instance = null;
|
|
562
|
+
let It = st;
|
|
536
563
|
export {
|
|
537
|
-
|
|
564
|
+
It as Morph
|
|
538
565
|
};
|