aptechka 0.82.6 → 0.83.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/Composed-C-TV9te3.cjs +1 -0
- package/lib/Composed-DyAWjEXE.js +121 -0
- package/lib/{LocalLinks-Baf0xWZ3.cjs → LocalLinks-BxhSFv_Q.cjs} +1 -1
- package/lib/{LocalLinks-Z9pxKguG.js → LocalLinks-DFZFpbjs.js} +2 -2
- package/lib/api-fetcher/index.cjs +1 -0
- package/lib/api-fetcher/index.d.ts +16 -0
- package/lib/api-fetcher/index.js +100 -0
- package/lib/jsx/h.d.ts +15 -0
- package/lib/jsx/hydrate.d.ts +1 -0
- package/lib/jsx/index.cjs +1 -1
- package/lib/jsx/index.d.ts +4 -1
- package/lib/jsx/index.js +312 -87
- package/lib/jsx/integrations/astro/client.cjs +1 -0
- package/lib/jsx/integrations/astro/client.d.ts +2 -0
- package/lib/jsx/integrations/astro/client.js +50 -0
- package/lib/jsx/integrations/astro/index.cjs +1 -0
- package/lib/jsx/integrations/astro/index.d.ts +2 -0
- package/lib/jsx/integrations/astro/index.js +54 -0
- package/lib/jsx/integrations/astro/server.cjs +1 -0
- package/lib/jsx/integrations/astro/server.d.ts +3 -0
- package/lib/jsx/integrations/astro/server.js +35 -0
- package/lib/jsx/plugins/vite.d.ts +21 -0
- package/lib/jsx/render.d.ts +1 -1
- package/lib/jsx/type.d.ts +190 -221
- package/lib/jsx/utils/children/createElement.d.ts +1 -0
- package/lib/jsx/utils/children/hydrateTextNode.d.ts +1 -0
- package/lib/local-links/index.cjs +1 -1
- package/lib/local-links/index.js +1 -1
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +72 -72
- package/lib/{morph-D_ybmXWR.js → morph-BQErz7qP.js} +8 -8
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/render-DQs7rIoN.cjs +1 -0
- package/lib/render-D_0FCWEu.js +18 -0
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +3 -3
- package/lib/spa/index.cjs +1 -1
- package/lib/spa/index.js +3 -3
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +6 -7
- package/lib/url-CHgcNwJ1.cjs +1 -0
- package/lib/url-CYgo5vrG.js +113 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +45 -43
- package/lib/utils/polyfills.d.ts +1 -1
- package/lib/utils/url.d.ts +6 -0
- package/lib/vite-C-i3hVDL.js +75 -0
- package/lib/vite-DzanPumM.cjs +44 -0
- package/package.json +40 -7
- package/lib/Composed-C-mnUGX6.js +0 -70
- package/lib/Composed-RFcm2x5c.cjs +0 -1
- package/lib/DerivedArray-DdCR-Oy7.cjs +0 -1
- package/lib/DerivedArray-opbeygTL.js +0 -59
- package/lib/jsx/plugins/hmr.d.ts +0 -13
- package/lib/render-1u700s93.js +0 -212
- package/lib/render-BIOfUddT.cjs +0 -1
- package/lib/url-CPgw9bd5.cjs +0 -1
- package/lib/url-DAl-mgbC.js +0 -97
package/lib/morph/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var te = (o, e, s) => e in o ? ge(o, e, { enumerable: !0, configurable: !0, writ
|
|
|
12
12
|
for (var s of Zt(e))
|
|
13
13
|
Se.call(e, s) && te(o, s, e[s]);
|
|
14
14
|
return o;
|
|
15
|
-
},
|
|
15
|
+
}, Tt = (o, e) => Ee(o, ve(e));
|
|
16
16
|
var zt = (o, e, s) => e.has(o) || ee("Cannot " + s);
|
|
17
17
|
var t = (o, e, s) => (zt(o, e, "read from private field"), s ? s.call(o) : e.get(o)), h = (o, e, s) => e.has(o) ? ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, s), n = (o, e, s, a) => (zt(o, e, "write to private field"), a ? a.call(o, s) : e.set(o, s), s), y = (o, e, s) => (zt(o, e, "access private method"), s);
|
|
18
18
|
var J = (o, e, s) => new Promise((a, l) => {
|
|
@@ -37,7 +37,7 @@ import { i as ye, e as ae, c as ie } from "../dom-BETkVSSZ.js";
|
|
|
37
37
|
import { d as q } from "../events-CsVF98U6.js";
|
|
38
38
|
import { w as we, s as be } from "../scroll-DY5senkF.js";
|
|
39
39
|
import "construct-style-sheets-polyfill";
|
|
40
|
-
import { a as Pe, c as qt,
|
|
40
|
+
import { a as Pe, c as qt, d as Ae } from "../url-CYgo5vrG.js";
|
|
41
41
|
import { cssValueParser as ke } from "../css-value-parser/index.js";
|
|
42
42
|
import { c as he } from "../string-BlMQbe8b.js";
|
|
43
43
|
class le extends HTMLElement {
|
|
@@ -52,18 +52,18 @@ class le extends HTMLElement {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
oe && !customElements.get("morph-announcer") && customElements.define("morph-announcer", le);
|
|
55
|
-
var M, i,
|
|
55
|
+
var M, i, T, it, ce, gt, rt;
|
|
56
56
|
class It {
|
|
57
57
|
constructor(e, s) {
|
|
58
|
-
h(this,
|
|
58
|
+
h(this, T);
|
|
59
59
|
h(this, M);
|
|
60
60
|
h(this, i);
|
|
61
61
|
h(this, gt, (e) => {
|
|
62
|
-
e.preventDefault(), y(this,
|
|
62
|
+
e.preventDefault(), y(this, T, ce).call(this);
|
|
63
63
|
});
|
|
64
64
|
h(this, rt, () => {
|
|
65
65
|
const e = t(this, i).hasAttribute("data-revalidate");
|
|
66
|
-
t(this, M).prefetch(t(this,
|
|
66
|
+
t(this, M).prefetch(t(this, T, it), e), t(this, i).removeEventListener("pointerenter", t(this, rt));
|
|
67
67
|
});
|
|
68
68
|
n(this, M, s), n(this, i, e), t(this, i).addEventListener("click", t(this, gt)), this.checkCurrent(location.href.replace(location.origin, "")), t(this, i).hasAttribute("data-prefetch") && t(this, i).addEventListener("pointerenter", t(this, rt));
|
|
69
69
|
}
|
|
@@ -72,9 +72,9 @@ class It {
|
|
|
72
72
|
}
|
|
73
73
|
checkCurrent(e) {
|
|
74
74
|
var p, st;
|
|
75
|
-
const s = t(this, M).normalizePath(e), a = t(this, M).normalizePath(t(this,
|
|
75
|
+
const s = t(this, M).normalizePath(e), a = t(this, M).normalizePath(t(this, T, it));
|
|
76
76
|
t(this, i).hasAttribute("data-include") && s.pathname.includes(a.pathname) ? t(this, i).classList.add("current") : a.pathname === s.pathname ? t(this, i).classList.add("current") : (p = t(this, i).getAttribute("data-associated-paths")) != null && p.split(",").find((A) => s.pathname.includes(A)) ? t(this, i).classList.add("current") : t(this, i).classList.remove("current"), s.path === a.path ? t(this, i).classList.add("exact") : t(this, i).classList.remove("exact");
|
|
77
|
-
const [l, v] = (st = t(this,
|
|
77
|
+
const [l, v] = (st = t(this, T, it).split("#")[0]) == null ? void 0 : st.split("?"), S = new URLSearchParams(v), f = new URLSearchParams(location.search);
|
|
78
78
|
let c = 0;
|
|
79
79
|
for (const [A] of f)
|
|
80
80
|
S.has(A) && f.get(A) === S.get(A) && c++;
|
|
@@ -88,8 +88,8 @@ class It {
|
|
|
88
88
|
for (const A in t(this, i).dataset) {
|
|
89
89
|
const at = he(A);
|
|
90
90
|
if (at.startsWith("match-param-")) {
|
|
91
|
-
const z = at.split("match-param-")[1], b = t(this, i).dataset[A],
|
|
92
|
-
f.has(z) && f.get(z) === b || !f.has(z) && (b === "" || b === "*" || b === "all" || b === "any" || b === "vse") ? t(this, i).classList.add(
|
|
91
|
+
const z = at.split("match-param-")[1], b = t(this, i).dataset[A], F = `param-${z}-matched`;
|
|
92
|
+
f.has(z) && f.get(z) === b || !f.has(z) && (b === "" || b === "*" || b === "all" || b === "any" || b === "vse") ? t(this, i).classList.add(F) : t(this, i).classList.remove(F);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -97,7 +97,7 @@ class It {
|
|
|
97
97
|
t(this, i).removeEventListener("click", t(this, gt)), t(this, i).removeEventListener("pointerenter", t(this, rt)), t(this, i).classList.remove("current", "exact");
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
M = new WeakMap(), i = new WeakMap(),
|
|
100
|
+
M = new WeakMap(), i = new WeakMap(), T = new WeakSet(), it = function() {
|
|
101
101
|
const e = new URL(t(this, i).href);
|
|
102
102
|
return t(this, M).normalizePath(
|
|
103
103
|
e.pathname + e.search + e.hash
|
|
@@ -116,14 +116,14 @@ M = new WeakMap(), i = new WeakMap(), D = new WeakSet(), it = function() {
|
|
|
116
116
|
), p = t(this, i).hasAttribute("data-keep-scroll-position") || t(this, i).hasAttribute("data-pagination-more-link"), st = t(this, i).getAttribute(
|
|
117
117
|
"data-scroll-behaviour"
|
|
118
118
|
), A = (s = t(this, i).getAttribute("data-submorph") || t(this, i).getAttribute("data-submorph-append")) == null ? void 0 : s.split(",").map((b) => b.trim()), at = t(this, i).hasAttribute("data-clear-state");
|
|
119
|
-
let z = t(this,
|
|
119
|
+
let z = t(this, T, it);
|
|
120
120
|
if (t(this, i).hasAttribute("data-toggle-params")) {
|
|
121
|
-
const [b,
|
|
121
|
+
const [b, F] = t(this, T, it).split("?"), At = new URLSearchParams(F), X = new URLSearchParams(location.search), d = new URLSearchParams();
|
|
122
122
|
for (const [R] of At)
|
|
123
|
-
(!
|
|
123
|
+
(!X.has(R) || X.has(R) && X.get(R) !== At.get(R)) && d.append(R, At.get(R));
|
|
124
124
|
if (t(this, i).hasAttribute("data-merge-params"))
|
|
125
|
-
for (const [R] of
|
|
126
|
-
At.has(R) || d.append(R,
|
|
125
|
+
for (const [R] of X)
|
|
126
|
+
At.has(R) || d.append(R, X.get(R));
|
|
127
127
|
z = `${b}?${d.toString()}`;
|
|
128
128
|
}
|
|
129
129
|
t(this, M).navigate(z, {
|
|
@@ -184,7 +184,7 @@ C = new WeakMap(), nt = new WeakMap(), Et = new WeakSet(), Wt = function() {
|
|
|
184
184
|
s ? a ? t(this, C).classList.remove(a) : t(this, C).style.display = "" : a ? t(this, C).classList.add(a) : t(this, C).style.display = "none";
|
|
185
185
|
}, vt = new WeakMap();
|
|
186
186
|
const Ce = new DOMParser();
|
|
187
|
-
var I, Q, U, W, Z,
|
|
187
|
+
var I, Q, U, W, Z, Y, ot, _, $, Lt, ht;
|
|
188
188
|
class re {
|
|
189
189
|
constructor(e, s) {
|
|
190
190
|
h(this, I);
|
|
@@ -192,10 +192,10 @@ class re {
|
|
|
192
192
|
h(this, U, { x: 0, y: 0 });
|
|
193
193
|
h(this, W, null);
|
|
194
194
|
h(this, Z, null);
|
|
195
|
-
h(this,
|
|
195
|
+
h(this, Y, null);
|
|
196
196
|
h(this, ot, null);
|
|
197
197
|
h(this, _, null);
|
|
198
|
-
h(this,
|
|
198
|
+
h(this, $, null);
|
|
199
199
|
h(this, Lt);
|
|
200
200
|
h(this, ht, !1);
|
|
201
201
|
n(this, I, e), n(this, Q, s);
|
|
@@ -207,7 +207,7 @@ class re {
|
|
|
207
207
|
return t(this, U);
|
|
208
208
|
}
|
|
209
209
|
get document() {
|
|
210
|
-
return t(this,
|
|
210
|
+
return t(this, Y);
|
|
211
211
|
}
|
|
212
212
|
needRavalidation() {
|
|
213
213
|
n(this, ht, !0);
|
|
@@ -229,10 +229,10 @@ class re {
|
|
|
229
229
|
var l;
|
|
230
230
|
if (!a && !t(this, ht)) {
|
|
231
231
|
const f = ((l = t(this, W)) == null ? void 0 : l.documentElement.getAttribute("data-cache")) && s !== e, c = t(this, W) && t(this, I).isPopstateNavigation;
|
|
232
|
-
if (t(this,
|
|
233
|
-
return t(this,
|
|
232
|
+
if (t(this, $) || f || c)
|
|
233
|
+
return t(this, $);
|
|
234
234
|
}
|
|
235
|
-
return n(this,
|
|
235
|
+
return n(this, $, new Promise((v) => J(this, null, function* () {
|
|
236
236
|
try {
|
|
237
237
|
n(this, _, new AbortController());
|
|
238
238
|
const f = yield (yield fetch(e, {
|
|
@@ -248,20 +248,20 @@ class re {
|
|
|
248
248
|
} catch (S) {
|
|
249
249
|
console.warn(S);
|
|
250
250
|
} finally {
|
|
251
|
-
n(this, _, null), n(this,
|
|
251
|
+
n(this, _, null), n(this, $, null), v();
|
|
252
252
|
}
|
|
253
|
-
}))), t(this,
|
|
253
|
+
}))), t(this, $);
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
cloneDocument() {
|
|
257
|
-
n(this,
|
|
257
|
+
n(this, Y, (t(this, Z) || t(this, W)).cloneNode(!0));
|
|
258
258
|
}
|
|
259
259
|
get title() {
|
|
260
260
|
let e = "";
|
|
261
|
-
if (t(this,
|
|
262
|
-
e = t(this,
|
|
261
|
+
if (t(this, Y).title)
|
|
262
|
+
e = t(this, Y).title;
|
|
263
263
|
else {
|
|
264
|
-
const s = t(this,
|
|
264
|
+
const s = t(this, Y).querySelector("h1");
|
|
265
265
|
e = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || t(this, Q);
|
|
266
266
|
}
|
|
267
267
|
return e;
|
|
@@ -304,19 +304,19 @@ class re {
|
|
|
304
304
|
return n(this, ot, null), e;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
I = new WeakMap(), Q = new WeakMap(), U = new WeakMap(), W = new WeakMap(), Z = new WeakMap(),
|
|
308
|
-
var
|
|
307
|
+
I = new WeakMap(), Q = new WeakMap(), U = new WeakMap(), W = new WeakMap(), Z = new WeakMap(), Y = new WeakMap(), ot = new WeakMap(), _ = new WeakMap(), $ = new WeakMap(), Lt = new WeakMap(), ht = new WeakMap();
|
|
308
|
+
var D, lt, w, j, u, tt, V, G, x, St, O, yt, et, ct, dt, wt, mt, bt, Pt, E, ft, Vt, Ot, Ft, Nt, xt, ut;
|
|
309
309
|
const pt = class pt {
|
|
310
310
|
constructor(e) {
|
|
311
311
|
h(this, E);
|
|
312
|
-
h(this,
|
|
312
|
+
h(this, D, null);
|
|
313
313
|
h(this, lt, null);
|
|
314
314
|
h(this, w, []);
|
|
315
|
-
h(this,
|
|
315
|
+
h(this, j);
|
|
316
316
|
h(this, u, null);
|
|
317
317
|
h(this, tt);
|
|
318
318
|
h(this, V, []);
|
|
319
|
-
h(this,
|
|
319
|
+
h(this, G, !1);
|
|
320
320
|
h(this, x, null);
|
|
321
321
|
h(this, St, !1);
|
|
322
322
|
h(this, O, /* @__PURE__ */ new Map());
|
|
@@ -332,12 +332,12 @@ const pt = class pt {
|
|
|
332
332
|
return (((s = e.getAttribute("href")) == null ? void 0 : s.startsWith("/")) || ((a = e.getAttribute("href")) == null ? void 0 : a.startsWith("?"))) && !e.hasAttribute("download") && !e.hasAttribute("data-morph-skip") && !e.closest("[data-morph-skip]") && e.getAttribute("target") !== "_blank";
|
|
333
333
|
});
|
|
334
334
|
h(this, xt, (e) => J(this, null, function* () {
|
|
335
|
-
e.preventDefault(), n(this,
|
|
335
|
+
e.preventDefault(), n(this, G, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
336
336
|
historyAction: "none",
|
|
337
337
|
submorph: t(this, mt) ? void 0 : t(this, wt),
|
|
338
338
|
revalidate: t(this, mt),
|
|
339
339
|
keepScrollPosition: t(this, bt)
|
|
340
|
-
}), n(this,
|
|
340
|
+
}), n(this, G, !1);
|
|
341
341
|
}));
|
|
342
342
|
h(this, ut, () => {
|
|
343
343
|
const { left: e, top: s } = this.scrollValue, a = s - t(this, dt), l = e - t(this, ct);
|
|
@@ -361,7 +361,7 @@ const pt = class pt {
|
|
|
361
361
|
});
|
|
362
362
|
});
|
|
363
363
|
if (oe && !pt.instance) {
|
|
364
|
-
pt.instance = this, n(this,
|
|
364
|
+
pt.instance = this, n(this, D, {
|
|
365
365
|
base: Pe(e == null ? void 0 : e.base),
|
|
366
366
|
waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
|
|
367
367
|
trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
|
|
@@ -400,7 +400,7 @@ const pt = class pt {
|
|
|
400
400
|
return t(this, x);
|
|
401
401
|
}
|
|
402
402
|
get isPopstateNavigation() {
|
|
403
|
-
return t(this,
|
|
403
|
+
return t(this, G);
|
|
404
404
|
}
|
|
405
405
|
get scrollValue() {
|
|
406
406
|
let e = 0, s = 0;
|
|
@@ -419,8 +419,8 @@ const pt = class pt {
|
|
|
419
419
|
}
|
|
420
420
|
normalizePath(e, s) {
|
|
421
421
|
return Ae(e, {
|
|
422
|
-
base: t(this,
|
|
423
|
-
trailingSlash: t(this,
|
|
422
|
+
base: t(this, D).base,
|
|
423
|
+
trailingSlash: t(this, D).trailingSlash,
|
|
424
424
|
mergeParams: s != null && s.mergeParams ? location.search : "",
|
|
425
425
|
removeParams: s == null ? void 0 : s.removeParams
|
|
426
426
|
});
|
|
@@ -459,18 +459,18 @@ const pt = class pt {
|
|
|
459
459
|
mergeParams: at,
|
|
460
460
|
removeParams: z,
|
|
461
461
|
detail: b,
|
|
462
|
-
scrollTo:
|
|
462
|
+
scrollTo: F
|
|
463
463
|
} = {}) {
|
|
464
|
-
var R, Xt,
|
|
464
|
+
var R, Xt, Kt, Bt;
|
|
465
465
|
if (t(this, V).length)
|
|
466
466
|
return;
|
|
467
467
|
n(this, wt, c), n(this, mt, S), n(this, bt, A);
|
|
468
|
-
const
|
|
468
|
+
const X = ((R = this.pathnameModifier) == null ? void 0 : R.call(this, e)) || e, d = this.normalizePath(X, {
|
|
469
469
|
mergeParams: at,
|
|
470
470
|
removeParams: z
|
|
471
471
|
});
|
|
472
|
-
if (!S && (((Xt = t(this,
|
|
473
|
-
A || y(this, E, Nt).call(this, d.hash || 0, {
|
|
472
|
+
if (!S && (((Xt = t(this, j)) == null ? void 0 : Xt.pathname) === d.pathname || t(this, u).pathname === d.pathname)) {
|
|
473
|
+
A || y(this, E, Nt).call(this, F || d.hash || 0, {
|
|
474
474
|
centerScroll: a,
|
|
475
475
|
offsetScroll: l,
|
|
476
476
|
behavior: "smooth"
|
|
@@ -478,8 +478,8 @@ const pt = class pt {
|
|
|
478
478
|
detail: {
|
|
479
479
|
detail: b
|
|
480
480
|
}
|
|
481
|
-
}), ((
|
|
482
|
-
action: ((
|
|
481
|
+
}), ((Kt = t(this, u)) == null ? void 0 : Kt.parameters) !== d.parameters && (n(this, tt, t(this, u)), n(this, u, d), qt({
|
|
482
|
+
action: ((Bt = t(this, u)) == null ? void 0 : Bt.hash) !== d.hash ? "replace" : s,
|
|
483
483
|
pathname: d.pathname,
|
|
484
484
|
searchParameters: d.parameters,
|
|
485
485
|
hash: d.hash
|
|
@@ -489,17 +489,17 @@ const pt = class pt {
|
|
|
489
489
|
previousURL: t(this, tt),
|
|
490
490
|
detail: b
|
|
491
491
|
}
|
|
492
|
-
})), t(this, w).forEach((
|
|
493
|
-
|
|
492
|
+
})), t(this, w).forEach((K) => {
|
|
493
|
+
K.checkCurrent(d.path);
|
|
494
494
|
});
|
|
495
495
|
return;
|
|
496
496
|
} else
|
|
497
|
-
t(this, w).forEach((
|
|
498
|
-
|
|
497
|
+
t(this, w).forEach((K) => {
|
|
498
|
+
K.checkCurrent(d.path);
|
|
499
499
|
});
|
|
500
|
-
n(this,
|
|
500
|
+
n(this, j, d);
|
|
501
501
|
try {
|
|
502
|
-
let
|
|
502
|
+
let K = !0;
|
|
503
503
|
if (this.preprocessor)
|
|
504
504
|
try {
|
|
505
505
|
yield new Promise((r, P) => {
|
|
@@ -513,9 +513,9 @@ const pt = class pt {
|
|
|
513
513
|
});
|
|
514
514
|
});
|
|
515
515
|
} catch (r) {
|
|
516
|
-
r ? console.error(r) : console.log("Route change canceled"),
|
|
516
|
+
r ? console.error(r) : console.log("Route change canceled"), K = !1;
|
|
517
517
|
}
|
|
518
|
-
if (!
|
|
518
|
+
if (!K || t(this, j).pathname !== d.pathname) {
|
|
519
519
|
t(this, w).forEach((r) => {
|
|
520
520
|
r.checkCurrent(t(this, u).path);
|
|
521
521
|
});
|
|
@@ -539,14 +539,14 @@ const pt = class pt {
|
|
|
539
539
|
const Ht = y(this, E, ft).call(this, t(this, u).pathname), L = y(this, E, ft).call(this, d.pathname);
|
|
540
540
|
if (t(this, O).forEach((r) => {
|
|
541
541
|
r.pathname !== d.pathname && r.abort();
|
|
542
|
-
}), yield L == null ? void 0 : L.fetch(
|
|
542
|
+
}), yield L == null ? void 0 : L.fetch(X, t(this, u).path, S), t(this, j).pathname !== d.pathname) {
|
|
543
543
|
t(this, w).forEach((r) => {
|
|
544
544
|
r.checkCurrent(t(this, u).path);
|
|
545
545
|
});
|
|
546
546
|
return;
|
|
547
547
|
}
|
|
548
|
-
Ht.clearState(), Ht.saveScrollState(), Ht.saveDocumentState(), (!t(this,
|
|
549
|
-
const kt =
|
|
548
|
+
Ht.clearState(), Ht.saveScrollState(), Ht.saveDocumentState(), (!t(this, G) || S) && (L.clearScrollState(), L.clearDocumentState()), st && L.clearState(), L.cloneDocument(), t(this, et).textContent = L.title, document.body.appendChild(t(this, et));
|
|
549
|
+
const kt = Tt(Ut({}, Yt), {
|
|
550
550
|
document: L.document
|
|
551
551
|
});
|
|
552
552
|
p || kt.document.querySelectorAll("[data-morph-out]").forEach((r) => {
|
|
@@ -577,7 +577,7 @@ const pt = class pt {
|
|
|
577
577
|
if (y(this, E, Ot).call(this, r))
|
|
578
578
|
return !0;
|
|
579
579
|
});
|
|
580
|
-
t(this,
|
|
580
|
+
t(this, D).waitForHeadToLoad && Mt.length && (yield new Promise((r) => J(this, null, function* () {
|
|
581
581
|
let P = 0;
|
|
582
582
|
try {
|
|
583
583
|
for (var N = se(Mt), ue, B, H; ue = !(B = yield N.next()).done; ue = !1) {
|
|
@@ -602,7 +602,7 @@ const pt = class pt {
|
|
|
602
602
|
r.hasAttribute("data-permanent") || (y(this, E, Ot).call(this, r) ? Jt.push(r) : r.remove());
|
|
603
603
|
});
|
|
604
604
|
const me = y(this, E, Vt).call(this, L.document.body);
|
|
605
|
-
!t(this,
|
|
605
|
+
!t(this, D).morphInsideScrollContainer && !c && y(this, E, Ft).call(this, L.document), document.documentElement.setAttribute(
|
|
606
606
|
"data-current-pathname",
|
|
607
607
|
d.pathname
|
|
608
608
|
), document.documentElement.setAttribute(
|
|
@@ -614,7 +614,7 @@ const pt = class pt {
|
|
|
614
614
|
searchParameters: d.parameters || (f ? location.search : ""),
|
|
615
615
|
hash: d.hash
|
|
616
616
|
}), t(this, et).remove(), n(this, tt, t(this, u)), n(this, u, d);
|
|
617
|
-
const
|
|
617
|
+
const Dt = [];
|
|
618
618
|
t(this, lt).forEach((r, P) => {
|
|
619
619
|
const N = me[P], ue = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
620
620
|
let B = [], H = [];
|
|
@@ -622,8 +622,8 @@ const pt = class pt {
|
|
|
622
622
|
const g = r.querySelector(m), k = N.querySelector(m);
|
|
623
623
|
g && k && (H.push(g), B.push(k));
|
|
624
624
|
}), H.forEach((m) => {
|
|
625
|
-
m.parentElement &&
|
|
626
|
-
})) : (B.push(...N.childNodes), H.push(...r.childNodes),
|
|
625
|
+
m.parentElement && Dt.push(m.parentElement);
|
|
626
|
+
})) : (B.push(...N.childNodes), H.push(...r.childNodes), Dt.push(r));
|
|
627
627
|
const Ct = [];
|
|
628
628
|
p || H.forEach((m) => {
|
|
629
629
|
m instanceof HTMLElement && (this.destroyOldLinks(m), m.classList.add("old"), m.querySelectorAll(
|
|
@@ -661,7 +661,7 @@ const pt = class pt {
|
|
|
661
661
|
), m.classList.add("new-idle"));
|
|
662
662
|
});
|
|
663
663
|
}, 0);
|
|
664
|
-
const Qt =
|
|
664
|
+
const Qt = Tt(Ut({}, kt), {
|
|
665
665
|
morphElement: r
|
|
666
666
|
});
|
|
667
667
|
q(document, "morphNewChildrenAdded", {
|
|
@@ -693,7 +693,7 @@ const pt = class pt {
|
|
|
693
693
|
this.scrollValue.top + "px"
|
|
694
694
|
), q(document, "morphBeforeNavigationScroll", {
|
|
695
695
|
detail: L.scrollState
|
|
696
|
-
}),
|
|
696
|
+
}), F ? (L.clearScrollState(), y(this, E, Nt).call(this, F, {
|
|
697
697
|
centerScroll: a,
|
|
698
698
|
offsetScroll: l,
|
|
699
699
|
behavior: v
|
|
@@ -701,7 +701,7 @@ const pt = class pt {
|
|
|
701
701
|
centerScroll: a,
|
|
702
702
|
offsetScroll: l,
|
|
703
703
|
behavior: v
|
|
704
|
-
})) : t(this,
|
|
704
|
+
})) : t(this, G) ? L.restoreScrollPosition() : A || L.renewScrollPosition(), yield Promise.all(t(this, V)), p || Jt.forEach((r) => r.remove()), n(this, V, []), Dt.forEach((r) => {
|
|
705
705
|
r.querySelectorAll("script").forEach((N) => {
|
|
706
706
|
N.replaceWith(ie(N));
|
|
707
707
|
});
|
|
@@ -712,10 +712,10 @@ const pt = class pt {
|
|
|
712
712
|
}), document.documentElement.style.removeProperty(
|
|
713
713
|
"--new-document-scroll-position"
|
|
714
714
|
), window.dispatchEvent(new Event("resize"));
|
|
715
|
-
} catch (
|
|
716
|
-
console.error(
|
|
715
|
+
} catch (K) {
|
|
716
|
+
console.error(K);
|
|
717
717
|
}
|
|
718
|
-
n(this,
|
|
718
|
+
n(this, j, void 0);
|
|
719
719
|
});
|
|
720
720
|
}
|
|
721
721
|
addLink(e) {
|
|
@@ -757,7 +757,7 @@ const pt = class pt {
|
|
|
757
757
|
));
|
|
758
758
|
}
|
|
759
759
|
};
|
|
760
|
-
|
|
760
|
+
D = new WeakMap(), lt = new WeakMap(), w = new WeakMap(), j = new WeakMap(), u = new WeakMap(), tt = new WeakMap(), V = new WeakMap(), G = new WeakMap(), x = new WeakMap(), St = new WeakMap(), O = new WeakMap(), yt = new WeakMap(), et = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), wt = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), Pt = new WeakMap(), E = new WeakSet(), ft = function(e) {
|
|
761
761
|
const s = this.normalizePath(e);
|
|
762
762
|
let a = t(this, O).get(s.pathname);
|
|
763
763
|
return a || (a = new re(this, s.pathname), t(this, O).set(s.pathname, a)), a;
|
|
@@ -771,9 +771,9 @@ T = new WeakMap(), lt = new WeakMap(), w = new WeakMap(), $ = new WeakMap(), u =
|
|
|
771
771
|
(s = t(this, x)) == null || s.removeEventListener(
|
|
772
772
|
"scroll",
|
|
773
773
|
t(this, ut)
|
|
774
|
-
), n(this, dt, 0), n(this, ct, 0), n(this, x, t(this,
|
|
774
|
+
), n(this, dt, 0), n(this, ct, 0), n(this, x, t(this, D).scrollSelector && e.querySelector(t(this, D).scrollSelector) || window), n(this, St, t(this, x) === window), (a = t(this, x)) == null || a.addEventListener("scroll", t(this, ut)), t(this, ut).call(this);
|
|
775
775
|
}, Nt = function(e, s) {
|
|
776
|
-
const a = typeof e == "string" ? document.
|
|
776
|
+
const a = typeof e == "string" ? document.querySelector(e) : e;
|
|
777
777
|
(typeof a == "number" || a) && be(a, {
|
|
778
778
|
scrollElement: t(this, x),
|
|
779
779
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
@@ -229,14 +229,14 @@ export {
|
|
|
229
229
|
R as a,
|
|
230
230
|
P as b,
|
|
231
231
|
M as c,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
232
|
+
D as d,
|
|
233
|
+
v as e,
|
|
234
|
+
L as f,
|
|
235
|
+
V as g,
|
|
236
|
+
S as h,
|
|
237
|
+
Y as i,
|
|
238
|
+
$ as j,
|
|
239
|
+
p as k,
|
|
240
240
|
w as m,
|
|
241
241
|
O as p
|
|
242
242
|
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var he=c=>{throw TypeError(c)};var se=(c,n,t)=>n.has(c)||he("Cannot "+t);var e=(c,n,t)=>(se(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(se(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),p=(c,n,t)=>(se(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../css-property/index.cjs"),Z=require("../Viewport-BxCr0GlB.cjs"),fe=require("../element-linked-store/index.cjs"),oe=require("../index-OE2INULi.cjs"),W=require("../events-KVanG9sR.cjs"),ge=require("../function-MthRj-GJ.cjs"),le=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ce=require("../url-CPgw9bd5.cjs"),ae=require("../window-resizer/index.cjs");var f,w,ee,te;class ve{constructor(){r(this,f,new Map);r(this,w,[]);r(this,ee,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(Q=>Q instanceof HTMLElement&&Q.hasAttribute("data-popover-content")))return;const l=i[0],d=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),L=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||L)&&t.close()}});r(this,te,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,ee)),addEventListener("keydown",e(this,te))}get groups(){return e(this,f)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,f).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,f).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,f).get(n);s!=null&&s.length||(s=[],e(this,f).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,f).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,f).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,f).get(n);e(this,f).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,f).get(n);s&&(s=s.filter(i=>i!==t),e(this,f).set(n,s))}}}f=new WeakMap,w=new WeakMap,ee=new WeakMap,te=new WeakMap;var v,B,H,R,G,m,T,P,q,$,b,V,O,k,E,z,a,M,D,u,ue,S,_,F,A,I,X,U;const C=class C extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,B);r(this,H);r(this,R);r(this,G);r(this,m);r(this,T);r(this,P);r(this,q);r(this,$);r(this,b);r(this,V);r(this,O);r(this,k);r(this,E);r(this,z);r(this,a);r(this,M);r(this,D);r(this,F);r(this,A);r(this,I);r(this,X);r(this,U);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,T,new y.CSSProperty(this,"--restore",!1)),o(this,P,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,q,new y.CSSProperty(this,"--close-rest",!1)),o(this,$,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,V,new y.CSSProperty(this,"--click-outside",!1)),o(this,O,new y.CSSProperty(this,"--escape",!1)),o(this,k,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,a,new fe.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,M,[]),o(this,D,[]),o(this,F,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,A,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,I).call(this)}),o(this,I,ge.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,k).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Z.viewport.width?s=Z.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Z.viewport.height?i=Z.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,U,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(C.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=C.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get dispatchResize(){return e(this,P)}get closeRest(){return e(this,q)}get closeRestInGroup(){return e(this,$)}get group(){return e(this,b)}get clickOutside(){return e(this,V)}get escape(){return e(this,O)}get opened(){return e(this,v)}get lastTrigger(){return e(this,z)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&ce.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,z,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),p(this,u,S).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),W.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,z)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,u,ue)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{C.stack.add(e(this,b).current,this),e(this,D).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,S).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,P).current?W.dispatchEvent(window,"resize",{custom:!0}):e(this,A).call(this),W.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,z)},bubbles:!0}),o(this,R,void 0),o(this,G,setTimeout(()=>{e(this,a).set("transitionend",!0),W.dispatchEvent(this,"popoverTransitionend")},le.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,R,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,R)),clearTimeout(e(this,G)),C.stack.remove(e(this,b).current,this),p(this,u,_).call(this),o(this,B,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!0,this.closingClass),W.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,S).call(this,!1,this.closingClass),W.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},le.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,M,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,M).forEach(t=>{t.addEventListener("click",e(this,U))}),o(this,D,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,P).observe(),e(this,q).observe(),e(this,$).observe(),e(this,b).observe(),e(this,V).observe(),e(this,O).observe(),e(this,k).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,F)),setTimeout(()=>{e(this,T).current?(o(this,E,!1),this.urlValue=ce.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(p(this,u,_).call(this),o(this,E,!0))},0),e(this,k).subscribe(()=>{e(this,A).call(this)}),ae.windowResizer.subscribe(e(this,A))}disconnectedCallback(){e(this,M).forEach(t=>{t.removeEventListener("click",e(this,U))}),C.stack.remove(e(this,b).current,this),ae.windowResizer.unsubscribe(e(this,A)),e(this,m).close(),e(this,T).close(),e(this,P).close(),e(this,q).close(),e(this,$).close(),e(this,b).close(),e(this,V).close(),e(this,O).close(),e(this,k).close(),this.removeAttribute("role"),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,R)),clearTimeout(e(this,G)),removeEventListener("popstate",e(this,F)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,_).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakMap,V=new WeakMap,O=new WeakMap,k=new WeakMap,E=new WeakMap,z=new WeakMap,a=new WeakMap,M=new WeakMap,D=new WeakMap,u=new WeakSet,ue=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},S=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},_=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},F=new WeakMap,A=new WeakMap,I=new WeakMap,X=new WeakMap,U=new WeakMap,C.stack=new ve;let j=C;oe.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",j);var h,g,x,ie,Y,J,K,N,re;class pe extends HTMLElement{constructor(){super();r(this,x);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,N,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});oe.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,x,ie).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const d=this.getRootNode();d instanceof ShadowRoot?i=d.host.closest("[data-popover]"):d instanceof HTMLElement&&(i=d.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=d=>{if(!d)return null;let L=d.querySelector("[data-popover]");return!L&&(d!=null&&d.parentElement)&&(L=l(d.parentElement)),L};i=l(this.parentElement)||null}else{let l=t;if(isNaN(parseInt(l))&&(!t.startsWith(".")&&!t.startsWith("[")&&!t.startsWith("#")&&(l=`#${t}`),i=document.querySelector(l)||this.getRootNode().querySelector(l)),!i){const L=[...document.querySelectorAll("[data-popover-ids]")].find(Q=>{var ne;return(ne=Q.getAttribute("data-popover-ids"))==null?void 0:ne.split(",").find(de=>de.trim()===t)});L&&(i=L)}}i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,J)),e(this,h).addEventListener("popoverClosing",e(this,K)),e(this,h).addEventListener("popoverClosed",e(this,N))):console.warn(this,`target ${t} not found`)}p(this,x,re).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,x,re).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,x,ie).call(this)}}h=new WeakMap,g=new WeakMap,x=new WeakSet,ie=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,J)),e(this,h).removeEventListener("popoverClosing",e(this,K)),e(this,h).removeEventListener("popoverClosed",e(this,N)))},Y=new WeakMap,J=new WeakMap,K=new WeakMap,N=new WeakMap,re=function(t){e(this,h)instanceof j&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};oe.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",pe);exports.PopoverButtonElement=pe;exports.PopoverElement=j;
|
|
1
|
+
"use strict";var he=c=>{throw TypeError(c)};var se=(c,n,t)=>n.has(c)||he("Cannot "+t);var e=(c,n,t)=>(se(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(se(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),p=(c,n,t)=>(se(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../css-property/index.cjs"),Z=require("../Viewport-BxCr0GlB.cjs"),fe=require("../element-linked-store/index.cjs"),oe=require("../index-OE2INULi.cjs"),W=require("../events-KVanG9sR.cjs"),ge=require("../function-MthRj-GJ.cjs"),le=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ce=require("../url-CHgcNwJ1.cjs"),ae=require("../window-resizer/index.cjs");var f,w,ee,te;class ve{constructor(){r(this,f,new Map);r(this,w,[]);r(this,ee,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(Q=>Q instanceof HTMLElement&&Q.hasAttribute("data-popover-content")))return;const l=i[0],d=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),L=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!d||L)&&t.close()}});r(this,te,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,ee)),addEventListener("keydown",e(this,te))}get groups(){return e(this,f)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,f).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,f).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,f).get(n);s!=null&&s.length||(s=[],e(this,f).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,f).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,f).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,f).get(n);e(this,f).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,f).get(n);s&&(s=s.filter(i=>i!==t),e(this,f).set(n,s))}}}f=new WeakMap,w=new WeakMap,ee=new WeakMap,te=new WeakMap;var v,B,H,R,G,m,T,P,q,$,b,V,O,k,E,z,a,M,D,u,ue,S,_,F,A,I,X,U;const C=class C extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,B);r(this,H);r(this,R);r(this,G);r(this,m);r(this,T);r(this,P);r(this,q);r(this,$);r(this,b);r(this,V);r(this,O);r(this,k);r(this,E);r(this,z);r(this,a);r(this,M);r(this,D);r(this,F);r(this,A);r(this,I);r(this,X);r(this,U);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,T,new y.CSSProperty(this,"--restore",!1)),o(this,P,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,q,new y.CSSProperty(this,"--close-rest",!1)),o(this,$,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,V,new y.CSSProperty(this,"--click-outside",!1)),o(this,O,new y.CSSProperty(this,"--escape",!1)),o(this,k,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,a,new fe.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,M,[]),o(this,D,[]),o(this,F,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,A,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,I).call(this)}),o(this,I,ge.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,k).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Z.viewport.width?s=Z.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Z.viewport.height?i=Z.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,U,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(C.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=C.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,T)}get dispatchResize(){return e(this,P)}get closeRest(){return e(this,q)}get closeRestInGroup(){return e(this,$)}get group(){return e(this,b)}get clickOutside(){return e(this,V)}get escape(){return e(this,O)}get opened(){return e(this,v)}get lastTrigger(){return e(this,z)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&ce.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,z,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),p(this,u,S).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),W.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,z)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,u,ue)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{C.stack.add(e(this,b).current,this),e(this,D).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,S).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,P).current?W.dispatchEvent(window,"resize",{custom:!0}):e(this,A).call(this),W.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,z)},bubbles:!0}),o(this,R,void 0),o(this,G,setTimeout(()=>{e(this,a).set("transitionend",!0),W.dispatchEvent(this,"popoverTransitionend")},le.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,R,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,R)),clearTimeout(e(this,G)),C.stack.remove(e(this,b).current,this),p(this,u,_).call(this),o(this,B,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!0,this.closingClass),W.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,S).call(this,!1,this.closingClass),W.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},le.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,M,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,M).forEach(t=>{t.addEventListener("click",e(this,U))}),o(this,D,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,T).observe(),e(this,P).observe(),e(this,q).observe(),e(this,$).observe(),e(this,b).observe(),e(this,V).observe(),e(this,O).observe(),e(this,k).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,F)),setTimeout(()=>{e(this,T).current?(o(this,E,!1),this.urlValue=ce.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(p(this,u,_).call(this),o(this,E,!0))},0),e(this,k).subscribe(()=>{e(this,A).call(this)}),ae.windowResizer.subscribe(e(this,A))}disconnectedCallback(){e(this,M).forEach(t=>{t.removeEventListener("click",e(this,U))}),C.stack.remove(e(this,b).current,this),ae.windowResizer.unsubscribe(e(this,A)),e(this,m).close(),e(this,T).close(),e(this,P).close(),e(this,q).close(),e(this,$).close(),e(this,b).close(),e(this,V).close(),e(this,O).close(),e(this,k).close(),this.removeAttribute("role"),p(this,u,S).call(this,!1,this.openClass),p(this,u,S).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,R)),clearTimeout(e(this,G)),removeEventListener("popstate",e(this,F)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,_).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakMap,V=new WeakMap,O=new WeakMap,k=new WeakMap,E=new WeakMap,z=new WeakMap,a=new WeakMap,M=new WeakMap,D=new WeakMap,u=new WeakSet,ue=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},S=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},_=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},F=new WeakMap,A=new WeakMap,I=new WeakMap,X=new WeakMap,U=new WeakMap,C.stack=new ve;let j=C;oe.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",j);var h,g,x,ie,Y,J,K,N,re;class pe extends HTMLElement{constructor(){super();r(this,x);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,N,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});oe.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,x,ie).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const d=this.getRootNode();d instanceof ShadowRoot?i=d.host.closest("[data-popover]"):d instanceof HTMLElement&&(i=d.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=d=>{if(!d)return null;let L=d.querySelector("[data-popover]");return!L&&(d!=null&&d.parentElement)&&(L=l(d.parentElement)),L};i=l(this.parentElement)||null}else{let l=t;if(isNaN(parseInt(l))&&(!t.startsWith(".")&&!t.startsWith("[")&&!t.startsWith("#")&&(l=`#${t}`),i=document.querySelector(l)||this.getRootNode().querySelector(l)),!i){const L=[...document.querySelectorAll("[data-popover-ids]")].find(Q=>{var ne;return(ne=Q.getAttribute("data-popover-ids"))==null?void 0:ne.split(",").find(de=>de.trim()===t)});L&&(i=L)}}i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,J)),e(this,h).addEventListener("popoverClosing",e(this,K)),e(this,h).addEventListener("popoverClosed",e(this,N))):console.warn(this,`target ${t} not found`)}p(this,x,re).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,x,re).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,x,ie).call(this)}}h=new WeakMap,g=new WeakMap,x=new WeakSet,ie=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,J)),e(this,h).removeEventListener("popoverClosing",e(this,K)),e(this,h).removeEventListener("popoverClosed",e(this,N)))},Y=new WeakMap,J=new WeakMap,K=new WeakMap,N=new WeakMap,re=function(t){e(this,h)instanceof j&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};oe.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",pe);exports.PopoverButtonElement=pe;exports.PopoverElement=j;
|
package/lib/popover/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { d as W } from "../events-CsVF98U6.js";
|
|
|
11
11
|
import { d as dt } from "../function-C10DGppn.js";
|
|
12
12
|
import { g as lt } from "../style-j2TwriJ_.js";
|
|
13
13
|
import "construct-style-sheets-polyfill";
|
|
14
|
-
import { u as ft, p as gt } from "../url-
|
|
14
|
+
import { u as ft, p as gt } from "../url-CYgo5vrG.js";
|
|
15
15
|
import { windowResizer as ct } from "../window-resizer/index.js";
|
|
16
16
|
var f, w, tt, et;
|
|
17
17
|
class mt {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertySymbols;var o=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var d=(r,e,n)=>e in r?i(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,s=(r,e)=>{for(var n in e||(e={}))o.call(e,n)&&d(r,n,e[n]);if(c)for(var n of c(e))p.call(e,n)&&d(r,n,e[n]);return r};function a(r,e,n,u){const t=h(e,s({},n),u);return r.append(t),t}exports.render=a;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var o = Object.getOwnPropertySymbols;
|
|
3
|
+
var s = Object.prototype.hasOwnProperty, u = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var p = (r, e, n) => e in r ? d(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n, a = (r, e) => {
|
|
5
|
+
for (var n in e || (e = {}))
|
|
6
|
+
s.call(e, n) && p(r, n, e[n]);
|
|
7
|
+
if (o)
|
|
8
|
+
for (var n of o(e))
|
|
9
|
+
u.call(e, n) && p(r, n, e[n]);
|
|
10
|
+
return r;
|
|
11
|
+
};
|
|
12
|
+
function i(r, e, n, c) {
|
|
13
|
+
const t = /* @__PURE__ */ h(e, a({}, n), c);
|
|
14
|
+
return r.append(t), t;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
i as r
|
|
18
|
+
};
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty,ce=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var Y=i=>{throw TypeError(i)};var W=(i,e,s)=>e in i?ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,$=(i,e)=>{for(var s in e||(e={}))me.call(e,s)&&W(i,s,e[s]);if(K)for(var s of K(e))fe.call(e,s)&&W(i,s,e[s]);return i},G=(i,e)=>ce(i,de(e));var U=(i,e,s)=>e.has(i)||Y("Cannot "+s);var t=(i,e,s)=>(U(i,e,"read from private field"),s?s.call(i):e.get(i)),n=(i,e,s)=>e.has(i)?Y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),h=(i,e,s,r)=>(U(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),d=(i,e,s)=>(U(i,e,"access private method"),s);var J=(i,e,s,r)=>({set _(a){h(i,e,a,s)},get _(){return t(i,e,r)}});var R=(i,e,s)=>new Promise((r,a)=>{var o=f=>{try{g(s.next(f))}catch(N){a(N)}},C=f=>{try{g(s.throw(f))}catch(N){a(N)}},g=f=>f.done?r(f.value):Promise.resolve(f.value).then(o,C);g((s=s.apply(i,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pe=require("../history/index.cjs"),ge=require("../LocalLinks-
|
|
1
|
+
"use strict";var ue=Object.defineProperty,ce=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var Y=i=>{throw TypeError(i)};var W=(i,e,s)=>e in i?ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,$=(i,e)=>{for(var s in e||(e={}))me.call(e,s)&&W(i,s,e[s]);if(K)for(var s of K(e))fe.call(e,s)&&W(i,s,e[s]);return i},G=(i,e)=>ce(i,de(e));var U=(i,e,s)=>e.has(i)||Y("Cannot "+s);var t=(i,e,s)=>(U(i,e,"read from private field"),s?s.call(i):e.get(i)),n=(i,e,s)=>e.has(i)?Y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),h=(i,e,s,r)=>(U(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),d=(i,e,s)=>(U(i,e,"access private method"),s);var J=(i,e,s,r)=>({set _(a){h(i,e,a,s)},get _(){return t(i,e,r)}});var R=(i,e,s)=>new Promise((r,a)=>{var o=f=>{try{g(s.next(f))}catch(N){a(N)}},C=f=>{try{g(s.throw(f))}catch(N){a(N)}},g=f=>f.done?r(f.value):Promise.resolve(f.value).then(o,C);g((s=s.apply(i,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pe=require("../history/index.cjs"),ge=require("../LocalLinks-BxhSFv_Q.cjs"),Re=require("../PageAnnouncerElement-AQ0Ja6HM.cjs"),we=require("../PageScroll-BXJUQwG7.cjs");require("construct-style-sheets-polyfill");require("../index-OE2INULi.cjs");const Q=require("../url-CHgcNwJ1.cjs"),ve=require("urlpattern-polyfill"),Pe=require("../render-DQs7rIoN.cjs"),be=require("../object-baN9pgbU.cjs");var S,H,q,p,u,T,M,v,P,b,l,X,Z,ee,te,se,ie,re,ae,B,y;class ye{constructor(e,s){n(this,l);n(this,S);n(this,H);n(this,q);n(this,p,null);n(this,u,null);n(this,T,!1);n(this,M,null);n(this,v);n(this,P,[]);n(this,b,[]);n(this,y,e=>{t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),h(this,u,e.detail.element),t(this,u).addEventListener("__hmrInstanceReplace",t(this,y))});h(this,S,e),h(this,H,s),h(this,q,new URLPattern({pathname:t(this,S)})),h(this,v,new MutationObserver(d(this,l,re).bind(this)))}get pattern(){return t(this,S)}get isActive(){return t(this,T)}get element(){return t(this,u)}get nest(){return t(this,M)}testPathname(e){return t(this,q).test({pathname:e})}render(e,s){return R(this,null,function*(){t(this,v).observe(document.head,{childList:!0,subtree:!0}),t(this,p)?d(this,l,Z).call(this):yield d(this,l,X).call(this),yield d(this,l,ae).call(this),t(this,p)&&(yield d(this,l,ee).call(this,e,s)),t(this,v).disconnect()})}close(){d(this,l,se).call(this)}}S=new WeakMap,H=new WeakMap,q=new WeakMap,p=new WeakMap,u=new WeakMap,T=new WeakMap,M=new WeakMap,v=new WeakMap,P=new WeakMap,b=new WeakMap,l=new WeakSet,X=function(){return R(this,null,function*(){const e=yield t(this,H).call(this);h(this,b,[...t(this,P)]),typeof e.default=="function"&&h(this,p,e.default)})},Z=function(){t(this,P).forEach(e=>{document.head.appendChild(e.cloneNode(!0))})},ee=function(e,s){return R(this,null,function*(){var o;const a={urlPatternResult:t(this,q).exec({pathname:s.pathname})};be.isESClass(t(this,p))?(h(this,u,new(t(this,p))(a)),e.appendChild(t(this,u))):h(this,u,Pe.render(e,t(this,p),a)),(o=t(this,u))==null||o.addEventListener("__hmrInstanceReplace",t(this,y)),d(this,l,te).call(this),h(this,T,!0)})},te=function(){var e;t(this,u)&&h(this,M,t(this,u).querySelector("[data-nest]")||((e=t(this,u).shadowRoot)==null?void 0:e.querySelector("[data-nest]"))||t(this,u).shadowRoot||t(this,u))},se=function(){t(this,v).disconnect(),t(this,u)&&(t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),t(this,u).remove()),h(this,T,!1),d(this,l,ie).call(this)},ie=function(){t(this,b).forEach(e=>{e.parentNode===document.head&&document.head.removeChild(e)}),h(this,b,[])},re=function(e){e.forEach(s=>{s.addedNodes.forEach(r=>{t(this,p)?t(this,b).push(r):t(this,P).push(r)})})},ae=function(){return R(this,null,function*(){const e=t(this,P).filter(d(this,l,B));yield Promise.all(e.map(s=>new Promise(r=>{d(this,l,B).call(this,s)?s.onload=()=>r():r()})))})},B=function(e){return e instanceof HTMLElement&&(e.tagName==="STYLE"||e.tagName==="SCRIPT"||e.tagName==="LINK")},y=new WeakMap;globalThis.URLPattern=ve.URLPattern;var c,L,k,E,I,_,w,A,m,ne,he,le,z,oe;class Le{constructor(e){n(this,m);n(this,c,null);n(this,L,null);n(this,k,null);n(this,E,null);n(this,I,null);n(this,_,0);n(this,w,[]);n(this,A,null);h(this,c,G($({},e),{rootElement:(e==null?void 0:e.rootElement)||document.body,base:Q.normalizeBase(e==null?void 0:e.base)})),h(this,I,new Re.PageAnnouncerElement),h(this,L,new we.PageScroll(t(this,c).scrollSelector)),t(this,L).update(),h(this,k,new ge.LocalLinks({base:t(this,c).base,trailingSlash:t(this,c).trailingSlash,includeAnchor:e==null?void 0:e.includeAnchor,onClick:(s,r)=>{try{this.navigate(s,r)}catch(a){window.location.assign(s)}}})),t(this,k).update(),h(this,E,new pe.History({onPop:s=>{this.navigate(s)}}))}history(){return t(this,E)}get scroll(){return scroll}get routes(){return t(this,w)}run(){d(this,m,oe).call(this),this.navigate(new URL(location.href),{revalidate:!0})}defineRoute(e,s){const r=new ye(e,s);t(this,w).push(r)}navigate(e,s){return R(this,null,function*(){var O,j,x,V,D,F;const r=t(this,E).isBack,a=++J(this,_)._;let o=Q.normalizeURL(e,{base:t(this,c).base,trailingSlash:t(this,c).trailingSlash});if(t(this,c).urlModifier&&(o=t(this,c).urlModifier(o)),!(yield d(this,m,ne).call(this,o))||t(this,_)!==a||(yield(j=(O=t(this,c)).beforeNavigation)==null?void 0:j.call(O),t(this,_)!==a))return;const{activeRoutes:C,newRoutes:g,oldRoutes:f,keepRoutes:N}=d(this,m,he).call(this,o);h(this,A,(x=N[N.length-1])!=null?x:null),r||(t(this,E).push(o),((V=s==null?void 0:s.keepScrollPosition)==null||V)&&t(this,L).element.scrollTo({top:0,behavior:"instant"})),t(this,I).create(document,o.pathname),t(this,c).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>d(this,m,z).call(this,f,g,o)).finished:yield d(this,m,z).call(this,f,g,o),t(this,L).update(),t(this,k).update(),t(this,I).done(),yield(F=(D=t(this,c)).afterNavigation)==null?void 0:F.call(D)})}}c=new WeakMap,L=new WeakMap,k=new WeakMap,E=new WeakMap,I=new WeakMap,_=new WeakMap,w=new WeakMap,A=new WeakMap,m=new WeakSet,ne=function(e){return R(this,null,function*(){if(!t(this,c).preprocessor)return!0;try{return yield new Promise((s,r)=>{var a,o;(o=(a=t(this,c)).preprocessor)==null||o.call(a,{url:e,resolve:s,reject:r})}),!0}catch(s){return console.error(s!=null?s:"Route change canceled"),!1}})},he=function(e){let s=e.pathname.replace(t(this,c).base,"");s.startsWith("/")||(s=`/${s}`);const r=t(this,w).filter(a=>a.isActive);return{activeRoutes:r,newRoutes:t(this,w).filter(a=>!r.includes(a)&&a.testPathname(s)),oldRoutes:r.filter(a=>!a.testPathname(s)),keepRoutes:r.filter(a=>a.testPathname(s))}},le=function(e){e.forEach(s=>s.close())},z=function(e,s,r){return R(this,null,function*(){var a,o;d(this,m,le).call(this,e);for(const C of s){const g=(o=(a=t(this,A))==null?void 0:a.nest)!=null?o:t(this,c).rootElement;yield C.render(g,r),h(this,A,C)}})},oe=function(){t(this,w).sort((e,s)=>{const r=e.pattern.split("/").length,a=s.pattern.split("/").length;return r-a})};exports.Router=Le;
|
package/lib/router/index.js
CHANGED
|
@@ -40,14 +40,14 @@ var w = (i, t, s) => new Promise((a, r) => {
|
|
|
40
40
|
R((s = s.apply(i, t)).next());
|
|
41
41
|
});
|
|
42
42
|
import { History as ft } from "../history/index.js";
|
|
43
|
-
import { L as pt } from "../LocalLinks-
|
|
43
|
+
import { L as pt } from "../LocalLinks-DFZFpbjs.js";
|
|
44
44
|
import { P as Rt } from "../PageAnnouncerElement-0LxZjtVH.js";
|
|
45
45
|
import { P as wt } from "../PageScroll-0LxFblry.js";
|
|
46
46
|
import "construct-style-sheets-polyfill";
|
|
47
47
|
import "../index-e9eDuagL.js";
|
|
48
|
-
import { a as gt, n as vt } from "../url-
|
|
48
|
+
import { a as gt, n as vt } from "../url-CYgo5vrG.js";
|
|
49
49
|
import { URLPattern as Pt } from "urlpattern-polyfill";
|
|
50
|
-
import { r as Lt } from "../render-
|
|
50
|
+
import { r as Lt } from "../render-D_0FCWEu.js";
|
|
51
51
|
import { i as bt } from "../object-CcMK4y_r.js";
|
|
52
52
|
var S, U, T, p, c, I, M, v, P, L, o, Q, X, Z, tt, et, st, it, at, z, b;
|
|
53
53
|
class Nt {
|
package/lib/spa/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var X=Object.defineProperty,$=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var D=i=>{throw TypeError(i)};var z=(i,t,e)=>t in i?X(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,R=(i,t)=>{for(var e in t||(t={}))J.call(t,e)&&z(i,e,t[e]);if(M)for(var e of M(t))K.call(t,e)&&z(i,e,t[e]);return i},I=(i,t)=>$(i,G(t));var O=(i,t,e)=>t.has(i)||D("Cannot "+e);var r=(i,t,e)=>(O(i,t,"read from private field"),e?e.call(i):t.get(i)),u=(i,t,e)=>t.has(i)?D("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),f=(i,t,e,c)=>(O(i,t,"write to private field"),c?c.call(i,e):t.set(i,e),e);var V=(i,t,e,c)=>({set _(o){f(i,t,o,e)},get _(){return r(i,t,c)}});var j=(i,t,e)=>new Promise((c,o)=>{var s=a=>{try{l(e.next(a))}catch(w){o(w)}},m=a=>{try{l(e.throw(a))}catch(w){o(w)}},l=a=>a.done?c(a.value):Promise.resolve(a.value).then(s,m);l((e=e.apply(i,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../cache/index.cjs"),Q=require("../history/index.cjs"),W=require("../LocalLinks-
|
|
1
|
+
"use strict";var X=Object.defineProperty,$=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var D=i=>{throw TypeError(i)};var z=(i,t,e)=>t in i?X(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,R=(i,t)=>{for(var e in t||(t={}))J.call(t,e)&&z(i,e,t[e]);if(M)for(var e of M(t))K.call(t,e)&&z(i,e,t[e]);return i},I=(i,t)=>$(i,G(t));var O=(i,t,e)=>t.has(i)||D("Cannot "+e);var r=(i,t,e)=>(O(i,t,"read from private field"),e?e.call(i):t.get(i)),u=(i,t,e)=>t.has(i)?D("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),f=(i,t,e,c)=>(O(i,t,"write to private field"),c?c.call(i,e):t.set(i,e),e);var V=(i,t,e,c)=>({set _(o){f(i,t,o,e)},get _(){return r(i,t,c)}});var j=(i,t,e)=>new Promise((c,o)=>{var s=a=>{try{l(e.next(a))}catch(w){o(w)}},m=a=>{try{l(e.throw(a))}catch(w){o(w)}},l=a=>a.done?c(a.value):Promise.resolve(a.value).then(s,m);l((e=e.apply(i,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../cache/index.cjs"),Q=require("../history/index.cjs"),W=require("../LocalLinks-BxhSFv_Q.cjs"),Y=require("../PageAnnouncerElement-AQ0Ja6HM.cjs"),Z=require("../PageScroll-BXJUQwG7.cjs"),F=require("../events-KVanG9sR.cjs"),H=require("../morph-B6sGhLCi.cjs");require("construct-style-sheets-polyfill");require("../index-OE2INULi.cjs");const k=require("../url-CHgcNwJ1.cjs");var y,P,n,d,S,g,v,q;const b=class b{constructor(t){u(this,y,new N.Cache);u(this,P,new DOMParser);u(this,n,null);u(this,d,null);u(this,S,null);u(this,g,null);u(this,v,null);u(this,q,0);b.instance||(b.instance=this,f(this,n,I(R({},t),{base:k.normalizeBase(t==null?void 0:t.base)})),f(this,v,new Y.PageAnnouncerElement),f(this,d,new Z.PageScroll(r(this,n).scrollSelector)),r(this,d).update(),f(this,S,new W.LocalLinks({base:r(this,n).base,trailingSlash:r(this,n).trailingSlash,includeAnchor:t==null?void 0:t.includeAnchor,onClick:(e,c)=>{try{this.navigate(e,c)}catch(o){window.location.assign(e)}}})),r(this,S).update(),f(this,g,new Q.History({onPop:e=>{this.navigate(e)}})))}history(){return r(this,g)}get scroll(){return r(this,d)}navigate(t,e){return j(this,null,function*(){var w,L,T,A,E,U,B,C;const c=r(this,g).isBack,o=++V(this,q)._;let s=k.normalizeURL(t,{base:r(this,n).base,trailingSlash:r(this,n).trailingSlash});r(this,n).urlModifier&&(s=r(this,n).urlModifier(s));let m=r(this,y).get(s.toString());if((!m||e!=null&&e.revalidate)&&(m=yield fetch(`${s}`,{headers:{"X-SPA":"true"}}).then(h=>h.text()).catch(()=>{window.location.assign(s)})),!m||(e!=null&&e.cache&&r(this,y).set(s.toString(),m),r(this,q)!==o))return;c||(r(this,g).push(s),((w=e==null?void 0:e.keepScrollPosition)==null||w)&&r(this,d).element.scrollTo({top:0,behavior:"instant"}));const l=r(this,P).parseFromString(m,"text/html");if(k.normalizeRelativeURLs(l,s),yield(T=(L=r(this,n)).beforeDiff)==null?void 0:T.call(L,l),r(this,q)!==o)return;F.dispatchEvent(document,"spaBeforeUpdate",{custom:!0});let a=(A=l.querySelector("title"))==null?void 0:A.textContent;if(a)document.title=a;else{const h=document.querySelector("h1");a=(U=(E=h==null?void 0:h.innerText)!=null?E:h==null?void 0:h.textContent)!=null?U:s.pathname}r(this,v).create(l,a),r(this,n).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>H.morph(document,l)).finished:yield H.morph(document,l),r(this,d).update(),r(this,S).update(),r(this,v).done(),yield(C=(B=r(this,n)).afterDiff)==null?void 0:C.call(B),F.dispatchEvent(document,"spaAfterUpdate",{custom:!0})})}};y=new WeakMap,P=new WeakMap,n=new WeakMap,d=new WeakMap,S=new WeakMap,g=new WeakMap,v=new WeakMap,q=new WeakMap,b.instance=null;let x=b;exports.SPA=x;
|