aptechka 0.76.2 → 0.76.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/en3/En3View.d.ts +2 -0
- package/lib/en3/index.cjs +2 -2
- package/lib/en3/index.js +64 -58
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +191 -191
- package/package.json +1 -1
package/lib/en3/En3View.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export declare class En3View {
|
|
|
28
28
|
get box(): LayoutBox;
|
|
29
29
|
get cameraDistance(): number;
|
|
30
30
|
set cameraDistance(value: number);
|
|
31
|
+
set fov(value: 'auto' | number);
|
|
32
|
+
get fov(): "auto" | number;
|
|
31
33
|
get sizeElement(): HTMLElement;
|
|
32
34
|
get isClipped(): boolean;
|
|
33
35
|
resize(): void;
|
package/lib/en3/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var j=Object.defineProperty,p=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var $=i=>{throw TypeError(i)};var N=(i,e,r)=>e in i?j(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))te.call(e,r)&&N(i,r,e[r]);if(H)for(var r of H(e))re.call(e,r)&&N(i,r,e[r]);return i},B=(i,e)=>p(i,ee(e));var W=(i,e,r)=>e.has(i)||$("Cannot "+r);var t=(i,e,r)=>(W(i,e,"read from private field"),r?r.call(i):e.get(i)),n=(i,e,r)=>e.has(i)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),h=(i,e,r,s)=>(W(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),G=require("../order/index.cjs"),K=require("../window-resizer/index.cjs"),U=require("../ticker/index.cjs"),J=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const Z=require("../layout-box/index.cjs");function Q(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const a=r[s];a&&typeof a=="object"&&"minFilter"in a&&a.dispose()}};i.traverse(r=>{if(r instanceof d.Mesh){if(r.geometry.dispose(),!Array.isArray(r.material)&&r.material.isMaterial)e(r.material);else if(Array.isArray(r.material))for(const s of r.material)e(s)}})}var
|
|
1
|
+
"use strict";var j=Object.defineProperty,p=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var $=i=>{throw TypeError(i)};var N=(i,e,r)=>e in i?j(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))te.call(e,r)&&N(i,r,e[r]);if(H)for(var r of H(e))re.call(e,r)&&N(i,r,e[r]);return i},B=(i,e)=>p(i,ee(e));var W=(i,e,r)=>e.has(i)||$("Cannot "+r);var t=(i,e,r)=>(W(i,e,"read from private field"),r?r.call(i):e.get(i)),n=(i,e,r)=>e.has(i)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),h=(i,e,r,s)=>(W(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),G=require("../order/index.cjs"),K=require("../window-resizer/index.cjs"),U=require("../ticker/index.cjs"),J=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const Z=require("../layout-box/index.cjs");function Q(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const a=r[s];a&&typeof a=="object"&&"minFilter"in a&&a.dispose()}};i.traverse(r=>{if(r instanceof d.Mesh){if(r.geometry.dispose(),!Array.isArray(r.material)&&r.material.isMaterial)e(r.material);else if(Array.isArray(r.material))for(const s of r.material)e(s)}})}var v,S,c,R,g,o,x,w,y;class F{constructor(e,r,s){n(this,v);n(this,S);n(this,c);n(this,R);n(this,g);n(this,o);n(this,x);n(this,w);n(this,y);h(this,v,e),h(this,S,r),h(this,c,(s==null?void 0:s.cameraType)==="orthographic"?new d.OrthographicCamera:new d.PerspectiveCamera),h(this,R,new d.Scene),h(this,g,[]),h(this,o,(s==null?void 0:s.cameraDistance)||1e3),t(this,c).near=(s==null?void 0:s.cameraNear)||1,t(this,c).far=(s==null?void 0:s.cameraFar)||11e3,h(this,x,(s==null?void 0:s.cameraFov)||"auto"),t(this,c).position.z=t(this,o),t(this,c).name=`Cameras.${t(this,S)}`,h(this,w,J.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,h(this,y,new Z.LayoutBox(t(this,w))),t(this,y).onResize(()=>{this.resize()})}get name(){return t(this,S)}get camera(){return t(this,c)}get scene(){return t(this,R)}get box(){return t(this,y)}get cameraDistance(){return t(this,o)}set cameraDistance(e){h(this,o,e),this.resize()}set fov(e){h(this,x,e),this.resize()}get fov(){return t(this,x)}get sizeElement(){return t(this,w)}get isClipped(){return t(this,w)!==t(this,v).containerElement}resize(){const{width:e,height:r}=t(this,y);t(this,c).userData.controlled||(t(this,c).position.z=t(this,o)),t(this,c)instanceof d.PerspectiveCamera?(t(this,c).aspect=e/r,t(this,c).fov=t(this,x)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,c).userData.controlled?t(this,c).fov:t(this,x)):t(this,c)instanceof d.OrthographicCamera&&(t(this,c).left=e/-2,t(this,c).right=e/2,t(this,c).top=r/2,t(this,c).bottom=r/-2),t(this,c).updateProjectionMatrix()}destroy(){t(this,g).forEach(e=>{e.userData.box.destroy()}),t(this,R).clear(),Q(t(this,R)),t(this,v).destroyView(this.name),t(this,y).destroy()}attachToHTMLElement(e,r,s){const a=new Z.LayoutBox(e,B(I({},s),{containerElement:t(this,w),cartesian:!0,scrollStep:!this.isClipped}));return a.bindObject(r),r.userData.box=a,t(this,g).push(r),r}detachFromHTMLElement(e){h(this,g,t(this,g).filter(r=>r===e?(e.userData.box.destroy(),!1):!0))}add(...e){const r=e[0],s=e[1],a=e[2];return s&&this.attachToHTMLElement(s,r,a),this.scene.add(r),r}remove(e,r){this.scene.remove(e),r&&this.detachFromHTMLElement(e)}}v=new WeakMap,S=new WeakMap,c=new WeakMap,R=new WeakMap,g=new WeakMap,o=new WeakMap,x=new WeakMap,w=new WeakMap,y=new WeakMap;var k,u,l,m,z,V,C,D,M,f,P,A;class se{constructor(){n(this,k,`https://unpkg.com/three@0.${d.REVISION}.x`);n(this,u,null);n(this,l,null);n(this,m,new Map);n(this,z,0);n(this,V,0);n(this,C,0);n(this,D,2);n(this,M,!1);n(this,f,null);n(this,P,e=>{e instanceof CustomEvent||(h(this,z,t(this,u).clientWidth),h(this,V,t(this,u).clientHeight),h(this,C,Math.min(t(this,D),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,C)),t(this,l).setSize(t(this,z),t(this,V)),t(this,f)&&(t(this,f).setPixelRatio(t(this,C)),t(this,f).setSize(t(this,z),t(this,V))))});n(this,A,()=>{t(this,l).setRenderTarget(null),t(this,m).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,k)}get containerElement(){return t(this,u)}get webglRenderer(){return t(this,l)}get views(){return t(this,m)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return t(this,z)}get height(){return t(this,V)}get pixelRatio(){return t(this,C)}get composer(){return t(this,f)}setup(e){if(t(this,M))return;h(this,u,J.getElement(e==null?void 0:e.containerElement)||document.body),h(this,D,(e==null?void 0:e.maxPixelRatio)||2),h(this,l,new d.WebGLRenderer(e==null?void 0:e.webGLRendererParameters)),t(this,l).domElement.style.cssText=`
|
|
2
2
|
position: ${(e==null?void 0:e.position)||"fixed"};
|
|
3
3
|
left: 0;
|
|
4
4
|
top: 0;
|
|
5
5
|
width: 100%;
|
|
6
6
|
height: 100%;
|
|
7
7
|
z-index: ${(e==null?void 0:e.zIndex)||0};
|
|
8
|
-
`,(t(this,u).shadowRoot||t(this,u)).append(t(this,l).domElement),t(this,m).set("default",new F(this,"default",I({sizeElement:t(this,u)},e==null?void 0:e.view))),e!=null&&e.composer&&(h(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),h(this,
|
|
8
|
+
`,(t(this,u).shadowRoot||t(this,u)).append(t(this,l).domElement),t(this,m).set("default",new F(this,"default",I({sizeElement:t(this,u)},e==null?void 0:e.view))),e!=null&&e.composer&&(h(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),h(this,M,!0),K.windowResizer.subscribe(t(this,P),G.RESIZE_ORDER.CANVAS),U.ticker.subscribe(t(this,A),{order:G.TICK_ORDER.CANVAS,culling:t(this,u)})}destroy(){var e;t(this,M)&&(K.windowResizer.unsubscribe(t(this,P)),U.ticker.unsubscribe(t(this,A)),t(this,m).forEach(r=>{r.destroy()}),t(this,m).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),h(this,l,null),(e=t(this,f))==null||e.dispose(),h(this,f,null),h(this,M,!1))}createView(e,r){const s=t(this,m).size,a=new F(this,e,r);return t(this,m).set(e,a),s===1&&t(this,l).setScissorTest(!0),a}getView(e){return t(this,m).get(e)}destroyView(e){const r=t(this,m).get(e);r&&(t(this,m).delete(e),r.destroy(),t(this,m).size<=1&&t(this,l).setScissorTest(!1))}render(e){var r;if(t(this,m).size>1||this.view.isClipped){const s=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,a=this.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(s,a,e.box.width,e.box.height),t(this,l).setViewport(s,a,e.box.width,e.box.height)}(r=e.beforeRenderCallback)==null||r.call(e),t(this,l).render(e.scene,e.camera)}}k=new WeakMap,u=new WeakMap,l=new WeakMap,m=new WeakMap,z=new WeakMap,V=new WeakMap,C=new WeakMap,D=new WeakMap,M=new WeakMap,f=new WeakMap,P=new WeakMap,A=new WeakMap;function ie(i,e,r){const s=e.x,a=e.y,E=r||i.image.width/i.image.height;let T=0,b=0,q=i.offset.x,L=i.offset.y,O=i.rotation,X=i.center.x,Y=i.center.y;s/a>E?(T=1,b=a/s*E):(b=1,T=s/a/E),i.matrix.setUvTransform(q,L,T,b,O,X,Y)}const _=new d.Vector3,ae=new d.Vector3;function he(i,e,r="default"){const s=i.getView(r),{width:a,height:E}=i,T=a/E;e instanceof d.Vector3?_.copy(e):_.set(...e);const b=s.camera.getWorldPosition(ae).distanceTo(_);if(s.camera instanceof d.OrthographicCamera)return{width:a/s.camera.zoom,height:E/s.camera.zoom,factor:1,distance:b,aspect:T};{const q=s.camera.fov*Math.PI/180,L=2*Math.tan(q/2)*b,O=L*(a/E);return{width:O,height:L,factor:a/O,distance:b,aspect:T}}}function ne(i,e){i.traverse(r=>{r instanceof d.Mesh&&r.material&&(Array.isArray(r.material)?r.material:[r.material]).forEach(e)})}function ce(i,e){i.traverse(r=>{r instanceof d.Mesh&&e(r)})}exports.En3=se;exports.En3View=F;exports.coverTexture=ie;exports.dispose=Q;exports.getCurrentViewport=he;exports.traverseMaterials=ne;exports.traverseMeshes=ce;
|
package/lib/en3/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var _ = (r, e, s) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writab
|
|
|
14
14
|
return r;
|
|
15
15
|
}, B = (r, e) => ee(r, te(e));
|
|
16
16
|
var K = (r, e, s) => e.has(r) || G("Cannot " + s);
|
|
17
|
-
var t = (r, e, s) => (K(r, e, "read from private field"), s ? s.call(r) : e.get(r)), n = (r, e, s) => e.has(r) ? G("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s),
|
|
18
|
-
import { Mesh as N, OrthographicCamera as H, PerspectiveCamera as U, Scene as re, REVISION as
|
|
17
|
+
var t = (r, e, s) => (K(r, e, "read from private field"), s ? s.call(r) : e.get(r)), n = (r, e, s) => e.has(r) ? G("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), a = (r, e, s, i) => (K(r, e, "write to private field"), i ? i.call(r, s) : e.set(r, s), s);
|
|
18
|
+
import { Mesh as N, OrthographicCamera as H, PerspectiveCamera as U, Scene as re, REVISION as he, WebGLRenderer as ae, Vector3 as $ } from "three";
|
|
19
19
|
import { RESIZE_ORDER as ne, TICK_ORDER as ce } from "../order/index.js";
|
|
20
20
|
import { windowResizer as Z } from "../window-resizer/index.js";
|
|
21
21
|
import { ticker as q } from "../ticker/index.js";
|
|
@@ -27,8 +27,8 @@ function le(r) {
|
|
|
27
27
|
const e = (s) => {
|
|
28
28
|
s.dispose();
|
|
29
29
|
for (const i of Object.keys(s)) {
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const h = s[i];
|
|
31
|
+
h && typeof h == "object" && "minFilter" in h && h.dispose();
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
r.traverse((s) => {
|
|
@@ -40,92 +40,98 @@ function le(r) {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var M, S, c, w, o, u, g, x, y;
|
|
44
44
|
class Q {
|
|
45
45
|
constructor(e, s, i) {
|
|
46
|
-
n(this, T);
|
|
47
46
|
n(this, M);
|
|
47
|
+
n(this, S);
|
|
48
48
|
n(this, c);
|
|
49
|
-
n(this,
|
|
49
|
+
n(this, w);
|
|
50
50
|
n(this, o);
|
|
51
51
|
n(this, u);
|
|
52
|
-
n(this, S);
|
|
53
52
|
n(this, g);
|
|
54
53
|
n(this, x);
|
|
55
|
-
|
|
54
|
+
n(this, y);
|
|
55
|
+
a(this, M, e), a(this, S, s), a(this, c, (i == null ? void 0 : i.cameraType) === "orthographic" ? new H() : new U()), a(this, w, new re()), a(this, o, []), a(this, u, (i == null ? void 0 : i.cameraDistance) || 1e3), t(this, c).near = (i == null ? void 0 : i.cameraNear) || 1, t(this, c).far = (i == null ? void 0 : i.cameraFar) || 11e3, a(this, g, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, c).position.z = t(this, u), t(this, c).name = `Cameras.${t(this, S)}`, a(this, x, X(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, a(this, y, new J(t(this, x))), t(this, y).onResize(() => {
|
|
56
56
|
this.resize();
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
get name() {
|
|
60
|
-
return t(this,
|
|
60
|
+
return t(this, S);
|
|
61
61
|
}
|
|
62
62
|
get camera() {
|
|
63
63
|
return t(this, c);
|
|
64
64
|
}
|
|
65
65
|
get scene() {
|
|
66
|
-
return t(this,
|
|
66
|
+
return t(this, w);
|
|
67
67
|
}
|
|
68
68
|
get box() {
|
|
69
|
-
return t(this,
|
|
69
|
+
return t(this, y);
|
|
70
70
|
}
|
|
71
71
|
get cameraDistance() {
|
|
72
72
|
return t(this, u);
|
|
73
73
|
}
|
|
74
74
|
set cameraDistance(e) {
|
|
75
|
-
|
|
75
|
+
a(this, u, e), this.resize();
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
set fov(e) {
|
|
78
|
+
a(this, g, e), this.resize();
|
|
79
|
+
}
|
|
80
|
+
get fov() {
|
|
78
81
|
return t(this, g);
|
|
79
82
|
}
|
|
83
|
+
get sizeElement() {
|
|
84
|
+
return t(this, x);
|
|
85
|
+
}
|
|
80
86
|
get isClipped() {
|
|
81
|
-
return t(this,
|
|
87
|
+
return t(this, x) !== t(this, M).containerElement;
|
|
82
88
|
}
|
|
83
89
|
resize() {
|
|
84
|
-
const { width: e, height: s } = t(this,
|
|
85
|
-
t(this, c).userData.controlled || (t(this, c).position.z = t(this, u)), t(this, c) instanceof U ? (t(this, c).aspect = e / s, t(this, c).fov = t(this,
|
|
90
|
+
const { width: e, height: s } = t(this, y);
|
|
91
|
+
t(this, c).userData.controlled || (t(this, c).position.z = t(this, u)), t(this, c) instanceof U ? (t(this, c).aspect = e / s, t(this, c).fov = t(this, g) === "auto" ? 2 * Math.atan(s / 2 / t(this, u)) * (180 / Math.PI) : t(this, c).userData.controlled ? t(this, c).fov : t(this, g)) : t(this, c) instanceof H && (t(this, c).left = e / -2, t(this, c).right = e / 2, t(this, c).top = s / 2, t(this, c).bottom = s / -2), t(this, c).updateProjectionMatrix();
|
|
86
92
|
}
|
|
87
93
|
destroy() {
|
|
88
94
|
t(this, o).forEach((e) => {
|
|
89
95
|
e.userData.box.destroy();
|
|
90
|
-
}), t(this,
|
|
96
|
+
}), t(this, w).clear(), le(t(this, w)), t(this, M).destroyView(this.name), t(this, y).destroy();
|
|
91
97
|
}
|
|
92
98
|
attachToHTMLElement(e, s, i) {
|
|
93
|
-
const
|
|
94
|
-
containerElement: t(this,
|
|
99
|
+
const h = new J(e, B(O({}, i), {
|
|
100
|
+
containerElement: t(this, x),
|
|
95
101
|
cartesian: !0,
|
|
96
102
|
scrollStep: !this.isClipped
|
|
97
103
|
}));
|
|
98
|
-
return
|
|
104
|
+
return h.bindObject(s), s.userData.box = h, t(this, o).push(s), s;
|
|
99
105
|
}
|
|
100
106
|
detachFromHTMLElement(e) {
|
|
101
|
-
|
|
107
|
+
a(this, o, t(this, o).filter((s) => s === e ? (e.userData.box.destroy(), !1) : !0));
|
|
102
108
|
}
|
|
103
109
|
add(...e) {
|
|
104
|
-
const s = e[0], i = e[1],
|
|
105
|
-
return i && this.attachToHTMLElement(i, s,
|
|
110
|
+
const s = e[0], i = e[1], h = e[2];
|
|
111
|
+
return i && this.attachToHTMLElement(i, s, h), this.scene.add(s), s;
|
|
106
112
|
}
|
|
107
113
|
remove(e, s) {
|
|
108
114
|
this.scene.remove(e), s && this.detachFromHTMLElement(e);
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
|
-
|
|
112
|
-
var k, f, l, m,
|
|
117
|
+
M = new WeakMap(), S = new WeakMap(), c = new WeakMap(), w = new WeakMap(), o = new WeakMap(), u = new WeakMap(), g = new WeakMap(), x = new WeakMap(), y = new WeakMap();
|
|
118
|
+
var k, f, l, m, R, z, V, D, C, d, v, P;
|
|
113
119
|
class we {
|
|
114
120
|
constructor() {
|
|
115
|
-
n(this, k, `https://unpkg.com/three@0.${
|
|
121
|
+
n(this, k, `https://unpkg.com/three@0.${he}.x`);
|
|
116
122
|
n(this, f, null);
|
|
117
123
|
n(this, l, null);
|
|
118
124
|
n(this, m, /* @__PURE__ */ new Map());
|
|
119
|
-
n(this, w, 0);
|
|
120
125
|
n(this, R, 0);
|
|
121
126
|
n(this, z, 0);
|
|
127
|
+
n(this, V, 0);
|
|
122
128
|
n(this, D, 2);
|
|
123
|
-
n(this,
|
|
129
|
+
n(this, C, !1);
|
|
124
130
|
n(this, d, null);
|
|
125
|
-
n(this,
|
|
126
|
-
e instanceof CustomEvent || (
|
|
131
|
+
n(this, v, (e) => {
|
|
132
|
+
e instanceof CustomEvent || (a(this, R, t(this, f).clientWidth), a(this, z, t(this, f).clientHeight), a(this, V, Math.min(t(this, D), devicePixelRatio || 1)), t(this, l).setPixelRatio(t(this, V)), t(this, l).setSize(t(this, R), t(this, z)), t(this, d) && (t(this, d).setPixelRatio(t(this, V)), t(this, d).setSize(t(this, R), t(this, z))));
|
|
127
133
|
});
|
|
128
|
-
n(this,
|
|
134
|
+
n(this, P, () => {
|
|
129
135
|
t(this, l).setRenderTarget(null), t(this, m).forEach((e) => {
|
|
130
136
|
this.render(e);
|
|
131
137
|
});
|
|
@@ -153,21 +159,21 @@ class we {
|
|
|
153
159
|
return this.getView("default").scene;
|
|
154
160
|
}
|
|
155
161
|
get width() {
|
|
156
|
-
return t(this,
|
|
162
|
+
return t(this, R);
|
|
157
163
|
}
|
|
158
164
|
get height() {
|
|
159
|
-
return t(this,
|
|
165
|
+
return t(this, z);
|
|
160
166
|
}
|
|
161
167
|
get pixelRatio() {
|
|
162
|
-
return t(this,
|
|
168
|
+
return t(this, V);
|
|
163
169
|
}
|
|
164
170
|
get composer() {
|
|
165
171
|
return t(this, d);
|
|
166
172
|
}
|
|
167
173
|
setup(e) {
|
|
168
|
-
if (t(this,
|
|
174
|
+
if (t(this, C))
|
|
169
175
|
return;
|
|
170
|
-
|
|
176
|
+
a(this, f, X(e == null ? void 0 : e.containerElement) || document.body), a(this, D, (e == null ? void 0 : e.maxPixelRatio) || 2), a(this, l, new ae(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
|
|
171
177
|
position: ${(e == null ? void 0 : e.position) || "fixed"};
|
|
172
178
|
left: 0;
|
|
173
179
|
top: 0;
|
|
@@ -179,22 +185,22 @@ class we {
|
|
|
179
185
|
new Q(this, "default", O({
|
|
180
186
|
sizeElement: t(this, f)
|
|
181
187
|
}, e == null ? void 0 : e.view))
|
|
182
|
-
), e != null && e.composer && (
|
|
188
|
+
), e != null && e.composer && (a(this, d, new e.composer(t(this, l))), this.render = () => {
|
|
183
189
|
t(this, d).render();
|
|
184
|
-
}),
|
|
190
|
+
}), a(this, C, !0), Z.subscribe(t(this, v), ne.CANVAS), q.subscribe(t(this, P), {
|
|
185
191
|
order: ce.CANVAS,
|
|
186
192
|
culling: t(this, f)
|
|
187
193
|
});
|
|
188
194
|
}
|
|
189
195
|
destroy() {
|
|
190
196
|
var e;
|
|
191
|
-
t(this,
|
|
197
|
+
t(this, C) && (Z.unsubscribe(t(this, v)), q.unsubscribe(t(this, P)), t(this, m).forEach((s) => {
|
|
192
198
|
s.destroy();
|
|
193
|
-
}), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(),
|
|
199
|
+
}), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), a(this, l, null), (e = t(this, d)) == null || e.dispose(), a(this, d, null), a(this, C, !1));
|
|
194
200
|
}
|
|
195
201
|
createView(e, s) {
|
|
196
|
-
const i = t(this, m).size,
|
|
197
|
-
return t(this, m).set(e,
|
|
202
|
+
const i = t(this, m).size, h = new Q(this, e, s);
|
|
203
|
+
return t(this, m).set(e, h), i === 1 && t(this, l).setScissorTest(!0), h;
|
|
198
204
|
}
|
|
199
205
|
getView(e) {
|
|
200
206
|
return t(this, m).get(e);
|
|
@@ -206,10 +212,10 @@ class we {
|
|
|
206
212
|
render(e) {
|
|
207
213
|
var s;
|
|
208
214
|
if (t(this, m).size > 1 || this.view.isClipped) {
|
|
209
|
-
const i = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x,
|
|
210
|
-
t(this, l).setScissor(i,
|
|
215
|
+
const i = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, h = this.height - e.box.height - e.box.top + e.box.CSSTranslation.y + e.box.scrollValue.y * -1;
|
|
216
|
+
t(this, l).setScissor(i, h, e.box.width, e.box.height), t(this, l).setViewport(
|
|
211
217
|
i,
|
|
212
|
-
|
|
218
|
+
h,
|
|
213
219
|
e.box.width,
|
|
214
220
|
e.box.height
|
|
215
221
|
);
|
|
@@ -217,28 +223,28 @@ class we {
|
|
|
217
223
|
(s = e.beforeRenderCallback) == null || s.call(e), t(this, l).render(e.scene, e.camera);
|
|
218
224
|
}
|
|
219
225
|
}
|
|
220
|
-
k = new WeakMap(), f = new WeakMap(), l = new WeakMap(), m = new WeakMap(),
|
|
226
|
+
k = new WeakMap(), f = new WeakMap(), l = new WeakMap(), m = new WeakMap(), R = new WeakMap(), z = new WeakMap(), V = new WeakMap(), D = new WeakMap(), C = new WeakMap(), d = new WeakMap(), v = new WeakMap(), P = new WeakMap();
|
|
221
227
|
function Re(r, e, s) {
|
|
222
|
-
const i = e.x,
|
|
223
|
-
let
|
|
224
|
-
i /
|
|
228
|
+
const i = e.x, h = e.y, E = s || r.image.width / r.image.height;
|
|
229
|
+
let T = 0, b = 0, I = r.offset.x, A = r.offset.y, L = r.rotation, Y = r.center.x, j = r.center.y;
|
|
230
|
+
i / h > E ? (T = 1, b = h / i * E) : (b = 1, T = i / h / E), r.matrix.setUvTransform(I, A, T, b, L, Y, j);
|
|
225
231
|
}
|
|
226
232
|
const F = new $(), me = new $();
|
|
227
233
|
function ze(r, e, s = "default") {
|
|
228
|
-
const i = r.getView(s), { width:
|
|
234
|
+
const i = r.getView(s), { width: h, height: E } = r, T = h / E;
|
|
229
235
|
e instanceof $ ? F.copy(e) : F.set(...e);
|
|
230
|
-
const
|
|
236
|
+
const b = i.camera.getWorldPosition(me).distanceTo(F);
|
|
231
237
|
if (i.camera instanceof H)
|
|
232
238
|
return {
|
|
233
|
-
width:
|
|
234
|
-
height:
|
|
239
|
+
width: h / i.camera.zoom,
|
|
240
|
+
height: E / i.camera.zoom,
|
|
235
241
|
factor: 1,
|
|
236
|
-
distance:
|
|
237
|
-
aspect:
|
|
242
|
+
distance: b,
|
|
243
|
+
aspect: T
|
|
238
244
|
};
|
|
239
245
|
{
|
|
240
|
-
const I = i.camera.fov * Math.PI / 180,
|
|
241
|
-
return { width: L, height:
|
|
246
|
+
const I = i.camera.fov * Math.PI / 180, A = 2 * Math.tan(I / 2) * b, L = A * (h / E);
|
|
247
|
+
return { width: L, height: A, factor: h / L, distance: b, aspect: T };
|
|
242
248
|
}
|
|
243
249
|
}
|
|
244
250
|
function Ve(r, e) {
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty,de=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Jt=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var Qt=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),_t=o=>{throw TypeError(o)};var Zt=(o,e,s)=>e in o?ue(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,Rt=(o,e)=>{for(var s in e||(e={}))fe.call(e,s)&&Zt(o,s,e[s]);if(Jt)for(var s of Jt(e))pe.call(e,s)&&Zt(o,s,e[s]);return o},Dt=(o,e)=>de(o,me(e));var qt=(o,e,s)=>e.has(o)||_t("Cannot "+s);var t=(o,e,s)=>(qt(o,e,"read from private field"),s?s.call(o):e.get(o)),h=(o,e,s)=>e.has(o)?_t("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,s),r=(o,e,s,i)=>(qt(o,e,"write to private field"),i?i.call(o,s):e.set(o,s),s),g=(o,e,s)=>(qt(o,e,"access private method"),s);var G=(o,e,s)=>new Promise((i,l)=>{var S=c=>{try{E(s.next(c))}catch(v){l(v)}},p=c=>{try{E(s.throw(c))}catch(v){l(v)}},E=c=>c.done?i(c.value):Promise.resolve(c.value).then(S,p);E((s=s.apply(o,e)).next())});var te=(o,e,s)=>(e=o[Qt("asyncIterator")])?e.call(o):(o=o[Qt("iterator")](),e={},s=(i,l)=>(l=o[i])&&(e[i]=S=>new Promise((p,E,c)=>(S=l.call(o,S),c=S.done,Promise.resolve(S.value).then(v=>p({value:v,done:c}),E)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("../index-DekP7OZe.cjs"),q=require("../events-KVanG9sR.cjs"),ee=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const dt=require("../url-Dns-01WU.cjs"),ge=require("../css-value-parser/index.cjs"),Ee=require("../string-DUXXtU8v.cjs");class ae 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,i]of Object.entries(e))this.setAttribute(s,i)}}ie.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",ae);var H,a,U,st,Ht,ft,it;class It{constructor(e,s){h(this,st);h(this,H);h(this,a);h(this,U);h(this,ft,e=>{var i;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,H).previousURL)history.back();else{r(this,U,t(this,a).getAttribute("href")||"/");const l=t(this,a).getAttribute("data-history-action")||"push",S=t(this,a).hasAttribute("data-center-scroll"),p=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),E=p?ge.cssValueParser.parse(p):void 0,c=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),v=t(this,a).hasAttribute("data-keep-search-parameters"),D=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),ut=t(this,a).getAttribute("data-scroll-behaviour"),et=g(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));et&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,H).links.forEach(T=>{T.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),et.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,H).links.forEach(T=>{T.updatePagination(et.currentPage+1,et.selector)}));const re=((i=t(this,a).getAttribute("data-submorph"))==null?void 0:i.split(",").map(T=>T.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,Pt=t(this,a).hasAttribute("data-clear-state");let u=t(this,U);if(t(this,a).hasAttribute("data-toggle-params")){const[T,wt]=t(this,U).split("?"),j=new URLSearchParams(wt),O=new URLSearchParams(location.search),A=new URLSearchParams;for(const[w]of j)(!O.has(w)||O.has(w)&&O.get(w)!==j.get(w))&&A.append(w,j.get(w));if(t(this,a).hasAttribute("data-merge-params"))for(const[w]of O)j.has(w)||A.append(w,O.get(w));u=`${T}?${A.toString()}`}t(this,H).navigate(u,{historyAction:l,centerScroll:S,offsetScroll:E,revalidate:c,keepSearchParameters:v,submorph:re,clearState:Pt,keepScrollPosition:D,scrollBehaviour:ut,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link"),mergeParams:t(this,a).hasAttribute("data-merge-params")&&!t(this,a).hasAttribute("data-toggle-params")})}});h(this,it,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,H).prefetch(t(this,U),e),t(this,a).removeEventListener("pointerenter",t(this,it))});r(this,H,s),r(this,a,e),t(this,a).addEventListener("click",t(this,ft)),r(this,U,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const i=g(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));i&&this.updatePagination(i.currentPage,i.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,it))}get element(){return t(this,a)}checkCurrent(e){var v;const s=t(this,H).normalizePath(e),i=t(this,H).normalizePath(t(this,U));t(this,a).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?t(this,a).classList.add("current"):i.pathname===s.pathname?t(this,a).classList.add("current"):(v=t(this,a).getAttribute("data-associated-paths"))!=null&&v.split(",").find(D=>s.pathname.includes(D))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),s.path===i.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact");const[l,S]=t(this,U).split("?"),p=new URLSearchParams(S),E=new URLSearchParams(location.search);let c=0;for(const[D]of E)p.has(D)&&E.get(D)===p.get(D)&&c++;c?(t(this,a).classList.toggle("all-params-matched",E.size===c),t(this,a).classList.toggle("some-params-matched",E.size!==c)):(t(this,a).classList.remove("all-params-matched"),t(this,a).classList.remove("some-params-matched"))}updatePagination(e,s){const i=g(this,st,Ht).call(this,s);if(i)if(i.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<i.totalPages){t(this,a).style.display="";const l=t(this,a).querySelector("[data-pagination-more-link-counter]");l&&(l.textContent=(i.totalPages-e).toString());const S=t(this,a).getAttribute("href"),p=new URL(S,window.location.origin);p.searchParams.set("page",(e+1).toString());const E=p.href.replace(p.origin,"").toString();t(this,a).setAttribute("href",E),this.checkCurrent(E)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,ft)),t(this,a).removeEventListener("pointerenter",t(this,it)),t(this,a).classList.remove("current","exact","pagination-current")}}H=new WeakMap,a=new WeakMap,U=new WeakMap,st=new WeakSet,Ht=function(e){if(!e)return;const s=document.querySelector(e);if(s){const i=parseInt(s.getAttribute("data-current-page")||"1"),l=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:i,totalPages:l,selector:e}}},ft=new WeakMap,it=new WeakMap;const ve=new DOMParser;var I,J,k,z,Q,B,at,Z,X,pt;class se{constructor(e,s){h(this,I);h(this,J);h(this,k,{x:0,y:0});h(this,z,null);h(this,Q,null);h(this,B,null);h(this,at,null);h(this,Z,null);h(this,X,null);h(this,pt);r(this,I,e),r(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,k)}get document(){return t(this,B)}setHeaders(e){r(this,pt,e)}setInitialDocument(e){r(this,z,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,i){return G(this,null,function*(){var l;if(!i){const E=((l=t(this,z))==null?void 0:l.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,z)&&t(this,I).isPopstateNavigation;if(t(this,X)||E||c)return t(this,X)}return r(this,X,new Promise(S=>G(this,null,function*(){try{r(this,Z,new AbortController);const E=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,pt))})).text(),c=ve.parseFromString(E,"text/html");this.setInitialDocument(c)}catch(p){console.warn(p)}finally{r(this,Z,null),r(this,X,null),S()}}))),t(this,X)})}cloneDocument(){r(this,B,(t(this,Q)||t(this,z)).cloneNode(!0))}get title(){let e="";if(t(this,B).title)e=t(this,B).title;else{const s=t(this,B).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,k).x=0,t(this,k).y=0}clearDocumentState(){r(this,Q,null)}saveScrollState(){t(this,z).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,k).x=0,t(this,k).y=0):(t(this,k).x=t(this,I).scrollValue.left,t(this,k).y=t(this,I).scrollValue.top)}restoreScrollPosition(){t(this,I).scrollElement.scroll({top:t(this,k).y,left:t(this,k).x,behavior:"instant"})}saveDocumentState(){t(this,z).documentElement.hasAttribute("data-no-page-restoration")?r(this,Q,null):r(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,I).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,at,e)}clearState(){const e=t(this,at);return r(this,at,null),e}}I=new WeakMap,J=new WeakMap,k=new WeakMap,z=new WeakMap,Q=new WeakMap,B=new WeakMap,at=new WeakMap,Z=new WeakMap,X=new WeakMap,pt=new WeakMap;var C,nt,gt,zt,Et;class Se{constructor(e){h(this,gt);h(this,C);h(this,nt,[]);h(this,Et,()=>{g(this,gt,zt).call(this)});r(this,C,e);for(const s in t(this,C).dataset){const i=Ee.camelToKebab(s);if(i.startsWith("param-")){const l=i.split("param-")[1],S=t(this,C).dataset[s];t(this,nt).push({name:l,value:S})}}document.addEventListener("morphURLParametersChange",t(this,Et)),g(this,gt,zt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,Et))}}C=new WeakMap,nt=new WeakMap,gt=new WeakSet,zt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,nt).find(l=>e.has(l.name)&&(e.get(l.name)===l.value||l.value==="*"));!s&&t(this,C).hasAttribute("data-match-no-params")&&(s=!t(this,nt).filter(l=>e.has(l.name)).length);const i=t(this,C).getAttribute("data-hide-class");s?i?t(this,C).classList.remove(i):t(this,C).style.display="":i?t(this,C).classList.add(i):t(this,C).style.display="none"},Et=new WeakMap;var N,rt,y,K,f,_,Y,$,M,vt,V,St,tt,ot,ht,Lt,lt,bt,m,Ot,yt,Mt,Wt,ne,Ft,Bt,Xt,Kt,Tt,ct;const mt=class mt{constructor(e){h(this,m);h(this,N,null);h(this,rt,null);h(this,y,[]);h(this,K);h(this,f,null);h(this,_);h(this,Y,[]);h(this,$,!1);h(this,M,null);h(this,vt,!1);h(this,V,new Map);h(this,St,[]);h(this,tt,null);h(this,ot,0);h(this,ht,0);h(this,Lt);h(this,lt);h(this,bt);h(this,yt,e=>{var s;return((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});h(this,Tt,e=>G(this,null,function*(){e.preventDefault(),r(this,$,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,lt)?void 0:t(this,Lt),revalidate:t(this,lt),keepScrollPosition:t(this,bt)}),r(this,$,!1)}));h(this,ct,()=>{const{left:e,top:s}=this.scrollValue,i=s-t(this,ht),l=e-t(this,ot);r(this,ht,s),r(this,ot,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",l>0),document.documentElement.classList.toggle("scroll-x-backward",l<0),q.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ie.isBrowser&&!mt.instance){mt.instance=this,r(this,N,{base:dt.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,rt,g(this,m,Wt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);r(this,f,s);const i=new se(this,t(this,f).pathname);i.setInitialDocument(document),t(this,V).set(t(this,f).pathname,i),document.documentElement.setAttribute("data-current-pathname",t(this,f).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),dt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,tt,new ae),g(this,m,Xt).call(this,document)}}get currentURL(){return t(this,f)}get previousURL(){return t(this,_)}get links(){return t(this,y)}get scrollElement(){return t(this,M)}get isPopstateNavigation(){return t(this,$)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,M).scrollTop,s=t(this,M).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,V).get(t(this,f).path);s&&s.saveState(e)}getState(){const e=t(this,V).get(t(this,f).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return dt.splitPath(e,{base:t(this,N).base,trailingSlash:t(this,N).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var l;if(t(this,Y).length)return;e=((l=this.pathnameModifier)==null?void 0:l.call(this,e))||e;const i=g(this,m,Mt).call(this,e);i==null||i.fetch(e,t(this,f).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(re){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:i,offsetScroll:l,scrollBehaviour:S,revalidate:p,keepSearchParameters:E,submorph:c,submorphAppend:v,clearState:D,keepScrollPosition:ut,mergeParams:et}={}){var T,wt,j,O;if(t(this,Y).length)return;r(this,Lt,c),r(this,lt,p),r(this,bt,ut);const Pt=((T=this.pathnameModifier)==null?void 0:T.call(this,e))||e,u=this.normalizePath(Pt,{mergeParams:et});if(!p&&(((wt=t(this,K))==null?void 0:wt.pathname)===u.pathname||t(this,f).pathname===u.pathname)){ut||g(this,m,Kt).call(this,u.hash||0,{centerScroll:i,offsetScroll:l,behavior:"smooth"}),q.dispatchEvent(document,"morphSamePath",{custom:!0}),((j=t(this,f))==null?void 0:j.parameters)!==u.parameters&&(r(this,_,t(this,f)),r(this,f,u),dt.changeHistory({action:((O=t(this,f))==null?void 0:O.hash)!==u.hash?"replace":s,pathname:u.pathname,searchParameters:u.parameters,hash:u.hash}),q.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,f),previousURL:t(this,_)}})),t(this,y).forEach(A=>{A.checkCurrent(u.path)});return}else t(this,y).forEach(A=>{A.checkCurrent(u.path)});r(this,K,u);try{let A=!0;if(this.preprocessor)try{yield new Promise((n,P)=>{var R;(R=this.preprocessor)==null||R.call(this,{url:u,resolve:n,reject:P,submorph:c})})}catch(n){n?console.error(n):console.log("Route change canceled"),A=!1}if(!A||t(this,K).pathname!==u.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}const w={url:u,submorph:c};c?v||c.forEach(n=>{document.querySelectorAll(n).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,rt).forEach(n=>{var P,R;(P=n.firstElementChild)==null||P.classList.add("out"),(R=n.firstElementChild)==null||R.setAttribute("data-morph-out","")}),q.dispatchEvent(document,"morphNavigation",{detail:w});const xt=g(this,m,Mt).call(this,t(this,f).pathname),L=g(this,m,Mt).call(this,u.pathname);if(t(this,V).forEach(n=>{n.pathname!==u.pathname&&n.abort()}),yield L==null?void 0:L.fetch(Pt,t(this,f).path,p),t(this,K).pathname!==u.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}xt.clearState(),xt.saveScrollState(),xt.saveDocumentState(),(!t(this,$)||p)&&(L.clearScrollState(),L.clearDocumentState()),D&&L.clearState(),L.cloneDocument(),t(this,tt).textContent=L.title,document.body.appendChild(t(this,tt));const At=Dt(Rt({},w),{document:L.document});v||At.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),q.dispatchEvent(document,"morphStart",{detail:At});const Yt=Array.from(document.head.children),$t=Array.from(L.document.head.children),jt=g(this,m,ne).call(this,Yt,$t),oe=g(this,m,Ft).call(this,Yt,jt),kt=g(this,m,Ft).call(this,$t,jt).filter(n=>!this.excludeHeadChild(n));kt.forEach((n,P)=>{n.tagName==="SCRIPT"&&(kt[P]=g(this,m,Ot).call(this,n))}),kt.forEach(n=>{document.head.appendChild(n)});const Ut=kt.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(g(this,m,Bt).call(this,n))return!0});t(this,N).waitForHeadToLoad&&Ut.length&&(yield new Promise(n=>G(this,null,function*(){let P=0;try{for(var R=te(Ut),le,W,x;le=!(W=yield R.next()).done;le=!1){const Ct=W.value;Ct.onload=()=>{P++,P===Ut.length&&n()}}}catch(W){x=[W]}finally{try{le&&(W=R.return)&&(yield W.call(R))}finally{if(x)throw x[0]}}}))),yield ee.wait(10);const Gt=[];v||oe.forEach(n=>{n.hasAttribute("data-permanent")||(g(this,m,Bt).call(this,n)?Gt.push(n):n.remove())});const he=g(this,m,Wt).call(this,L.document.body);!t(this,N).morphInsideScrollContainer&&!c&&g(this,m,Xt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",u.pathname),document.documentElement.setAttribute("data-current-leaf",u.leaf),dt.changeHistory({action:s,pathname:u.pathname,searchParameters:u.parameters||(E?location.search:""),hash:u.hash}),t(this,tt).remove(),r(this,_,t(this,f)),r(this,f,u);const Nt=[];t(this,rt).forEach((n,P)=>{const R=he[P],le=getComputedStyle(n).getPropertyValue("--morph-duration");let W=[],x=[];c?(c.forEach(d=>{const b=n.querySelector(d),F=R.querySelector(d);b&&F&&(x.push(b),W.push(F))}),x.forEach(d=>{d.parentElement&&Nt.push(d.parentElement)})):(W.push(...R.childNodes),x.push(...n.childNodes),Nt.push(n)),v||x.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),W.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),c?v?W.forEach((d,b)=>{x[b]instanceof HTMLElement&&x[b].append(...d.childNodes)}):W.forEach((d,b)=>{var F;(F=x[b].parentElement)==null||F.insertBefore(d,x[b])}):n.prepend(...W),setTimeout(()=>{v||x.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),W.forEach(d=>{var b;d instanceof HTMLElement&&((b=d.parentElement)==null||b.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})},0);const Ct=Dt(Rt({},At),{morphElement:n});q.dispatchEvent(document,"morphNewChildrenAdded",{detail:Ct});const ce=new Promise(d=>{setTimeout(()=>{v||x.forEach(b=>b.remove()),W.forEach(b=>{var F;b instanceof HTMLElement&&((F=b.parentElement)==null||F.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),v||q.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Ct}),d()},(parseFloat(le)||0)*1e3+10)});t(this,Y).push(ce)}),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"),q.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:L.scrollState}),u.hash?(L.clearScrollState(),g(this,m,Kt).call(this,u.hash,{centerScroll:i,offsetScroll:l,behavior:S})):t(this,$)?L.restoreScrollPosition():ut||L.renewScrollPosition(),yield Promise.all(t(this,Y)),v||Gt.forEach(n=>n.remove()),r(this,Y,[]),Nt.forEach(n=>{n.querySelectorAll("script").forEach(R=>{R.replaceWith(g(this,m,Ot).call(this,R))})}),t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)}),this.findParamsDependent(),q.dispatchEvent(document,"morphComplete",{detail:At}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(A){console.error(A)}r(this,K,void 0)})}addLink(e){t(this,y).push(new It(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){r(this,y,t(this,y).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){r(this,y,t(this,y).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,yt));t(this,y).push(...s.map(i=>new It(i,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,yt));t(this,y).forEach(s=>s.destroy()),r(this,y,e.map(s=>new It(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,St).forEach(s=>s.destroy()),r(this,St,e.map(s=>new Se(s)))}};N=new WeakMap,rt=new WeakMap,y=new WeakMap,K=new WeakMap,f=new WeakMap,_=new WeakMap,Y=new WeakMap,$=new WeakMap,M=new WeakMap,vt=new WeakMap,V=new WeakMap,St=new WeakMap,tt=new WeakMap,ot=new WeakMap,ht=new WeakMap,Lt=new WeakMap,lt=new WeakMap,bt=new WeakMap,m=new WeakSet,Ot=function(e){const s=document.createElement("script");for(let i=0;i<e.attributes.length;i++){const l=e.attributes[i];s.setAttribute(l.name,l.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},yt=new WeakMap,Mt=function(e){const s=this.normalizePath(e);let i=t(this,V).get(s.pathname);return i||(i=new se(this,s.pathname),t(this,V).set(s.pathname,i)),i},Wt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ne=function(e,s){return e.filter(i=>s.find(l=>l.outerHTML===i.outerHTML))},Ft=function(e,s){return e.filter(i=>!s.find(l=>l.outerHTML===i.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Xt=function(e){var s,i;(s=t(this,M))==null||s.removeEventListener("scroll",t(this,ct)),r(this,ht,0),r(this,ot,0),r(this,M,t(this,N).scrollSelector&&e.querySelector(t(this,N).scrollSelector)||window),r(this,vt,t(this,M)===window),(i=t(this,M))==null||i.addEventListener("scroll",t(this,ct)),t(this,ct).call(this)},Kt=function(e,s){const i=typeof e=="string"?document.getElementById(e):e;(typeof i=="number"||i)&&ee.scrollToElement(i,{scrollElement:t(this,M),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ct=new WeakMap,mt.instance=null;let Vt=mt;exports.Morph=Vt;
|
|
1
|
+
"use strict";var ue=Object.defineProperty,de=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Jt=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var Qt=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),_t=h=>{throw TypeError(h)};var Zt=(h,e,s)=>e in h?ue(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Rt=(h,e)=>{for(var s in e||(e={}))fe.call(e,s)&&Zt(h,s,e[s]);if(Jt)for(var s of Jt(e))pe.call(e,s)&&Zt(h,s,e[s]);return h},Dt=(h,e)=>de(h,me(e));var qt=(h,e,s)=>e.has(h)||_t("Cannot "+s);var t=(h,e,s)=>(qt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?_t("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,i)=>(qt(h,e,"write to private field"),i?i.call(h,s):e.set(h,s),s),E=(h,e,s)=>(qt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((i,n)=>{var S=c=>{try{g(s.next(c))}catch(v){n(v)}},p=c=>{try{g(s.throw(c))}catch(v){n(v)}},g=c=>c.done?i(c.value):Promise.resolve(c.value).then(S,p);g((s=s.apply(h,e)).next())});var te=(h,e,s)=>(e=h[Qt("asyncIterator")])?e.call(h):(h=h[Qt("iterator")](),e={},s=(i,n)=>(n=h[i])&&(e[i]=S=>new Promise((p,g,c)=>(S=n.call(h,S),c=S.done,Promise.resolve(S.value).then(v=>p({value:v,done:c}),g)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("../index-DekP7OZe.cjs"),q=require("../events-KVanG9sR.cjs"),ee=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const dt=require("../url-Dns-01WU.cjs"),ge=require("../css-value-parser/index.cjs"),Ee=require("../string-DUXXtU8v.cjs");class ae 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,i]of Object.entries(e))this.setAttribute(s,i)}}ie.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",ae);var H,a,U,st,Ht,ft,it;class It{constructor(e,s){l(this,st);l(this,H);l(this,a);l(this,U);l(this,ft,e=>{var i;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,H).previousURL)history.back();else{o(this,U,t(this,a).getAttribute("href")||"/");const n=t(this,a).getAttribute("data-history-action")||"push",S=t(this,a).hasAttribute("data-center-scroll"),p=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),g=p?ge.cssValueParser.parse(p):void 0,c=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),v=t(this,a).hasAttribute("data-keep-search-parameters"),D=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),ut=t(this,a).getAttribute("data-scroll-behaviour"),et=E(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));et&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,H).links.forEach(T=>{T.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),et.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,H).links.forEach(T=>{T.updatePagination(et.currentPage+1,et.selector)}));const re=((i=t(this,a).getAttribute("data-submorph"))==null?void 0:i.split(",").map(T=>T.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,Pt=t(this,a).hasAttribute("data-clear-state");let u=t(this,U);if(t(this,a).hasAttribute("data-toggle-params")){const[T,wt]=t(this,U).split("?"),j=new URLSearchParams(wt),O=new URLSearchParams(location.search),A=new URLSearchParams;for(const[w]of j)(!O.has(w)||O.has(w)&&O.get(w)!==j.get(w))&&A.append(w,j.get(w));if(t(this,a).hasAttribute("data-merge-params"))for(const[w]of O)j.has(w)||A.append(w,O.get(w));u=`${T}?${A.toString()}`}t(this,H).navigate(u,{historyAction:n,centerScroll:S,offsetScroll:g,revalidate:c,keepSearchParameters:v,submorph:re,clearState:Pt,keepScrollPosition:D,scrollBehaviour:ut,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link"),mergeParams:t(this,a).hasAttribute("data-merge-params")&&!t(this,a).hasAttribute("data-toggle-params")})}});l(this,it,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,H).prefetch(t(this,U),e),t(this,a).removeEventListener("pointerenter",t(this,it))});o(this,H,s),o(this,a,e),t(this,a).addEventListener("click",t(this,ft)),o(this,U,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const i=E(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));i&&this.updatePagination(i.currentPage,i.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,it))}get element(){return t(this,a)}checkCurrent(e){var v;const s=t(this,H).normalizePath(e),i=t(this,H).normalizePath(t(this,U));t(this,a).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?t(this,a).classList.add("current"):i.pathname===s.pathname?t(this,a).classList.add("current"):(v=t(this,a).getAttribute("data-associated-paths"))!=null&&v.split(",").find(D=>s.pathname.includes(D))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),s.path===i.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact");const[n,S]=t(this,U).split("?"),p=new URLSearchParams(S),g=new URLSearchParams(location.search);let c=0;for(const[D]of g)p.has(D)&&g.get(D)===p.get(D)&&c++;c?(t(this,a).classList.toggle("all-params-matched",g.size===c),t(this,a).classList.toggle("some-params-matched",g.size!==c)):!g.size&&t(this,a).hasAttribute("data-match-no-params")?t(this,a).classList.add("all-params-matched"):(t(this,a).classList.remove("all-params-matched"),t(this,a).classList.remove("some-params-matched"))}updatePagination(e,s){const i=E(this,st,Ht).call(this,s);if(i)if(i.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<i.totalPages){t(this,a).style.display="";const n=t(this,a).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(i.totalPages-e).toString());const S=t(this,a).getAttribute("href"),p=new URL(S,window.location.origin);p.searchParams.set("page",(e+1).toString());const g=p.href.replace(p.origin,"").toString();t(this,a).setAttribute("href",g),this.checkCurrent(g)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,ft)),t(this,a).removeEventListener("pointerenter",t(this,it)),t(this,a).classList.remove("current","exact","pagination-current")}}H=new WeakMap,a=new WeakMap,U=new WeakMap,st=new WeakSet,Ht=function(e){if(!e)return;const s=document.querySelector(e);if(s){const i=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:i,totalPages:n,selector:e}}},ft=new WeakMap,it=new WeakMap;const ve=new DOMParser;var I,J,k,z,Q,B,at,Z,X,pt;class se{constructor(e,s){l(this,I);l(this,J);l(this,k,{x:0,y:0});l(this,z,null);l(this,Q,null);l(this,B,null);l(this,at,null);l(this,Z,null);l(this,X,null);l(this,pt);o(this,I,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,k)}get document(){return t(this,B)}setHeaders(e){o(this,pt,e)}setInitialDocument(e){o(this,z,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,i){return G(this,null,function*(){var n;if(!i){const g=((n=t(this,z))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,z)&&t(this,I).isPopstateNavigation;if(t(this,X)||g||c)return t(this,X)}return o(this,X,new Promise(S=>G(this,null,function*(){try{o(this,Z,new AbortController);const g=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,pt))})).text(),c=ve.parseFromString(g,"text/html");this.setInitialDocument(c)}catch(p){console.warn(p)}finally{o(this,Z,null),o(this,X,null),S()}}))),t(this,X)})}cloneDocument(){o(this,B,(t(this,Q)||t(this,z)).cloneNode(!0))}get title(){let e="";if(t(this,B).title)e=t(this,B).title;else{const s=t(this,B).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,k).x=0,t(this,k).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,z).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,k).x=0,t(this,k).y=0):(t(this,k).x=t(this,I).scrollValue.left,t(this,k).y=t(this,I).scrollValue.top)}restoreScrollPosition(){t(this,I).scrollElement.scroll({top:t(this,k).y,left:t(this,k).x,behavior:"instant"})}saveDocumentState(){t(this,z).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,I).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,at,e)}clearState(){const e=t(this,at);return o(this,at,null),e}}I=new WeakMap,J=new WeakMap,k=new WeakMap,z=new WeakMap,Q=new WeakMap,B=new WeakMap,at=new WeakMap,Z=new WeakMap,X=new WeakMap,pt=new WeakMap;var C,nt,gt,zt,Et;class Se{constructor(e){l(this,gt);l(this,C);l(this,nt,[]);l(this,Et,()=>{E(this,gt,zt).call(this)});o(this,C,e);for(const s in t(this,C).dataset){const i=Ee.camelToKebab(s);if(i.startsWith("param-")){const n=i.split("param-")[1],S=t(this,C).dataset[s];t(this,nt).push({name:n,value:S})}}document.addEventListener("morphURLParametersChange",t(this,Et)),E(this,gt,zt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,Et))}}C=new WeakMap,nt=new WeakMap,gt=new WeakSet,zt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,nt).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,C).hasAttribute("data-match-no-params")&&(s=!t(this,nt).filter(n=>e.has(n.name)).length);const i=t(this,C).getAttribute("data-hide-class");s?i?t(this,C).classList.remove(i):t(this,C).style.display="":i?t(this,C).classList.add(i):t(this,C).style.display="none"},Et=new WeakMap;var N,rt,y,K,f,_,Y,$,M,vt,V,St,tt,ot,ht,Lt,lt,bt,m,Ot,yt,Mt,Wt,ne,Ft,Bt,Xt,Kt,Tt,ct;const mt=class mt{constructor(e){l(this,m);l(this,N,null);l(this,rt,null);l(this,y,[]);l(this,K);l(this,f,null);l(this,_);l(this,Y,[]);l(this,$,!1);l(this,M,null);l(this,vt,!1);l(this,V,new Map);l(this,St,[]);l(this,tt,null);l(this,ot,0);l(this,ht,0);l(this,Lt);l(this,lt);l(this,bt);l(this,yt,e=>{var s;return((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Tt,e=>G(this,null,function*(){e.preventDefault(),o(this,$,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,lt)?void 0:t(this,Lt),revalidate:t(this,lt),keepScrollPosition:t(this,bt)}),o(this,$,!1)}));l(this,ct,()=>{const{left:e,top:s}=this.scrollValue,i=s-t(this,ht),n=e-t(this,ot);o(this,ht,s),o(this,ot,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),q.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ie.isBrowser&&!mt.instance){mt.instance=this,o(this,N,{base:dt.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}),o(this,rt,E(this,m,Wt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,f,s);const i=new se(this,t(this,f).pathname);i.setInitialDocument(document),t(this,V).set(t(this,f).pathname,i),document.documentElement.setAttribute("data-current-pathname",t(this,f).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),dt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new ae),E(this,m,Xt).call(this,document)}}get currentURL(){return t(this,f)}get previousURL(){return t(this,_)}get links(){return t(this,y)}get scrollElement(){return t(this,M)}get isPopstateNavigation(){return t(this,$)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,M).scrollTop,s=t(this,M).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,V).get(t(this,f).path);s&&s.saveState(e)}getState(){const e=t(this,V).get(t(this,f).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return dt.splitPath(e,{base:t(this,N).base,trailingSlash:t(this,N).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,Y).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const i=E(this,m,Mt).call(this,e);i==null||i.fetch(e,t(this,f).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(re){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:i,offsetScroll:n,scrollBehaviour:S,revalidate:p,keepSearchParameters:g,submorph:c,submorphAppend:v,clearState:D,keepScrollPosition:ut,mergeParams:et}={}){var T,wt,j,O;if(t(this,Y).length)return;o(this,Lt,c),o(this,lt,p),o(this,bt,ut);const Pt=((T=this.pathnameModifier)==null?void 0:T.call(this,e))||e,u=this.normalizePath(Pt,{mergeParams:et});if(!p&&(((wt=t(this,K))==null?void 0:wt.pathname)===u.pathname||t(this,f).pathname===u.pathname)){ut||E(this,m,Kt).call(this,u.hash||0,{centerScroll:i,offsetScroll:n,behavior:"smooth"}),q.dispatchEvent(document,"morphSamePath",{custom:!0}),((j=t(this,f))==null?void 0:j.parameters)!==u.parameters&&(o(this,_,t(this,f)),o(this,f,u),dt.changeHistory({action:((O=t(this,f))==null?void 0:O.hash)!==u.hash?"replace":s,pathname:u.pathname,searchParameters:u.parameters,hash:u.hash}),q.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,f),previousURL:t(this,_)}})),t(this,y).forEach(A=>{A.checkCurrent(u.path)});return}else t(this,y).forEach(A=>{A.checkCurrent(u.path)});o(this,K,u);try{let A=!0;if(this.preprocessor)try{yield new Promise((r,P)=>{var R;(R=this.preprocessor)==null||R.call(this,{url:u,resolve:r,reject:P,submorph:c})})}catch(r){r?console.error(r):console.log("Route change canceled"),A=!1}if(!A||t(this,K).pathname!==u.pathname){t(this,y).forEach(r=>{r.checkCurrent(t(this,f).path)});return}const w={url:u,submorph:c};c?v||c.forEach(r=>{document.querySelectorAll(r).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,rt).forEach(r=>{var P,R;(P=r.firstElementChild)==null||P.classList.add("out"),(R=r.firstElementChild)==null||R.setAttribute("data-morph-out","")}),q.dispatchEvent(document,"morphNavigation",{detail:w});const xt=E(this,m,Mt).call(this,t(this,f).pathname),L=E(this,m,Mt).call(this,u.pathname);if(t(this,V).forEach(r=>{r.pathname!==u.pathname&&r.abort()}),yield L==null?void 0:L.fetch(Pt,t(this,f).path,p),t(this,K).pathname!==u.pathname){t(this,y).forEach(r=>{r.checkCurrent(t(this,f).path)});return}xt.clearState(),xt.saveScrollState(),xt.saveDocumentState(),(!t(this,$)||p)&&(L.clearScrollState(),L.clearDocumentState()),D&&L.clearState(),L.cloneDocument(),t(this,tt).textContent=L.title,document.body.appendChild(t(this,tt));const At=Dt(Rt({},w),{document:L.document});v||At.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),q.dispatchEvent(document,"morphStart",{detail:At});const Yt=Array.from(document.head.children),$t=Array.from(L.document.head.children),jt=E(this,m,ne).call(this,Yt,$t),oe=E(this,m,Ft).call(this,Yt,jt),kt=E(this,m,Ft).call(this,$t,jt).filter(r=>!this.excludeHeadChild(r));kt.forEach((r,P)=>{r.tagName==="SCRIPT"&&(kt[P]=E(this,m,Ot).call(this,r))}),kt.forEach(r=>{document.head.appendChild(r)});const Ut=kt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,m,Bt).call(this,r))return!0});t(this,N).waitForHeadToLoad&&Ut.length&&(yield new Promise(r=>G(this,null,function*(){let P=0;try{for(var R=te(Ut),le,W,x;le=!(W=yield R.next()).done;le=!1){const Ct=W.value;Ct.onload=()=>{P++,P===Ut.length&&r()}}}catch(W){x=[W]}finally{try{le&&(W=R.return)&&(yield W.call(R))}finally{if(x)throw x[0]}}}))),yield ee.wait(10);const Gt=[];v||oe.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,m,Bt).call(this,r)?Gt.push(r):r.remove())});const he=E(this,m,Wt).call(this,L.document.body);!t(this,N).morphInsideScrollContainer&&!c&&E(this,m,Xt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",u.pathname),document.documentElement.setAttribute("data-current-leaf",u.leaf),dt.changeHistory({action:s,pathname:u.pathname,searchParameters:u.parameters||(g?location.search:""),hash:u.hash}),t(this,tt).remove(),o(this,_,t(this,f)),o(this,f,u);const Nt=[];t(this,rt).forEach((r,P)=>{const R=he[P],le=getComputedStyle(r).getPropertyValue("--morph-duration");let W=[],x=[];c?(c.forEach(d=>{const b=r.querySelector(d),F=R.querySelector(d);b&&F&&(x.push(b),W.push(F))}),x.forEach(d=>{d.parentElement&&Nt.push(d.parentElement)})):(W.push(...R.childNodes),x.push(...r.childNodes),Nt.push(r)),v||x.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),W.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),c?v?W.forEach((d,b)=>{x[b]instanceof HTMLElement&&x[b].append(...d.childNodes)}):W.forEach((d,b)=>{var F;(F=x[b].parentElement)==null||F.insertBefore(d,x[b])}):r.prepend(...W),setTimeout(()=>{v||x.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),W.forEach(d=>{var b;d instanceof HTMLElement&&((b=d.parentElement)==null||b.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})},0);const Ct=Dt(Rt({},At),{morphElement:r});q.dispatchEvent(document,"morphNewChildrenAdded",{detail:Ct});const ce=new Promise(d=>{setTimeout(()=>{v||x.forEach(b=>b.remove()),W.forEach(b=>{var F;b instanceof HTMLElement&&((F=b.parentElement)==null||F.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),v||q.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Ct}),d()},(parseFloat(le)||0)*1e3+10)});t(this,Y).push(ce)}),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"),q.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:L.scrollState}),u.hash?(L.clearScrollState(),E(this,m,Kt).call(this,u.hash,{centerScroll:i,offsetScroll:n,behavior:S})):t(this,$)?L.restoreScrollPosition():ut||L.renewScrollPosition(),yield Promise.all(t(this,Y)),v||Gt.forEach(r=>r.remove()),o(this,Y,[]),Nt.forEach(r=>{r.querySelectorAll("script").forEach(R=>{R.replaceWith(E(this,m,Ot).call(this,R))})}),t(this,y).forEach(r=>{r.checkCurrent(t(this,f).path)}),this.findParamsDependent(),q.dispatchEvent(document,"morphComplete",{detail:At}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(A){console.error(A)}o(this,K,void 0)})}addLink(e){t(this,y).push(new It(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,y,t(this,y).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,y,t(this,y).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,yt));t(this,y).push(...s.map(i=>new It(i,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,yt));t(this,y).forEach(s=>s.destroy()),o(this,y,e.map(s=>new It(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,St).forEach(s=>s.destroy()),o(this,St,e.map(s=>new Se(s)))}};N=new WeakMap,rt=new WeakMap,y=new WeakMap,K=new WeakMap,f=new WeakMap,_=new WeakMap,Y=new WeakMap,$=new WeakMap,M=new WeakMap,vt=new WeakMap,V=new WeakMap,St=new WeakMap,tt=new WeakMap,ot=new WeakMap,ht=new WeakMap,Lt=new WeakMap,lt=new WeakMap,bt=new WeakMap,m=new WeakSet,Ot=function(e){const s=document.createElement("script");for(let i=0;i<e.attributes.length;i++){const n=e.attributes[i];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},yt=new WeakMap,Mt=function(e){const s=this.normalizePath(e);let i=t(this,V).get(s.pathname);return i||(i=new se(this,s.pathname),t(this,V).set(s.pathname,i)),i},Wt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ne=function(e,s){return e.filter(i=>s.find(n=>n.outerHTML===i.outerHTML))},Ft=function(e,s){return e.filter(i=>!s.find(n=>n.outerHTML===i.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Xt=function(e){var s,i;(s=t(this,M))==null||s.removeEventListener("scroll",t(this,ct)),o(this,ht,0),o(this,ot,0),o(this,M,t(this,N).scrollSelector&&e.querySelector(t(this,N).scrollSelector)||window),o(this,vt,t(this,M)===window),(i=t(this,M))==null||i.addEventListener("scroll",t(this,ct)),t(this,ct).call(this)},Kt=function(e,s){const i=typeof e=="string"?document.getElementById(e):e;(typeof i=="number"||i)&&ee.scrollToElement(i,{scrollElement:t(this,M),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ct=new WeakMap,mt.instance=null;let Vt=mt;exports.Morph=Vt;
|
package/lib/morph/index.js
CHANGED
|
@@ -2,36 +2,36 @@ var ce = Object.defineProperty, de = Object.defineProperties;
|
|
|
2
2
|
var ue = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Gt = Object.getOwnPropertySymbols;
|
|
4
4
|
var me = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Jt = (
|
|
6
|
-
throw TypeError(
|
|
5
|
+
var Jt = (h, e) => (e = Symbol[h]) ? e : Symbol.for("Symbol." + h), Zt = (h) => {
|
|
6
|
+
throw TypeError(h);
|
|
7
7
|
};
|
|
8
|
-
var Qt = (
|
|
8
|
+
var Qt = (h, e, s) => e in h ? ce(h, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : h[e] = s, Ct = (h, e) => {
|
|
9
9
|
for (var s in e || (e = {}))
|
|
10
|
-
me.call(e, s) && Qt(
|
|
10
|
+
me.call(e, s) && Qt(h, s, e[s]);
|
|
11
11
|
if (Gt)
|
|
12
12
|
for (var s of Gt(e))
|
|
13
|
-
fe.call(e, s) && Qt(
|
|
14
|
-
return
|
|
15
|
-
}, Nt = (
|
|
16
|
-
var Dt = (
|
|
17
|
-
var t = (
|
|
18
|
-
var G = (
|
|
13
|
+
fe.call(e, s) && Qt(h, s, e[s]);
|
|
14
|
+
return h;
|
|
15
|
+
}, Nt = (h, e) => de(h, ue(e));
|
|
16
|
+
var Dt = (h, e, s) => e.has(h) || Zt("Cannot " + s);
|
|
17
|
+
var t = (h, e, s) => (Dt(h, e, "read from private field"), s ? s.call(h) : e.get(h)), l = (h, e, s) => e.has(h) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(h) : e.set(h, s), o = (h, e, s, i) => (Dt(h, e, "write to private field"), i ? i.call(h, s) : e.set(h, s), s), E = (h, e, s) => (Dt(h, e, "access private method"), s);
|
|
18
|
+
var G = (h, e, s) => new Promise((i, n) => {
|
|
19
19
|
var S = (c) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
g(s.next(c));
|
|
22
22
|
} catch (L) {
|
|
23
|
-
|
|
23
|
+
n(L);
|
|
24
24
|
}
|
|
25
25
|
}, p = (c) => {
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
g(s.throw(c));
|
|
28
28
|
} catch (L) {
|
|
29
|
-
|
|
29
|
+
n(L);
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
}, g = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(S, p);
|
|
32
|
+
g((s = s.apply(h, e)).next());
|
|
33
33
|
});
|
|
34
|
-
var _t = (
|
|
34
|
+
var _t = (h, e, s) => (e = h[Jt("asyncIterator")]) ? e.call(h) : (h = h[Jt("iterator")](), e = {}, s = (i, n) => (n = h[i]) && (e[i] = (S) => new Promise((p, g, c) => (S = n.call(h, S), c = S.done, Promise.resolve(S.value).then((L) => p({ value: L, done: c }), g)))), s("next"), s("return"), e);
|
|
35
35
|
import { i as se } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as I } from "../events-CsVF98U6.js";
|
|
37
37
|
import { w as pe, s as ge } from "../scroll-DNGJVxa2.js";
|
|
@@ -52,27 +52,27 @@ class ie extends HTMLElement {
|
|
|
52
52
|
}
|
|
53
53
|
se && !customElements.get("morph-announcer") && customElements.define("morph-announcer", ie);
|
|
54
54
|
var H, a, U, st, Rt, mt, it;
|
|
55
|
-
class
|
|
55
|
+
class zt {
|
|
56
56
|
constructor(e, s) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
l(this, st);
|
|
58
|
+
l(this, H);
|
|
59
|
+
l(this, a);
|
|
60
|
+
l(this, U);
|
|
61
|
+
l(this, mt, (e) => {
|
|
62
62
|
var i;
|
|
63
63
|
if (e.preventDefault(), document.documentElement.classList.contains("click-disabled"))
|
|
64
64
|
return;
|
|
65
65
|
if (t(this, a).hasAttribute("data-back") && t(this, H).previousURL)
|
|
66
66
|
history.back();
|
|
67
67
|
else {
|
|
68
|
-
|
|
69
|
-
const
|
|
68
|
+
o(this, U, t(this, a).getAttribute("href") || "/");
|
|
69
|
+
const n = t(this, a).getAttribute(
|
|
70
70
|
"data-history-action"
|
|
71
|
-
) || "push", S = t(this, a).hasAttribute("data-center-scroll"), p = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(),
|
|
71
|
+
) || "push", S = t(this, a).hasAttribute("data-center-scroll"), p = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(), g = p ? Se.parse(p) : void 0, c = t(this, a).hasAttribute("data-revalidate") || t(this, a).hasAttribute("data-pagination-more-link") || t(this, a).hasAttribute("data-pagination-set-link"), L = t(this, a).hasAttribute(
|
|
72
72
|
"data-keep-search-parameters"
|
|
73
73
|
), D = t(this, a).hasAttribute("data-keep-scroll-position") || t(this, a).hasAttribute("data-pagination-more-link"), dt = t(this, a).getAttribute(
|
|
74
74
|
"data-scroll-behaviour"
|
|
75
|
-
), et =
|
|
75
|
+
), et = E(this, st, Rt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
|
|
76
76
|
et && (t(this, a).hasAttribute("data-pagination-set-link") ? t(this, H).links.forEach((M) => {
|
|
77
77
|
M.updatePagination(
|
|
78
78
|
parseInt(t(this, a).getAttribute("data-value") || "1"),
|
|
@@ -100,9 +100,9 @@ class qt {
|
|
|
100
100
|
d = `${M}?${A.toString()}`;
|
|
101
101
|
}
|
|
102
102
|
t(this, H).navigate(d, {
|
|
103
|
-
historyAction:
|
|
103
|
+
historyAction: n,
|
|
104
104
|
centerScroll: S,
|
|
105
|
-
offsetScroll:
|
|
105
|
+
offsetScroll: g,
|
|
106
106
|
revalidate: c,
|
|
107
107
|
keepSearchParameters: L,
|
|
108
108
|
submorph: ne,
|
|
@@ -114,12 +114,12 @@ class qt {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
-
|
|
117
|
+
l(this, it, () => {
|
|
118
118
|
const e = t(this, a).hasAttribute("data-revalidate");
|
|
119
119
|
t(this, H).prefetch(t(this, U), e), t(this, a).removeEventListener("pointerenter", t(this, it));
|
|
120
120
|
});
|
|
121
|
-
|
|
122
|
-
const i =
|
|
121
|
+
o(this, H, s), o(this, a, e), t(this, a).addEventListener("click", t(this, mt)), o(this, U, t(this, a).getAttribute("href") || "/"), this.checkCurrent(location.href.replace(location.origin, ""));
|
|
122
|
+
const i = E(this, st, Rt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
|
|
123
123
|
i && this.updatePagination(
|
|
124
124
|
i.currentPage,
|
|
125
125
|
i.selector
|
|
@@ -132,20 +132,20 @@ class qt {
|
|
|
132
132
|
var L;
|
|
133
133
|
const s = t(this, H).normalizePath(e), i = t(this, H).normalizePath(t(this, U));
|
|
134
134
|
t(this, a).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? t(this, a).classList.add("current") : i.pathname === s.pathname ? t(this, a).classList.add("current") : (L = t(this, a).getAttribute("data-associated-paths")) != null && L.split(",").find((D) => s.pathname.includes(D)) ? t(this, a).classList.add("current") : t(this, a).classList.remove("current"), s.path === i.path ? t(this, a).classList.add("exact") : t(this, a).classList.remove("exact");
|
|
135
|
-
const [
|
|
135
|
+
const [n, S] = t(this, U).split("?"), p = new URLSearchParams(S), g = new URLSearchParams(location.search);
|
|
136
136
|
let c = 0;
|
|
137
|
-
for (const [D] of
|
|
138
|
-
p.has(D) &&
|
|
137
|
+
for (const [D] of g)
|
|
138
|
+
p.has(D) && g.get(D) === p.get(D) && c++;
|
|
139
139
|
c ? (t(this, a).classList.toggle(
|
|
140
140
|
"all-params-matched",
|
|
141
|
-
|
|
141
|
+
g.size === c
|
|
142
142
|
), t(this, a).classList.toggle(
|
|
143
143
|
"some-params-matched",
|
|
144
|
-
|
|
145
|
-
)) : (t(this, a).classList.remove("all-params-matched"), t(this, a).classList.remove("some-params-matched"));
|
|
144
|
+
g.size !== c
|
|
145
|
+
)) : !g.size && t(this, a).hasAttribute("data-match-no-params") ? t(this, a).classList.add("all-params-matched") : (t(this, a).classList.remove("all-params-matched"), t(this, a).classList.remove("some-params-matched"));
|
|
146
146
|
}
|
|
147
147
|
updatePagination(e, s) {
|
|
148
|
-
const i =
|
|
148
|
+
const i = E(this, st, Rt).call(this, s);
|
|
149
149
|
if (i)
|
|
150
150
|
if (i.element.setAttribute(
|
|
151
151
|
"data-current-page",
|
|
@@ -153,14 +153,14 @@ class qt {
|
|
|
153
153
|
), t(this, a).hasAttribute("data-pagination-more-link"))
|
|
154
154
|
if (e < i.totalPages) {
|
|
155
155
|
t(this, a).style.display = "";
|
|
156
|
-
const
|
|
156
|
+
const n = t(this, a).querySelector(
|
|
157
157
|
"[data-pagination-more-link-counter]"
|
|
158
158
|
);
|
|
159
|
-
|
|
159
|
+
n && (n.textContent = (i.totalPages - e).toString());
|
|
160
160
|
const S = t(this, a).getAttribute("href"), p = new URL(S, window.location.origin);
|
|
161
161
|
p.searchParams.set("page", (e + 1).toString());
|
|
162
|
-
const
|
|
163
|
-
t(this, a).setAttribute("href",
|
|
162
|
+
const g = p.href.replace(p.origin, "").toString();
|
|
163
|
+
t(this, a).setAttribute("href", g), this.checkCurrent(g);
|
|
164
164
|
} else
|
|
165
165
|
t(this, a).style.display = "none";
|
|
166
166
|
else t(this, a).hasAttribute("data-pagination-set-link") && (t(this, a).getAttribute("data-value") === e.toString() ? t(this, a).classList.add("pagination-current") : t(this, a).classList.remove("pagination-current"));
|
|
@@ -176,32 +176,32 @@ H = new WeakMap(), a = new WeakMap(), U = new WeakMap(), st = new WeakSet(), Rt
|
|
|
176
176
|
if (s) {
|
|
177
177
|
const i = parseInt(
|
|
178
178
|
s.getAttribute("data-current-page") || "1"
|
|
179
|
-
),
|
|
179
|
+
), n = parseInt(
|
|
180
180
|
s.getAttribute("data-total-pages") || "1"
|
|
181
181
|
);
|
|
182
182
|
return {
|
|
183
183
|
element: s,
|
|
184
184
|
currentPage: i,
|
|
185
|
-
totalPages:
|
|
185
|
+
totalPages: n,
|
|
186
186
|
selector: e
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
}, mt = new WeakMap(), it = new WeakMap();
|
|
190
190
|
const be = new DOMParser();
|
|
191
|
-
var
|
|
191
|
+
var z, J, k, q, Q, B, at, Z, X, ft;
|
|
192
192
|
class te {
|
|
193
193
|
constructor(e, s) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
194
|
+
l(this, z);
|
|
195
|
+
l(this, J);
|
|
196
|
+
l(this, k, { x: 0, y: 0 });
|
|
197
|
+
l(this, q, null);
|
|
198
|
+
l(this, Q, null);
|
|
199
|
+
l(this, B, null);
|
|
200
|
+
l(this, at, null);
|
|
201
|
+
l(this, Z, null);
|
|
202
|
+
l(this, X, null);
|
|
203
|
+
l(this, ft);
|
|
204
|
+
o(this, z, e), o(this, J, s);
|
|
205
205
|
}
|
|
206
206
|
get pathname() {
|
|
207
207
|
return t(this, J);
|
|
@@ -213,10 +213,10 @@ class te {
|
|
|
213
213
|
return t(this, B);
|
|
214
214
|
}
|
|
215
215
|
setHeaders(e) {
|
|
216
|
-
|
|
216
|
+
o(this, ft, e);
|
|
217
217
|
}
|
|
218
218
|
setInitialDocument(e) {
|
|
219
|
-
|
|
219
|
+
o(this, q, e.cloneNode(!0));
|
|
220
220
|
}
|
|
221
221
|
abort() {
|
|
222
222
|
var e;
|
|
@@ -226,34 +226,34 @@ class te {
|
|
|
226
226
|
}
|
|
227
227
|
fetch(e, s, i) {
|
|
228
228
|
return G(this, null, function* () {
|
|
229
|
-
var
|
|
229
|
+
var n;
|
|
230
230
|
if (!i) {
|
|
231
|
-
const
|
|
232
|
-
if (t(this, X) ||
|
|
231
|
+
const g = ((n = t(this, q)) == null ? void 0 : n.documentElement.getAttribute("data-cache")) && s !== e, c = t(this, q) && t(this, z).isPopstateNavigation;
|
|
232
|
+
if (t(this, X) || g || c)
|
|
233
233
|
return t(this, X);
|
|
234
234
|
}
|
|
235
|
-
return
|
|
235
|
+
return o(this, X, new Promise((S) => G(this, null, function* () {
|
|
236
236
|
try {
|
|
237
|
-
|
|
238
|
-
const
|
|
237
|
+
o(this, Z, new AbortController());
|
|
238
|
+
const g = yield (yield fetch(e, {
|
|
239
239
|
signal: t(this, Z).signal,
|
|
240
240
|
headers: Ct({
|
|
241
241
|
"X-MORPH": "true",
|
|
242
242
|
"X-MORPH-CURRENT-PATH": encodeURIComponent(s),
|
|
243
243
|
"X-MORPH-NEW-PATH": encodeURIComponent(e)
|
|
244
244
|
}, t(this, ft))
|
|
245
|
-
})).text(), c = be.parseFromString(
|
|
245
|
+
})).text(), c = be.parseFromString(g, "text/html");
|
|
246
246
|
this.setInitialDocument(c);
|
|
247
247
|
} catch (p) {
|
|
248
248
|
console.warn(p);
|
|
249
249
|
} finally {
|
|
250
|
-
|
|
250
|
+
o(this, Z, null), o(this, X, null), S();
|
|
251
251
|
}
|
|
252
252
|
}))), t(this, X);
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
cloneDocument() {
|
|
256
|
-
|
|
256
|
+
o(this, B, (t(this, Q) || t(this, q)).cloneNode(!0));
|
|
257
257
|
}
|
|
258
258
|
get title() {
|
|
259
259
|
let e = "";
|
|
@@ -269,57 +269,57 @@ class te {
|
|
|
269
269
|
t(this, k).x = 0, t(this, k).y = 0;
|
|
270
270
|
}
|
|
271
271
|
clearDocumentState() {
|
|
272
|
-
|
|
272
|
+
o(this, Q, null);
|
|
273
273
|
}
|
|
274
274
|
saveScrollState() {
|
|
275
|
-
t(this,
|
|
275
|
+
t(this, q).documentElement.hasAttribute(
|
|
276
276
|
"data-no-scroll-restoration"
|
|
277
|
-
) ? (t(this, k).x = 0, t(this, k).y = 0) : (t(this, k).x = t(this,
|
|
277
|
+
) ? (t(this, k).x = 0, t(this, k).y = 0) : (t(this, k).x = t(this, z).scrollValue.left, t(this, k).y = t(this, z).scrollValue.top);
|
|
278
278
|
}
|
|
279
279
|
restoreScrollPosition() {
|
|
280
|
-
t(this,
|
|
280
|
+
t(this, z).scrollElement.scroll({
|
|
281
281
|
top: t(this, k).y,
|
|
282
282
|
left: t(this, k).x,
|
|
283
283
|
behavior: "instant"
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
saveDocumentState() {
|
|
287
|
-
t(this,
|
|
287
|
+
t(this, q).documentElement.hasAttribute(
|
|
288
288
|
"data-no-page-restoration"
|
|
289
|
-
) ?
|
|
289
|
+
) ? o(this, Q, null) : o(this, Q, document.cloneNode(!0));
|
|
290
290
|
}
|
|
291
291
|
renewScrollPosition() {
|
|
292
|
-
t(this,
|
|
292
|
+
t(this, z).scrollElement.scroll({
|
|
293
293
|
top: 0,
|
|
294
294
|
left: 0,
|
|
295
295
|
behavior: "instant"
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
saveState(e) {
|
|
299
|
-
|
|
299
|
+
o(this, at, e);
|
|
300
300
|
}
|
|
301
301
|
clearState() {
|
|
302
302
|
const e = t(this, at);
|
|
303
|
-
return
|
|
303
|
+
return o(this, at, null), e;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
var C, nt, pt,
|
|
306
|
+
z = new WeakMap(), J = new WeakMap(), k = new WeakMap(), q = new WeakMap(), Q = new WeakMap(), B = new WeakMap(), at = new WeakMap(), Z = new WeakMap(), X = new WeakMap(), ft = new WeakMap();
|
|
307
|
+
var C, nt, pt, qt, gt;
|
|
308
308
|
class ye {
|
|
309
309
|
constructor(e) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
310
|
+
l(this, pt);
|
|
311
|
+
l(this, C);
|
|
312
|
+
l(this, nt, []);
|
|
313
|
+
l(this, gt, () => {
|
|
314
|
+
E(this, pt, qt).call(this);
|
|
315
315
|
});
|
|
316
|
-
|
|
316
|
+
o(this, C, e);
|
|
317
317
|
for (const s in t(this, C).dataset) {
|
|
318
318
|
const i = ve(s);
|
|
319
319
|
if (i.startsWith("param-")) {
|
|
320
|
-
const
|
|
320
|
+
const n = i.split("param-")[1], S = t(this, C).dataset[s];
|
|
321
321
|
t(this, nt).push({
|
|
322
|
-
name:
|
|
322
|
+
name: n,
|
|
323
323
|
value: S
|
|
324
324
|
});
|
|
325
325
|
}
|
|
@@ -327,7 +327,7 @@ class ye {
|
|
|
327
327
|
document.addEventListener(
|
|
328
328
|
"morphURLParametersChange",
|
|
329
329
|
t(this, gt)
|
|
330
|
-
),
|
|
330
|
+
), E(this, pt, qt).call(this);
|
|
331
331
|
}
|
|
332
332
|
destroy() {
|
|
333
333
|
document.removeEventListener(
|
|
@@ -336,50 +336,50 @@ class ye {
|
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
C = new WeakMap(), nt = new WeakMap(), pt = new WeakSet(),
|
|
339
|
+
C = new WeakMap(), nt = new WeakMap(), pt = new WeakSet(), qt = function() {
|
|
340
340
|
const e = new URLSearchParams(location.search);
|
|
341
|
-
let s = !!t(this, nt).find((
|
|
342
|
-
!s && t(this, C).hasAttribute("data-match-no-params") && (s = !t(this, nt).filter((
|
|
341
|
+
let s = !!t(this, nt).find((n) => e.has(n.name) && (e.get(n.name) === n.value || n.value === "*" || n.value === "all" || n.value === "any" || n.value === "vse" || e.get(n.name) === "*" || e.get(n.name) === "all" || e.get(n.name) === "any" || e.get(n.name) === "vse"));
|
|
342
|
+
!s && t(this, C).hasAttribute("data-match-no-params") && (s = !t(this, nt).filter((n) => e.has(n.name)).length);
|
|
343
343
|
const i = t(this, C).getAttribute("data-hide-class");
|
|
344
344
|
s ? i ? t(this, C).classList.remove(i) : t(this, C).style.display = "" : i ? t(this, C).classList.add(i) : t(this, C).style.display = "none";
|
|
345
345
|
}, gt = new WeakMap();
|
|
346
346
|
var N, rt, y, K, f, _, Y, $, T, Et, V, Lt, tt, ot, ht, St, lt, vt, m, Vt, bt, Ht, Wt, ae, Ft, Ot, Bt, Xt, Tt, ct;
|
|
347
347
|
const ut = class ut {
|
|
348
348
|
constructor(e) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
349
|
+
l(this, m);
|
|
350
|
+
l(this, N, null);
|
|
351
|
+
l(this, rt, null);
|
|
352
|
+
l(this, y, []);
|
|
353
|
+
l(this, K);
|
|
354
|
+
l(this, f, null);
|
|
355
|
+
l(this, _);
|
|
356
|
+
l(this, Y, []);
|
|
357
|
+
l(this, $, !1);
|
|
358
|
+
l(this, T, null);
|
|
359
|
+
l(this, Et, !1);
|
|
360
|
+
l(this, V, /* @__PURE__ */ new Map());
|
|
361
|
+
l(this, Lt, []);
|
|
362
|
+
l(this, tt, null);
|
|
363
|
+
l(this, ot, 0);
|
|
364
|
+
l(this, ht, 0);
|
|
365
|
+
l(this, St);
|
|
366
|
+
l(this, lt);
|
|
367
|
+
l(this, vt);
|
|
368
|
+
l(this, bt, (e) => {
|
|
369
369
|
var s;
|
|
370
370
|
return ((s = e.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !e.hasAttribute("download") && !e.hasAttribute("data-morph-skip") && !e.closest("[data-morph-skip]") && e.getAttribute("target") !== "_blank";
|
|
371
371
|
});
|
|
372
|
-
|
|
373
|
-
e.preventDefault(),
|
|
372
|
+
l(this, Tt, (e) => G(this, null, function* () {
|
|
373
|
+
e.preventDefault(), o(this, $, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
374
374
|
historyAction: "none",
|
|
375
375
|
submorph: t(this, lt) ? void 0 : t(this, St),
|
|
376
376
|
revalidate: t(this, lt),
|
|
377
377
|
keepScrollPosition: t(this, vt)
|
|
378
|
-
}),
|
|
378
|
+
}), o(this, $, !1);
|
|
379
379
|
}));
|
|
380
|
-
|
|
381
|
-
const { left: e, top: s } = this.scrollValue, i = s - t(this, ht),
|
|
382
|
-
|
|
380
|
+
l(this, ct, () => {
|
|
381
|
+
const { left: e, top: s } = this.scrollValue, i = s - t(this, ht), n = e - t(this, ot);
|
|
382
|
+
o(this, ht, s), o(this, ot, e), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
|
|
383
383
|
"scroll-y-forward",
|
|
384
384
|
i > 0
|
|
385
385
|
), document.documentElement.classList.toggle(
|
|
@@ -387,10 +387,10 @@ const ut = class ut {
|
|
|
387
387
|
i < 0
|
|
388
388
|
), document.documentElement.classList.toggle(
|
|
389
389
|
"scroll-x-forward",
|
|
390
|
-
|
|
390
|
+
n > 0
|
|
391
391
|
), document.documentElement.classList.toggle(
|
|
392
392
|
"scroll-x-backward",
|
|
393
|
-
|
|
393
|
+
n < 0
|
|
394
394
|
), I(document, "morphScroll", {
|
|
395
395
|
detail: {
|
|
396
396
|
left: e,
|
|
@@ -399,17 +399,17 @@ const ut = class ut {
|
|
|
399
399
|
});
|
|
400
400
|
});
|
|
401
401
|
if (se && !ut.instance) {
|
|
402
|
-
ut.instance = this,
|
|
402
|
+
ut.instance = this, o(this, N, {
|
|
403
403
|
base: Ee(e == null ? void 0 : e.base),
|
|
404
404
|
waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
|
|
405
405
|
trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
|
|
406
406
|
scrollSelector: e == null ? void 0 : e.scrollSelector,
|
|
407
407
|
morphInsideScrollContainer: (e == null ? void 0 : e.morphInsideScrollContainer) || !1
|
|
408
|
-
}),
|
|
408
|
+
}), o(this, rt, E(this, m, Wt).call(this, document.body));
|
|
409
409
|
const s = this.normalizePath(
|
|
410
410
|
location.pathname + location.search + location.hash
|
|
411
411
|
);
|
|
412
|
-
|
|
412
|
+
o(this, f, s);
|
|
413
413
|
const i = new te(this, t(this, f).pathname);
|
|
414
414
|
i.setInitialDocument(document), t(this, V).set(t(this, f).pathname, i), document.documentElement.setAttribute(
|
|
415
415
|
"data-current-pathname",
|
|
@@ -422,7 +422,7 @@ const ut = class ut {
|
|
|
422
422
|
pathname: s.pathname,
|
|
423
423
|
searchParameters: s.parameters,
|
|
424
424
|
hash: s.hash
|
|
425
|
-
}),
|
|
425
|
+
}), o(this, tt, new ie()), E(this, m, Bt).call(this, document);
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
get currentURL() {
|
|
@@ -461,11 +461,11 @@ const ut = class ut {
|
|
|
461
461
|
}
|
|
462
462
|
prefetch(e, s) {
|
|
463
463
|
return G(this, null, function* () {
|
|
464
|
-
var
|
|
464
|
+
var n;
|
|
465
465
|
if (t(this, Y).length)
|
|
466
466
|
return;
|
|
467
|
-
e = ((
|
|
468
|
-
const i =
|
|
467
|
+
e = ((n = this.pathnameModifier) == null ? void 0 : n.call(this, e)) || e;
|
|
468
|
+
const i = E(this, m, Ht).call(this, e);
|
|
469
469
|
i == null || i.fetch(e, t(this, f).path, s);
|
|
470
470
|
});
|
|
471
471
|
}
|
|
@@ -478,10 +478,10 @@ const ut = class ut {
|
|
|
478
478
|
return G(this, arguments, function* (e, {
|
|
479
479
|
historyAction: s = "push",
|
|
480
480
|
centerScroll: i,
|
|
481
|
-
offsetScroll:
|
|
481
|
+
offsetScroll: n,
|
|
482
482
|
scrollBehaviour: S,
|
|
483
483
|
revalidate: p,
|
|
484
|
-
keepSearchParameters:
|
|
484
|
+
keepSearchParameters: g,
|
|
485
485
|
submorph: c,
|
|
486
486
|
submorphAppend: L,
|
|
487
487
|
clearState: D,
|
|
@@ -491,18 +491,18 @@ const ut = class ut {
|
|
|
491
491
|
var M, Pt, j, W;
|
|
492
492
|
if (t(this, Y).length)
|
|
493
493
|
return;
|
|
494
|
-
|
|
494
|
+
o(this, St, c), o(this, lt, p), o(this, vt, dt);
|
|
495
495
|
const yt = ((M = this.pathnameModifier) == null ? void 0 : M.call(this, e)) || e, d = this.normalizePath(yt, {
|
|
496
496
|
mergeParams: et
|
|
497
497
|
});
|
|
498
498
|
if (!p && (((Pt = t(this, K)) == null ? void 0 : Pt.pathname) === d.pathname || t(this, f).pathname === d.pathname)) {
|
|
499
|
-
dt ||
|
|
499
|
+
dt || E(this, m, Xt).call(this, d.hash || 0, {
|
|
500
500
|
centerScroll: i,
|
|
501
|
-
offsetScroll:
|
|
501
|
+
offsetScroll: n,
|
|
502
502
|
behavior: "smooth"
|
|
503
503
|
}), I(document, "morphSamePath", {
|
|
504
504
|
custom: !0
|
|
505
|
-
}), ((j = t(this, f)) == null ? void 0 : j.parameters) !== d.parameters && (
|
|
505
|
+
}), ((j = t(this, f)) == null ? void 0 : j.parameters) !== d.parameters && (o(this, _, t(this, f)), o(this, f, d), It({
|
|
506
506
|
action: ((W = t(this, f)) == null ? void 0 : W.hash) !== d.hash ? "replace" : s,
|
|
507
507
|
pathname: d.pathname,
|
|
508
508
|
searchParameters: d.parameters,
|
|
@@ -520,26 +520,26 @@ const ut = class ut {
|
|
|
520
520
|
t(this, y).forEach((A) => {
|
|
521
521
|
A.checkCurrent(d.path);
|
|
522
522
|
});
|
|
523
|
-
|
|
523
|
+
o(this, K, d);
|
|
524
524
|
try {
|
|
525
525
|
let A = !0;
|
|
526
526
|
if (this.preprocessor)
|
|
527
527
|
try {
|
|
528
|
-
yield new Promise((
|
|
528
|
+
yield new Promise((r, P) => {
|
|
529
529
|
var R;
|
|
530
530
|
(R = this.preprocessor) == null || R.call(this, {
|
|
531
531
|
url: d,
|
|
532
|
-
resolve:
|
|
532
|
+
resolve: r,
|
|
533
533
|
reject: P,
|
|
534
534
|
submorph: c
|
|
535
535
|
});
|
|
536
536
|
});
|
|
537
|
-
} catch (
|
|
538
|
-
|
|
537
|
+
} catch (r) {
|
|
538
|
+
r ? console.error(r) : console.log("Route change canceled"), A = !1;
|
|
539
539
|
}
|
|
540
540
|
if (!A || t(this, K).pathname !== d.pathname) {
|
|
541
|
-
t(this, y).forEach((
|
|
542
|
-
|
|
541
|
+
t(this, y).forEach((r) => {
|
|
542
|
+
r.checkCurrent(t(this, f).path);
|
|
543
543
|
});
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
@@ -547,22 +547,22 @@ const ut = class ut {
|
|
|
547
547
|
url: d,
|
|
548
548
|
submorph: c
|
|
549
549
|
};
|
|
550
|
-
c ? L || c.forEach((
|
|
551
|
-
document.querySelectorAll(
|
|
550
|
+
c ? L || c.forEach((r) => {
|
|
551
|
+
document.querySelectorAll(r).forEach((P) => {
|
|
552
552
|
P.classList.add("out"), P.setAttribute("data-morph-out", "");
|
|
553
553
|
});
|
|
554
|
-
}) : t(this, rt).forEach((
|
|
554
|
+
}) : t(this, rt).forEach((r) => {
|
|
555
555
|
var P, R;
|
|
556
|
-
(P =
|
|
556
|
+
(P = r.firstElementChild) == null || P.classList.add("out"), (R = r.firstElementChild) == null || R.setAttribute("data-morph-out", "");
|
|
557
557
|
}), I(document, "morphNavigation", {
|
|
558
558
|
detail: w
|
|
559
559
|
});
|
|
560
|
-
const Mt =
|
|
561
|
-
if (t(this, V).forEach((
|
|
562
|
-
|
|
560
|
+
const Mt = E(this, m, Ht).call(this, t(this, f).pathname), v = E(this, m, Ht).call(this, d.pathname);
|
|
561
|
+
if (t(this, V).forEach((r) => {
|
|
562
|
+
r.pathname !== d.pathname && r.abort();
|
|
563
563
|
}), yield v == null ? void 0 : v.fetch(yt, t(this, f).path, p), t(this, K).pathname !== d.pathname) {
|
|
564
|
-
t(this, y).forEach((
|
|
565
|
-
|
|
564
|
+
t(this, y).forEach((r) => {
|
|
565
|
+
r.checkCurrent(t(this, f).path);
|
|
566
566
|
});
|
|
567
567
|
return;
|
|
568
568
|
}
|
|
@@ -570,30 +570,30 @@ const ut = class ut {
|
|
|
570
570
|
const wt = Nt(Ct({}, w), {
|
|
571
571
|
document: v.document
|
|
572
572
|
});
|
|
573
|
-
L || wt.document.querySelectorAll("[data-morph-out]").forEach((
|
|
574
|
-
|
|
573
|
+
L || wt.document.querySelectorAll("[data-morph-out]").forEach((r) => {
|
|
574
|
+
r.classList.remove("out");
|
|
575
575
|
}), I(document, "morphStart", {
|
|
576
576
|
detail: wt
|
|
577
577
|
});
|
|
578
|
-
const Kt = Array.from(document.head.children), Yt = Array.from(v.document.head.children), $t =
|
|
579
|
-
At.forEach((
|
|
580
|
-
|
|
581
|
-
}), At.forEach((
|
|
582
|
-
document.head.appendChild(
|
|
578
|
+
const Kt = Array.from(document.head.children), Yt = Array.from(v.document.head.children), $t = E(this, m, ae).call(this, Kt, Yt), re = E(this, m, Ft).call(this, Kt, $t), At = E(this, m, Ft).call(this, Yt, $t).filter((r) => !this.excludeHeadChild(r));
|
|
579
|
+
At.forEach((r, P) => {
|
|
580
|
+
r.tagName === "SCRIPT" && (At[P] = E(this, m, Vt).call(this, r));
|
|
581
|
+
}), At.forEach((r) => {
|
|
582
|
+
document.head.appendChild(r);
|
|
583
583
|
});
|
|
584
|
-
const xt = At.filter((
|
|
585
|
-
if (
|
|
584
|
+
const xt = At.filter((r) => {
|
|
585
|
+
if (r.hasAttribute("data-no-waiting"))
|
|
586
586
|
return !1;
|
|
587
|
-
if (
|
|
587
|
+
if (E(this, m, Ot).call(this, r))
|
|
588
588
|
return !0;
|
|
589
589
|
});
|
|
590
|
-
t(this, N).waitForHeadToLoad && xt.length && (yield new Promise((
|
|
590
|
+
t(this, N).waitForHeadToLoad && xt.length && (yield new Promise((r) => G(this, null, function* () {
|
|
591
591
|
let P = 0;
|
|
592
592
|
try {
|
|
593
593
|
for (var R = _t(xt), he, F, x; he = !(F = yield R.next()).done; he = !1) {
|
|
594
594
|
const kt = F.value;
|
|
595
595
|
kt.onload = () => {
|
|
596
|
-
P++, P === xt.length &&
|
|
596
|
+
P++, P === xt.length && r();
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
599
|
} catch (F) {
|
|
@@ -608,11 +608,11 @@ const ut = class ut {
|
|
|
608
608
|
}
|
|
609
609
|
}))), yield pe(10);
|
|
610
610
|
const jt = [];
|
|
611
|
-
L || re.forEach((
|
|
612
|
-
|
|
611
|
+
L || re.forEach((r) => {
|
|
612
|
+
r.hasAttribute("data-permanent") || (E(this, m, Ot).call(this, r) ? jt.push(r) : r.remove());
|
|
613
613
|
});
|
|
614
|
-
const oe =
|
|
615
|
-
!t(this, N).morphInsideScrollContainer && !c &&
|
|
614
|
+
const oe = E(this, m, Wt).call(this, v.document.body);
|
|
615
|
+
!t(this, N).morphInsideScrollContainer && !c && E(this, m, Bt).call(this, v.document), document.documentElement.setAttribute(
|
|
616
616
|
"data-current-pathname",
|
|
617
617
|
d.pathname
|
|
618
618
|
), document.documentElement.setAttribute(
|
|
@@ -621,19 +621,19 @@ const ut = class ut {
|
|
|
621
621
|
), It({
|
|
622
622
|
action: s,
|
|
623
623
|
pathname: d.pathname,
|
|
624
|
-
searchParameters: d.parameters || (
|
|
624
|
+
searchParameters: d.parameters || (g ? location.search : ""),
|
|
625
625
|
hash: d.hash
|
|
626
|
-
}), t(this, tt).remove(),
|
|
626
|
+
}), t(this, tt).remove(), o(this, _, t(this, f)), o(this, f, d);
|
|
627
627
|
const Ut = [];
|
|
628
|
-
t(this, rt).forEach((
|
|
629
|
-
const R = oe[P], he = getComputedStyle(
|
|
628
|
+
t(this, rt).forEach((r, P) => {
|
|
629
|
+
const R = oe[P], he = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
630
630
|
let F = [], x = [];
|
|
631
631
|
c ? (c.forEach((u) => {
|
|
632
|
-
const b =
|
|
632
|
+
const b = r.querySelector(u), O = R.querySelector(u);
|
|
633
633
|
b && O && (x.push(b), F.push(O));
|
|
634
634
|
}), x.forEach((u) => {
|
|
635
635
|
u.parentElement && Ut.push(u.parentElement);
|
|
636
|
-
})) : (F.push(...R.childNodes), x.push(...
|
|
636
|
+
})) : (F.push(...R.childNodes), x.push(...r.childNodes), Ut.push(r)), L || x.forEach((u) => {
|
|
637
637
|
u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
|
|
638
638
|
}), F.forEach((u) => {
|
|
639
639
|
u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
|
|
@@ -645,7 +645,7 @@ const ut = class ut {
|
|
|
645
645
|
u,
|
|
646
646
|
x[b]
|
|
647
647
|
);
|
|
648
|
-
}) :
|
|
648
|
+
}) : r.prepend(...F), setTimeout(() => {
|
|
649
649
|
L || x.forEach((u) => {
|
|
650
650
|
u instanceof HTMLElement && u.classList.add("old-idle");
|
|
651
651
|
}), F.forEach((u) => {
|
|
@@ -657,7 +657,7 @@ const ut = class ut {
|
|
|
657
657
|
});
|
|
658
658
|
}, 0);
|
|
659
659
|
const kt = Nt(Ct({}, wt), {
|
|
660
|
-
morphElement:
|
|
660
|
+
morphElement: r
|
|
661
661
|
});
|
|
662
662
|
I(document, "morphNewChildrenAdded", {
|
|
663
663
|
detail: kt
|
|
@@ -683,16 +683,16 @@ const ut = class ut {
|
|
|
683
683
|
this.scrollValue.top + "px"
|
|
684
684
|
), I(document, "morphBeforeNavigationScroll", {
|
|
685
685
|
detail: v.scrollState
|
|
686
|
-
}), d.hash ? (v.clearScrollState(),
|
|
686
|
+
}), d.hash ? (v.clearScrollState(), E(this, m, Xt).call(this, d.hash, {
|
|
687
687
|
centerScroll: i,
|
|
688
|
-
offsetScroll:
|
|
688
|
+
offsetScroll: n,
|
|
689
689
|
behavior: S
|
|
690
|
-
})) : t(this, $) ? v.restoreScrollPosition() : dt || v.renewScrollPosition(), yield Promise.all(t(this, Y)), L || jt.forEach((
|
|
691
|
-
|
|
692
|
-
R.replaceWith(
|
|
690
|
+
})) : t(this, $) ? v.restoreScrollPosition() : dt || v.renewScrollPosition(), yield Promise.all(t(this, Y)), L || jt.forEach((r) => r.remove()), o(this, Y, []), Ut.forEach((r) => {
|
|
691
|
+
r.querySelectorAll("script").forEach((R) => {
|
|
692
|
+
R.replaceWith(E(this, m, Vt).call(this, R));
|
|
693
693
|
});
|
|
694
|
-
}), t(this, y).forEach((
|
|
695
|
-
|
|
694
|
+
}), t(this, y).forEach((r) => {
|
|
695
|
+
r.checkCurrent(t(this, f).path);
|
|
696
696
|
}), this.findParamsDependent(), I(document, "morphComplete", {
|
|
697
697
|
detail: wt
|
|
698
698
|
}), document.documentElement.style.removeProperty(
|
|
@@ -701,11 +701,11 @@ const ut = class ut {
|
|
|
701
701
|
} catch (A) {
|
|
702
702
|
console.error(A);
|
|
703
703
|
}
|
|
704
|
-
|
|
704
|
+
o(this, K, void 0);
|
|
705
705
|
});
|
|
706
706
|
}
|
|
707
707
|
addLink(e) {
|
|
708
|
-
t(this, y).push(new
|
|
708
|
+
t(this, y).push(new zt(e, this));
|
|
709
709
|
}
|
|
710
710
|
addLinks(e) {
|
|
711
711
|
e.forEach((s) => {
|
|
@@ -713,24 +713,24 @@ const ut = class ut {
|
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
715
|
removeLink(e) {
|
|
716
|
-
|
|
716
|
+
o(this, y, t(this, y).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
|
|
717
717
|
}
|
|
718
718
|
destroyOldLinks(e) {
|
|
719
|
-
|
|
719
|
+
o(this, y, t(this, y).filter((s) => e.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
720
720
|
}
|
|
721
721
|
findNewLinks(e) {
|
|
722
722
|
const s = [...e.querySelectorAll("a")].filter(
|
|
723
723
|
t(this, bt)
|
|
724
724
|
);
|
|
725
725
|
t(this, y).push(
|
|
726
|
-
...s.map((i) => new
|
|
726
|
+
...s.map((i) => new zt(i, this))
|
|
727
727
|
);
|
|
728
728
|
}
|
|
729
729
|
findLinks() {
|
|
730
730
|
const e = [
|
|
731
731
|
...document.documentElement.querySelectorAll("a")
|
|
732
732
|
].filter(t(this, bt));
|
|
733
|
-
t(this, y).forEach((s) => s.destroy()),
|
|
733
|
+
t(this, y).forEach((s) => s.destroy()), o(this, y, e.map((s) => new zt(s, this)));
|
|
734
734
|
}
|
|
735
735
|
findParamsDependent() {
|
|
736
736
|
const e = [
|
|
@@ -738,7 +738,7 @@ const ut = class ut {
|
|
|
738
738
|
"[data-morph-params-dependent]"
|
|
739
739
|
)
|
|
740
740
|
];
|
|
741
|
-
t(this, Lt).forEach((s) => s.destroy()),
|
|
741
|
+
t(this, Lt).forEach((s) => s.destroy()), o(this, Lt, e.map(
|
|
742
742
|
(s) => new ye(s)
|
|
743
743
|
));
|
|
744
744
|
}
|
|
@@ -746,8 +746,8 @@ const ut = class ut {
|
|
|
746
746
|
N = new WeakMap(), rt = new WeakMap(), y = new WeakMap(), K = new WeakMap(), f = new WeakMap(), _ = new WeakMap(), Y = new WeakMap(), $ = new WeakMap(), T = new WeakMap(), Et = new WeakMap(), V = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), ot = new WeakMap(), ht = new WeakMap(), St = new WeakMap(), lt = new WeakMap(), vt = new WeakMap(), m = new WeakSet(), Vt = function(e) {
|
|
747
747
|
const s = document.createElement("script");
|
|
748
748
|
for (let i = 0; i < e.attributes.length; i++) {
|
|
749
|
-
const
|
|
750
|
-
s.setAttribute(
|
|
749
|
+
const n = e.attributes[i];
|
|
750
|
+
s.setAttribute(n.name, n.value);
|
|
751
751
|
}
|
|
752
752
|
return e.hasAttribute("src") || (s.innerHTML = e.innerHTML), s;
|
|
753
753
|
}, bt = new WeakMap(), Ht = function(e) {
|
|
@@ -760,13 +760,13 @@ N = new WeakMap(), rt = new WeakMap(), y = new WeakMap(), K = new WeakMap(), f =
|
|
|
760
760
|
}, ae = function(e, s) {
|
|
761
761
|
return e.filter(
|
|
762
762
|
(i) => s.find(
|
|
763
|
-
(
|
|
763
|
+
(n) => n.outerHTML === i.outerHTML
|
|
764
764
|
)
|
|
765
765
|
);
|
|
766
766
|
}, Ft = function(e, s) {
|
|
767
767
|
return e.filter(
|
|
768
768
|
(i) => !s.find(
|
|
769
|
-
(
|
|
769
|
+
(n) => n.outerHTML === i.outerHTML
|
|
770
770
|
)
|
|
771
771
|
);
|
|
772
772
|
}, Ot = function(e) {
|
|
@@ -776,7 +776,7 @@ N = new WeakMap(), rt = new WeakMap(), y = new WeakMap(), K = new WeakMap(), f =
|
|
|
776
776
|
(s = t(this, T)) == null || s.removeEventListener(
|
|
777
777
|
"scroll",
|
|
778
778
|
t(this, ct)
|
|
779
|
-
),
|
|
779
|
+
), o(this, ht, 0), o(this, ot, 0), o(this, T, t(this, N).scrollSelector && e.querySelector(t(this, N).scrollSelector) || window), o(this, Et, t(this, T) === window), (i = t(this, T)) == null || i.addEventListener("scroll", t(this, ct)), t(this, ct).call(this);
|
|
780
780
|
}, Xt = function(e, s) {
|
|
781
781
|
const i = typeof e == "string" ? document.getElementById(e) : e;
|
|
782
782
|
(typeof i == "number" || i) && ge(i, {
|