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