aptechka 0.66.4 → 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/Morph.d.ts +1 -1
- package/lib/morph/MorphRoute.d.ts +5 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +306 -273
- package/package.json +1 -1
package/lib/morph/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
1
|
+
var xt = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Mt = (a) => {
|
|
2
2
|
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (a, t, s) => (
|
|
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 z = (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 (V) {
|
|
11
|
+
c(V);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, x = (E) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
15
|
+
w(s.throw(E));
|
|
16
|
+
} catch (V) {
|
|
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
|
|
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
25
|
import { r as Wt } from "../polyfills-DJrTJQky.js";
|
|
26
|
-
import { w as
|
|
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,109 +38,149 @@ 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
|
-
o(this,
|
|
45
|
+
o(this, k);
|
|
46
46
|
o(this, l);
|
|
47
|
-
o(this,
|
|
48
|
-
o(this,
|
|
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
|
-
keepSearchParameters:
|
|
65
|
-
submorph:
|
|
66
|
-
clearState:
|
|
64
|
+
keepSearchParameters: V,
|
|
65
|
+
submorph: dt,
|
|
66
|
+
clearState: m
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
o(this,
|
|
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
|
o(this, H);
|
|
92
|
-
o(this,
|
|
93
|
-
o(this,
|
|
94
|
-
o(this,
|
|
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);
|
|
95
100
|
o(this, O, null);
|
|
96
|
-
o(this,
|
|
97
|
-
|
|
98
|
-
n(this, H, t), n(this, j, s), n(this, F, i.cloneNode(!0));
|
|
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
174
|
e(this, H).scrollElement.scroll({
|
|
135
|
-
top: e(this,
|
|
136
|
-
left: e(this,
|
|
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
186
|
e(this, H).scrollElement.scroll({
|
|
@@ -150,44 +190,43 @@ class Ht {
|
|
|
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
|
-
H = new WeakMap(),
|
|
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
|
-
o(this,
|
|
165
|
-
o(this, A, null);
|
|
166
|
-
o(this, G, null);
|
|
167
|
-
o(this, p, []);
|
|
168
|
-
o(this, lt, new DOMParser());
|
|
169
|
-
o(this, D);
|
|
170
|
-
o(this, d, null);
|
|
171
|
-
o(this, st);
|
|
172
|
-
o(this, W, []);
|
|
173
|
-
o(this, T, !1);
|
|
204
|
+
o(this, h);
|
|
174
205
|
o(this, P, null);
|
|
175
|
-
o(this,
|
|
176
|
-
o(this,
|
|
177
|
-
o(this,
|
|
178
|
-
o(this,
|
|
179
|
-
o(this,
|
|
180
|
-
o(this,
|
|
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
|
-
o(this,
|
|
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
|
-
o(this,
|
|
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,264 +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
|
-
return
|
|
273
|
-
const i = this.normalizePath(t);
|
|
274
|
-
|
|
275
|
-
searchParameters: i.parameters,
|
|
276
|
-
revalidate: s
|
|
277
|
-
});
|
|
310
|
+
return z(this, null, function* () {
|
|
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
|
-
navigate(
|
|
281
|
-
return
|
|
315
|
+
navigate(V) {
|
|
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:
|
|
334
|
-
});
|
|
335
|
-
const dt = yield m(this, c, ot).call(this, e(this, d)), v = yield m(this, c, ot).call(this, f, {
|
|
336
|
-
searchParameters: yt,
|
|
337
|
-
revalidate: w
|
|
367
|
+
B(document, "morphNavigation", {
|
|
368
|
+
detail: mt
|
|
338
369
|
});
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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
|
-
} catch (
|
|
373
|
-
|
|
406
|
+
} catch (q) {
|
|
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 Ft =
|
|
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
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
}) : (
|
|
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
|
-
}) :
|
|
410
|
-
|
|
411
|
-
var
|
|
412
|
-
u instanceof HTMLElement && ((
|
|
443
|
+
}) : n.prepend(...q), Wt(() => {
|
|
444
|
+
q.forEach((u) => {
|
|
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
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,
|
|
438
|
-
}),
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
471
|
+
e(this, Y).push(Ot);
|
|
472
|
+
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
473
|
+
"--new-document-scroll-position",
|
|
474
|
+
(this.scrollValue.top - f.scrollState.y) * 1 + "px"
|
|
475
|
+
) : document.documentElement.style.setProperty(
|
|
476
|
+
"--new-document-scroll-position",
|
|
477
|
+
this.scrollValue.top + "px"
|
|
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);
|
|
444
484
|
});
|
|
445
|
-
}),
|
|
446
|
-
detail:
|
|
447
|
-
}),
|
|
448
|
-
|
|
449
|
-
|
|
485
|
+
}), B(document, "morphComplete", {
|
|
486
|
+
detail: mt
|
|
487
|
+
}), document.documentElement.style.removeProperty(
|
|
488
|
+
"--new-document-scroll-position"
|
|
489
|
+
), window.dispatchEvent(new Event("resize"));
|
|
490
|
+
} catch (U) {
|
|
491
|
+
console.error(U);
|
|
450
492
|
}
|
|
451
|
-
|
|
493
|
+
r(this, R, void 0);
|
|
452
494
|
});
|
|
453
495
|
}
|
|
454
496
|
addLink(t) {
|
|
455
|
-
e(this,
|
|
497
|
+
e(this, g).push(new Et(t, this));
|
|
456
498
|
}
|
|
457
499
|
addLinks(t) {
|
|
458
500
|
t.forEach((s) => {
|
|
@@ -460,71 +502,62 @@ const tt = class tt {
|
|
|
460
502
|
});
|
|
461
503
|
}
|
|
462
504
|
removeLink(t) {
|
|
463
|
-
|
|
505
|
+
r(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
464
506
|
}
|
|
465
507
|
destroyOldLinks(t) {
|
|
466
|
-
|
|
508
|
+
r(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
467
509
|
}
|
|
468
510
|
findNewLinks(t) {
|
|
469
511
|
const s = [...t.querySelectorAll("a")].filter(
|
|
470
|
-
e(this,
|
|
512
|
+
e(this, at)
|
|
471
513
|
);
|
|
472
|
-
e(this,
|
|
473
|
-
...s.map((i) => new
|
|
514
|
+
e(this, g).push(
|
|
515
|
+
...s.map((i) => new Et(i, this))
|
|
474
516
|
);
|
|
475
517
|
}
|
|
476
518
|
findLinks() {
|
|
477
519
|
const t = [
|
|
478
520
|
...document.documentElement.querySelectorAll("a")
|
|
479
|
-
].filter(e(this,
|
|
480
|
-
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)));
|
|
481
523
|
}
|
|
482
524
|
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
});
|
|
488
|
-
}, qt = function(t, s) {
|
|
489
|
-
return I(this, null, function* () {
|
|
490
|
-
const h = yield (yield fetch(
|
|
491
|
-
`${t}${s ? "?" + s : ""}`
|
|
492
|
-
)).text(), w = e(this, lt).parseFromString(h, "text/html"), b = new Ht(this, t, w);
|
|
493
|
-
return e(this, R).set(t, b), b;
|
|
494
|
-
});
|
|
495
|
-
}, 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) {
|
|
496
529
|
const s = [...t.querySelectorAll("[data-morph]")];
|
|
497
530
|
return s.length ? s : [t];
|
|
498
|
-
},
|
|
531
|
+
}, qt = function(t, s) {
|
|
499
532
|
return t.filter(
|
|
500
533
|
(i) => s.find(
|
|
501
|
-
(
|
|
534
|
+
(c) => c.outerHTML === i.outerHTML
|
|
502
535
|
)
|
|
503
536
|
);
|
|
504
|
-
},
|
|
537
|
+
}, wt = function(t, s) {
|
|
505
538
|
return t.filter(
|
|
506
539
|
(i) => !s.find(
|
|
507
|
-
(
|
|
540
|
+
(c) => c.outerHTML === i.outerHTML
|
|
508
541
|
)
|
|
509
542
|
);
|
|
510
|
-
},
|
|
543
|
+
}, yt = function(t) {
|
|
511
544
|
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
512
|
-
},
|
|
545
|
+
}, vt = function(t) {
|
|
513
546
|
var s, i;
|
|
514
|
-
(s = e(this,
|
|
547
|
+
(s = e(this, L)) == null || s.removeEventListener(
|
|
515
548
|
"scroll",
|
|
516
|
-
e(this,
|
|
517
|
-
),
|
|
518
|
-
},
|
|
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) {
|
|
519
552
|
const i = typeof t == "string" ? document.getElementById(t) : t;
|
|
520
|
-
(typeof i == "number" || i) &&
|
|
521
|
-
scrollElement: e(this,
|
|
553
|
+
(typeof i == "number" || i) && Xt(i, {
|
|
554
|
+
scrollElement: e(this, L),
|
|
522
555
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
523
556
|
center: s == null ? void 0 : s.centerScroll,
|
|
524
557
|
offset: s == null ? void 0 : s.offsetScroll
|
|
525
558
|
});
|
|
526
|
-
},
|
|
527
|
-
let
|
|
559
|
+
}, ut = new WeakMap(), tt = new WeakMap(), st.instance = null;
|
|
560
|
+
let It = st;
|
|
528
561
|
export {
|
|
529
|
-
|
|
562
|
+
It as Morph
|
|
530
563
|
};
|