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/morph/index.js
CHANGED
|
@@ -1,787 +1,792 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
throw TypeError(
|
|
1
|
+
var __defProp = Object.defineProperty, __defProps = Object.defineProperties;
|
|
2
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name), __typeError = (msg) => {
|
|
6
|
+
throw TypeError(msg);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
__hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
11
|
+
if (__getOwnPropSymbols)
|
|
12
|
+
for (var prop of __getOwnPropSymbols(b))
|
|
13
|
+
__propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);
|
|
14
|
+
return a;
|
|
15
|
+
}, __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)), __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
16
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
17
|
+
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);
|
|
18
|
+
var __async = (__this, __arguments, generator) => new Promise((resolve, reject) => {
|
|
19
|
+
var fulfilled = (value) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
|
|
21
|
+
step(generator.next(value));
|
|
22
|
+
} catch (e) {
|
|
23
|
+
reject(e);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, rejected = (value) => {
|
|
26
26
|
try {
|
|
27
|
-
|
|
28
|
-
} catch (
|
|
29
|
-
|
|
27
|
+
step(generator.throw(value));
|
|
28
|
+
} catch (e) {
|
|
29
|
+
reject(e);
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
}, step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
32
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
33
33
|
});
|
|
34
|
-
var
|
|
35
|
-
import { i as
|
|
36
|
-
import { i as
|
|
37
|
-
import { d as
|
|
38
|
-
import { w as
|
|
34
|
+
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);
|
|
35
|
+
import { i as isBrowser } from "../index-DpKsHe97.js";
|
|
36
|
+
import { i as intersectElements, e as excludeElements, c as createScriptElement } from "../dom-D8D-_9ty.js";
|
|
37
|
+
import { d as dispatchEvent } from "../events-Ds-TuvYW.js";
|
|
38
|
+
import { w as wait, s as scrollToElement } from "../scroll-BvIWh1xB.js";
|
|
39
39
|
import "construct-style-sheets-polyfill";
|
|
40
|
-
import { a as
|
|
41
|
-
import { cssValueParser
|
|
42
|
-
import { c as
|
|
43
|
-
class
|
|
40
|
+
import { a as normalizeBase, c as changeHistory, d as splitPath } from "../url-CWCY_qe_.js";
|
|
41
|
+
import { cssValueParser } from "../css-value-parser/index.js";
|
|
42
|
+
import { c as camelToKebab } from "../string-B3lm2b7v.js";
|
|
43
|
+
const _MorphAnnouncer = class _MorphAnnouncer extends HTMLElement {
|
|
44
44
|
connectedCallback() {
|
|
45
|
-
const
|
|
45
|
+
const attrs = {
|
|
46
46
|
"aria-live": "assertive",
|
|
47
47
|
"aria-atomic": "true",
|
|
48
48
|
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"
|
|
49
49
|
};
|
|
50
|
-
for (const [
|
|
51
|
-
this.setAttribute(
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
for (const [key, value] of Object.entries(attrs))
|
|
51
|
+
this.setAttribute(key, value);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
__name(_MorphAnnouncer, "MorphAnnouncer");
|
|
55
|
+
let MorphAnnouncer = _MorphAnnouncer;
|
|
56
|
+
isBrowser && !customElements.get("morph-announcer") && customElements.define("morph-announcer", MorphAnnouncer);
|
|
57
|
+
var _morph, _element, _MorphLink_instances, path_get, click_fn, _clickListener, _pointerListener;
|
|
58
|
+
const _MorphLink = class _MorphLink {
|
|
59
|
+
constructor(element, morph) {
|
|
60
|
+
__privateAdd(this, _MorphLink_instances);
|
|
61
|
+
__privateAdd(this, _morph);
|
|
62
|
+
__privateAdd(this, _element);
|
|
63
|
+
__privateAdd(this, _clickListener, /* @__PURE__ */ __name((e) => {
|
|
64
|
+
e.preventDefault(), __privateMethod(this, _MorphLink_instances, click_fn).call(this);
|
|
65
|
+
}, "#clickListener"));
|
|
66
|
+
__privateAdd(this, _pointerListener, /* @__PURE__ */ __name(() => {
|
|
67
|
+
const revalidate = __privateGet(this, _element).hasAttribute("data-revalidate");
|
|
68
|
+
__privateGet(this, _morph).prefetch(__privateGet(this, _MorphLink_instances, path_get), revalidate), __privateGet(this, _element).removeEventListener("pointerenter", __privateGet(this, _pointerListener));
|
|
69
|
+
}, "#pointerListener"));
|
|
70
|
+
__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));
|
|
69
71
|
}
|
|
70
72
|
get element() {
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
checkCurrent(
|
|
74
|
-
var
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const [
|
|
78
|
-
let
|
|
79
|
-
for (const [
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
return __privateGet(this, _element);
|
|
74
|
+
}
|
|
75
|
+
checkCurrent(path) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const locationUrl = __privateGet(this, _morph).normalizePath(path), linkUrl = __privateGet(this, _morph).normalizePath(__privateGet(this, _MorphLink_instances, path_get));
|
|
78
|
+
__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");
|
|
79
|
+
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);
|
|
80
|
+
let matchCounter = 0;
|
|
81
|
+
for (const [key] of locationParams)
|
|
82
|
+
pathParams.has(key) && locationParams.get(key) === pathParams.get(key) && matchCounter++;
|
|
83
|
+
matchCounter ? (__privateGet(this, _element).classList.toggle(
|
|
82
84
|
"all-params-matched",
|
|
83
|
-
|
|
84
|
-
),
|
|
85
|
+
locationParams.size === matchCounter
|
|
86
|
+
), __privateGet(this, _element).classList.toggle(
|
|
85
87
|
"some-params-matched",
|
|
86
|
-
|
|
87
|
-
)) : !
|
|
88
|
-
for (const
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
|
|
88
|
+
locationParams.size !== matchCounter
|
|
89
|
+
)) : !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"));
|
|
90
|
+
for (const key in __privateGet(this, _element).dataset) {
|
|
91
|
+
const kebabKey = camelToKebab(key);
|
|
92
|
+
if (kebabKey.startsWith("match-param-")) {
|
|
93
|
+
const name = kebabKey.split("match-param-")[1], value = __privateGet(this, _element).dataset[key], className = `param-${name}-matched`;
|
|
94
|
+
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);
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
destroy() {
|
|
97
|
-
|
|
99
|
+
__privateGet(this, _element).removeEventListener("click", __privateGet(this, _clickListener)), __privateGet(this, _element).removeEventListener("pointerenter", __privateGet(this, _pointerListener)), __privateGet(this, _element).classList.remove("current", "exact");
|
|
98
100
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
|
|
101
|
+
};
|
|
102
|
+
_morph = new WeakMap(), _element = new WeakMap(), _MorphLink_instances = new WeakSet(), path_get = /* @__PURE__ */ __name(function() {
|
|
103
|
+
const url = new URL(__privateGet(this, _element).href);
|
|
104
|
+
return __privateGet(this, _morph).normalizePath(
|
|
105
|
+
url.pathname + url.search + url.hash
|
|
104
106
|
).path;
|
|
105
|
-
},
|
|
106
|
-
var
|
|
107
|
+
}, "#path"), click_fn = /* @__PURE__ */ __name(function() {
|
|
108
|
+
var _a;
|
|
107
109
|
if (document.documentElement.classList.contains("click-disabled"))
|
|
108
110
|
return;
|
|
109
|
-
if (
|
|
111
|
+
if (__privateGet(this, _element).hasAttribute("data-back") && __privateGet(this, _morph).previousURL)
|
|
110
112
|
history.back();
|
|
111
113
|
else {
|
|
112
|
-
const
|
|
114
|
+
const historyAction = __privateGet(this, _element).getAttribute(
|
|
113
115
|
"data-history-action"
|
|
114
|
-
) || "push",
|
|
116
|
+
) || "push", centerScroll = __privateGet(this, _element).hasAttribute("data-center-scroll"), offsetScrollRawValue = getComputedStyle(__privateGet(this, _element)).getPropertyValue("--offset-scroll").trim(), offsetScroll = offsetScrollRawValue ? 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(
|
|
115
117
|
"data-keep-search-parameters"
|
|
116
|
-
),
|
|
118
|
+
), keepScrollPosition = __privateGet(this, _element).hasAttribute("data-keep-scroll-position") || __privateGet(this, _element).hasAttribute("data-pagination-more-link"), scrollBehaviour = __privateGet(this, _element).getAttribute(
|
|
117
119
|
"data-scroll-behaviour"
|
|
118
|
-
),
|
|
119
|
-
let
|
|
120
|
-
if (
|
|
121
|
-
const [
|
|
122
|
-
for (const [
|
|
123
|
-
(!
|
|
124
|
-
if (
|
|
125
|
-
for (const [
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
), 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");
|
|
121
|
+
let path = __privateGet(this, _MorphLink_instances, path_get);
|
|
122
|
+
if (__privateGet(this, _element).hasAttribute("data-toggle-params")) {
|
|
123
|
+
const [pathWithoutParams, pathParamsStr] = __privateGet(this, _MorphLink_instances, path_get).split("?"), pathParams = new URLSearchParams(pathParamsStr), locationParams = new URLSearchParams(location.search), resultParams = new URLSearchParams();
|
|
124
|
+
for (const [key] of pathParams)
|
|
125
|
+
(!locationParams.has(key) || locationParams.has(key) && locationParams.get(key) !== pathParams.get(key)) && resultParams.append(key, pathParams.get(key));
|
|
126
|
+
if (__privateGet(this, _element).hasAttribute("data-merge-params"))
|
|
127
|
+
for (const [key] of locationParams)
|
|
128
|
+
pathParams.has(key) || resultParams.append(key, locationParams.get(key));
|
|
129
|
+
path = `${pathWithoutParams}?${resultParams.toString()}`;
|
|
128
130
|
}
|
|
129
|
-
|
|
130
|
-
historyAction
|
|
131
|
-
centerScroll
|
|
132
|
-
offsetScroll
|
|
133
|
-
revalidate
|
|
134
|
-
keepSearchParameters
|
|
135
|
-
submorph
|
|
136
|
-
clearState
|
|
137
|
-
keepScrollPosition
|
|
138
|
-
scrollBehaviour
|
|
139
|
-
submorphAppend:
|
|
140
|
-
mergeParams:
|
|
141
|
-
detail:
|
|
142
|
-
removeParams:
|
|
143
|
-
scrollTo:
|
|
131
|
+
__privateGet(this, _morph).navigate(path, {
|
|
132
|
+
historyAction,
|
|
133
|
+
centerScroll,
|
|
134
|
+
offsetScroll,
|
|
135
|
+
revalidate,
|
|
136
|
+
keepSearchParameters,
|
|
137
|
+
submorph,
|
|
138
|
+
clearState,
|
|
139
|
+
keepScrollPosition,
|
|
140
|
+
scrollBehaviour,
|
|
141
|
+
submorphAppend: __privateGet(this, _element).hasAttribute("data-submorph-append"),
|
|
142
|
+
mergeParams: __privateGet(this, _element).hasAttribute("data-merge-params") && !__privateGet(this, _element).hasAttribute("data-toggle-params"),
|
|
143
|
+
detail: __privateGet(this, _element).getAttribute("data-detail"),
|
|
144
|
+
removeParams: __privateGet(this, _element).getAttribute("data-remove-params") || void 0,
|
|
145
|
+
scrollTo: __privateGet(this, _element).getAttribute("data-scroll-to") || void 0
|
|
144
146
|
});
|
|
145
147
|
}
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
148
|
+
}, "#click"), _clickListener = new WeakMap(), _pointerListener = new WeakMap(), __name(_MorphLink, "MorphLink");
|
|
149
|
+
let MorphLink = _MorphLink;
|
|
150
|
+
var _element2, _params, _MorphParamsDependent_instances, update_fn, _urlChangeListener;
|
|
151
|
+
const _MorphParamsDependent = class _MorphParamsDependent {
|
|
152
|
+
constructor(element) {
|
|
153
|
+
__privateAdd(this, _MorphParamsDependent_instances);
|
|
154
|
+
__privateAdd(this, _element2);
|
|
155
|
+
__privateAdd(this, _params, []);
|
|
156
|
+
__privateAdd(this, _urlChangeListener, /* @__PURE__ */ __name(() => {
|
|
157
|
+
__privateMethod(this, _MorphParamsDependent_instances, update_fn).call(this);
|
|
158
|
+
}, "#urlChangeListener"));
|
|
159
|
+
__privateSet(this, _element2, element);
|
|
160
|
+
for (const key in __privateGet(this, _element2).dataset) {
|
|
161
|
+
const kebabKey = camelToKebab(key);
|
|
162
|
+
if (kebabKey.startsWith("param-")) {
|
|
163
|
+
const name = kebabKey.split("param-")[1], value = __privateGet(this, _element2).dataset[key];
|
|
164
|
+
__privateGet(this, _params).push({
|
|
165
|
+
name,
|
|
166
|
+
value
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
document.addEventListener(
|
|
168
171
|
"morphURLParametersChange",
|
|
169
|
-
|
|
170
|
-
),
|
|
172
|
+
__privateGet(this, _urlChangeListener)
|
|
173
|
+
), __privateMethod(this, _MorphParamsDependent_instances, update_fn).call(this);
|
|
171
174
|
}
|
|
172
175
|
destroy() {
|
|
173
176
|
document.removeEventListener(
|
|
174
177
|
"morphURLParametersChange",
|
|
175
|
-
|
|
178
|
+
__privateGet(this, _urlChangeListener)
|
|
176
179
|
);
|
|
177
180
|
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
let
|
|
182
|
-
!
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
181
|
+
};
|
|
182
|
+
_element2 = new WeakMap(), _params = new WeakMap(), _MorphParamsDependent_instances = new WeakSet(), update_fn = /* @__PURE__ */ __name(function() {
|
|
183
|
+
const locationParams = new URLSearchParams(location.search);
|
|
184
|
+
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"));
|
|
185
|
+
!matched && __privateGet(this, _element2).hasAttribute("data-match-no-params") && (matched = !__privateGet(this, _params).filter((param) => locationParams.has(param.name)).length);
|
|
186
|
+
const hideClass = __privateGet(this, _element2).getAttribute("data-hide-class");
|
|
187
|
+
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";
|
|
188
|
+
}, "#update"), _urlChangeListener = new WeakMap(), __name(_MorphParamsDependent, "MorphParamsDependent");
|
|
189
|
+
let MorphParamsDependent = _MorphParamsDependent;
|
|
190
|
+
const domParser = new DOMParser();
|
|
191
|
+
var _morph2, _pathname, _scrollState, _initialDocument, _modifiedDocument, _currentDocument, _savedState, _abortController, _fetching, _headers, _needRavalidation;
|
|
192
|
+
const _MorphRoute = class _MorphRoute {
|
|
193
|
+
constructor(morph, pathname) {
|
|
194
|
+
__privateAdd(this, _morph2);
|
|
195
|
+
__privateAdd(this, _pathname);
|
|
196
|
+
__privateAdd(this, _scrollState, { x: 0, y: 0 });
|
|
197
|
+
__privateAdd(this, _initialDocument, null);
|
|
198
|
+
__privateAdd(this, _modifiedDocument, null);
|
|
199
|
+
__privateAdd(this, _currentDocument, null);
|
|
200
|
+
__privateAdd(this, _savedState, null);
|
|
201
|
+
__privateAdd(this, _abortController, null);
|
|
202
|
+
__privateAdd(this, _fetching, null);
|
|
203
|
+
__privateAdd(this, _headers);
|
|
204
|
+
__privateAdd(this, _needRavalidation, !1);
|
|
205
|
+
__privateSet(this, _morph2, morph), __privateSet(this, _pathname, pathname);
|
|
202
206
|
}
|
|
203
207
|
get pathname() {
|
|
204
|
-
return
|
|
208
|
+
return __privateGet(this, _pathname);
|
|
205
209
|
}
|
|
206
210
|
get scrollState() {
|
|
207
|
-
return
|
|
211
|
+
return __privateGet(this, _scrollState);
|
|
208
212
|
}
|
|
209
213
|
get document() {
|
|
210
|
-
return
|
|
214
|
+
return __privateGet(this, _currentDocument);
|
|
211
215
|
}
|
|
212
216
|
needRavalidation() {
|
|
213
|
-
|
|
217
|
+
__privateSet(this, _needRavalidation, !0);
|
|
214
218
|
}
|
|
215
|
-
setHeaders(
|
|
216
|
-
|
|
219
|
+
setHeaders(headers) {
|
|
220
|
+
__privateSet(this, _headers, headers);
|
|
217
221
|
}
|
|
218
|
-
setInitialDocument(
|
|
219
|
-
|
|
222
|
+
setInitialDocument(document2) {
|
|
223
|
+
__privateSet(this, _initialDocument, document2.cloneNode(!0));
|
|
220
224
|
}
|
|
221
225
|
abort() {
|
|
222
|
-
var
|
|
223
|
-
return (
|
|
224
|
-
`[${
|
|
226
|
+
var _a;
|
|
227
|
+
return (_a = __privateGet(this, _abortController)) == null ? void 0 : _a.abort(
|
|
228
|
+
`[${__privateGet(this, _pathname)}] page loading cancelled`
|
|
225
229
|
);
|
|
226
230
|
}
|
|
227
|
-
fetch(
|
|
228
|
-
return
|
|
229
|
-
var
|
|
230
|
-
if (!
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
231
|
+
fetch(path, currentPath, revalidate) {
|
|
232
|
+
return __async(this, null, function* () {
|
|
233
|
+
var _a;
|
|
234
|
+
if (!revalidate && !__privateGet(this, _needRavalidation)) {
|
|
235
|
+
const shouldUseCache = ((_a = __privateGet(this, _initialDocument)) == null ? void 0 : _a.documentElement.getAttribute("data-cache")) && currentPath !== path, isPopstateNavigation = __privateGet(this, _initialDocument) && __privateGet(this, _morph2).isPopstateNavigation;
|
|
236
|
+
if (__privateGet(this, _fetching) || shouldUseCache || isPopstateNavigation)
|
|
237
|
+
return __privateGet(this, _fetching);
|
|
234
238
|
}
|
|
235
|
-
return
|
|
239
|
+
return __privateSet(this, _fetching, new Promise((res) => __async(this, null, function* () {
|
|
236
240
|
try {
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
signal:
|
|
240
|
-
headers:
|
|
241
|
+
__privateSet(this, _abortController, new AbortController());
|
|
242
|
+
const text = yield (yield fetch(path, {
|
|
243
|
+
signal: __privateGet(this, _abortController).signal,
|
|
244
|
+
headers: __spreadValues({
|
|
241
245
|
"X-MORPH": "true",
|
|
242
|
-
"X-MORPH-REVALIDATE":
|
|
243
|
-
"X-MORPH-CURRENT-PATH": encodeURIComponent(
|
|
244
|
-
"X-MORPH-NEW-PATH": encodeURIComponent(
|
|
245
|
-
},
|
|
246
|
-
})).text(),
|
|
247
|
-
this.setInitialDocument(
|
|
248
|
-
} catch (
|
|
249
|
-
console.warn(
|
|
246
|
+
"X-MORPH-REVALIDATE": revalidate ? "true" : "false",
|
|
247
|
+
"X-MORPH-CURRENT-PATH": encodeURIComponent(currentPath),
|
|
248
|
+
"X-MORPH-NEW-PATH": encodeURIComponent(path)
|
|
249
|
+
}, __privateGet(this, _headers))
|
|
250
|
+
})).text(), document2 = domParser.parseFromString(text, "text/html");
|
|
251
|
+
this.setInitialDocument(document2), __privateSet(this, _needRavalidation, !1);
|
|
252
|
+
} catch (e) {
|
|
253
|
+
console.warn(e);
|
|
250
254
|
} finally {
|
|
251
|
-
|
|
255
|
+
__privateSet(this, _abortController, null), __privateSet(this, _fetching, null), res();
|
|
252
256
|
}
|
|
253
|
-
}))),
|
|
257
|
+
}))), __privateGet(this, _fetching);
|
|
254
258
|
});
|
|
255
259
|
}
|
|
256
260
|
cloneDocument() {
|
|
257
|
-
|
|
261
|
+
__privateSet(this, _currentDocument, (__privateGet(this, _modifiedDocument) || __privateGet(this, _initialDocument)).cloneNode(!0));
|
|
258
262
|
}
|
|
259
263
|
get title() {
|
|
260
|
-
let
|
|
261
|
-
if (
|
|
262
|
-
|
|
264
|
+
let title = "";
|
|
265
|
+
if (__privateGet(this, _currentDocument).title)
|
|
266
|
+
title = __privateGet(this, _currentDocument).title;
|
|
263
267
|
else {
|
|
264
|
-
const
|
|
265
|
-
|
|
268
|
+
const h1 = __privateGet(this, _currentDocument).querySelector("h1");
|
|
269
|
+
title = (h1 == null ? void 0 : h1.innerText) || (h1 == null ? void 0 : h1.textContent) || __privateGet(this, _pathname);
|
|
266
270
|
}
|
|
267
|
-
return
|
|
271
|
+
return title;
|
|
268
272
|
}
|
|
269
273
|
clearScrollState() {
|
|
270
|
-
|
|
274
|
+
__privateGet(this, _scrollState).x = 0, __privateGet(this, _scrollState).y = 0;
|
|
271
275
|
}
|
|
272
276
|
clearDocumentState() {
|
|
273
|
-
|
|
277
|
+
__privateSet(this, _modifiedDocument, null);
|
|
274
278
|
}
|
|
275
279
|
saveScrollState() {
|
|
276
|
-
|
|
280
|
+
__privateGet(this, _initialDocument).documentElement.hasAttribute(
|
|
277
281
|
"data-no-scroll-restoration"
|
|
278
|
-
) ? (
|
|
282
|
+
) ? (__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);
|
|
279
283
|
}
|
|
280
284
|
restoreScrollPosition() {
|
|
281
|
-
|
|
282
|
-
top:
|
|
283
|
-
left:
|
|
285
|
+
__privateGet(this, _morph2).scrollElement.scroll({
|
|
286
|
+
top: __privateGet(this, _scrollState).y,
|
|
287
|
+
left: __privateGet(this, _scrollState).x,
|
|
284
288
|
behavior: "instant"
|
|
285
289
|
});
|
|
286
290
|
}
|
|
287
291
|
saveDocumentState() {
|
|
288
|
-
|
|
292
|
+
__privateGet(this, _initialDocument).documentElement.hasAttribute(
|
|
289
293
|
"data-no-page-restoration"
|
|
290
|
-
) ?
|
|
294
|
+
) ? __privateSet(this, _modifiedDocument, null) : __privateSet(this, _modifiedDocument, document.cloneNode(!0));
|
|
291
295
|
}
|
|
292
296
|
renewScrollPosition() {
|
|
293
|
-
|
|
297
|
+
__privateGet(this, _morph2).scrollElement.scroll({
|
|
294
298
|
top: 0,
|
|
295
299
|
left: 0,
|
|
296
300
|
behavior: "instant"
|
|
297
301
|
});
|
|
298
302
|
}
|
|
299
|
-
saveState(
|
|
300
|
-
|
|
303
|
+
saveState(state) {
|
|
304
|
+
__privateSet(this, _savedState, state);
|
|
301
305
|
}
|
|
302
306
|
clearState() {
|
|
303
|
-
const
|
|
304
|
-
return
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
307
|
+
const state = __privateGet(this, _savedState);
|
|
308
|
+
return __privateSet(this, _savedState, null), state;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
_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");
|
|
312
|
+
let MorphRoute = _MorphRoute;
|
|
313
|
+
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;
|
|
314
|
+
const _Morph = class _Morph {
|
|
315
|
+
constructor(parameters) {
|
|
316
|
+
__privateAdd(this, _Morph_instances);
|
|
317
|
+
__privateAdd(this, _options, null);
|
|
318
|
+
__privateAdd(this, _morphElements, null);
|
|
319
|
+
__privateAdd(this, _links, []);
|
|
320
|
+
__privateAdd(this, _candidateURL);
|
|
321
|
+
__privateAdd(this, _currentURL, null);
|
|
322
|
+
__privateAdd(this, _previousURL);
|
|
323
|
+
__privateAdd(this, _promises, []);
|
|
324
|
+
__privateAdd(this, _isPopstateNavigation, !1);
|
|
325
|
+
__privateAdd(this, _currentScrollElement, null);
|
|
326
|
+
__privateAdd(this, _isWindowScroll, !1);
|
|
327
|
+
__privateAdd(this, _routes, /* @__PURE__ */ new Map());
|
|
328
|
+
__privateAdd(this, _paramDependent, []);
|
|
329
|
+
__privateAdd(this, _announcer, null);
|
|
330
|
+
__privateAdd(this, _currentScrollX, 0);
|
|
331
|
+
__privateAdd(this, _currentScrollY, 0);
|
|
332
|
+
__privateAdd(this, _lastSubmorph);
|
|
333
|
+
__privateAdd(this, _lastRevalidate);
|
|
334
|
+
__privateAdd(this, _lastKeepScrollPosition);
|
|
335
|
+
__privateAdd(this, _checkLink, /* @__PURE__ */ __name((element) => {
|
|
336
|
+
var _a, _b;
|
|
337
|
+
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";
|
|
338
|
+
}, "#checkLink"));
|
|
339
|
+
__privateAdd(this, _popStateListener, /* @__PURE__ */ __name((event) => __async(this, null, function* () {
|
|
340
|
+
event.preventDefault(), __privateSet(this, _isPopstateNavigation, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
336
341
|
historyAction: "none",
|
|
337
|
-
submorph:
|
|
338
|
-
revalidate:
|
|
339
|
-
keepScrollPosition:
|
|
340
|
-
}),
|
|
341
|
-
}));
|
|
342
|
-
|
|
343
|
-
const { left
|
|
344
|
-
|
|
342
|
+
submorph: __privateGet(this, _lastRevalidate) ? void 0 : __privateGet(this, _lastSubmorph),
|
|
343
|
+
revalidate: __privateGet(this, _lastRevalidate),
|
|
344
|
+
keepScrollPosition: __privateGet(this, _lastKeepScrollPosition)
|
|
345
|
+
}), __privateSet(this, _isPopstateNavigation, !1);
|
|
346
|
+
}), "#popStateListener"));
|
|
347
|
+
__privateAdd(this, _scrollListener, /* @__PURE__ */ __name(() => {
|
|
348
|
+
const { left, top } = this.scrollValue, directionY = top - __privateGet(this, _currentScrollY), directionX = left - __privateGet(this, _currentScrollX);
|
|
349
|
+
__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(
|
|
345
350
|
"scroll-y-forward",
|
|
346
|
-
|
|
351
|
+
directionY > 0
|
|
347
352
|
), document.documentElement.classList.toggle(
|
|
348
353
|
"scroll-y-backward",
|
|
349
|
-
|
|
354
|
+
directionY < 0
|
|
350
355
|
), document.documentElement.classList.toggle(
|
|
351
356
|
"scroll-x-forward",
|
|
352
|
-
|
|
357
|
+
directionX > 0
|
|
353
358
|
), document.documentElement.classList.toggle(
|
|
354
359
|
"scroll-x-backward",
|
|
355
|
-
|
|
356
|
-
),
|
|
360
|
+
directionX < 0
|
|
361
|
+
), dispatchEvent(document, "morphScroll", {
|
|
357
362
|
detail: {
|
|
358
|
-
left
|
|
359
|
-
top
|
|
363
|
+
left,
|
|
364
|
+
top
|
|
360
365
|
}
|
|
361
366
|
});
|
|
362
|
-
});
|
|
363
|
-
if (
|
|
364
|
-
|
|
365
|
-
base:
|
|
366
|
-
waitForHeadToLoad: (
|
|
367
|
-
trailingSlash: (
|
|
368
|
-
scrollSelector:
|
|
369
|
-
morphInsideScrollContainer: (
|
|
370
|
-
}),
|
|
371
|
-
const
|
|
367
|
+
}, "#scrollListener"));
|
|
368
|
+
if (isBrowser && !_Morph.instance) {
|
|
369
|
+
_Morph.instance = this, __privateSet(this, _options, {
|
|
370
|
+
base: normalizeBase(parameters == null ? void 0 : parameters.base),
|
|
371
|
+
waitForHeadToLoad: (parameters == null ? void 0 : parameters.waitForHeadToLoad) !== !1,
|
|
372
|
+
trailingSlash: (parameters == null ? void 0 : parameters.trailingSlash) || !1,
|
|
373
|
+
scrollSelector: parameters == null ? void 0 : parameters.scrollSelector,
|
|
374
|
+
morphInsideScrollContainer: (parameters == null ? void 0 : parameters.morphInsideScrollContainer) || !1
|
|
375
|
+
}), __privateSet(this, _morphElements, __privateMethod(this, _Morph_instances, getMorphElements_fn).call(this, document.body));
|
|
376
|
+
const normalizedURL = this.normalizePath(
|
|
372
377
|
location.pathname + location.search + location.hash
|
|
373
378
|
);
|
|
374
|
-
|
|
375
|
-
const
|
|
376
|
-
|
|
379
|
+
__privateSet(this, _currentURL, normalizedURL);
|
|
380
|
+
const initialRoute = new MorphRoute(this, __privateGet(this, _currentURL).pathname);
|
|
381
|
+
initialRoute.setInitialDocument(document), __privateGet(this, _routes).set(__privateGet(this, _currentURL).pathname, initialRoute), document.documentElement.setAttribute(
|
|
377
382
|
"data-current-pathname",
|
|
378
|
-
|
|
383
|
+
__privateGet(this, _currentURL).pathname
|
|
379
384
|
), document.documentElement.setAttribute(
|
|
380
385
|
"data-current-leaf",
|
|
381
|
-
|
|
382
|
-
), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate",
|
|
386
|
+
normalizedURL.leaf
|
|
387
|
+
), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", __privateGet(this, _popStateListener)), changeHistory({
|
|
383
388
|
action: "replace",
|
|
384
|
-
pathname:
|
|
385
|
-
searchParameters:
|
|
386
|
-
hash:
|
|
387
|
-
}),
|
|
389
|
+
pathname: normalizedURL.pathname,
|
|
390
|
+
searchParameters: normalizedURL.parameters,
|
|
391
|
+
hash: normalizedURL.hash
|
|
392
|
+
}), __privateSet(this, _announcer, new MorphAnnouncer()), __privateMethod(this, _Morph_instances, updateCurrentScrollElement_fn).call(this, document);
|
|
388
393
|
}
|
|
389
394
|
}
|
|
390
395
|
get currentURL() {
|
|
391
|
-
return
|
|
396
|
+
return __privateGet(this, _currentURL);
|
|
392
397
|
}
|
|
393
398
|
get previousURL() {
|
|
394
|
-
return
|
|
399
|
+
return __privateGet(this, _previousURL);
|
|
395
400
|
}
|
|
396
401
|
get links() {
|
|
397
|
-
return
|
|
402
|
+
return __privateGet(this, _links);
|
|
398
403
|
}
|
|
399
404
|
get scrollElement() {
|
|
400
|
-
return
|
|
405
|
+
return __privateGet(this, _currentScrollElement);
|
|
401
406
|
}
|
|
402
407
|
get isPopstateNavigation() {
|
|
403
|
-
return
|
|
408
|
+
return __privateGet(this, _isPopstateNavigation);
|
|
404
409
|
}
|
|
405
410
|
get scrollValue() {
|
|
406
|
-
let
|
|
407
|
-
return
|
|
411
|
+
let top = 0, left = 0;
|
|
412
|
+
return __privateGet(this, _isWindowScroll) ? (top = window.scrollY, left = window.scrollX) : (top = __privateGet(this, _currentScrollElement).scrollTop, left = __privateGet(this, _currentScrollElement).scrollLeft), { top, left };
|
|
408
413
|
}
|
|
409
414
|
get isNavigating() {
|
|
410
|
-
return !!
|
|
415
|
+
return !!__privateGet(this, _promises).length;
|
|
411
416
|
}
|
|
412
|
-
saveState(
|
|
413
|
-
const
|
|
414
|
-
|
|
417
|
+
saveState(state) {
|
|
418
|
+
const route = __privateGet(this, _routes).get(__privateGet(this, _currentURL).path);
|
|
419
|
+
route && route.saveState(state);
|
|
415
420
|
}
|
|
416
421
|
getState() {
|
|
417
|
-
const
|
|
418
|
-
return
|
|
419
|
-
}
|
|
420
|
-
normalizePath(
|
|
421
|
-
return
|
|
422
|
-
base:
|
|
423
|
-
trailingSlash:
|
|
424
|
-
mergeParams:
|
|
425
|
-
removeParams:
|
|
422
|
+
const route = __privateGet(this, _routes).get(__privateGet(this, _currentURL).path);
|
|
423
|
+
return route == null ? void 0 : route.clearState();
|
|
424
|
+
}
|
|
425
|
+
normalizePath(path, options) {
|
|
426
|
+
return splitPath(path, {
|
|
427
|
+
base: __privateGet(this, _options).base,
|
|
428
|
+
trailingSlash: __privateGet(this, _options).trailingSlash,
|
|
429
|
+
mergeParams: options != null && options.mergeParams ? location.search : "",
|
|
430
|
+
removeParams: options == null ? void 0 : options.removeParams
|
|
426
431
|
});
|
|
427
432
|
}
|
|
428
|
-
prefetch(
|
|
429
|
-
return
|
|
430
|
-
var
|
|
431
|
-
if (
|
|
433
|
+
prefetch(path, revalidate) {
|
|
434
|
+
return __async(this, null, function* () {
|
|
435
|
+
var _a;
|
|
436
|
+
if (__privateGet(this, _promises).length)
|
|
432
437
|
return;
|
|
433
|
-
|
|
434
|
-
const
|
|
435
|
-
|
|
438
|
+
path = ((_a = this.pathnameModifier) == null ? void 0 : _a.call(this, path)) || path;
|
|
439
|
+
const route = __privateMethod(this, _Morph_instances, getRoute_fn).call(this, path);
|
|
440
|
+
route == null || route.fetch(path, __privateGet(this, _currentURL).path, revalidate);
|
|
436
441
|
});
|
|
437
442
|
}
|
|
438
|
-
excludeHeadChild(
|
|
443
|
+
excludeHeadChild(child) {
|
|
439
444
|
return !1;
|
|
440
445
|
}
|
|
441
|
-
setHeaders(
|
|
442
|
-
}
|
|
443
|
-
needRavalidation(
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
navigate(
|
|
448
|
-
return
|
|
449
|
-
historyAction
|
|
450
|
-
centerScroll
|
|
451
|
-
offsetScroll
|
|
452
|
-
scrollBehaviour
|
|
453
|
-
revalidate
|
|
454
|
-
keepSearchParameters
|
|
455
|
-
submorph
|
|
456
|
-
submorphAppend
|
|
457
|
-
clearState
|
|
458
|
-
keepScrollPosition
|
|
459
|
-
mergeParams
|
|
460
|
-
removeParams
|
|
461
|
-
detail
|
|
462
|
-
scrollTo
|
|
446
|
+
setHeaders(path) {
|
|
447
|
+
}
|
|
448
|
+
needRavalidation(path) {
|
|
449
|
+
const normalizedURL = this.normalizePath(path), route = __privateMethod(this, _Morph_instances, getRoute_fn).call(this, normalizedURL.path);
|
|
450
|
+
route == null || route.needRavalidation();
|
|
451
|
+
}
|
|
452
|
+
navigate(_0) {
|
|
453
|
+
return __async(this, arguments, function* (path, {
|
|
454
|
+
historyAction = "push",
|
|
455
|
+
centerScroll,
|
|
456
|
+
offsetScroll,
|
|
457
|
+
scrollBehaviour,
|
|
458
|
+
revalidate,
|
|
459
|
+
keepSearchParameters,
|
|
460
|
+
submorph,
|
|
461
|
+
submorphAppend,
|
|
462
|
+
clearState,
|
|
463
|
+
keepScrollPosition,
|
|
464
|
+
mergeParams,
|
|
465
|
+
removeParams,
|
|
466
|
+
detail,
|
|
467
|
+
scrollTo
|
|
463
468
|
} = {}) {
|
|
464
|
-
var
|
|
465
|
-
if (
|
|
469
|
+
var _a, _b, _c, _d;
|
|
470
|
+
if (__privateGet(this, _promises).length)
|
|
466
471
|
return;
|
|
467
|
-
|
|
468
|
-
const
|
|
469
|
-
mergeParams
|
|
470
|
-
removeParams
|
|
472
|
+
__privateSet(this, _lastSubmorph, submorph), __privateSet(this, _lastRevalidate, revalidate), __privateSet(this, _lastKeepScrollPosition, keepScrollPosition);
|
|
473
|
+
const modifiedPath = ((_a = this.pathnameModifier) == null ? void 0 : _a.call(this, path)) || path, normalizedURL = this.normalizePath(modifiedPath, {
|
|
474
|
+
mergeParams,
|
|
475
|
+
removeParams
|
|
471
476
|
});
|
|
472
|
-
if (!
|
|
473
|
-
|
|
474
|
-
centerScroll
|
|
475
|
-
offsetScroll
|
|
477
|
+
if (!revalidate && (((_b = __privateGet(this, _candidateURL)) == null ? void 0 : _b.pathname) === normalizedURL.pathname || __privateGet(this, _currentURL).pathname === normalizedURL.pathname)) {
|
|
478
|
+
keepScrollPosition || __privateMethod(this, _Morph_instances, tryScrollToElement_fn).call(this, scrollTo || normalizedURL.hash || 0, {
|
|
479
|
+
centerScroll,
|
|
480
|
+
offsetScroll,
|
|
476
481
|
behavior: "smooth"
|
|
477
|
-
}),
|
|
482
|
+
}), dispatchEvent(document, "morphSamePath", {
|
|
478
483
|
detail: {
|
|
479
|
-
detail
|
|
484
|
+
detail
|
|
480
485
|
}
|
|
481
|
-
}), ((
|
|
482
|
-
action: ((
|
|
483
|
-
pathname:
|
|
484
|
-
searchParameters:
|
|
485
|
-
hash:
|
|
486
|
-
}),
|
|
486
|
+
}), ((_c = __privateGet(this, _currentURL)) == null ? void 0 : _c.parameters) !== normalizedURL.parameters && (__privateSet(this, _previousURL, __privateGet(this, _currentURL)), __privateSet(this, _currentURL, normalizedURL), changeHistory({
|
|
487
|
+
action: ((_d = __privateGet(this, _currentURL)) == null ? void 0 : _d.hash) !== normalizedURL.hash ? "replace" : historyAction,
|
|
488
|
+
pathname: normalizedURL.pathname,
|
|
489
|
+
searchParameters: normalizedURL.parameters,
|
|
490
|
+
hash: normalizedURL.hash
|
|
491
|
+
}), dispatchEvent(document, "morphURLParametersChange", {
|
|
487
492
|
detail: {
|
|
488
|
-
newURL:
|
|
489
|
-
previousURL:
|
|
490
|
-
detail
|
|
493
|
+
newURL: __privateGet(this, _currentURL),
|
|
494
|
+
previousURL: __privateGet(this, _previousURL),
|
|
495
|
+
detail
|
|
491
496
|
}
|
|
492
|
-
})),
|
|
493
|
-
|
|
497
|
+
})), __privateGet(this, _links).forEach((link) => {
|
|
498
|
+
link.checkCurrent(normalizedURL.path);
|
|
494
499
|
});
|
|
495
500
|
return;
|
|
496
501
|
} else
|
|
497
|
-
|
|
498
|
-
|
|
502
|
+
__privateGet(this, _links).forEach((link) => {
|
|
503
|
+
link.checkCurrent(normalizedURL.path);
|
|
499
504
|
});
|
|
500
|
-
|
|
505
|
+
__privateSet(this, _candidateURL, normalizedURL);
|
|
501
506
|
try {
|
|
502
|
-
let
|
|
507
|
+
let preprocessedSuccesfully = !0;
|
|
503
508
|
if (this.preprocessor)
|
|
504
509
|
try {
|
|
505
|
-
yield new Promise((
|
|
506
|
-
var
|
|
507
|
-
(
|
|
508
|
-
url:
|
|
509
|
-
resolve
|
|
510
|
-
reject
|
|
511
|
-
submorph
|
|
512
|
-
detail
|
|
510
|
+
yield new Promise((resolve, reject) => {
|
|
511
|
+
var _a2;
|
|
512
|
+
(_a2 = this.preprocessor) == null || _a2.call(this, {
|
|
513
|
+
url: normalizedURL,
|
|
514
|
+
resolve,
|
|
515
|
+
reject,
|
|
516
|
+
submorph,
|
|
517
|
+
detail
|
|
513
518
|
});
|
|
514
519
|
});
|
|
515
|
-
} catch (
|
|
516
|
-
|
|
520
|
+
} catch (e) {
|
|
521
|
+
e ? console.error(e) : console.log("Route change canceled"), preprocessedSuccesfully = !1;
|
|
517
522
|
}
|
|
518
|
-
if (!
|
|
519
|
-
|
|
520
|
-
|
|
523
|
+
if (!preprocessedSuccesfully || __privateGet(this, _candidateURL).pathname !== normalizedURL.pathname) {
|
|
524
|
+
__privateGet(this, _links).forEach((link) => {
|
|
525
|
+
link.checkCurrent(__privateGet(this, _currentURL).path);
|
|
521
526
|
});
|
|
522
527
|
return;
|
|
523
528
|
}
|
|
524
|
-
const
|
|
525
|
-
url:
|
|
526
|
-
submorph
|
|
527
|
-
detail
|
|
529
|
+
const navigationEntry = {
|
|
530
|
+
url: normalizedURL,
|
|
531
|
+
submorph,
|
|
532
|
+
detail
|
|
528
533
|
};
|
|
529
|
-
|
|
530
|
-
document.querySelectorAll(
|
|
531
|
-
|
|
534
|
+
submorph ? submorphAppend || submorph.forEach((sel) => {
|
|
535
|
+
document.querySelectorAll(sel).forEach((el) => {
|
|
536
|
+
el.classList.add("out"), el.setAttribute("data-morph-out", "");
|
|
532
537
|
});
|
|
533
|
-
}) :
|
|
534
|
-
var
|
|
535
|
-
(
|
|
536
|
-
}),
|
|
537
|
-
detail:
|
|
538
|
+
}) : __privateGet(this, _morphElements).forEach((el) => {
|
|
539
|
+
var _a2, _b2;
|
|
540
|
+
(_a2 = el.firstElementChild) == null || _a2.classList.add("out"), (_b2 = el.firstElementChild) == null || _b2.setAttribute("data-morph-out", "");
|
|
541
|
+
}), dispatchEvent(document, "morphNavigation", {
|
|
542
|
+
detail: navigationEntry
|
|
538
543
|
});
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
541
|
-
|
|
542
|
-
}), yield
|
|
543
|
-
|
|
544
|
-
|
|
544
|
+
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);
|
|
545
|
+
if (__privateGet(this, _routes).forEach((el) => {
|
|
546
|
+
el.pathname !== normalizedURL.pathname && el.abort();
|
|
547
|
+
}), yield nextRoute == null ? void 0 : nextRoute.fetch(modifiedPath, __privateGet(this, _currentURL).path, revalidate), __privateGet(this, _candidateURL).pathname !== normalizedURL.pathname) {
|
|
548
|
+
__privateGet(this, _links).forEach((link) => {
|
|
549
|
+
link.checkCurrent(__privateGet(this, _currentURL).path);
|
|
545
550
|
});
|
|
546
551
|
return;
|
|
547
552
|
}
|
|
548
|
-
|
|
549
|
-
const
|
|
550
|
-
document:
|
|
553
|
+
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));
|
|
554
|
+
const documentFetchedEntry = __spreadProps(__spreadValues({}, navigationEntry), {
|
|
555
|
+
document: nextRoute.document
|
|
551
556
|
});
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}),
|
|
555
|
-
detail:
|
|
557
|
+
submorphAppend || documentFetchedEntry.document.querySelectorAll("[data-morph-out]").forEach((el) => {
|
|
558
|
+
el.classList.remove("out");
|
|
559
|
+
}), dispatchEvent(document, "morphStart", {
|
|
560
|
+
detail: documentFetchedEntry
|
|
556
561
|
});
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
),
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
),
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
).filter((
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
562
|
+
const currentHeadChildren = Array.from(document.head.children), newHeadChildren = Array.from(nextRoute.document.head.children), identicalHeadChildren = intersectElements(
|
|
563
|
+
currentHeadChildren,
|
|
564
|
+
newHeadChildren
|
|
565
|
+
), removeHeadChildren = excludeElements(
|
|
566
|
+
currentHeadChildren,
|
|
567
|
+
identicalHeadChildren
|
|
568
|
+
), addHeadChildren = excludeElements(
|
|
569
|
+
newHeadChildren,
|
|
570
|
+
identicalHeadChildren
|
|
571
|
+
).filter((child) => !this.excludeHeadChild(child));
|
|
572
|
+
addHeadChildren.forEach((child, index) => {
|
|
573
|
+
child.tagName === "SCRIPT" && (addHeadChildren[index] = createScriptElement(
|
|
574
|
+
child
|
|
570
575
|
));
|
|
571
|
-
}),
|
|
572
|
-
document.head.appendChild(
|
|
576
|
+
}), addHeadChildren.forEach((child) => {
|
|
577
|
+
document.head.appendChild(child);
|
|
573
578
|
});
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
579
|
+
const elementsWithLoad = addHeadChildren.filter((child) => {
|
|
580
|
+
if (child.hasAttribute("data-no-waiting"))
|
|
576
581
|
return !1;
|
|
577
|
-
if (
|
|
582
|
+
if (__privateMethod(this, _Morph_instances, isElementEmitsLoadEvent_fn).call(this, child))
|
|
578
583
|
return !0;
|
|
579
584
|
});
|
|
580
|
-
|
|
581
|
-
let
|
|
585
|
+
__privateGet(this, _options).waitForHeadToLoad && elementsWithLoad.length && (yield new Promise((res) => __async(this, null, function* () {
|
|
586
|
+
let counter = 0;
|
|
582
587
|
try {
|
|
583
|
-
for (var
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
588
|
+
for (var iter = __forAwait(elementsWithLoad), more, temp, error; more = !(temp = yield iter.next()).done; more = !1) {
|
|
589
|
+
const element = temp.value;
|
|
590
|
+
element.onload = () => {
|
|
591
|
+
counter++, counter === elementsWithLoad.length && res();
|
|
587
592
|
};
|
|
588
593
|
}
|
|
589
|
-
} catch (
|
|
590
|
-
|
|
594
|
+
} catch (temp) {
|
|
595
|
+
error = [temp];
|
|
591
596
|
} finally {
|
|
592
597
|
try {
|
|
593
|
-
|
|
598
|
+
more && (temp = iter.return) && (yield temp.call(iter));
|
|
594
599
|
} finally {
|
|
595
|
-
if (
|
|
596
|
-
throw
|
|
600
|
+
if (error)
|
|
601
|
+
throw error[0];
|
|
597
602
|
}
|
|
598
603
|
}
|
|
599
|
-
}))), yield
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
604
|
+
}))), yield wait(10);
|
|
605
|
+
const oldElementsWithLoadEvent = [];
|
|
606
|
+
submorphAppend || removeHeadChildren.forEach((child) => {
|
|
607
|
+
child.hasAttribute("data-permanent") || (__privateMethod(this, _Morph_instances, isElementEmitsLoadEvent_fn).call(this, child) ? oldElementsWithLoadEvent.push(child) : child.remove());
|
|
603
608
|
});
|
|
604
|
-
const
|
|
605
|
-
!
|
|
609
|
+
const newMorphElements = __privateMethod(this, _Morph_instances, getMorphElements_fn).call(this, nextRoute.document.body);
|
|
610
|
+
!__privateGet(this, _options).morphInsideScrollContainer && !submorph && __privateMethod(this, _Morph_instances, updateCurrentScrollElement_fn).call(this, nextRoute.document), document.documentElement.setAttribute(
|
|
606
611
|
"data-current-pathname",
|
|
607
|
-
|
|
612
|
+
normalizedURL.pathname
|
|
608
613
|
), document.documentElement.setAttribute(
|
|
609
614
|
"data-current-leaf",
|
|
610
|
-
|
|
611
|
-
),
|
|
612
|
-
action:
|
|
613
|
-
pathname:
|
|
614
|
-
searchParameters:
|
|
615
|
-
hash:
|
|
616
|
-
}),
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
let
|
|
621
|
-
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
}),
|
|
625
|
-
|
|
626
|
-
})) : (
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
|
|
615
|
+
normalizedURL.leaf
|
|
616
|
+
), changeHistory({
|
|
617
|
+
action: historyAction,
|
|
618
|
+
pathname: normalizedURL.pathname,
|
|
619
|
+
searchParameters: normalizedURL.parameters || (keepSearchParameters ? location.search : ""),
|
|
620
|
+
hash: normalizedURL.hash
|
|
621
|
+
}), __privateGet(this, _announcer).remove(), __privateSet(this, _previousURL, __privateGet(this, _currentURL)), __privateSet(this, _currentURL, normalizedURL);
|
|
622
|
+
const morphedElements = [];
|
|
623
|
+
__privateGet(this, _morphElements).forEach((morphElement, i) => {
|
|
624
|
+
const newMorphElement = newMorphElements[i], duration = getComputedStyle(morphElement).getPropertyValue("--morph-duration");
|
|
625
|
+
let newMorphElementChildNodes = [], currentMorphElementChildNodes = [];
|
|
626
|
+
submorph ? (submorph.forEach((selector) => {
|
|
627
|
+
const curSubMorphElement = morphElement.querySelector(selector), newSubMorphElement = newMorphElement.querySelector(selector);
|
|
628
|
+
curSubMorphElement && newSubMorphElement && (currentMorphElementChildNodes.push(curSubMorphElement), newMorphElementChildNodes.push(newSubMorphElement));
|
|
629
|
+
}), currentMorphElementChildNodes.forEach((el) => {
|
|
630
|
+
el.parentElement && morphedElements.push(el.parentElement);
|
|
631
|
+
})) : (newMorphElementChildNodes.push(...newMorphElement.childNodes), currentMorphElementChildNodes.push(...morphElement.childNodes), morphedElements.push(morphElement));
|
|
632
|
+
const transfer = [];
|
|
633
|
+
submorphAppend || currentMorphElementChildNodes.forEach((element) => {
|
|
634
|
+
element instanceof HTMLElement && (this.destroyOldLinks(element), element.classList.add("old"), element.querySelectorAll(
|
|
630
635
|
"[data-morph-transfer]"
|
|
631
|
-
).forEach((
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
element:
|
|
635
|
-
selector
|
|
636
|
+
).forEach((el) => {
|
|
637
|
+
const selector = el.getAttribute("data-morph-transfer");
|
|
638
|
+
transfer.push({
|
|
639
|
+
element: el,
|
|
640
|
+
selector
|
|
636
641
|
});
|
|
637
642
|
}));
|
|
638
|
-
}),
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
|
|
643
|
+
}), newMorphElementChildNodes.forEach((element) => {
|
|
644
|
+
element instanceof HTMLElement && (transfer.forEach((item) => {
|
|
645
|
+
const nestlement = element.querySelector(item.selector);
|
|
646
|
+
nestlement && nestlement.replaceWith(
|
|
647
|
+
nextRoute.document.importNode(item.element, !0)
|
|
643
648
|
);
|
|
644
|
-
}), this.findNewLinks(
|
|
645
|
-
}),
|
|
646
|
-
|
|
647
|
-
}) :
|
|
648
|
-
var
|
|
649
|
-
(
|
|
650
|
-
|
|
651
|
-
|
|
649
|
+
}), this.findNewLinks(element), element.classList.add("new"));
|
|
650
|
+
}), submorph ? submorphAppend ? newMorphElementChildNodes.forEach((el, i2) => {
|
|
651
|
+
currentMorphElementChildNodes[i2] instanceof HTMLElement && currentMorphElementChildNodes[i2].append(...el.childNodes);
|
|
652
|
+
}) : newMorphElementChildNodes.forEach((el, i2) => {
|
|
653
|
+
var _a2;
|
|
654
|
+
(_a2 = currentMorphElementChildNodes[i2].parentElement) == null || _a2.insertBefore(
|
|
655
|
+
el,
|
|
656
|
+
currentMorphElementChildNodes[i2]
|
|
652
657
|
);
|
|
653
|
-
}) :
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}),
|
|
657
|
-
var
|
|
658
|
-
|
|
658
|
+
}) : morphElement.prepend(...newMorphElementChildNodes), setTimeout(() => {
|
|
659
|
+
submorphAppend || currentMorphElementChildNodes.forEach((element) => {
|
|
660
|
+
element instanceof HTMLElement && element.classList.add("old-idle");
|
|
661
|
+
}), newMorphElementChildNodes.forEach((element) => {
|
|
662
|
+
var _a2;
|
|
663
|
+
element instanceof HTMLElement && ((_a2 = element.parentElement) == null || _a2.style.setProperty(
|
|
659
664
|
"--new-content-height",
|
|
660
|
-
|
|
661
|
-
),
|
|
665
|
+
element.offsetHeight + "px"
|
|
666
|
+
), element.classList.add("new-idle"));
|
|
662
667
|
});
|
|
663
668
|
}, 0);
|
|
664
|
-
const
|
|
665
|
-
morphElement
|
|
669
|
+
const detail2 = __spreadProps(__spreadValues({}, documentFetchedEntry), {
|
|
670
|
+
morphElement
|
|
666
671
|
});
|
|
667
|
-
|
|
668
|
-
detail:
|
|
672
|
+
dispatchEvent(document, "morphNewChildrenAdded", {
|
|
673
|
+
detail: detail2
|
|
669
674
|
});
|
|
670
|
-
const
|
|
675
|
+
const promise = new Promise((res) => {
|
|
671
676
|
setTimeout(
|
|
672
677
|
() => {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}),
|
|
676
|
-
var
|
|
677
|
-
|
|
678
|
+
submorphAppend || currentMorphElementChildNodes.forEach((el) => {
|
|
679
|
+
el.remove();
|
|
680
|
+
}), newMorphElementChildNodes.forEach((element) => {
|
|
681
|
+
var _a2;
|
|
682
|
+
element instanceof HTMLElement && ((_a2 = element.parentElement) == null || _a2.style.removeProperty(
|
|
678
683
|
"--new-content-height"
|
|
679
|
-
),
|
|
680
|
-
}),
|
|
681
|
-
detail:
|
|
682
|
-
}),
|
|
684
|
+
), element.classList.remove("new-idle", "new"));
|
|
685
|
+
}), submorphAppend || dispatchEvent(document, "morphOldChildrenRemoved", {
|
|
686
|
+
detail: detail2
|
|
687
|
+
}), res();
|
|
683
688
|
},
|
|
684
|
-
(parseFloat(
|
|
689
|
+
(parseFloat(duration) || 0) * 1e3 + 10
|
|
685
690
|
);
|
|
686
691
|
});
|
|
687
|
-
|
|
692
|
+
__privateGet(this, _promises).push(promise);
|
|
688
693
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
689
694
|
"--new-document-scroll-position",
|
|
690
|
-
(this.scrollValue.top -
|
|
695
|
+
(this.scrollValue.top - nextRoute.scrollState.y) * 1 + "px"
|
|
691
696
|
) : document.documentElement.style.setProperty(
|
|
692
697
|
"--new-document-scroll-position",
|
|
693
698
|
this.scrollValue.top + "px"
|
|
694
|
-
),
|
|
695
|
-
detail:
|
|
696
|
-
}),
|
|
697
|
-
centerScroll
|
|
698
|
-
offsetScroll
|
|
699
|
-
behavior:
|
|
700
|
-
})) :
|
|
701
|
-
centerScroll
|
|
702
|
-
offsetScroll
|
|
703
|
-
behavior:
|
|
704
|
-
})) :
|
|
705
|
-
|
|
706
|
-
|
|
699
|
+
), dispatchEvent(document, "morphBeforeNavigationScroll", {
|
|
700
|
+
detail: nextRoute.scrollState
|
|
701
|
+
}), scrollTo ? (nextRoute.clearScrollState(), __privateMethod(this, _Morph_instances, tryScrollToElement_fn).call(this, scrollTo, {
|
|
702
|
+
centerScroll,
|
|
703
|
+
offsetScroll,
|
|
704
|
+
behavior: scrollBehaviour
|
|
705
|
+
})) : normalizedURL.hash ? (nextRoute.clearScrollState(), __privateMethod(this, _Morph_instances, tryScrollToElement_fn).call(this, normalizedURL.hash, {
|
|
706
|
+
centerScroll,
|
|
707
|
+
offsetScroll,
|
|
708
|
+
behavior: scrollBehaviour
|
|
709
|
+
})) : __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) => {
|
|
710
|
+
el.querySelectorAll("script").forEach((element) => {
|
|
711
|
+
element.replaceWith(createScriptElement(element));
|
|
707
712
|
});
|
|
708
|
-
}),
|
|
709
|
-
|
|
710
|
-
}), this.findParamsDependent(),
|
|
711
|
-
detail:
|
|
713
|
+
}), __privateGet(this, _links).forEach((link) => {
|
|
714
|
+
link.checkCurrent(__privateGet(this, _currentURL).path);
|
|
715
|
+
}), this.findParamsDependent(), dispatchEvent(document, "morphComplete", {
|
|
716
|
+
detail: documentFetchedEntry
|
|
712
717
|
}), document.documentElement.style.removeProperty(
|
|
713
718
|
"--new-document-scroll-position"
|
|
714
719
|
), window.dispatchEvent(new Event("resize"));
|
|
715
|
-
} catch (
|
|
716
|
-
console.error(
|
|
720
|
+
} catch (e) {
|
|
721
|
+
console.error(e);
|
|
717
722
|
}
|
|
718
|
-
|
|
723
|
+
__privateSet(this, _candidateURL, void 0);
|
|
719
724
|
});
|
|
720
725
|
}
|
|
721
|
-
addLink(
|
|
722
|
-
|
|
726
|
+
addLink(element) {
|
|
727
|
+
__privateGet(this, _links).push(new MorphLink(element, this));
|
|
723
728
|
}
|
|
724
|
-
addLinks(
|
|
725
|
-
|
|
726
|
-
this.addLink(
|
|
729
|
+
addLinks(elements) {
|
|
730
|
+
elements.forEach((element) => {
|
|
731
|
+
this.addLink(element);
|
|
727
732
|
});
|
|
728
733
|
}
|
|
729
|
-
removeLink(
|
|
730
|
-
|
|
734
|
+
removeLink(element) {
|
|
735
|
+
__privateSet(this, _links, __privateGet(this, _links).filter((link) => link.element === element ? (link.destroy(), !1) : !0));
|
|
731
736
|
}
|
|
732
|
-
destroyOldLinks(
|
|
733
|
-
|
|
737
|
+
destroyOldLinks(morphElement) {
|
|
738
|
+
__privateSet(this, _links, __privateGet(this, _links).filter((link) => morphElement.contains(link.element) ? (link.destroy(), !1) : !0));
|
|
734
739
|
}
|
|
735
|
-
findNewLinks(
|
|
736
|
-
const
|
|
737
|
-
|
|
740
|
+
findNewLinks(morphElement) {
|
|
741
|
+
const linkElements = [...morphElement.querySelectorAll("a")].filter(
|
|
742
|
+
__privateGet(this, _checkLink)
|
|
738
743
|
);
|
|
739
|
-
|
|
740
|
-
...
|
|
744
|
+
__privateGet(this, _links).push(
|
|
745
|
+
...linkElements.map((element) => new MorphLink(element, this))
|
|
741
746
|
);
|
|
742
747
|
}
|
|
743
748
|
findLinks() {
|
|
744
|
-
const
|
|
749
|
+
const linkElements = [
|
|
745
750
|
...document.documentElement.querySelectorAll("a")
|
|
746
|
-
].filter(
|
|
747
|
-
|
|
751
|
+
].filter(__privateGet(this, _checkLink));
|
|
752
|
+
__privateGet(this, _links).forEach((link) => link.destroy()), __privateSet(this, _links, linkElements.map((element) => new MorphLink(element, this)));
|
|
748
753
|
}
|
|
749
754
|
findParamsDependent() {
|
|
750
|
-
const
|
|
755
|
+
const elements = [
|
|
751
756
|
...document.documentElement.querySelectorAll(
|
|
752
757
|
"[data-morph-params-dependent]"
|
|
753
758
|
)
|
|
754
759
|
];
|
|
755
|
-
|
|
756
|
-
(
|
|
760
|
+
__privateGet(this, _paramDependent).forEach((link) => link.destroy()), __privateSet(this, _paramDependent, elements.map(
|
|
761
|
+
(element) => new MorphParamsDependent(element)
|
|
757
762
|
));
|
|
758
763
|
}
|
|
759
764
|
};
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
let
|
|
763
|
-
return
|
|
764
|
-
},
|
|
765
|
-
const
|
|
766
|
-
return
|
|
767
|
-
},
|
|
768
|
-
return
|
|
769
|
-
},
|
|
770
|
-
var
|
|
771
|
-
(
|
|
765
|
+
_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 = /* @__PURE__ */ __name(function(path) {
|
|
766
|
+
const normalizedURL = this.normalizePath(path);
|
|
767
|
+
let route = __privateGet(this, _routes).get(normalizedURL.pathname);
|
|
768
|
+
return route || (route = new MorphRoute(this, normalizedURL.pathname), __privateGet(this, _routes).set(normalizedURL.pathname, route)), route;
|
|
769
|
+
}, "#getRoute"), getMorphElements_fn = /* @__PURE__ */ __name(function(el) {
|
|
770
|
+
const morphElements = [...el.querySelectorAll("[data-morph]")];
|
|
771
|
+
return morphElements.length ? morphElements : [el];
|
|
772
|
+
}, "#getMorphElements"), isElementEmitsLoadEvent_fn = /* @__PURE__ */ __name(function(element) {
|
|
773
|
+
return element.tagName === "SCRIPT" || element.tagName === "STYLE" || element.tagName === "LINK" && element.getAttribute("rel") === "stylesheet";
|
|
774
|
+
}, "#isElementEmitsLoadEvent"), updateCurrentScrollElement_fn = /* @__PURE__ */ __name(function(document2) {
|
|
775
|
+
var _a, _b;
|
|
776
|
+
(_a = __privateGet(this, _currentScrollElement)) == null || _a.removeEventListener(
|
|
772
777
|
"scroll",
|
|
773
|
-
|
|
774
|
-
),
|
|
775
|
-
},
|
|
776
|
-
const
|
|
777
|
-
(typeof
|
|
778
|
-
scrollElement:
|
|
779
|
-
behavior: (
|
|
780
|
-
center:
|
|
781
|
-
offset:
|
|
778
|
+
__privateGet(this, _scrollListener)
|
|
779
|
+
), __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);
|
|
780
|
+
}, "#updateCurrentScrollElement"), tryScrollToElement_fn = /* @__PURE__ */ __name(function(id, options) {
|
|
781
|
+
const value = typeof id == "string" ? document.querySelector(id) : id;
|
|
782
|
+
(typeof value == "number" || value) && scrollToElement(value, {
|
|
783
|
+
scrollElement: __privateGet(this, _currentScrollElement),
|
|
784
|
+
behavior: (options == null ? void 0 : options.behavior) || "instant",
|
|
785
|
+
center: options == null ? void 0 : options.centerScroll,
|
|
786
|
+
offset: options == null ? void 0 : options.offsetScroll
|
|
782
787
|
});
|
|
783
|
-
},
|
|
784
|
-
let
|
|
788
|
+
}, "#tryScrollToElement"), _popStateListener = new WeakMap(), _scrollListener = new WeakMap(), __name(_Morph, "Morph"), _Morph.instance = null;
|
|
789
|
+
let Morph = _Morph;
|
|
785
790
|
export {
|
|
786
|
-
|
|
791
|
+
Morph
|
|
787
792
|
};
|