aptechka 0.83.1 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Animation-BAiM6_n1.js +111 -0
- package/lib/Animation-DMWabSR0.cjs +1 -0
- package/lib/Composed-B0fvCtZz.cjs +1 -0
- package/lib/Composed-CgA9lLWA.js +75 -0
- package/lib/Damped-BLo-OAVb.cjs +1 -0
- package/lib/Damped-Dcz5UdMH.js +57 -0
- package/lib/DerivedArray-DFhxap_z.js +63 -0
- package/lib/DerivedArray-DYtWMW0n.cjs +1 -0
- package/lib/DragControls-BPHsDeH6.cjs +1 -0
- package/lib/DragControls-D2a1Cifp.js +234 -0
- package/lib/LocalLinks-BWFJYhGX.cjs +1 -0
- package/lib/LocalLinks-Dwgf3No6.js +65 -0
- package/lib/PageAnnouncerElement-DPMlVJZG.cjs +1 -0
- package/lib/PageAnnouncerElement-DV9pm_od.js +28 -0
- package/lib/PageScroll-BAatKJx6.cjs +1 -0
- package/lib/PageScroll-m3TsHnzR.js +65 -0
- package/lib/SourceElement-941MrYpq.js +265 -0
- package/lib/SourceElement-DBLZ7b5k.cjs +5 -0
- package/lib/Store-BCW70G3Z.cjs +1 -0
- package/lib/Store-uLDYY9ed.js +158 -0
- package/lib/Tweened-BvtjLCa3.js +48 -0
- package/lib/Tweened-DdXm1dbF.cjs +1 -0
- package/lib/Viewport-BiDoiU8M.js +113 -0
- package/lib/Viewport-CXGKUyDy.cjs +1 -0
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +97 -93
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +6 -6
- package/lib/api-fetcher/index.cjs +1 -1
- package/lib/api-fetcher/index.js +67 -66
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +37 -34
- package/lib/attributes-BADnRZpK.cjs +1 -0
- package/lib/attributes-FObgMNCf.js +36 -0
- package/lib/billboard/index.cjs +1 -1
- package/lib/billboard/index.js +240 -232
- package/lib/cache/index.cjs +1 -1
- package/lib/cache/index.js +26 -23
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +62 -59
- package/lib/canvas-BP1ceie3.cjs +1 -0
- package/lib/canvas-DsglKco1.js +40 -0
- package/lib/connector/index.cjs +1 -1
- package/lib/connector/index.js +44 -41
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +6 -6
- package/lib/coordinates--JG1U6kQ.js +29 -0
- package/lib/coordinates-DQ9XV9M1.cjs +1 -0
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.d.ts +1 -1
- package/lib/css-property/index.js +40 -37
- package/lib/css-unit-parser/index.cjs +2 -2
- package/lib/css-unit-parser/index.js +22 -19
- package/lib/css-value-parser/index.cjs +1 -1
- package/lib/css-value-parser/index.js +13 -11
- package/lib/custom-elements-BfZCJde6.cjs +1 -0
- package/lib/custom-elements-HEMuF7yH.js +27 -0
- package/lib/dev/index.cjs +2 -1
- package/lib/dev/index.d.ts +1 -0
- package/lib/dev/index.js +25 -10
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +5 -5
- package/lib/dom-B40i6NXw.cjs +1 -0
- package/lib/dom-D8D-_9ty.js +108 -0
- package/lib/easings-BSGJFMAo.js +40 -0
- package/lib/easings-BWq0pPLq.cjs +1 -0
- package/lib/element-CqD0jqBJ.cjs +1 -0
- package/lib/element-DKw5H-Tu.js +10 -0
- package/lib/element-linked-store/index.cjs +1 -1
- package/lib/element-linked-store/index.js +53 -52
- package/lib/element-resizer/index.cjs +1 -1
- package/lib/element-resizer/index.js +47 -44
- package/lib/en3/index.cjs +4 -4
- package/lib/en3/index.js +192 -185
- package/lib/events-Ds-TuvYW.js +9 -0
- package/lib/events-UlGk63iC.cjs +1 -0
- package/lib/file-DwQs6bB6.js +28 -0
- package/lib/file-RHfA3OS-.cjs +1 -0
- package/lib/function-H4b_gTg6.cjs +1 -0
- package/lib/function-UmbPrOHm.js +19 -0
- package/lib/gestures-DmKKNnh4.js +14 -0
- package/lib/gestures-DtYbQr49.cjs +1 -0
- package/lib/history/index.cjs +1 -1
- package/lib/history/index.js +24 -21
- package/lib/iframe/index.cjs +1 -1
- package/lib/iframe/index.js +27 -24
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +17 -13
- package/lib/index-BpO2RJ__.cjs +1 -0
- package/lib/index-DpKsHe97.js +68 -0
- package/lib/intersector/index.cjs +1 -1
- package/lib/intersector/index.js +3 -3
- package/lib/jsx/ComponentElement.d.ts +4 -0
- package/lib/jsx/h.d.ts +7 -16
- package/lib/jsx/hooks/component/useStylesheet.d.ts +1 -1
- package/lib/jsx/hooks/cssProperty.d.ts +6 -0
- package/lib/jsx/hooks/resize.d.ts +4 -0
- package/lib/jsx/hooks/store.d.ts +1 -2
- package/lib/jsx/hooks/ticker.d.ts +5 -0
- package/lib/jsx/index.cjs +1 -1
- package/lib/jsx/index.d.ts +4 -4
- package/lib/jsx/index.js +171 -349
- package/lib/jsx/plugins/vite/index.cjs +49 -0
- package/lib/jsx/plugins/vite/index.d.ts +38 -0
- package/lib/jsx/plugins/vite/index.js +104 -0
- package/lib/jsx/render.d.ts +2 -0
- package/lib/jsx/type.d.ts +228 -190
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.js +86 -84
- package/lib/layout-C26zkY7D.js +35 -0
- package/lib/layout-CnGLl7oe.cjs +1 -0
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.js +221 -217
- package/lib/loading/index.cjs +1 -1
- package/lib/loading/index.js +48 -45
- package/lib/local-links/index.cjs +1 -1
- package/lib/local-links/index.js +2 -2
- package/lib/masonry-layout/index.cjs +1 -1
- package/lib/masonry-layout/index.js +48 -45
- package/lib/math-C-knY2TL.cjs +1 -0
- package/lib/math-r8V23YFe.js +57 -0
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +28 -25
- package/lib/metadata-BNdkmeeD.js +15 -0
- package/lib/metadata-BrHUfpV9.cjs +1 -0
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +561 -556
- package/lib/morph-BtgB1YQP.js +256 -0
- package/lib/morph-Buhxq-X0.cjs +1 -0
- package/lib/need_redo_tweaker/index.cjs +4 -4
- package/lib/need_redo_tweaker/index.js +862 -834
- package/lib/notifier/index.cjs +1 -1
- package/lib/notifier/index.js +29 -26
- package/lib/number-Bu4sGvW7.cjs +1 -0
- package/lib/number-DiVt2xnh.js +47 -0
- package/lib/object-CiIdEmJx.js +98 -0
- package/lib/object-DTY_W6xG.cjs +1 -0
- package/lib/order/index.cjs +1 -1
- package/lib/order/index.js +3 -3
- package/lib/page-announcer/index.cjs +1 -1
- package/lib/page-announcer/index.js +2 -2
- package/lib/page-scroll/index.cjs +1 -1
- package/lib/page-scroll/index.js +2 -2
- package/lib/pixel-perfect/index.cjs +4 -4
- package/lib/pixel-perfect/index.js +43 -40
- package/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +125 -122
- package/lib/polyfills-CG1XJNia.js +28 -0
- package/lib/polyfills-DZCuDBkA.cjs +1 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +249 -245
- package/lib/radio/index.cjs +1 -1
- package/lib/radio/index.js +58 -55
- package/lib/render-DLcWVnuH.js +355 -0
- package/lib/render-DdomypCo.cjs +1 -0
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +196 -194
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +890 -877
- package/lib/scroll-BvIWh1xB.js +41 -0
- package/lib/scroll-CT0lpyRZ.cjs +1 -0
- package/lib/scroll-entries/index.cjs +1 -1
- package/lib/scroll-entries/index.js +37 -34
- package/lib/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +214 -209
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +102 -98
- package/lib/size-element/index.cjs +1 -1
- package/lib/size-element/index.js +29 -26
- package/lib/slicer/index.cjs +1 -1
- package/lib/slicer/index.js +118 -113
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +5 -5
- package/lib/spa/index.cjs +1 -1
- package/lib/spa/index.js +94 -94
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.d.ts +2 -2
- package/lib/store/index.js +10 -8
- package/lib/string-B3lm2b7v.js +84 -0
- package/lib/string-CbRNzmd9.cjs +1 -0
- package/lib/style-DBoQWK0d.js +14 -0
- package/lib/style-IDJ6db6n.cjs +1 -0
- package/lib/stylesheet-CHvuef16.js +28 -0
- package/lib/stylesheet-CQdBaIAA.cjs +1 -0
- package/lib/ticker/index.cjs +1 -1
- package/lib/ticker/index.js +96 -92
- package/lib/url-CPCO10Sy.cjs +1 -0
- package/lib/url-CWCY_qe_.js +124 -0
- package/lib/utils/attributes.d.ts +2 -0
- package/lib/utils/dom.d.ts +1 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +245 -226
- package/lib/utils/polyfills.d.ts +1 -1
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +36 -33
- package/lib/window-resizer/index.cjs +1 -1
- package/lib/window-resizer/index.js +27 -24
- package/lib/youtube/index.cjs +1 -1
- package/lib/youtube/index.js +56 -54
- package/package.json +11 -24
- package/lib/Animation-BzTjZIE-.js +0 -108
- package/lib/Animation-C39Ah-LM.cjs +0 -1
- package/lib/Composed-C-TV9te3.cjs +0 -1
- package/lib/Composed-DyAWjEXE.js +0 -121
- package/lib/Damped-CRusiRIV.js +0 -56
- package/lib/Damped-Prr0iKu1.cjs +0 -1
- package/lib/DragControls-8rNZwQrs.cjs +0 -1
- package/lib/DragControls-DBNdMBA4.js +0 -228
- package/lib/LocalLinks-BxhSFv_Q.cjs +0 -1
- package/lib/LocalLinks-DFZFpbjs.js +0 -62
- package/lib/PageAnnouncerElement-0LxZjtVH.js +0 -24
- package/lib/PageAnnouncerElement-AQ0Ja6HM.cjs +0 -1
- package/lib/PageScroll-0LxFblry.js +0 -62
- package/lib/PageScroll-BXJUQwG7.cjs +0 -1
- package/lib/SourceElement-BHqPFbna.cjs +0 -5
- package/lib/SourceElement-DjbHjynf.js +0 -260
- package/lib/Store-Blf4msDz.cjs +0 -1
- package/lib/Store-ZThXYBQd.js +0 -152
- package/lib/Tweened-Bw1Cn1PJ.js +0 -47
- package/lib/Tweened-DWtk9E-O.cjs +0 -1
- package/lib/Viewport-BxCr0GlB.cjs +0 -1
- package/lib/Viewport-Dt-d9DPi.js +0 -109
- package/lib/attributes-69we3byR.js +0 -10
- package/lib/attributes-Bf2svn4j.cjs +0 -1
- package/lib/canvas-CU5Xjahf.cjs +0 -1
- package/lib/canvas-DeZ0SLUJ.js +0 -34
- package/lib/coordinates-CgdGoSYs.js +0 -24
- package/lib/coordinates-D8Np3cPD.cjs +0 -1
- package/lib/custom-elements-DBnCK7Zx.js +0 -24
- package/lib/custom-elements-Dh4TWRDJ.cjs +0 -1
- package/lib/dom-BETkVSSZ.js +0 -82
- package/lib/dom-CBLlqORw.cjs +0 -1
- package/lib/easings-BEmRlrDd.js +0 -38
- package/lib/easings-GegIwET5.cjs +0 -1
- package/lib/element-CGVl1jA-.js +0 -7
- package/lib/element-yhcBhsho.cjs +0 -1
- package/lib/events-CsVF98U6.js +0 -6
- package/lib/events-KVanG9sR.cjs +0 -1
- package/lib/file-DSpfWdd9.cjs +0 -1
- package/lib/file-GHShUlue.js +0 -24
- package/lib/function-C10DGppn.js +0 -17
- package/lib/function-MthRj-GJ.cjs +0 -1
- package/lib/gestures-C7gbKx11.cjs +0 -1
- package/lib/gestures-CcXV6fCp.js +0 -11
- package/lib/index-OE2INULi.cjs +0 -1
- package/lib/index-e9eDuagL.js +0 -65
- package/lib/jsx/hydrate.d.ts +0 -1
- package/lib/jsx/integrations/astro/client.cjs +0 -1
- package/lib/jsx/integrations/astro/client.d.ts +0 -2
- package/lib/jsx/integrations/astro/client.js +0 -50
- package/lib/jsx/integrations/astro/index.cjs +0 -1
- package/lib/jsx/integrations/astro/index.d.ts +0 -2
- package/lib/jsx/integrations/astro/index.js +0 -54
- package/lib/jsx/integrations/astro/server.cjs +0 -1
- package/lib/jsx/integrations/astro/server.d.ts +0 -3
- package/lib/jsx/integrations/astro/server.js +0 -35
- package/lib/jsx/plugins/vite.d.ts +0 -21
- package/lib/layout-BSMtwCga.js +0 -29
- package/lib/layout-Ctc2p3uz.cjs +0 -1
- package/lib/math-BOBiC4TN.js +0 -45
- package/lib/math-GDWEqu7y.cjs +0 -1
- package/lib/metadata-BcYZ5w3T.cjs +0 -1
- package/lib/metadata-jfowcCyz.js +0 -12
- package/lib/morph-B6sGhLCi.cjs +0 -1
- package/lib/morph-BQErz7qP.js +0 -242
- package/lib/number-ChAm68cm.cjs +0 -1
- package/lib/number-CumqY64S.js +0 -40
- package/lib/object-CcMK4y_r.js +0 -87
- package/lib/object-baN9pgbU.cjs +0 -1
- package/lib/polyfills-DJrTJQky.js +0 -24
- package/lib/polyfills-Df4r-ETT.cjs +0 -1
- package/lib/render-DQs7rIoN.cjs +0 -1
- package/lib/render-D_0FCWEu.js +0 -18
- package/lib/scroll-BA2WnUrb.cjs +0 -1
- package/lib/scroll-DY5senkF.js +0 -37
- package/lib/string-BlMQbe8b.js +0 -70
- package/lib/string-DUXXtU8v.cjs +0 -1
- package/lib/style-At6aDoqG.cjs +0 -1
- package/lib/style-j2TwriJ_.js +0 -10
- package/lib/stylesheet-5_o7PFzM.cjs +0 -1
- package/lib/stylesheet-DdBzowZY.js +0 -24
- package/lib/url-CHgcNwJ1.cjs +0 -1
- package/lib/url-CYgo5vrG.js +0 -113
- package/lib/vite-C-i3hVDL.js +0 -75
- package/lib/vite-DzanPumM.cjs +0 -44
package/lib/loading/index.js
CHANGED
|
@@ -1,71 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
3
4
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
import { d as
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
6
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
7
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
|
+
import { d as dispatchEvent } from "../events-Ds-TuvYW.js";
|
|
9
|
+
import { d as debounce } from "../function-UmbPrOHm.js";
|
|
8
10
|
import "construct-style-sheets-polyfill";
|
|
9
|
-
import "../index-
|
|
10
|
-
var
|
|
11
|
-
class
|
|
11
|
+
import "../index-DpKsHe97.js";
|
|
12
|
+
var _map, _isStarted, _loaded, _progress, _start, _check, _complete;
|
|
13
|
+
const _Loading = class _Loading {
|
|
12
14
|
constructor() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
__privateAdd(this, _map, /* @__PURE__ */ new Map());
|
|
16
|
+
__privateAdd(this, _isStarted, !1);
|
|
17
|
+
__privateAdd(this, _loaded, 0);
|
|
18
|
+
__privateAdd(this, _progress, 0);
|
|
19
|
+
__privateAdd(this, _start, debounce(() => {
|
|
20
|
+
__privateGet(this, _isStarted) || (__privateSet(this, _isStarted, !0), dispatchEvent(document, "loadingStart"), __privateGet(this, _check).call(this));
|
|
19
21
|
}, 0));
|
|
20
|
-
|
|
21
|
-
if (!
|
|
22
|
+
__privateAdd(this, _check, /* @__PURE__ */ __name((resourceName) => {
|
|
23
|
+
if (!__privateGet(this, _isStarted))
|
|
22
24
|
return;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
+
const total = __privateGet(this, _map).size, loaded = Array.from(__privateGet(this, _map)).filter((item) => item[1]).length, progress = loaded / total;
|
|
26
|
+
__privateSet(this, _loaded, loaded), __privateSet(this, _progress, progress), dispatchEvent(document, "loadingProgress", {
|
|
25
27
|
detail: {
|
|
26
|
-
total
|
|
27
|
-
loaded
|
|
28
|
-
progress
|
|
29
|
-
resourceName
|
|
28
|
+
total,
|
|
29
|
+
loaded,
|
|
30
|
+
progress,
|
|
31
|
+
resourceName
|
|
30
32
|
}
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
}), progress === 1 && __privateGet(this, _complete).call(this);
|
|
34
|
+
}, "#check"));
|
|
35
|
+
__privateAdd(this, _complete, debounce(() => {
|
|
36
|
+
__privateSet(this, _isStarted, !1), dispatchEvent(document, "loadingComplete", {
|
|
35
37
|
detail: {
|
|
36
|
-
total:
|
|
38
|
+
total: __privateGet(this, _map).size
|
|
37
39
|
}
|
|
38
|
-
}),
|
|
40
|
+
}), __privateSet(this, _loaded, 0), __privateSet(this, _progress, 0), __privateGet(this, _map).clear();
|
|
39
41
|
}, 0));
|
|
40
42
|
}
|
|
41
43
|
get total() {
|
|
42
|
-
return
|
|
44
|
+
return __privateGet(this, _map).size;
|
|
43
45
|
}
|
|
44
46
|
get loaded() {
|
|
45
|
-
return
|
|
47
|
+
return __privateGet(this, _loaded);
|
|
46
48
|
}
|
|
47
49
|
get progress() {
|
|
48
|
-
return
|
|
50
|
+
return __privateGet(this, _progress);
|
|
49
51
|
}
|
|
50
52
|
get map() {
|
|
51
|
-
return
|
|
53
|
+
return __privateGet(this, _map);
|
|
52
54
|
}
|
|
53
|
-
add(
|
|
54
|
-
|
|
55
|
+
add(resourceName) {
|
|
56
|
+
__privateGet(this, _map).set(resourceName, !1), __privateGet(this, _start).call(this);
|
|
55
57
|
}
|
|
56
|
-
complete(
|
|
57
|
-
|
|
58
|
+
complete(resourceName) {
|
|
59
|
+
__privateGet(this, _map).set(resourceName, !0), __privateGet(this, _check).call(this, resourceName);
|
|
58
60
|
}
|
|
59
|
-
error(
|
|
60
|
-
|
|
61
|
+
error(resourceName) {
|
|
62
|
+
__privateGet(this, _map).has(resourceName) && (console.error(`Failed to load ${resourceName}`), __privateGet(this, _map).delete(resourceName), dispatchEvent(document, "loadingError", {
|
|
61
63
|
detail: {
|
|
62
|
-
name:
|
|
64
|
+
name: resourceName
|
|
63
65
|
}
|
|
64
|
-
})),
|
|
66
|
+
})), __privateGet(this, _check).call(this);
|
|
65
67
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
};
|
|
69
|
+
_map = new WeakMap(), _isStarted = new WeakMap(), _loaded = new WeakMap(), _progress = new WeakMap(), _start = new WeakMap(), _check = new WeakMap(), _complete = new WeakMap(), __name(_Loading, "Loading");
|
|
70
|
+
let Loading = _Loading;
|
|
71
|
+
const loading = new Loading();
|
|
69
72
|
export {
|
|
70
|
-
|
|
73
|
+
loading
|
|
71
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const LocalLinks=require("../LocalLinks-BWFJYhGX.cjs");exports.LocalLinks=LocalLinks.LocalLinks;
|
package/lib/local-links/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cssProperty_index=require("../css-property/index.cjs"),intersector_index=require("../index-BpO2RJ__.cjs"),events=require("../events-UlGk63iC.cjs"),stylesheet=require("../stylesheet-CQdBaIAA.cjs");var _distributeRule,_columns,_columnElements,_mutationObserver,_mutationListener,_MasonryLayoutElement_instances,distribute_fn;const _MasonryLayoutElement=class _MasonryLayoutElement extends HTMLElement{constructor(){super();__privateAdd(this,_MasonryLayoutElement_instances);__privateAdd(this,_distributeRule,new cssProperty_index.CSSProperty(this,"--distribute-rule","default",{skipSubscribeNotification:!0}));__privateAdd(this,_columns,new cssProperty_index.CSSProperty(this,"--columns",2));__privateAdd(this,_columnElements,[]);__privateAdd(this,_mutationObserver,null);__privateAdd(this,_mutationListener,__name(()=>{__privateMethod(this,_MasonryLayoutElement_instances,distribute_fn).call(this)},"#mutationListener"));const root=this.attachShadow({mode:"open"});root.adoptedStyleSheets=[stylesheet.createStylesheet({":host":{display:"grid",gridTemplateColumns:"repeat(var(--columns), 1fr)"},".column":{display:"grid",width:"100%",gap:"var(--gap, 0rem)",gridAutoRows:"max-content"}})]}get columnElements(){return __privateGet(this,_columnElements)}connectedCallback(){__privateSet(this,_mutationObserver,new MutationObserver(__privateGet(this,_mutationListener))),__privateGet(this,_mutationObserver).observe(this,{childList:!0}),__privateGet(this,_distributeRule).subscribe(()=>{__privateMethod(this,_MasonryLayoutElement_instances,distribute_fn).call(this)}),__privateGet(this,_columns).subscribe(e=>{var _a;this.shadowRoot.innerHTML="",__privateSet(this,_columnElements,[]);for(let index=0;index<e.current;index++){const column=document.createElement("div");column.classList.add("column"),column.innerHTML=`<slot name="col-${index}"></slot>`,__privateGet(this,_columnElements).push(column),(_a=this.shadowRoot)==null||_a.appendChild(column)}__privateMethod(this,_MasonryLayoutElement_instances,distribute_fn).call(this)}),__privateGet(this,_distributeRule).observe(),__privateGet(this,_columns).observe()}disconnectedCallback(){__privateGet(this,_columns).close(),__privateGet(this,_mutationObserver).disconnect(),this.classList.remove("distributed")}};_distributeRule=new WeakMap,_columns=new WeakMap,_columnElements=new WeakMap,_mutationObserver=new WeakMap,_mutationListener=new WeakMap,_MasonryLayoutElement_instances=new WeakSet,distribute_fn=__name(function(){const children=[...this.children],columns=__privateGet(this,_columns).current;__privateGet(this,_distributeRule).current==="chessboard"&&columns%2===0?children.forEach((el,i)=>{const row=Math.floor(i/columns),posInRow=i%columns,shift=row%2,col=(posInRow+shift)%columns;el.slot=`col-${col}`}):__privateGet(this,_distributeRule).current==="default"&&children.forEach((el,i)=>{el.slot=`col-${i%columns}`}),this.classList.add("distributed"),events.dispatchEvent(this,"masonryLayoutDistributed",{custom:!0})},"#distribute"),__name(_MasonryLayoutElement,"MasonryLayoutElement");let MasonryLayoutElement=_MasonryLayoutElement;intersector_index.isBrowser&&!customElements.get("e-masonry-layout")&&customElements.define("e-masonry-layout",MasonryLayoutElement);exports.MasonryLayoutElement=MasonryLayoutElement;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
3
4
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
6
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
7
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
8
|
+
import { CSSProperty } from "../css-property/index.js";
|
|
9
|
+
import { i as isBrowser } from "../index-DpKsHe97.js";
|
|
10
|
+
import { d as dispatchEvent } from "../events-Ds-TuvYW.js";
|
|
11
|
+
import { c as createStylesheet } from "../stylesheet-CHvuef16.js";
|
|
12
|
+
var _distributeRule, _columns, _columnElements, _mutationObserver, _mutationListener, _MasonryLayoutElement_instances, distribute_fn;
|
|
13
|
+
const _MasonryLayoutElement = class _MasonryLayoutElement extends HTMLElement {
|
|
12
14
|
constructor() {
|
|
13
15
|
super();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
__privateAdd(this, _MasonryLayoutElement_instances);
|
|
17
|
+
__privateAdd(this, _distributeRule, new CSSProperty(
|
|
16
18
|
this,
|
|
17
19
|
"--distribute-rule",
|
|
18
20
|
"default",
|
|
@@ -20,15 +22,15 @@ class x extends HTMLElement {
|
|
|
20
22
|
skipSubscribeNotification: !0
|
|
21
23
|
}
|
|
22
24
|
));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
__privateAdd(this, _columns, new CSSProperty(this, "--columns", 2));
|
|
26
|
+
__privateAdd(this, _columnElements, []);
|
|
27
|
+
__privateAdd(this, _mutationObserver, null);
|
|
28
|
+
__privateAdd(this, _mutationListener, /* @__PURE__ */ __name(() => {
|
|
29
|
+
__privateMethod(this, _MasonryLayoutElement_instances, distribute_fn).call(this);
|
|
30
|
+
}, "#mutationListener"));
|
|
31
|
+
const root = this.attachShadow({ mode: "open" });
|
|
32
|
+
root.adoptedStyleSheets = [
|
|
33
|
+
createStylesheet({
|
|
32
34
|
":host": {
|
|
33
35
|
display: "grid",
|
|
34
36
|
gridTemplateColumns: "repeat(var(--columns), 1fr)"
|
|
@@ -43,37 +45,38 @@ class x extends HTMLElement {
|
|
|
43
45
|
];
|
|
44
46
|
}
|
|
45
47
|
get columnElements() {
|
|
46
|
-
return
|
|
48
|
+
return __privateGet(this, _columnElements);
|
|
47
49
|
}
|
|
48
50
|
connectedCallback() {
|
|
49
|
-
|
|
51
|
+
__privateSet(this, _mutationObserver, new MutationObserver(__privateGet(this, _mutationListener))), __privateGet(this, _mutationObserver).observe(this, {
|
|
50
52
|
childList: !0
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
}),
|
|
54
|
-
var
|
|
55
|
-
this.shadowRoot.innerHTML = "",
|
|
56
|
-
for (let
|
|
57
|
-
const
|
|
58
|
-
|
|
53
|
+
}), __privateGet(this, _distributeRule).subscribe(() => {
|
|
54
|
+
__privateMethod(this, _MasonryLayoutElement_instances, distribute_fn).call(this);
|
|
55
|
+
}), __privateGet(this, _columns).subscribe((e) => {
|
|
56
|
+
var _a;
|
|
57
|
+
this.shadowRoot.innerHTML = "", __privateSet(this, _columnElements, []);
|
|
58
|
+
for (let index = 0; index < e.current; index++) {
|
|
59
|
+
const column = document.createElement("div");
|
|
60
|
+
column.classList.add("column"), column.innerHTML = `<slot name="col-${index}"></slot>`, __privateGet(this, _columnElements).push(column), (_a = this.shadowRoot) == null || _a.appendChild(column);
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
}),
|
|
62
|
+
__privateMethod(this, _MasonryLayoutElement_instances, distribute_fn).call(this);
|
|
63
|
+
}), __privateGet(this, _distributeRule).observe(), __privateGet(this, _columns).observe();
|
|
62
64
|
}
|
|
63
65
|
disconnectedCallback() {
|
|
64
|
-
|
|
66
|
+
__privateGet(this, _columns).close(), __privateGet(this, _mutationObserver).disconnect(), this.classList.remove("distributed");
|
|
65
67
|
}
|
|
66
|
-
}
|
|
67
|
-
l = new WeakMap(), a = new WeakMap(), h = new WeakMap(), u = new WeakMap(), b = new WeakMap(), d = new WeakSet(), p = function() {
|
|
68
|
-
const t = [...this.children], i = o(this, a).current;
|
|
69
|
-
o(this, l).current === "chessboard" && i % 2 === 0 ? t.forEach((n, r) => {
|
|
70
|
-
const E = Math.floor(r / i), L = r % i, g = E % 2, S = (L + g) % i;
|
|
71
|
-
n.slot = `col-${S}`;
|
|
72
|
-
}) : o(this, l).current === "default" && t.forEach((n, r) => {
|
|
73
|
-
n.slot = `col-${r % i}`;
|
|
74
|
-
}), this.classList.add("distributed"), C(this, "masonryLayoutDistributed", { custom: !0 });
|
|
75
68
|
};
|
|
76
|
-
|
|
69
|
+
_distributeRule = new WeakMap(), _columns = new WeakMap(), _columnElements = new WeakMap(), _mutationObserver = new WeakMap(), _mutationListener = new WeakMap(), _MasonryLayoutElement_instances = new WeakSet(), distribute_fn = /* @__PURE__ */ __name(function() {
|
|
70
|
+
const children = [...this.children], columns = __privateGet(this, _columns).current;
|
|
71
|
+
__privateGet(this, _distributeRule).current === "chessboard" && columns % 2 === 0 ? children.forEach((el, i) => {
|
|
72
|
+
const row = Math.floor(i / columns), posInRow = i % columns, shift = row % 2, col = (posInRow + shift) % columns;
|
|
73
|
+
el.slot = `col-${col}`;
|
|
74
|
+
}) : __privateGet(this, _distributeRule).current === "default" && children.forEach((el, i) => {
|
|
75
|
+
el.slot = `col-${i % columns}`;
|
|
76
|
+
}), this.classList.add("distributed"), dispatchEvent(this, "masonryLayoutDistributed", { custom: !0 });
|
|
77
|
+
}, "#distribute"), __name(_MasonryLayoutElement, "MasonryLayoutElement");
|
|
78
|
+
let MasonryLayoutElement = _MasonryLayoutElement;
|
|
79
|
+
isBrowser && !customElements.get("e-masonry-layout") && customElements.define("e-masonry-layout", MasonryLayoutElement);
|
|
77
80
|
export {
|
|
78
|
-
|
|
81
|
+
MasonryLayoutElement
|
|
79
82
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});function lerp(a,b,c){return(1-c)*a+c*b}__name(lerp,"lerp");function damp(a,b,c,dt){return lerp(a,b,1-Math.exp(-c*dt))}__name(damp,"damp");function step(edge,value,x=0,y=1){return value<edge?x:y}__name(step,"step");function round(number,precision=5){return+number.toFixed(precision)}__name(round,"round");function clamp(number,min=0,max=0){return Math.max(min,Math.min(number,max))}__name(clamp,"clamp");function mapRange(value,rangeA,rangeB){const mappedValue=(value-rangeA[0])/(rangeA[1]-rangeA[0])*(rangeB[1]-rangeB[0])+rangeB[0];return clamp(mappedValue,rangeB[0],rangeB[1])}__name(mapRange,"mapRange");function smoothstep(x,min,max){return x<=min?0:x>=max?1:(x=(x-min)/(max-min),x*x*(3-2*x))}__name(smoothstep,"smoothstep");function smootherstep(x,min,max){return x<=min?0:x>=max?1:(x=(x-min)/(max-min),x*x*x*(x*(x*6-15)+10))}__name(smootherstep,"smootherstep");function calculateDistance(d1,d2){const xDistance=d2.x-d1.x,yDistance=d2.y-d1.y;return Math.sqrt(Math.pow(xDistance,2)+Math.pow(yDistance,2))}__name(calculateDistance,"calculateDistance");function calculateDistanceWithRadius(x1,y1,r1,x2,y2,r2){const dx=x2-x1,dy=y2-y1;return Math.sqrt(dx*dx+dy*dy)-(r1+r2)}__name(calculateDistanceWithRadius,"calculateDistanceWithRadius");exports.calculateDistance=calculateDistance;exports.calculateDistanceWithRadius=calculateDistanceWithRadius;exports.clamp=clamp;exports.damp=damp;exports.lerp=lerp;exports.mapRange=mapRange;exports.round=round;exports.smootherstep=smootherstep;exports.smoothstep=smoothstep;exports.step=step;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
3
|
+
function lerp(a, b, c) {
|
|
4
|
+
return (1 - c) * a + c * b;
|
|
5
|
+
}
|
|
6
|
+
__name(lerp, "lerp");
|
|
7
|
+
function damp(a, b, c, dt) {
|
|
8
|
+
return lerp(a, b, 1 - Math.exp(-c * dt));
|
|
9
|
+
}
|
|
10
|
+
__name(damp, "damp");
|
|
11
|
+
function step(edge, value, x = 0, y = 1) {
|
|
12
|
+
return value < edge ? x : y;
|
|
13
|
+
}
|
|
14
|
+
__name(step, "step");
|
|
15
|
+
function round(number, precision = 5) {
|
|
16
|
+
return +number.toFixed(precision);
|
|
17
|
+
}
|
|
18
|
+
__name(round, "round");
|
|
19
|
+
function clamp(number, min = 0, max = 0) {
|
|
20
|
+
return Math.max(min, Math.min(number, max));
|
|
21
|
+
}
|
|
22
|
+
__name(clamp, "clamp");
|
|
23
|
+
function mapRange(value, rangeA, rangeB) {
|
|
24
|
+
const mappedValue = (value - rangeA[0]) / (rangeA[1] - rangeA[0]) * (rangeB[1] - rangeB[0]) + rangeB[0];
|
|
25
|
+
return clamp(mappedValue, rangeB[0], rangeB[1]);
|
|
26
|
+
}
|
|
27
|
+
__name(mapRange, "mapRange");
|
|
28
|
+
function smoothstep(x, min, max) {
|
|
29
|
+
return x <= min ? 0 : x >= max ? 1 : (x = (x - min) / (max - min), x * x * (3 - 2 * x));
|
|
30
|
+
}
|
|
31
|
+
__name(smoothstep, "smoothstep");
|
|
32
|
+
function smootherstep(x, min, max) {
|
|
33
|
+
return x <= min ? 0 : x >= max ? 1 : (x = (x - min) / (max - min), x * x * x * (x * (x * 6 - 15) + 10));
|
|
34
|
+
}
|
|
35
|
+
__name(smootherstep, "smootherstep");
|
|
36
|
+
function calculateDistance(d1, d2) {
|
|
37
|
+
const xDistance = d2.x - d1.x, yDistance = d2.y - d1.y;
|
|
38
|
+
return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2));
|
|
39
|
+
}
|
|
40
|
+
__name(calculateDistance, "calculateDistance");
|
|
41
|
+
function calculateDistanceWithRadius(x1, y1, r1, x2, y2, r2) {
|
|
42
|
+
const dx = x2 - x1, dy = y2 - y1;
|
|
43
|
+
return Math.sqrt(dx * dx + dy * dy) - (r1 + r2);
|
|
44
|
+
}
|
|
45
|
+
__name(calculateDistanceWithRadius, "calculateDistanceWithRadius");
|
|
46
|
+
export {
|
|
47
|
+
smoothstep as a,
|
|
48
|
+
smootherstep as b,
|
|
49
|
+
clamp as c,
|
|
50
|
+
damp as d,
|
|
51
|
+
calculateDistance as e,
|
|
52
|
+
calculateDistanceWithRadius as f,
|
|
53
|
+
lerp as l,
|
|
54
|
+
mapRange as m,
|
|
55
|
+
round as r,
|
|
56
|
+
step as s
|
|
57
|
+
};
|
package/lib/media/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const order_index=require("../order/index.cjs"),windowResizer_index=require("../window-resizer/index.cjs"),Store=require("../Store-BCW70G3Z.cjs");require("construct-style-sheets-polyfill");require("../index-BpO2RJ__.cjs");var _query,_unsubscribeFromwindowResizer;const _Media=class _Media extends Store.Store{constructor(query){super(!1);__privateAdd(this,_query);__privateAdd(this,_unsubscribeFromwindowResizer);__privateSet(this,_query,query);const callback=__name(()=>{matchMedia(__privateGet(this,_query)).matches?this.current=!0:this.current=!1},"callback");__privateSet(this,_unsubscribeFromwindowResizer,windowResizer_index.windowResizer.subscribe(callback,order_index.RESIZE_ORDER.MEDIA)),callback()}close(){super.close(),__privateGet(this,_unsubscribeFromwindowResizer).call(this)}};_query=new WeakMap,_unsubscribeFromwindowResizer=new WeakMap,__name(_Media,"Media");let Media=_Media;exports.Media=Media;
|
package/lib/media/index.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
3
4
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
6
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
7
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
|
+
import { RESIZE_ORDER } from "../order/index.js";
|
|
9
|
+
import { windowResizer } from "../window-resizer/index.js";
|
|
10
|
+
import { S as Store } from "../Store-uLDYY9ed.js";
|
|
9
11
|
import "construct-style-sheets-polyfill";
|
|
10
|
-
import "../index-
|
|
11
|
-
var
|
|
12
|
-
class
|
|
13
|
-
constructor(
|
|
12
|
+
import "../index-DpKsHe97.js";
|
|
13
|
+
var _query, _unsubscribeFromwindowResizer;
|
|
14
|
+
const _Media = class _Media extends Store {
|
|
15
|
+
constructor(query) {
|
|
14
16
|
super(!1);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
matchMedia(
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)),
|
|
17
|
+
__privateAdd(this, _query);
|
|
18
|
+
__privateAdd(this, _unsubscribeFromwindowResizer);
|
|
19
|
+
__privateSet(this, _query, query);
|
|
20
|
+
const callback = /* @__PURE__ */ __name(() => {
|
|
21
|
+
matchMedia(__privateGet(this, _query)).matches ? this.current = !0 : this.current = !1;
|
|
22
|
+
}, "callback");
|
|
23
|
+
__privateSet(this, _unsubscribeFromwindowResizer, windowResizer.subscribe(
|
|
24
|
+
callback,
|
|
25
|
+
RESIZE_ORDER.MEDIA
|
|
26
|
+
)), callback();
|
|
25
27
|
}
|
|
26
28
|
close() {
|
|
27
|
-
super.close(),
|
|
29
|
+
super.close(), __privateGet(this, _unsubscribeFromwindowResizer).call(this);
|
|
28
30
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
+
};
|
|
32
|
+
_query = new WeakMap(), _unsubscribeFromwindowResizer = new WeakMap(), __name(_Media, "Media");
|
|
33
|
+
let Media = _Media;
|
|
31
34
|
export {
|
|
32
|
-
|
|
35
|
+
Media
|
|
33
36
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
3
|
+
function formatMediaDuration(seconds) {
|
|
4
|
+
if (isNaN(seconds)) return "0:00";
|
|
5
|
+
const totalSeconds = Math.floor(Math.max(0, seconds)), hours = Math.floor(totalSeconds / 3600), minutes = Math.floor(totalSeconds % 3600 / 60), formattedSecs = (totalSeconds % 60).toString().padStart(2, "0");
|
|
6
|
+
if (hours > 0) {
|
|
7
|
+
const formattedMins = minutes.toString().padStart(2, "0");
|
|
8
|
+
return `${hours}:${formattedMins}:${formattedSecs}`;
|
|
9
|
+
} else
|
|
10
|
+
return `${minutes}:${formattedSecs}`;
|
|
11
|
+
}
|
|
12
|
+
__name(formatMediaDuration, "formatMediaDuration");
|
|
13
|
+
export {
|
|
14
|
+
formatMediaDuration as f
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});function formatMediaDuration(seconds){if(isNaN(seconds))return"0:00";const totalSeconds=Math.floor(Math.max(0,seconds)),hours=Math.floor(totalSeconds/3600),minutes=Math.floor(totalSeconds%3600/60),formattedSecs=(totalSeconds%60).toString().padStart(2,"0");if(hours>0){const formattedMins=minutes.toString().padStart(2,"0");return`${hours}:${formattedMins}:${formattedSecs}`}else return`${minutes}:${formattedSecs}`}__name(formatMediaDuration,"formatMediaDuration");exports.formatMediaDuration=formatMediaDuration;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ge=Object.defineProperty,Ee=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var te=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable;var ee=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),ae=o=>{throw TypeError(o)};var se=(o,e,s)=>e in o?ge(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,Ht=(o,e)=>{for(var s in e||(e={}))Le.call(e,s)&&se(o,s,e[s]);if(te)for(var s of te(e))Se.call(e,s)&&se(o,s,e[s]);return o},zt=(o,e)=>Ee(o,ve(e));var It=(o,e,s)=>e.has(o)||ae("Cannot "+s);var t=(o,e,s)=>(It(o,e,"read from private field"),s?s.call(o):e.get(o)),h=(o,e,s)=>e.has(o)?ae("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,s),r=(o,e,s,a)=>(It(o,e,"write to private field"),a?a.call(o,s):e.set(o,s),s),y=(o,e,s)=>(It(o,e,"access private method"),s);var J=(o,e,s)=>new Promise((a,l)=>{var v=c=>{try{f(s.next(c))}catch(p){l(p)}},S=c=>{try{f(s.throw(c))}catch(p){l(p)}},f=c=>c.done?a(c.value):Promise.resolve(c.value).then(v,S);f((s=s.apply(o,e)).next())});var ie=(o,e,s)=>(e=o[ee("asyncIterator")])?e.call(o):(o=o[ee("iterator")](),e={},s=(a,l)=>(l=o[a])&&(e[a]=v=>new Promise((S,f,c)=>(v=l.call(o,v),c=v.done,Promise.resolve(v.value).then(p=>S({value:p,done:c}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("../index-OE2INULi.cjs"),ft=require("../dom-CBLlqORw.cjs"),z=require("../events-KVanG9sR.cjs"),ne=require("../scroll-BA2WnUrb.cjs");require("construct-style-sheets-polyfill");const pt=require("../url-CHgcNwJ1.cjs"),ye=require("../css-value-parser/index.cjs"),he=require("../string-DUXXtU8v.cjs");class le extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",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"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}oe.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",le);var M,i,D,it,ce,vt,nt;class Vt{constructor(e,s){h(this,D);h(this,M);h(this,i);h(this,vt,e=>{e.preventDefault(),y(this,D,ce).call(this)});h(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,M).prefetch(t(this,D,it),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});r(this,M,s),r(this,i,e),t(this,i).addEventListener("click",t(this,vt)),this.checkCurrent(location.href.replace(location.origin,"")),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var p,st;const s=t(this,M).normalizePath(e),a=t(this,M).normalizePath(t(this,D,it));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");const[l,v]=(st=t(this,D,it).split("#")[0])==null?void 0:st.split("?"),S=new URLSearchParams(v),f=new URLSearchParams(location.search);let c=0;for(const[A]of f)S.has(A)&&f.get(A)===S.get(A)&&c++;c?(t(this,i).classList.toggle("all-params-matched",f.size===c),t(this,i).classList.toggle("some-params-matched",f.size!==c)):!f.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const A in t(this,i).dataset){const at=he.camelToKebab(A);if(at.startsWith("match-param-")){const q=at.split("match-param-")[1],w=t(this,i).dataset[A],F=`param-${q}-matched`;f.has(q)&&f.get(q)===w||!f.has(q)&&(w===""||w==="*"||w==="all"||w==="any"||w==="vse")?t(this,i).classList.add(F):t(this,i).classList.remove(F)}}}destroy(){t(this,i).removeEventListener("click",t(this,vt)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact")}}M=new WeakMap,i=new WeakMap,D=new WeakSet,it=function(){const e=new URL(t(this,i).href);return t(this,M).normalizePath(e.pathname+e.search+e.hash).path},ce=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,M).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",l=t(this,i).hasAttribute("data-center-scroll"),v=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),S=v?ye.cssValueParser.parse(v):void 0,f=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),c=t(this,i).hasAttribute("data-keep-search-parameters"),p=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),st=t(this,i).getAttribute("data-scroll-behaviour"),A=(s=t(this,i).getAttribute("data-submorph")||t(this,i).getAttribute("data-submorph-append"))==null?void 0:s.split(",").map(w=>w.trim()),at=t(this,i).hasAttribute("data-clear-state");let q=t(this,D,it);if(t(this,i).hasAttribute("data-toggle-params")){const[w,F]=t(this,D,it).split("?"),Rt=new URLSearchParams(F),X=new URLSearchParams(location.search),d=new URLSearchParams;for(const[R]of Rt)(!X.has(R)||X.has(R)&&X.get(R)!==Rt.get(R))&&d.append(R,Rt.get(R));if(t(this,i).hasAttribute("data-merge-params"))for(const[R]of X)Rt.has(R)||d.append(R,X.get(R));q=`${w}?${d.toString()}`}t(this,M).navigate(q,{historyAction:a,centerScroll:l,offsetScroll:S,revalidate:f,keepSearchParameters:c,submorph:A,clearState:at,keepScrollPosition:p,scrollBehaviour:st,submorphAppend:t(this,i).hasAttribute("data-submorph-append"),mergeParams:t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params"),detail:t(this,i).getAttribute("data-detail"),removeParams:t(this,i).getAttribute("data-remove-params")||void 0,scrollTo:t(this,i).getAttribute("data-scroll-to")||void 0})}},vt=new WeakMap,nt=new WeakMap;var C,rt,Lt,Wt,St;class be{constructor(e){h(this,Lt);h(this,C);h(this,rt,[]);h(this,St,()=>{y(this,Lt,Wt).call(this)});r(this,C,e);for(const s in t(this,C).dataset){const a=he.camelToKebab(s);if(a.startsWith("param-")){const l=a.split("param-")[1],v=t(this,C).dataset[s];t(this,rt).push({name:l,value:v})}}document.addEventListener("morphURLParametersChange",t(this,St)),y(this,Lt,Wt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,St))}}C=new WeakMap,rt=new WeakMap,Lt=new WeakSet,Wt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,rt).find(l=>e.has(l.name)&&(e.get(l.name)===l.value||l.value==="*"||l.value==="all"||l.value==="any"||l.value==="vse"||e.get(l.name)==="*"||e.get(l.name)==="all"||e.get(l.name)==="any"||e.get(l.name)==="vse"));!s&&t(this,C).hasAttribute("data-match-no-params")&&(s=!t(this,rt).filter(l=>e.has(l.name)).length);const a=t(this,C).getAttribute("data-hide-class");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"},St=new WeakMap;const we=new DOMParser;var I,Q,U,V,Z,Y,ot,_,$,yt,ht;class re{constructor(e,s){h(this,I);h(this,Q);h(this,U,{x:0,y:0});h(this,V,null);h(this,Z,null);h(this,Y,null);h(this,ot,null);h(this,_,null);h(this,$,null);h(this,yt);h(this,ht,!1);r(this,I,e),r(this,Q,s)}get pathname(){return t(this,Q)}get scrollState(){return t(this,U)}get document(){return t(this,Y)}needRavalidation(){r(this,ht,!0)}setHeaders(e){r(this,yt,e)}setInitialDocument(e){r(this,V,e.cloneNode(!0))}abort(){var e;return(e=t(this,_))==null?void 0:e.abort(`[${t(this,Q)}] page loading cancelled`)}fetch(e,s,a){return J(this,null,function*(){var l;if(!a&&!t(this,ht)){const f=((l=t(this,V))==null?void 0:l.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,V)&&t(this,I).isPopstateNavigation;if(t(this,$)||f||c)return t(this,$)}return r(this,$,new Promise(v=>J(this,null,function*(){try{r(this,_,new AbortController);const f=yield(yield fetch(e,{signal:t(this,_).signal,headers:Ht({"X-MORPH":"true","X-MORPH-REVALIDATE":a?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,yt))})).text(),c=we.parseFromString(f,"text/html");this.setInitialDocument(c),r(this,ht,!1)}catch(S){console.warn(S)}finally{r(this,_,null),r(this,$,null),v()}}))),t(this,$)})}cloneDocument(){r(this,Y,(t(this,Z)||t(this,V)).cloneNode(!0))}get title(){let e="";if(t(this,Y).title)e=t(this,Y).title;else{const s=t(this,Y).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,Q)}return e}clearScrollState(){t(this,U).x=0,t(this,U).y=0}clearDocumentState(){r(this,Z,null)}saveScrollState(){t(this,V).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,U).x=0,t(this,U).y=0):(t(this,U).x=t(this,I).scrollValue.left,t(this,U).y=t(this,I).scrollValue.top)}restoreScrollPosition(){t(this,I).scrollElement.scroll({top:t(this,U).y,left:t(this,U).x,behavior:"instant"})}saveDocumentState(){t(this,V).documentElement.hasAttribute("data-no-page-restoration")?r(this,Z,null):r(this,Z,document.cloneNode(!0))}renewScrollPosition(){t(this,I).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,ot,e)}clearState(){const e=t(this,ot);return r(this,ot,null),e}}I=new WeakMap,Q=new WeakMap,U=new WeakMap,V=new WeakMap,Z=new WeakMap,Y=new WeakMap,ot=new WeakMap,_=new WeakMap,$=new WeakMap,yt=new WeakMap,ht=new WeakMap;var T,lt,b,j,m,tt,W,G,H,bt,O,wt,et,ct,dt,Pt,ut,At,kt,E,gt,Ft,Xt,Kt,Nt,Mt,mt;const Et=class Et{constructor(e){h(this,E);h(this,T,null);h(this,lt,null);h(this,b,[]);h(this,j);h(this,m,null);h(this,tt);h(this,W,[]);h(this,G,!1);h(this,H,null);h(this,bt,!1);h(this,O,new Map);h(this,wt,[]);h(this,et,null);h(this,ct,0);h(this,dt,0);h(this,Pt);h(this,ut);h(this,At);h(this,kt,e=>{var s,a;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"});h(this,Mt,e=>J(this,null,function*(){e.preventDefault(),r(this,G,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,ut)?void 0:t(this,Pt),revalidate:t(this,ut),keepScrollPosition:t(this,At)}),r(this,G,!1)}));h(this,mt,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,dt),l=e-t(this,ct);r(this,dt,s),r(this,ct,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",l>0),document.documentElement.classList.toggle("scroll-x-backward",l<0),z.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(oe.isBrowser&&!Et.instance){Et.instance=this,r(this,T,{base:pt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,lt,y(this,E,Ft).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);r(this,m,s);const a=new re(this,t(this,m).pathname);a.setInitialDocument(document),t(this,O).set(t(this,m).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Mt)),pt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,et,new le),y(this,E,Kt).call(this,document)}}get currentURL(){return t(this,m)}get previousURL(){return t(this,tt)}get links(){return t(this,b)}get scrollElement(){return t(this,H)}get isPopstateNavigation(){return t(this,G)}get scrollValue(){let e=0,s=0;return t(this,bt)?(e=window.scrollY,s=window.scrollX):(e=t(this,H).scrollTop,s=t(this,H).scrollLeft),{top:e,left:s}}get isNavigating(){return!!t(this,W).length}saveState(e){const s=t(this,O).get(t(this,m).path);s&&s.saveState(e)}getState(){const e=t(this,O).get(t(this,m).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return pt.splitPath(e,{base:t(this,T).base,trailingSlash:t(this,T).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:"",removeParams:s==null?void 0:s.removeParams})}prefetch(e,s){return J(this,null,function*(){var l;if(t(this,W).length)return;e=((l=this.pathnameModifier)==null?void 0:l.call(this,e))||e;const a=y(this,E,gt).call(this,e);a==null||a.fetch(e,t(this,m).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),a=y(this,E,gt).call(this,s.path);a==null||a.needRavalidation()}navigate(Rt){return J(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:l,scrollBehaviour:v,revalidate:S,keepSearchParameters:f,submorph:c,submorphAppend:p,clearState:st,keepScrollPosition:A,mergeParams:at,removeParams:q,detail:w,scrollTo:F}={}){var R,Bt,Yt,$t;if(t(this,W).length)return;r(this,Pt,c),r(this,ut,S),r(this,At,A);const X=((R=this.pathnameModifier)==null?void 0:R.call(this,e))||e,d=this.normalizePath(X,{mergeParams:at,removeParams:q});if(!S&&(((Bt=t(this,j))==null?void 0:Bt.pathname)===d.pathname||t(this,m).pathname===d.pathname)){A||y(this,E,Nt).call(this,F||d.hash||0,{centerScroll:a,offsetScroll:l,behavior:"smooth"}),z.dispatchEvent(document,"morphSamePath",{detail:{detail:w}}),((Yt=t(this,m))==null?void 0:Yt.parameters)!==d.parameters&&(r(this,tt,t(this,m)),r(this,m,d),pt.changeHistory({action:(($t=t(this,m))==null?void 0:$t.hash)!==d.hash?"replace":s,pathname:d.pathname,searchParameters:d.parameters,hash:d.hash}),z.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,m),previousURL:t(this,tt),detail:w}})),t(this,b).forEach(K=>{K.checkCurrent(d.path)});return}else t(this,b).forEach(K=>{K.checkCurrent(d.path)});r(this,j,d);try{let K=!0;if(this.preprocessor)try{yield new Promise((n,P)=>{var x;(x=this.preprocessor)==null||x.call(this,{url:d,resolve:n,reject:P,submorph:c,detail:w})})}catch(n){n?console.error(n):console.log("Route change canceled"),K=!1}if(!K||t(this,j).pathname!==d.pathname){t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)});return}const jt={url:d,submorph:c,detail:w};c?p||c.forEach(n=>{document.querySelectorAll(n).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,lt).forEach(n=>{var P,x;(P=n.firstElementChild)==null||P.classList.add("out"),(x=n.firstElementChild)==null||x.setAttribute("data-morph-out","")}),z.dispatchEvent(document,"morphNavigation",{detail:jt});const Tt=y(this,E,gt).call(this,t(this,m).pathname),L=y(this,E,gt).call(this,d.pathname);if(t(this,O).forEach(n=>{n.pathname!==d.pathname&&n.abort()}),yield L==null?void 0:L.fetch(X,t(this,m).path,S),t(this,j).pathname!==d.pathname){t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)});return}Tt.clearState(),Tt.saveScrollState(),Tt.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));const Ct=zt(Ht({},jt),{document:L.document});p||Ct.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),z.dispatchEvent(document,"morphStart",{detail:Ct});const Gt=Array.from(document.head.children),Jt=Array.from(L.document.head.children),Qt=ft.intersectElements(Gt,Jt),de=ft.excludeElements(Gt,Qt),Ut=ft.excludeElements(Jt,Qt).filter(n=>!this.excludeHeadChild(n));Ut.forEach((n,P)=>{n.tagName==="SCRIPT"&&(Ut[P]=ft.createScriptElement(n))}),Ut.forEach(n=>{document.head.appendChild(n)});const Dt=Ut.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(y(this,E,Xt).call(this,n))return!0});t(this,T).waitForHeadToLoad&&Dt.length&&(yield new Promise(n=>J(this,null,function*(){let P=0;try{for(var x=ie(Dt),me,B,N;me=!(B=yield x.next()).done;me=!1){const xt=B.value;xt.onload=()=>{P++,P===Dt.length&&n()}}}catch(B){N=[B]}finally{try{me&&(B=x.return)&&(yield B.call(x))}finally{if(N)throw N[0]}}}))),yield ne.wait(10);const Zt=[];p||de.forEach(n=>{n.hasAttribute("data-permanent")||(y(this,E,Xt).call(this,n)?Zt.push(n):n.remove())});const ue=y(this,E,Ft).call(this,L.document.body);!t(this,T).morphInsideScrollContainer&&!c&&y(this,E,Kt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",d.pathname),document.documentElement.setAttribute("data-current-leaf",d.leaf),pt.changeHistory({action:s,pathname:d.pathname,searchParameters:d.parameters||(f?location.search:""),hash:d.hash}),t(this,et).remove(),r(this,tt,t(this,m)),r(this,m,d);const qt=[];t(this,lt).forEach((n,P)=>{const x=ue[P],me=getComputedStyle(n).getPropertyValue("--morph-duration");let B=[],N=[];c?(c.forEach(u=>{const g=n.querySelector(u),k=x.querySelector(u);g&&k&&(N.push(g),B.push(k))}),N.forEach(u=>{u.parentElement&&qt.push(u.parentElement)})):(B.push(...x.childNodes),N.push(...n.childNodes),qt.push(n));const xt=[];p||N.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"),u.querySelectorAll("[data-morph-transfer]").forEach(k=>{const pe=k.getAttribute("data-morph-transfer");xt.push({element:k,selector:pe})}))}),B.forEach(u=>{u instanceof HTMLElement&&(xt.forEach(g=>{const k=u.querySelector(g.selector);k&&k.replaceWith(L.document.importNode(g.element,!0))}),this.findNewLinks(u),u.classList.add("new"))}),c?p?B.forEach((u,g)=>{N[g]instanceof HTMLElement&&N[g].append(...u.childNodes)}):B.forEach((u,g)=>{var k;(k=N[g].parentElement)==null||k.insertBefore(u,N[g])}):n.prepend(...B),setTimeout(()=>{p||N.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),B.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})},0);const _t=zt(Ht({},Ct),{morphElement:n});z.dispatchEvent(document,"morphNewChildrenAdded",{detail:_t});const fe=new Promise(u=>{setTimeout(()=>{p||N.forEach(g=>{g.remove()}),B.forEach(g=>{var k;g instanceof HTMLElement&&((k=g.parentElement)==null||k.style.removeProperty("--new-content-height"),g.classList.remove("new-idle","new"))}),p||z.dispatchEvent(document,"morphOldChildrenRemoved",{detail:_t}),u()},(parseFloat(me)||0)*1e3+10)});t(this,W).push(fe)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-L.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),z.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:L.scrollState}),F?(L.clearScrollState(),y(this,E,Nt).call(this,F,{centerScroll:a,offsetScroll:l,behavior:v})):d.hash?(L.clearScrollState(),y(this,E,Nt).call(this,d.hash,{centerScroll:a,offsetScroll:l,behavior:v})):t(this,G)?L.restoreScrollPosition():A||L.renewScrollPosition(),yield Promise.all(t(this,W)),p||Zt.forEach(n=>n.remove()),r(this,W,[]),qt.forEach(n=>{n.querySelectorAll("script").forEach(x=>{x.replaceWith(ft.createScriptElement(x))})}),t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)}),this.findParamsDependent(),z.dispatchEvent(document,"morphComplete",{detail:Ct}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(K){console.error(K)}r(this,j,void 0)})}addLink(e){t(this,b).push(new Vt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){r(this,b,t(this,b).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){r(this,b,t(this,b).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,kt));t(this,b).push(...s.map(a=>new Vt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,kt));t(this,b).forEach(s=>s.destroy()),r(this,b,e.map(s=>new Vt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,wt).forEach(s=>s.destroy()),r(this,wt,e.map(s=>new be(s)))}};T=new WeakMap,lt=new WeakMap,b=new WeakMap,j=new WeakMap,m=new WeakMap,tt=new WeakMap,W=new WeakMap,G=new WeakMap,H=new WeakMap,bt=new WeakMap,O=new WeakMap,wt=new WeakMap,et=new WeakMap,ct=new WeakMap,dt=new WeakMap,Pt=new WeakMap,ut=new WeakMap,At=new WeakMap,kt=new WeakMap,E=new WeakSet,gt=function(e){const s=this.normalizePath(e);let a=t(this,O).get(s.pathname);return a||(a=new re(this,s.pathname),t(this,O).set(s.pathname,a)),a},Ft=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},Xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Kt=function(e){var s,a;(s=t(this,H))==null||s.removeEventListener("scroll",t(this,mt)),r(this,dt,0),r(this,ct,0),r(this,H,t(this,T).scrollSelector&&e.querySelector(t(this,T).scrollSelector)||window),r(this,bt,t(this,H)===window),(a=t(this,H))==null||a.addEventListener("scroll",t(this,mt)),t(this,mt).call(this)},Nt=function(e,s){const a=typeof e=="string"?document.querySelector(e):e;(typeof a=="number"||a)&&ne.scrollToElement(a,{scrollElement:t(this,H),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Mt=new WeakMap,mt=new WeakMap,Et.instance=null;let Ot=Et;exports.Morph=Ot;
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __knownSymbol=(name,symbol)=>(symbol=Symbol[name])?symbol:Symbol.for("Symbol."+name),__typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});var __forAwait=(obj,it,method)=>(it=obj[__knownSymbol("asyncIterator")])?it.call(obj):(obj=obj[__knownSymbol("iterator")](),it={},method=(key,fn)=>(fn=obj[key])&&(it[key]=arg=>new Promise((yes,no,done)=>(arg=fn.call(obj,arg),done=arg.done,Promise.resolve(arg.value).then(value=>yes({value,done}),no)))),method("next"),method("return"),it);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const intersector_index=require("../index-BpO2RJ__.cjs"),dom=require("../dom-B40i6NXw.cjs"),events=require("../events-UlGk63iC.cjs"),scroll=require("../scroll-CT0lpyRZ.cjs");require("construct-style-sheets-polyfill");const url=require("../url-CPCO10Sy.cjs"),cssValueParser_index=require("../css-value-parser/index.cjs"),string=require("../string-CbRNzmd9.cjs"),_MorphAnnouncer=class _MorphAnnouncer extends HTMLElement{connectedCallback(){const attrs={"aria-live":"assertive","aria-atomic":"true",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"};for(const[key,value]of Object.entries(attrs))this.setAttribute(key,value)}};__name(_MorphAnnouncer,"MorphAnnouncer");let MorphAnnouncer=_MorphAnnouncer;intersector_index.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",MorphAnnouncer);var _morph,_element,_MorphLink_instances,path_get,click_fn,_clickListener,_pointerListener;const _MorphLink=class _MorphLink{constructor(element,morph){__privateAdd(this,_MorphLink_instances);__privateAdd(this,_morph);__privateAdd(this,_element);__privateAdd(this,_clickListener,__name(e=>{e.preventDefault(),__privateMethod(this,_MorphLink_instances,click_fn).call(this)},"#clickListener"));__privateAdd(this,_pointerListener,__name(()=>{const revalidate=__privateGet(this,_element).hasAttribute("data-revalidate");__privateGet(this,_morph).prefetch(__privateGet(this,_MorphLink_instances,path_get),revalidate),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener))},"#pointerListener"));__privateSet(this,_morph,morph),__privateSet(this,_element,element),__privateGet(this,_element).addEventListener("click",__privateGet(this,_clickListener)),this.checkCurrent(location.href.replace(location.origin,"")),__privateGet(this,_element).hasAttribute("data-prefetch")&&__privateGet(this,_element).addEventListener("pointerenter",__privateGet(this,_pointerListener))}get element(){return __privateGet(this,_element)}checkCurrent(path){var _a,_b;const locationUrl=__privateGet(this,_morph).normalizePath(path),linkUrl=__privateGet(this,_morph).normalizePath(__privateGet(this,_MorphLink_instances,path_get));__privateGet(this,_element).hasAttribute("data-include")&&locationUrl.pathname.includes(linkUrl.pathname)?__privateGet(this,_element).classList.add("current"):linkUrl.pathname===locationUrl.pathname?__privateGet(this,_element).classList.add("current"):(_a=__privateGet(this,_element).getAttribute("data-associated-paths"))!=null&&_a.split(",").find(path2=>locationUrl.pathname.includes(path2))?__privateGet(this,_element).classList.add("current"):__privateGet(this,_element).classList.remove("current"),locationUrl.path===linkUrl.path?__privateGet(this,_element).classList.add("exact"):__privateGet(this,_element).classList.remove("exact");const[pathWithoutParams,pathParamsStr]=(_b=__privateGet(this,_MorphLink_instances,path_get).split("#")[0])==null?void 0:_b.split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search);let matchCounter=0;for(const[key]of locationParams)pathParams.has(key)&&locationParams.get(key)===pathParams.get(key)&&matchCounter++;matchCounter?(__privateGet(this,_element).classList.toggle("all-params-matched",locationParams.size===matchCounter),__privateGet(this,_element).classList.toggle("some-params-matched",locationParams.size!==matchCounter)):!locationParams.size&&__privateGet(this,_element).hasAttribute("data-match-no-params")?__privateGet(this,_element).classList.add("all-params-matched"):(__privateGet(this,_element).classList.remove("all-params-matched"),__privateGet(this,_element).classList.remove("some-params-matched"));for(const key in __privateGet(this,_element).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("match-param-")){const name=kebabKey.split("match-param-")[1],value=__privateGet(this,_element).dataset[key],className=`param-${name}-matched`;locationParams.has(name)&&locationParams.get(name)===value||!locationParams.has(name)&&(value===""||value==="*"||value==="all"||value==="any"||value==="vse")?__privateGet(this,_element).classList.add(className):__privateGet(this,_element).classList.remove(className)}}}destroy(){__privateGet(this,_element).removeEventListener("click",__privateGet(this,_clickListener)),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener)),__privateGet(this,_element).classList.remove("current","exact")}};_morph=new WeakMap,_element=new WeakMap,_MorphLink_instances=new WeakSet,path_get=__name(function(){const url2=new URL(__privateGet(this,_element).href);return __privateGet(this,_morph).normalizePath(url2.pathname+url2.search+url2.hash).path},"#path"),click_fn=__name(function(){var _a;if(document.documentElement.classList.contains("click-disabled"))return;if(__privateGet(this,_element).hasAttribute("data-back")&&__privateGet(this,_morph).previousURL)history.back();else{const historyAction=__privateGet(this,_element).getAttribute("data-history-action")||"push",centerScroll=__privateGet(this,_element).hasAttribute("data-center-scroll"),offsetScrollRawValue=getComputedStyle(__privateGet(this,_element)).getPropertyValue("--offset-scroll").trim(),offsetScroll=offsetScrollRawValue?cssValueParser_index.cssValueParser.parse(offsetScrollRawValue):void 0,revalidate=__privateGet(this,_element).hasAttribute("data-revalidate")||__privateGet(this,_element).hasAttribute("data-pagination-more-link")||__privateGet(this,_element).hasAttribute("data-pagination-set-link")||__privateGet(this,_element).hasAttribute("data-pagination-next-link")||__privateGet(this,_element).hasAttribute("data-pagination-prev-link"),keepSearchParameters=__privateGet(this,_element).hasAttribute("data-keep-search-parameters"),keepScrollPosition=__privateGet(this,_element).hasAttribute("data-keep-scroll-position")||__privateGet(this,_element).hasAttribute("data-pagination-more-link"),scrollBehaviour=__privateGet(this,_element).getAttribute("data-scroll-behaviour"),submorph=(_a=__privateGet(this,_element).getAttribute("data-submorph")||__privateGet(this,_element).getAttribute("data-submorph-append"))==null?void 0:_a.split(",").map(v=>v.trim()),clearState=__privateGet(this,_element).hasAttribute("data-clear-state");let path=__privateGet(this,_MorphLink_instances,path_get);if(__privateGet(this,_element).hasAttribute("data-toggle-params")){const[pathWithoutParams,pathParamsStr]=__privateGet(this,_MorphLink_instances,path_get).split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search),resultParams=new URLSearchParams;for(const[key]of pathParams)(!locationParams.has(key)||locationParams.has(key)&&locationParams.get(key)!==pathParams.get(key))&&resultParams.append(key,pathParams.get(key));if(__privateGet(this,_element).hasAttribute("data-merge-params"))for(const[key]of locationParams)pathParams.has(key)||resultParams.append(key,locationParams.get(key));path=`${pathWithoutParams}?${resultParams.toString()}`}__privateGet(this,_morph).navigate(path,{historyAction,centerScroll,offsetScroll,revalidate,keepSearchParameters,submorph,clearState,keepScrollPosition,scrollBehaviour,submorphAppend:__privateGet(this,_element).hasAttribute("data-submorph-append"),mergeParams:__privateGet(this,_element).hasAttribute("data-merge-params")&&!__privateGet(this,_element).hasAttribute("data-toggle-params"),detail:__privateGet(this,_element).getAttribute("data-detail"),removeParams:__privateGet(this,_element).getAttribute("data-remove-params")||void 0,scrollTo:__privateGet(this,_element).getAttribute("data-scroll-to")||void 0})}},"#click"),_clickListener=new WeakMap,_pointerListener=new WeakMap,__name(_MorphLink,"MorphLink");let MorphLink=_MorphLink;var _element2,_params,_MorphParamsDependent_instances,update_fn,_urlChangeListener;const _MorphParamsDependent=class _MorphParamsDependent{constructor(element){__privateAdd(this,_MorphParamsDependent_instances);__privateAdd(this,_element2);__privateAdd(this,_params,[]);__privateAdd(this,_urlChangeListener,__name(()=>{__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)},"#urlChangeListener"));__privateSet(this,_element2,element);for(const key in __privateGet(this,_element2).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("param-")){const name=kebabKey.split("param-")[1],value=__privateGet(this,_element2).dataset[key];__privateGet(this,_params).push({name,value})}}document.addEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener)),__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener))}};_element2=new WeakMap,_params=new WeakMap,_MorphParamsDependent_instances=new WeakSet,update_fn=__name(function(){const locationParams=new URLSearchParams(location.search);let matched=!!__privateGet(this,_params).find(param=>locationParams.has(param.name)&&(locationParams.get(param.name)===param.value||param.value==="*"||param.value==="all"||param.value==="any"||param.value==="vse"||locationParams.get(param.name)==="*"||locationParams.get(param.name)==="all"||locationParams.get(param.name)==="any"||locationParams.get(param.name)==="vse"));!matched&&__privateGet(this,_element2).hasAttribute("data-match-no-params")&&(matched=!__privateGet(this,_params).filter(param=>locationParams.has(param.name)).length);const hideClass=__privateGet(this,_element2).getAttribute("data-hide-class");matched?hideClass?__privateGet(this,_element2).classList.remove(hideClass):__privateGet(this,_element2).style.display="":hideClass?__privateGet(this,_element2).classList.add(hideClass):__privateGet(this,_element2).style.display="none"},"#update"),_urlChangeListener=new WeakMap,__name(_MorphParamsDependent,"MorphParamsDependent");let MorphParamsDependent=_MorphParamsDependent;const domParser=new DOMParser;var _morph2,_pathname,_scrollState,_initialDocument,_modifiedDocument,_currentDocument,_savedState,_abortController,_fetching,_headers,_needRavalidation;const _MorphRoute=class _MorphRoute{constructor(morph,pathname){__privateAdd(this,_morph2);__privateAdd(this,_pathname);__privateAdd(this,_scrollState,{x:0,y:0});__privateAdd(this,_initialDocument,null);__privateAdd(this,_modifiedDocument,null);__privateAdd(this,_currentDocument,null);__privateAdd(this,_savedState,null);__privateAdd(this,_abortController,null);__privateAdd(this,_fetching,null);__privateAdd(this,_headers);__privateAdd(this,_needRavalidation,!1);__privateSet(this,_morph2,morph),__privateSet(this,_pathname,pathname)}get pathname(){return __privateGet(this,_pathname)}get scrollState(){return __privateGet(this,_scrollState)}get document(){return __privateGet(this,_currentDocument)}needRavalidation(){__privateSet(this,_needRavalidation,!0)}setHeaders(headers){__privateSet(this,_headers,headers)}setInitialDocument(document2){__privateSet(this,_initialDocument,document2.cloneNode(!0))}abort(){var _a;return(_a=__privateGet(this,_abortController))==null?void 0:_a.abort(`[${__privateGet(this,_pathname)}] page loading cancelled`)}fetch(path,currentPath,revalidate){return __async(this,null,function*(){var _a;if(!revalidate&&!__privateGet(this,_needRavalidation)){const shouldUseCache=((_a=__privateGet(this,_initialDocument))==null?void 0:_a.documentElement.getAttribute("data-cache"))&¤tPath!==path,isPopstateNavigation=__privateGet(this,_initialDocument)&&__privateGet(this,_morph2).isPopstateNavigation;if(__privateGet(this,_fetching)||shouldUseCache||isPopstateNavigation)return __privateGet(this,_fetching)}return __privateSet(this,_fetching,new Promise(res=>__async(this,null,function*(){try{__privateSet(this,_abortController,new AbortController);const text=yield(yield fetch(path,{signal:__privateGet(this,_abortController).signal,headers:__spreadValues({"X-MORPH":"true","X-MORPH-REVALIDATE":revalidate?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(currentPath),"X-MORPH-NEW-PATH":encodeURIComponent(path)},__privateGet(this,_headers))})).text(),document2=domParser.parseFromString(text,"text/html");this.setInitialDocument(document2),__privateSet(this,_needRavalidation,!1)}catch(e){console.warn(e)}finally{__privateSet(this,_abortController,null),__privateSet(this,_fetching,null),res()}}))),__privateGet(this,_fetching)})}cloneDocument(){__privateSet(this,_currentDocument,(__privateGet(this,_modifiedDocument)||__privateGet(this,_initialDocument)).cloneNode(!0))}get title(){let title="";if(__privateGet(this,_currentDocument).title)title=__privateGet(this,_currentDocument).title;else{const h1=__privateGet(this,_currentDocument).querySelector("h1");title=(h1==null?void 0:h1.innerText)||(h1==null?void 0:h1.textContent)||__privateGet(this,_pathname)}return title}clearScrollState(){__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0}clearDocumentState(){__privateSet(this,_modifiedDocument,null)}saveScrollState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-scroll-restoration")?(__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0):(__privateGet(this,_scrollState).x=__privateGet(this,_morph2).scrollValue.left,__privateGet(this,_scrollState).y=__privateGet(this,_morph2).scrollValue.top)}restoreScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:__privateGet(this,_scrollState).y,left:__privateGet(this,_scrollState).x,behavior:"instant"})}saveDocumentState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-page-restoration")?__privateSet(this,_modifiedDocument,null):__privateSet(this,_modifiedDocument,document.cloneNode(!0))}renewScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(state){__privateSet(this,_savedState,state)}clearState(){const state=__privateGet(this,_savedState);return __privateSet(this,_savedState,null),state}};_morph2=new WeakMap,_pathname=new WeakMap,_scrollState=new WeakMap,_initialDocument=new WeakMap,_modifiedDocument=new WeakMap,_currentDocument=new WeakMap,_savedState=new WeakMap,_abortController=new WeakMap,_fetching=new WeakMap,_headers=new WeakMap,_needRavalidation=new WeakMap,__name(_MorphRoute,"MorphRoute");let MorphRoute=_MorphRoute;var _options,_morphElements,_links,_candidateURL,_currentURL,_previousURL,_promises,_isPopstateNavigation,_currentScrollElement,_isWindowScroll,_routes,_paramDependent,_announcer,_currentScrollX,_currentScrollY,_lastSubmorph,_lastRevalidate,_lastKeepScrollPosition,_checkLink,_Morph_instances,getRoute_fn,getMorphElements_fn,isElementEmitsLoadEvent_fn,updateCurrentScrollElement_fn,tryScrollToElement_fn,_popStateListener,_scrollListener;const _Morph=class _Morph{constructor(parameters){__privateAdd(this,_Morph_instances);__privateAdd(this,_options,null);__privateAdd(this,_morphElements,null);__privateAdd(this,_links,[]);__privateAdd(this,_candidateURL);__privateAdd(this,_currentURL,null);__privateAdd(this,_previousURL);__privateAdd(this,_promises,[]);__privateAdd(this,_isPopstateNavigation,!1);__privateAdd(this,_currentScrollElement,null);__privateAdd(this,_isWindowScroll,!1);__privateAdd(this,_routes,new Map);__privateAdd(this,_paramDependent,[]);__privateAdd(this,_announcer,null);__privateAdd(this,_currentScrollX,0);__privateAdd(this,_currentScrollY,0);__privateAdd(this,_lastSubmorph);__privateAdd(this,_lastRevalidate);__privateAdd(this,_lastKeepScrollPosition);__privateAdd(this,_checkLink,__name(element=>{var _a,_b;return(((_a=element.getAttribute("href"))==null?void 0:_a.startsWith("/"))||((_b=element.getAttribute("href"))==null?void 0:_b.startsWith("?")))&&!element.hasAttribute("download")&&!element.hasAttribute("data-morph-skip")&&!element.closest("[data-morph-skip]")&&element.getAttribute("target")!=="_blank"},"#checkLink"));__privateAdd(this,_popStateListener,__name(event=>__async(this,null,function*(){event.preventDefault(),__privateSet(this,_isPopstateNavigation,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:__privateGet(this,_lastRevalidate)?void 0:__privateGet(this,_lastSubmorph),revalidate:__privateGet(this,_lastRevalidate),keepScrollPosition:__privateGet(this,_lastKeepScrollPosition)}),__privateSet(this,_isPopstateNavigation,!1)}),"#popStateListener"));__privateAdd(this,_scrollListener,__name(()=>{const{left,top}=this.scrollValue,directionY=top-__privateGet(this,_currentScrollY),directionX=left-__privateGet(this,_currentScrollX);__privateSet(this,_currentScrollY,top),__privateSet(this,_currentScrollX,left),document.documentElement.classList.toggle("scroll-y",top>0),document.documentElement.classList.toggle("scroll-x",left>0),document.documentElement.classList.toggle("scroll-y-forward",directionY>0),document.documentElement.classList.toggle("scroll-y-backward",directionY<0),document.documentElement.classList.toggle("scroll-x-forward",directionX>0),document.documentElement.classList.toggle("scroll-x-backward",directionX<0),events.dispatchEvent(document,"morphScroll",{detail:{left,top}})},"#scrollListener"));if(intersector_index.isBrowser&&!_Morph.instance){_Morph.instance=this,__privateSet(this,_options,{base:url.normalizeBase(parameters==null?void 0:parameters.base),waitForHeadToLoad:(parameters==null?void 0:parameters.waitForHeadToLoad)!==!1,trailingSlash:(parameters==null?void 0:parameters.trailingSlash)||!1,scrollSelector:parameters==null?void 0:parameters.scrollSelector,morphInsideScrollContainer:(parameters==null?void 0:parameters.morphInsideScrollContainer)||!1}),__privateSet(this,_morphElements,__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,document.body));const normalizedURL=this.normalizePath(location.pathname+location.search+location.hash);__privateSet(this,_currentURL,normalizedURL);const initialRoute=new MorphRoute(this,__privateGet(this,_currentURL).pathname);initialRoute.setInitialDocument(document),__privateGet(this,_routes).set(__privateGet(this,_currentURL).pathname,initialRoute),document.documentElement.setAttribute("data-current-pathname",__privateGet(this,_currentURL).pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",__privateGet(this,_popStateListener)),url.changeHistory({action:"replace",pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),__privateSet(this,_announcer,new MorphAnnouncer),__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,document)}}get currentURL(){return __privateGet(this,_currentURL)}get previousURL(){return __privateGet(this,_previousURL)}get links(){return __privateGet(this,_links)}get scrollElement(){return __privateGet(this,_currentScrollElement)}get isPopstateNavigation(){return __privateGet(this,_isPopstateNavigation)}get scrollValue(){let top=0,left=0;return __privateGet(this,_isWindowScroll)?(top=window.scrollY,left=window.scrollX):(top=__privateGet(this,_currentScrollElement).scrollTop,left=__privateGet(this,_currentScrollElement).scrollLeft),{top,left}}get isNavigating(){return!!__privateGet(this,_promises).length}saveState(state){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);route&&route.saveState(state)}getState(){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);return route==null?void 0:route.clearState()}normalizePath(path,options){return url.splitPath(path,{base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash,mergeParams:options!=null&&options.mergeParams?location.search:"",removeParams:options==null?void 0:options.removeParams})}prefetch(path,revalidate){return __async(this,null,function*(){var _a;if(__privateGet(this,_promises).length)return;path=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path;const route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,path);route==null||route.fetch(path,__privateGet(this,_currentURL).path,revalidate)})}excludeHeadChild(child){return!1}setHeaders(path){}needRavalidation(path){const normalizedURL=this.normalizePath(path),route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.path);route==null||route.needRavalidation()}navigate(_0){return __async(this,arguments,function*(path,{historyAction="push",centerScroll,offsetScroll,scrollBehaviour,revalidate,keepSearchParameters,submorph,submorphAppend,clearState,keepScrollPosition,mergeParams,removeParams,detail,scrollTo}={}){var _a,_b,_c,_d;if(__privateGet(this,_promises).length)return;__privateSet(this,_lastSubmorph,submorph),__privateSet(this,_lastRevalidate,revalidate),__privateSet(this,_lastKeepScrollPosition,keepScrollPosition);const modifiedPath=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path,normalizedURL=this.normalizePath(modifiedPath,{mergeParams,removeParams});if(!revalidate&&(((_b=__privateGet(this,_candidateURL))==null?void 0:_b.pathname)===normalizedURL.pathname||__privateGet(this,_currentURL).pathname===normalizedURL.pathname)){keepScrollPosition||__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo||normalizedURL.hash||0,{centerScroll,offsetScroll,behavior:"smooth"}),events.dispatchEvent(document,"morphSamePath",{detail:{detail}}),((_c=__privateGet(this,_currentURL))==null?void 0:_c.parameters)!==normalizedURL.parameters&&(__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL),url.changeHistory({action:((_d=__privateGet(this,_currentURL))==null?void 0:_d.hash)!==normalizedURL.hash?"replace":historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),events.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:__privateGet(this,_currentURL),previousURL:__privateGet(this,_previousURL),detail}})),__privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});return}else __privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});__privateSet(this,_candidateURL,normalizedURL);try{let preprocessedSuccesfully=!0;if(this.preprocessor)try{yield new Promise((resolve,reject)=>{var _a2;(_a2=this.preprocessor)==null||_a2.call(this,{url:normalizedURL,resolve,reject,submorph,detail})})}catch(e){e?console.error(e):console.log("Route change canceled"),preprocessedSuccesfully=!1}if(!preprocessedSuccesfully||__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}const navigationEntry={url:normalizedURL,submorph,detail};submorph?submorphAppend||submorph.forEach(sel=>{document.querySelectorAll(sel).forEach(el=>{el.classList.add("out"),el.setAttribute("data-morph-out","")})}):__privateGet(this,_morphElements).forEach(el=>{var _a2,_b2;(_a2=el.firstElementChild)==null||_a2.classList.add("out"),(_b2=el.firstElementChild)==null||_b2.setAttribute("data-morph-out","")}),events.dispatchEvent(document,"morphNavigation",{detail:navigationEntry});const currentRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,__privateGet(this,_currentURL).pathname),nextRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.pathname);if(__privateGet(this,_routes).forEach(el=>{el.pathname!==normalizedURL.pathname&&el.abort()}),yield nextRoute==null?void 0:nextRoute.fetch(modifiedPath,__privateGet(this,_currentURL).path,revalidate),__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}currentRoute.clearState(),currentRoute.saveScrollState(),currentRoute.saveDocumentState(),(!__privateGet(this,_isPopstateNavigation)||revalidate)&&(nextRoute.clearScrollState(),nextRoute.clearDocumentState()),clearState&&nextRoute.clearState(),nextRoute.cloneDocument(),__privateGet(this,_announcer).textContent=nextRoute.title,document.body.appendChild(__privateGet(this,_announcer));const documentFetchedEntry=__spreadProps(__spreadValues({},navigationEntry),{document:nextRoute.document});submorphAppend||documentFetchedEntry.document.querySelectorAll("[data-morph-out]").forEach(el=>{el.classList.remove("out")}),events.dispatchEvent(document,"morphStart",{detail:documentFetchedEntry});const currentHeadChildren=Array.from(document.head.children),newHeadChildren=Array.from(nextRoute.document.head.children),identicalHeadChildren=dom.intersectElements(currentHeadChildren,newHeadChildren),removeHeadChildren=dom.excludeElements(currentHeadChildren,identicalHeadChildren),addHeadChildren=dom.excludeElements(newHeadChildren,identicalHeadChildren).filter(child=>!this.excludeHeadChild(child));addHeadChildren.forEach((child,index)=>{child.tagName==="SCRIPT"&&(addHeadChildren[index]=dom.createScriptElement(child))}),addHeadChildren.forEach(child=>{document.head.appendChild(child)});const elementsWithLoad=addHeadChildren.filter(child=>{if(child.hasAttribute("data-no-waiting"))return!1;if(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child))return!0});__privateGet(this,_options).waitForHeadToLoad&&elementsWithLoad.length&&(yield new Promise(res=>__async(this,null,function*(){let counter=0;try{for(var iter=__forAwait(elementsWithLoad),more,temp,error;more=!(temp=yield iter.next()).done;more=!1){const element=temp.value;element.onload=()=>{counter++,counter===elementsWithLoad.length&&res()}}}catch(temp){error=[temp]}finally{try{more&&(temp=iter.return)&&(yield temp.call(iter))}finally{if(error)throw error[0]}}}))),yield scroll.wait(10);const oldElementsWithLoadEvent=[];submorphAppend||removeHeadChildren.forEach(child=>{child.hasAttribute("data-permanent")||(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child)?oldElementsWithLoadEvent.push(child):child.remove())});const newMorphElements=__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,nextRoute.document.body);!__privateGet(this,_options).morphInsideScrollContainer&&!submorph&&__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,nextRoute.document),document.documentElement.setAttribute("data-current-pathname",normalizedURL.pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),url.changeHistory({action:historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters||(keepSearchParameters?location.search:""),hash:normalizedURL.hash}),__privateGet(this,_announcer).remove(),__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL);const morphedElements=[];__privateGet(this,_morphElements).forEach((morphElement,i)=>{const newMorphElement=newMorphElements[i],duration=getComputedStyle(morphElement).getPropertyValue("--morph-duration");let newMorphElementChildNodes=[],currentMorphElementChildNodes=[];submorph?(submorph.forEach(selector=>{const curSubMorphElement=morphElement.querySelector(selector),newSubMorphElement=newMorphElement.querySelector(selector);curSubMorphElement&&newSubMorphElement&&(currentMorphElementChildNodes.push(curSubMorphElement),newMorphElementChildNodes.push(newSubMorphElement))}),currentMorphElementChildNodes.forEach(el=>{el.parentElement&&morphedElements.push(el.parentElement)})):(newMorphElementChildNodes.push(...newMorphElement.childNodes),currentMorphElementChildNodes.push(...morphElement.childNodes),morphedElements.push(morphElement));const transfer=[];submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(this.destroyOldLinks(element),element.classList.add("old"),element.querySelectorAll("[data-morph-transfer]").forEach(el=>{const selector=el.getAttribute("data-morph-transfer");transfer.push({element:el,selector})}))}),newMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(transfer.forEach(item=>{const nestlement=element.querySelector(item.selector);nestlement&&nestlement.replaceWith(nextRoute.document.importNode(item.element,!0))}),this.findNewLinks(element),element.classList.add("new"))}),submorph?submorphAppend?newMorphElementChildNodes.forEach((el,i2)=>{currentMorphElementChildNodes[i2]instanceof HTMLElement&¤tMorphElementChildNodes[i2].append(...el.childNodes)}):newMorphElementChildNodes.forEach((el,i2)=>{var _a2;(_a2=currentMorphElementChildNodes[i2].parentElement)==null||_a2.insertBefore(el,currentMorphElementChildNodes[i2])}):morphElement.prepend(...newMorphElementChildNodes),setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&element.classList.add("old-idle")}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.setProperty("--new-content-height",element.offsetHeight+"px"),element.classList.add("new-idle"))})},0);const detail2=__spreadProps(__spreadValues({},documentFetchedEntry),{morphElement});events.dispatchEvent(document,"morphNewChildrenAdded",{detail:detail2});const promise=new Promise(res=>{setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(el=>{el.remove()}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.removeProperty("--new-content-height"),element.classList.remove("new-idle","new"))}),submorphAppend||events.dispatchEvent(document,"morphOldChildrenRemoved",{detail:detail2}),res()},(parseFloat(duration)||0)*1e3+10)});__privateGet(this,_promises).push(promise)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-nextRoute.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),events.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:nextRoute.scrollState}),scrollTo?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo,{centerScroll,offsetScroll,behavior:scrollBehaviour})):normalizedURL.hash?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,normalizedURL.hash,{centerScroll,offsetScroll,behavior:scrollBehaviour})):__privateGet(this,_isPopstateNavigation)?nextRoute.restoreScrollPosition():keepScrollPosition||nextRoute.renewScrollPosition(),yield Promise.all(__privateGet(this,_promises)),submorphAppend||oldElementsWithLoadEvent.forEach(child=>child.remove()),__privateSet(this,_promises,[]),morphedElements.forEach(el=>{el.querySelectorAll("script").forEach(element=>{element.replaceWith(dom.createScriptElement(element))})}),__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)}),this.findParamsDependent(),events.dispatchEvent(document,"morphComplete",{detail:documentFetchedEntry}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(e){console.error(e)}__privateSet(this,_candidateURL,void 0)})}addLink(element){__privateGet(this,_links).push(new MorphLink(element,this))}addLinks(elements){elements.forEach(element=>{this.addLink(element)})}removeLink(element){__privateSet(this,_links,__privateGet(this,_links).filter(link=>link.element===element?(link.destroy(),!1):!0))}destroyOldLinks(morphElement){__privateSet(this,_links,__privateGet(this,_links).filter(link=>morphElement.contains(link.element)?(link.destroy(),!1):!0))}findNewLinks(morphElement){const linkElements=[...morphElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).push(...linkElements.map(element=>new MorphLink(element,this)))}findLinks(){const linkElements=[...document.documentElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).forEach(link=>link.destroy()),__privateSet(this,_links,linkElements.map(element=>new MorphLink(element,this)))}findParamsDependent(){const elements=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];__privateGet(this,_paramDependent).forEach(link=>link.destroy()),__privateSet(this,_paramDependent,elements.map(element=>new MorphParamsDependent(element)))}};_options=new WeakMap,_morphElements=new WeakMap,_links=new WeakMap,_candidateURL=new WeakMap,_currentURL=new WeakMap,_previousURL=new WeakMap,_promises=new WeakMap,_isPopstateNavigation=new WeakMap,_currentScrollElement=new WeakMap,_isWindowScroll=new WeakMap,_routes=new WeakMap,_paramDependent=new WeakMap,_announcer=new WeakMap,_currentScrollX=new WeakMap,_currentScrollY=new WeakMap,_lastSubmorph=new WeakMap,_lastRevalidate=new WeakMap,_lastKeepScrollPosition=new WeakMap,_checkLink=new WeakMap,_Morph_instances=new WeakSet,getRoute_fn=__name(function(path){const normalizedURL=this.normalizePath(path);let route=__privateGet(this,_routes).get(normalizedURL.pathname);return route||(route=new MorphRoute(this,normalizedURL.pathname),__privateGet(this,_routes).set(normalizedURL.pathname,route)),route},"#getRoute"),getMorphElements_fn=__name(function(el){const morphElements=[...el.querySelectorAll("[data-morph]")];return morphElements.length?morphElements:[el]},"#getMorphElements"),isElementEmitsLoadEvent_fn=__name(function(element){return element.tagName==="SCRIPT"||element.tagName==="STYLE"||element.tagName==="LINK"&&element.getAttribute("rel")==="stylesheet"},"#isElementEmitsLoadEvent"),updateCurrentScrollElement_fn=__name(function(document2){var _a,_b;(_a=__privateGet(this,_currentScrollElement))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),__privateSet(this,_currentScrollY,0),__privateSet(this,_currentScrollX,0),__privateSet(this,_currentScrollElement,__privateGet(this,_options).scrollSelector&&document2.querySelector(__privateGet(this,_options).scrollSelector)||window),__privateSet(this,_isWindowScroll,__privateGet(this,_currentScrollElement)===window),(_b=__privateGet(this,_currentScrollElement))==null||_b.addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_scrollListener).call(this)},"#updateCurrentScrollElement"),tryScrollToElement_fn=__name(function(id,options){const value=typeof id=="string"?document.querySelector(id):id;(typeof value=="number"||value)&&scroll.scrollToElement(value,{scrollElement:__privateGet(this,_currentScrollElement),behavior:(options==null?void 0:options.behavior)||"instant",center:options==null?void 0:options.centerScroll,offset:options==null?void 0:options.offsetScroll})},"#tryScrollToElement"),_popStateListener=new WeakMap,_scrollListener=new WeakMap,__name(_Morph,"Morph"),_Morph.instance=null;let Morph=_Morph;exports.Morph=Morph;
|