aptechka 0.80.0 → 0.80.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/en3/En3.d.ts +1 -1
- package/lib/en3/index.cjs +2 -2
- package/lib/en3/index.js +11 -11
- package/lib/jsx/h.d.ts +1 -1
- package/lib/jsx/index.cjs +1 -1
- package/lib/jsx/index.js +2 -2
- package/lib/jsx/type.d.ts +2 -2
- package/lib/morph/Morph.d.ts +1 -0
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +232 -226
- package/lib/render-CMQbWthg.js +205 -0
- package/lib/render-DBQUdpsp.cjs +1 -0
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +1 -1
- package/lib/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +3 -2
- package/package.json +1 -1
- package/lib/render-BCEBRfHS.js +0 -196
- package/lib/render-Rv0UMACs.cjs +0 -1
package/lib/en3/En3.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ElementOrSelector } from '../utils';
|
|
1
2
|
import { WebGLRenderer, WebGLRendererParameters } from 'three';
|
|
2
3
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
3
|
-
import { ElementOrSelector } from '../utils';
|
|
4
4
|
import { En3View, En3ViewOptions } from './En3View';
|
|
5
5
|
export interface En3Options {
|
|
6
6
|
webGLRendererParameters?: WebGLRendererParameters;
|
package/lib/en3/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var p=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var B=i=>{throw TypeError(i)};var $=(i,e,r)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))re.call(e,r)&&$(i,r,e[r]);if(N)for(var r of N(e))se.call(e,r)&&$(i,r,e[r]);return i},W=(i,e)=>ee(i,te(e));var G=(i,e,r)=>e.has(i)||B("Cannot "+r);var t=(i,e,r)=>(G(i,e,"read from private field"),r?r.call(i):e.get(i)),c=(i,e,r)=>e.has(i)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),n=(i,e,r,s)=>(G(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";var p=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var B=i=>{throw TypeError(i)};var $=(i,e,r)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))re.call(e,r)&&$(i,r,e[r]);if(N)for(var r of N(e))se.call(e,r)&&$(i,r,e[r]);return i},W=(i,e)=>ee(i,te(e));var G=(i,e,r)=>e.has(i)||B("Cannot "+r);var t=(i,e,r)=>(G(i,e,"read from private field"),r?r.call(i):e.get(i)),c=(i,e,r)=>e.has(i)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),n=(i,e,r,s)=>(G(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("../order/index.cjs"),U=require("../ticker/index.cjs"),Q=require("../dom-hTEdqeoj.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const Z=require("../window-resizer/index.cjs"),m=require("three"),J=require("../layout-box/index.cjs"),ie=require("../function-MthRj-GJ.cjs");function X(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const h=r[s];h&&typeof h=="object"&&"minFilter"in h&&h.dispose()}};i.traverse(r=>{if(r instanceof m.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 S,D,a,R,g,o,x,w,y,z;class H{constructor(e,r,s){c(this,S);c(this,D);c(this,a);c(this,R);c(this,g);c(this,o);c(this,x);c(this,w);c(this,y);c(this,z,ie.debounce(()=>{this.resize()},0));n(this,S,e),n(this,D,r),n(this,a,(s==null?void 0:s.cameraType)==="orthographic"?new m.OrthographicCamera:new m.PerspectiveCamera),n(this,R,new m.Scene),n(this,g,[]),n(this,o,(s==null?void 0:s.cameraDistance)||1e3),t(this,a).near=(s==null?void 0:s.cameraNear)||1,t(this,a).far=(s==null?void 0:s.cameraFar)||11e3,n(this,x,(s==null?void 0:s.cameraFov)||"auto"),t(this,a).position.z=t(this,o),t(this,a).name=`Cameras.${t(this,D)}`,n(this,w,Q.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,n(this,y,new J.LayoutBox(t(this,w))),t(this,y).onResize(()=>{this.resize()})}get name(){return t(this,D)}get camera(){return t(this,a)}get scene(){return t(this,R)}get box(){return t(this,y)}get cameraDistance(){return t(this,o)}set cameraDistance(e){n(this,o,e),t(this,z).call(this)}set fov(e){n(this,x,e),t(this,z).call(this)}get fov(){return t(this,x)}set near(e){t(this,a).near=e,t(this,z).call(this)}get near(){return t(this,a).near}set far(e){t(this,a).far=e,t(this,z).call(this)}get far(){return t(this,a).far}get sizeElement(){return t(this,w)}get isClipped(){return t(this,w)!==t(this,S).containerElement}resize(){const{width:e,height:r}=t(this,y);t(this,a).userData.controlled||(t(this,a).position.z=t(this,o)),t(this,a)instanceof m.PerspectiveCamera?(t(this,a).aspect=e/r,t(this,a).fov=t(this,x)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,a).userData.controlled?t(this,a).fov:t(this,x)):t(this,a)instanceof m.OrthographicCamera&&(t(this,a).left=e/-2,t(this,a).right=e/2,t(this,a).top=r/2,t(this,a).bottom=r/-2),t(this,a).updateProjectionMatrix()}destroy(){t(this,g).forEach(e=>{e.userData.box.destroy()}),t(this,R).clear(),X(t(this,R)),t(this,S).destroyView(this.name),t(this,y).destroy()}attachToHTMLElement(e,r,s){const h=new J.LayoutBox(e,W(I({},s),{containerElement:t(this,w),cartesian:!0,scrollStep:!this.isClipped}));return h.bindObject(r),r.userData.box=h,t(this,g).push(r),r}detachFromHTMLElement(e){n(this,g,t(this,g).filter(r=>r===e?(e.userData.box.destroy(),!1):!0))}add(...e){const r=e[0],s=e[1],h=e[2];return s&&this.attachToHTMLElement(s,r,h),this.scene.add(r),r}remove(e,r){this.scene.remove(e),r&&this.detachFromHTMLElement(e)}}S=new WeakMap,D=new WeakMap,a=new WeakMap,R=new WeakMap,g=new WeakMap,o=new WeakMap,x=new WeakMap,w=new WeakMap,y=new WeakMap,z=new WeakMap;var q,d,l,u,V,C,M,P,T,f,A,L;class ae{constructor(){c(this,q,`https://unpkg.com/three@0.${m.REVISION}.x`);c(this,d,null);c(this,l,null);c(this,u,new Map);c(this,V,0);c(this,C,0);c(this,M,0);c(this,P,2);c(this,T,!1);c(this,f,null);c(this,A,e=>{e instanceof CustomEvent||(n(this,V,t(this,d).clientWidth),n(this,C,t(this,d).clientHeight),n(this,M,Math.min(t(this,P),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,M)),t(this,l).setSize(t(this,V),t(this,C)),t(this,f)&&(t(this,f).setPixelRatio(t(this,M)),t(this,f).setSize(t(this,V),t(this,C))))});c(this,L,()=>{t(this,l).setRenderTarget(null),t(this,u).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,q)}get containerElement(){return t(this,d)}get webglRenderer(){return t(this,l)}get views(){return t(this,u)}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,V)}get height(){return t(this,C)}get pixelRatio(){return t(this,M)}get composer(){return t(this,f)}setup(e){if(t(this,T))return;n(this,d,Q.getElement(e==null?void 0:e.containerElement)||document.body),n(this,P,(e==null?void 0:e.maxPixelRatio)||2),n(this,l,new m.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,d).shadowRoot||t(this,d)).append(t(this,l).domElement),t(this,u).set("default",new H(this,"default",I({sizeElement:t(this,d)},e==null?void 0:e.view))),e!=null&&e.composer&&(n(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),n(this,T,!0),
|
|
8
|
+
`,(t(this,d).shadowRoot||t(this,d)).append(t(this,l).domElement),t(this,u).set("default",new H(this,"default",I({sizeElement:t(this,d)},e==null?void 0:e.view))),e!=null&&e.composer&&(n(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),n(this,T,!0),Z.windowResizer.subscribe(t(this,A),K.RESIZE_ORDER.CANVAS),U.ticker.subscribe(t(this,L),{order:K.TICK_ORDER.CANVAS,culling:t(this,d)})}destroy(){var e;t(this,T)&&(Z.windowResizer.unsubscribe(t(this,A)),U.ticker.unsubscribe(t(this,L)),t(this,u).forEach(r=>{r.destroy()}),t(this,u).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),n(this,l,null),(e=t(this,f))==null||e.dispose(),n(this,f,null),n(this,T,!1))}createView(e,r){const s=t(this,u).size,h=new H(this,e,r);return t(this,u).set(e,h),s===1&&t(this,l).setScissorTest(!0),h}getView(e){return t(this,u).get(e)}destroyView(e){const r=t(this,u).get(e);r&&(t(this,u).delete(e),r.destroy(),t(this,u).size<=1&&t(this,l).setScissorTest(!1))}render(e){var r;if(t(this,u).size>1||this.view.isClipped){const s=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;t(this,l).setScissor(s,h,e.box.width,e.box.height),t(this,l).setViewport(s,h,e.box.width,e.box.height)}(r=e.beforeRenderCallback)==null||r.call(e),t(this,l).render(e.scene,e.camera)}}q=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,V=new WeakMap,C=new WeakMap,M=new WeakMap,P=new WeakMap,T=new WeakMap,f=new WeakMap,A=new WeakMap,L=new WeakMap;function he(i,e,r){const s=e.x,h=e.y,b=r||i.image.width/i.image.height;let v=0,E=0,_=i.offset.x,O=i.offset.y,k=i.rotation,Y=i.center.x,j=i.center.y;s/h>b?(v=1,E=h/s*b):(E=1,v=s/h/b),i.matrix.setUvTransform(_,O,v,E,k,Y,j)}const F=new m.Vector3,ne=new m.Vector3;function ce(i,e,r="default"){const s=i.getView(r),{width:h,height:b}=i,v=h/b;e instanceof m.Vector3?F.copy(e):F.set(...e);const E=s.camera.getWorldPosition(ne).distanceTo(F);if(s.camera instanceof m.OrthographicCamera)return{width:h/s.camera.zoom,height:b/s.camera.zoom,factor:1,distance:E,aspect:v};{const _=s.camera.fov*Math.PI/180,O=2*Math.tan(_/2)*E,k=O*(h/b);return{width:k,height:O,factor:h/k,distance:E,aspect:v}}}function le(i,e){i.traverse(r=>{r instanceof m.Mesh&&r.material&&(Array.isArray(r.material)?r.material:[r.material]).forEach(e)})}function ue(i,e){i.traverse(r=>{r instanceof m.Mesh&&e(r)})}exports.En3=ae;exports.En3View=H;exports.coverTexture=he;exports.dispose=X;exports.getCurrentViewport=ce;exports.traverseMaterials=le;exports.traverseMeshes=ue;
|
package/lib/en3/index.js
CHANGED
|
@@ -15,13 +15,13 @@ var G = (r, e, s) => e in r ? ee(r, e, { enumerable: !0, configurable: !0, writa
|
|
|
15
15
|
}, K = (r, e) => te(r, se(e));
|
|
16
16
|
var U = (r, e, s) => e.has(r) || B("Cannot " + s);
|
|
17
17
|
var t = (r, e, s) => (U(r, e, "read from private field"), s ? s.call(r) : e.get(r)), c = (r, e, s) => e.has(r) ? B("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), n = (r, e, s, i) => (U(r, e, "write to private field"), i ? i.call(r, s) : e.set(r, s), s);
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { windowResizer as q } from "../window-resizer/index.js";
|
|
21
|
-
import { ticker as J } from "../ticker/index.js";
|
|
18
|
+
import { RESIZE_ORDER as he, TICK_ORDER as ae } from "../order/index.js";
|
|
19
|
+
import { ticker as Z } from "../ticker/index.js";
|
|
22
20
|
import { g as Y } from "../dom-fgxIeFxm.js";
|
|
23
21
|
import "construct-style-sheets-polyfill";
|
|
24
22
|
import "../index-JqYHGoo6.js";
|
|
23
|
+
import { windowResizer as q } from "../window-resizer/index.js";
|
|
24
|
+
import { Mesh as $, OrthographicCamera as N, PerspectiveCamera as J, Scene as ne, REVISION as ce, WebGLRenderer as le, Vector3 as W } from "three";
|
|
25
25
|
import { LayoutBox as Q } from "../layout-box/index.js";
|
|
26
26
|
import { d as me } from "../function-C10DGppn.js";
|
|
27
27
|
function fe(r) {
|
|
@@ -56,7 +56,7 @@ class X {
|
|
|
56
56
|
c(this, R, me(() => {
|
|
57
57
|
this.resize();
|
|
58
58
|
}, 0));
|
|
59
|
-
n(this, S, e), n(this, D, s), n(this, h, (i == null ? void 0 : i.cameraType) === "orthographic" ? new N() : new
|
|
59
|
+
n(this, S, e), n(this, D, s), n(this, h, (i == null ? void 0 : i.cameraType) === "orthographic" ? new N() : new J()), n(this, w, new ne()), n(this, o, []), n(this, u, (i == null ? void 0 : i.cameraDistance) || 1e3), t(this, h).near = (i == null ? void 0 : i.cameraNear) || 1, t(this, h).far = (i == null ? void 0 : i.cameraFar) || 11e3, n(this, g, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, h).position.z = t(this, u), t(this, h).name = `Cameras.${t(this, D)}`, n(this, x, Y(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, n(this, b, new Q(t(this, x))), t(this, b).onResize(() => {
|
|
60
60
|
this.resize();
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -104,7 +104,7 @@ class X {
|
|
|
104
104
|
}
|
|
105
105
|
resize() {
|
|
106
106
|
const { width: e, height: s } = t(this, b);
|
|
107
|
-
t(this, h).userData.controlled || (t(this, h).position.z = t(this, u)), t(this, h) instanceof
|
|
107
|
+
t(this, h).userData.controlled || (t(this, h).position.z = t(this, u)), t(this, h) instanceof J ? (t(this, h).aspect = e / s, t(this, h).fov = t(this, g) === "auto" ? 2 * Math.atan(s / 2 / t(this, u)) * (180 / Math.PI) : t(this, h).userData.controlled ? t(this, h).fov : t(this, g)) : t(this, h) instanceof N && (t(this, h).left = e / -2, t(this, h).right = e / 2, t(this, h).top = s / 2, t(this, h).bottom = s / -2), t(this, h).updateProjectionMatrix();
|
|
108
108
|
}
|
|
109
109
|
destroy() {
|
|
110
110
|
t(this, o).forEach((e) => {
|
|
@@ -134,7 +134,7 @@ S = new WeakMap(), D = new WeakMap(), h = new WeakMap(), w = new WeakMap(), o =
|
|
|
134
134
|
var I, f, l, m, z, V, C, v, T, d, P, A;
|
|
135
135
|
class Ve {
|
|
136
136
|
constructor() {
|
|
137
|
-
c(this, I, `https://unpkg.com/three@0.${
|
|
137
|
+
c(this, I, `https://unpkg.com/three@0.${ce}.x`);
|
|
138
138
|
c(this, f, null);
|
|
139
139
|
c(this, l, null);
|
|
140
140
|
c(this, m, /* @__PURE__ */ new Map());
|
|
@@ -189,7 +189,7 @@ class Ve {
|
|
|
189
189
|
setup(e) {
|
|
190
190
|
if (t(this, T))
|
|
191
191
|
return;
|
|
192
|
-
n(this, f, Y(e == null ? void 0 : e.containerElement) || document.body), n(this, v, (e == null ? void 0 : e.maxPixelRatio) || 2), n(this, l, new
|
|
192
|
+
n(this, f, Y(e == null ? void 0 : e.containerElement) || document.body), n(this, v, (e == null ? void 0 : e.maxPixelRatio) || 2), n(this, l, new le(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
|
|
193
193
|
position: ${(e == null ? void 0 : e.position) || "fixed"};
|
|
194
194
|
left: 0;
|
|
195
195
|
top: 0;
|
|
@@ -203,14 +203,14 @@ class Ve {
|
|
|
203
203
|
}, e == null ? void 0 : e.view))
|
|
204
204
|
), e != null && e.composer && (n(this, d, new e.composer(t(this, l))), this.render = () => {
|
|
205
205
|
t(this, d).render();
|
|
206
|
-
}), n(this, T, !0), q.subscribe(t(this, P),
|
|
207
|
-
order:
|
|
206
|
+
}), n(this, T, !0), q.subscribe(t(this, P), he.CANVAS), Z.subscribe(t(this, A), {
|
|
207
|
+
order: ae.CANVAS,
|
|
208
208
|
culling: t(this, f)
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
destroy() {
|
|
212
212
|
var e;
|
|
213
|
-
t(this, T) && (q.unsubscribe(t(this, P)),
|
|
213
|
+
t(this, T) && (q.unsubscribe(t(this, P)), Z.unsubscribe(t(this, A)), t(this, m).forEach((s) => {
|
|
214
214
|
s.destroy();
|
|
215
215
|
}), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), n(this, l, null), (e = t(this, d)) == null || e.dispose(), n(this, d, null), n(this, T, !1));
|
|
216
216
|
}
|
package/lib/jsx/h.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function appendChildren(element: Element, attributes: JSX.Attributes | undefined, children: JSX.Children): void;
|
|
1
|
+
export declare function appendChildren(element: Element, attributes: JSX.Attributes | undefined, children: JSX.Children, isSVG?: boolean): void;
|
|
2
2
|
export declare function h(jsxTag: string | Function, attributes?: JSX.Attributes, ...children: JSX.Children): any;
|
|
3
3
|
export declare function Fragment(children: any): DocumentFragment;
|
package/lib/jsx/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var d=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var l=(t,e,o)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,f=(t,e)=>{for(var o in e||(e={}))p.call(e,o)&&l(t,o,e[o]);if(d)for(var o of d(e))v.call(e,o)&&l(t,o,e[o]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../render-
|
|
1
|
+
"use strict";var y=Object.defineProperty;var d=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var l=(t,e,o)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,f=(t,e)=>{for(var o in e||(e={}))p.call(e,o)&&l(t,o,e[o]);if(d)for(var o of d(e))v.call(e,o)&&l(t,o,e[o]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../render-DBQUdpsp.cjs"),h=require("../string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const D=require("../Store-1JrMCgdX.cjs"),a=require("../Composed-CSeUTRCg.cjs"),S=require("../DerivedArray-B8A0-8uT.cjs");function w(){return{value:null}}function m(t){n.activeComponent.current.addConnectCallback(t)}function R(t){n.activeComponent.current.addDisconnectCallback(t)}function A(t){const e=n.activeComponent.current.attachInternals();return t==null||t(e),e}function x(t,e){const o=n.activeComponent.current.attachShadow(f({mode:"open"},t));return e==null||e(o),o}function C(t){const e=new CSSStyleSheet;return e.replaceSync(t),e}function g(t){let e="";const o=(s,r)=>{r&&(e+=`${r} {`);for(const[u,c]of Object.entries(s))typeof c=="object"&&c!==null?o(c,u):e+=`${h.camelToKebab(u)}: ${c};`;r&&(e+="}")};return o(t),e}function T(t,e){const o=C(e),s=[];for(const r of t.adoptedStyleSheets)Array.from(o.cssRules).filter(c=>!Array.from(r.cssRules).some(i=>i.cssText===c.cssText)).forEach(c=>{const i=r.insertRule(c.cssText);s.push(()=>r.deleteRule(i))});return()=>s.forEach(r=>r())}function b(t){const e=document.createElement("style");return e.textContent=t,document.head.appendChild(e),()=>e.remove()}function q(t){const e=g(t);if(n.activeComponent.current.shadowRoot){n.activeComponent.current.shadowRoot.adoptedStyleSheets=[...n.activeComponent.current.shadowRoot.adoptedStyleSheets,C(e)];return}m(o=>{const s=o.getRootNode();if(s===document){if(!Array.from(document.head.querySelectorAll("style")).find(u=>u.textContent===e))return b(e)}else if(s instanceof ShadowRoot)return T(s,e)})}function j(...t){const e=new D.Store(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function E(...t){const e=new a.Derived(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function K(...t){const e=new S.DerivedArray(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function I(...t){const e=new S.DerivedKeyedArray(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function O(...t){const e=new a.Resource(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function $(...t){const e=new a.Composed(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}exports.Fragment=n.Fragment;exports.h=n.h;exports.render=n.render;exports.useComposedStore=$;exports.useConnect=m;exports.useDerivedArrayStore=K;exports.useDerivedKeyedArrayStore=I;exports.useDerivedStore=E;exports.useDisconnect=R;exports.useInternals=A;exports.useRef=w;exports.useResourceStore=O;exports.useShadow=x;exports.useStore=j;exports.useStylesheet=q;
|
package/lib/jsx/index.js
CHANGED
|
@@ -9,8 +9,8 @@ var d = (t, e, n) => e in t ? S(t, e, { enumerable: !0, configurable: !0, writab
|
|
|
9
9
|
y.call(e, n) && d(t, n, e[n]);
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { a as r } from "../render-
|
|
13
|
-
import { F as V, h as W, r as X } from "../render-
|
|
12
|
+
import { a as r } from "../render-CMQbWthg.js";
|
|
13
|
+
import { F as V, h as W, r as X } from "../render-CMQbWthg.js";
|
|
14
14
|
import { c as h } from "../string-BlMQbe8b.js";
|
|
15
15
|
import "construct-style-sheets-polyfill";
|
|
16
16
|
import "../index-JqYHGoo6.js";
|
package/lib/jsx/type.d.ts
CHANGED
|
@@ -163,7 +163,7 @@ declare global {
|
|
|
163
163
|
srcSet?: StoreOr<string>
|
|
164
164
|
start?: StoreOr<number>
|
|
165
165
|
step?: StoreOr<number | string>
|
|
166
|
-
style?: StyleAttribute
|
|
166
|
+
style?: StyleAttribute | string
|
|
167
167
|
summary?: StoreOr<string>
|
|
168
168
|
tabIndex?: StoreOr<number>
|
|
169
169
|
target?: StoreOr<string>
|
|
@@ -172,7 +172,7 @@ declare global {
|
|
|
172
172
|
useMap?: StoreOr<string>
|
|
173
173
|
value?: StoreOr<string | string[] | number>
|
|
174
174
|
volume?: StoreOr<number>
|
|
175
|
-
width?: StoreOr<number>
|
|
175
|
+
width?: StoreOr<number | string>
|
|
176
176
|
wmode?: StoreOr<string>
|
|
177
177
|
wrap?: StoreOr<string>
|
|
178
178
|
|
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare class Morph {
|
|
|
75
75
|
top: number;
|
|
76
76
|
left: number;
|
|
77
77
|
};
|
|
78
|
+
get isNavigating(): boolean;
|
|
78
79
|
saveState(state: any): void;
|
|
79
80
|
getState(): any;
|
|
80
81
|
normalizePath(path: string, options?: Pick<MorphNavigateOptions, 'mergeParams'>): import('../utils').SplitPathResult;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ge=Object.defineProperty,Ee=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var _t=Object.getOwnPropertySymbols;var ve=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var te=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),se=h=>{throw TypeError(h)};var ee=(h,e,s)=>e in h?ge(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Ht=(h,e)=>{for(var s in e||(e={}))ve.call(e,s)&&ee(h,s,e[s]);if(_t)for(var s of _t(e))Le.call(e,s)&&ee(h,s,e[s]);return h},Dt=(h,e)=>Ee(h,be(e));var zt=(h,e,s)=>e.has(h)||se("Cannot "+s);var t=(h,e,s)=>(zt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(zt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),g=(h,e,s)=>(zt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((a,n)=>{var b=d=>{try{u(s.next(d))}catch(v){n(v)}},f=d=>{try{u(s.throw(d))}catch(v){n(v)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(b,f);u((s=s.apply(h,e)).next())});var ie=(h,e,s)=>(e=h[te("asyncIterator")])?e.call(h):(h=h[te("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=b=>new Promise((f,u,d)=>(b=n.call(h,b),d=b.done,Promise.resolve(b.value).then(v=>f({value:v,done:d}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("../index-CKTweR3M.cjs"),D=require("../events-KVanG9sR.cjs"),ae=require("../scroll-DxcPU0vk.cjs");require("construct-style-sheets-polyfill");const pt=require("../url-C2kASACG.cjs"),oe=require("../string-DUXXtU8v.cjs"),Se=require("../math-GDWEqu7y.cjs"),ye=require("../css-value-parser/index.cjs");class he extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}re.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",he);var R,i,x,at,Tt,le,Et,nt;class It{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,Et,e=>{e.preventDefault(),g(this,x,le).call(this)});l(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,at),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,Et)),this.checkCurrent(location.href.replace(location.origin,""));const a=g(this,x,Tt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var v,et;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,at));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(v=t(this,i).getAttribute("data-associated-paths"))!=null&&v.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,b]=(et=t(this,x,at).split("#")[0])==null?void 0:et.split("?"),f=new URLSearchParams(b),u=new URLSearchParams(location.search);let d=0;for(const[w]of u)f.has(w)&&u.get(w)===f.get(w)&&d++;d?(t(this,i).classList.toggle("all-params-matched",u.size===d),t(this,i).classList.toggle("some-params-matched",u.size!==d)):!u.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const st=oe.camelToKebab(w);if(st.startsWith("match-param-")){const $=st.split("match-param-")[1],S=t(this,i).dataset[w],c=`param-${$}-matched`;u.has($)&&u.get($)===S||!u.has($)&&(S===""||S==="*"||S==="all"||S==="any"||S==="vse")?t(this,i).classList.add(c):t(this,i).classList.remove(c)}}}updatePagination(e,s){const a=g(this,x,Tt).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",u),this.checkCurrent(u)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Se.clamp(u,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?u<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):u>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,Et)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,at=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},Tt=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},le=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),b=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=b?ye.cssValueParser.parse(b):void 0,u=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),v=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),et=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,st=t(this,i).hasAttribute("data-clear-state");let $=t(this,x,at);if(t(this,i).hasAttribute("data-toggle-params")){const[c,wt]=t(this,x,at).split("?"),j=new URLSearchParams(wt),V=new URLSearchParams(location.search),it=new URLSearchParams;for(const[y]of j)(!V.has(y)||V.has(y)&&V.get(y)!==j.get(y))&&it.append(y,j.get(y));if(t(this,i).hasAttribute("data-merge-params"))for(const[y]of V)j.has(y)||it.append(y,V.get(y));$=`${c}?${it.toString()}`}const S=g(this,x,Tt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));S&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),S.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage-1,S.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)})),t(this,R).navigate($,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:d,submorph:w,clearState:st,keepScrollPosition:v,scrollBehaviour:et,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:!!S||t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},Et=new WeakMap,nt=new WeakMap;const Ae=new DOMParser;var z,J,H,I,Q,F,rt,Z,B,bt,ot;class ne{constructor(e,s){l(this,z);l(this,J);l(this,H,{x:0,y:0});l(this,I,null);l(this,Q,null);l(this,F,null);l(this,rt,null);l(this,Z,null);l(this,B,null);l(this,bt);l(this,ot,!1);o(this,z,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,H)}get document(){return t(this,F)}needRavalidation(){o(this,ot,!0)}setHeaders(e){o(this,bt,e)}setInitialDocument(e){o(this,I,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,a){return G(this,null,function*(){var n;if(!a&&!t(this,ot)){const u=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,B)||u||d)return t(this,B)}return o(this,B,new Promise(b=>G(this,null,function*(){try{o(this,Z,new AbortController);const u=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Ht({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,bt))})).text(),d=Ae.parseFromString(u,"text/html");this.setInitialDocument(d),o(this,ot,!1)}catch(f){console.warn(f)}finally{o(this,Z,null),o(this,B,null),b()}}))),t(this,B)})}cloneDocument(){o(this,F,(t(this,Q)||t(this,I)).cloneNode(!0))}get title(){let e="";if(t(this,F).title)e=t(this,F).title;else{const s=t(this,F).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,H).x=0,t(this,H).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,H).x=0,t(this,H).y=0):(t(this,H).x=t(this,z).scrollValue.left,t(this,H).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,H).y,left:t(this,H).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,rt,e)}clearState(){const e=t(this,rt);return o(this,rt,null),e}}z=new WeakMap,J=new WeakMap,H=new WeakMap,I=new WeakMap,Q=new WeakMap,F=new WeakMap,rt=new WeakMap,Z=new WeakMap,B=new WeakMap,bt=new WeakMap,ot=new WeakMap;var T,ht,vt,Wt,Lt;class Pe{constructor(e){l(this,vt);l(this,T);l(this,ht,[]);l(this,Lt,()=>{g(this,vt,Wt).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const a=oe.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],b=t(this,T).dataset[s];t(this,ht).push({name:n,value:b})}}document.addEventListener("morphURLParametersChange",t(this,Lt)),g(this,vt,Wt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,Lt))}}T=new WeakMap,ht=new WeakMap,vt=new WeakSet,Wt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ht).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,T).hasAttribute("data-match-no-params")&&(s=!t(this,ht).filter(n=>e.has(n.name)).length);const a=t(this,T).getAttribute("data-hide-class");s?a?t(this,T).classList.remove(a):t(this,T).style.display="":a?t(this,T).classList.add(a):t(this,T).style.display="none"},Lt=new WeakMap;var q,lt,P,K,E,_,X,Y,M,St,W,yt,tt,ct,dt,At,ut,Pt,p,Ot,kt,ft,Ft,ce,Bt,Kt,Xt,Yt,Ut,mt;const gt=class gt{constructor(e){l(this,p);l(this,q,null);l(this,lt,null);l(this,P,[]);l(this,K);l(this,E,null);l(this,_);l(this,X,[]);l(this,Y,!1);l(this,M,null);l(this,St,!1);l(this,W,new Map);l(this,yt,[]);l(this,tt,null);l(this,ct,0);l(this,dt,0);l(this,At);l(this,ut);l(this,Pt);l(this,kt,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Ut,e=>G(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,ut)?void 0:t(this,At),revalidate:t(this,ut),keepScrollPosition:t(this,Pt)}),o(this,Y,!1)}));l(this,mt,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,dt),n=e-t(this,ct);o(this,dt,s),o(this,ct,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(re.isBrowser&&!gt.instance){gt.instance=this,o(this,q,{base:pt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,lt,g(this,p,Ft).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,E,s);const a=new ne(this,t(this,E).pathname);a.setInitialDocument(document),t(this,W).set(t(this,E).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,E).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Ut)),pt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new he),g(this,p,Xt).call(this,document)}}get currentURL(){return t(this,E)}get previousURL(){return t(this,_)}get links(){return t(this,P)}get scrollElement(){return t(this,M)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,St)?(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,W).get(t(this,E).path);s&&s.saveState(e)}getState(){const e=t(this,W).get(t(this,E).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return pt.splitPath(e,{base:t(this,q).base,trailingSlash:t(this,q).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,X).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=g(this,p,ft).call(this,e);a==null||a.fetch(e,t(this,E).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),a=g(this,p,ft).call(this,s.path);a==null||a.needRavalidation()}navigate($){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:b,revalidate:f,keepSearchParameters:u,submorph:d,submorphAppend:v,clearState:et,keepScrollPosition:w,mergeParams:st}={}){var wt,j,V,it;if(t(this,X).length)return;o(this,At,d),o(this,ut,f),o(this,Pt,w);const S=((wt=this.pathnameModifier)==null?void 0:wt.call(this,e))||e,c=this.normalizePath(S,{mergeParams:st});if(!f&&(((j=t(this,K))==null?void 0:j.pathname)===c.pathname||t(this,E).pathname===c.pathname)){w||g(this,p,Yt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((V=t(this,E))==null?void 0:V.parameters)!==c.parameters&&(o(this,_,t(this,E)),o(this,E,c),pt.changeHistory({action:((it=t(this,E))==null?void 0:it.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,E),previousURL:t(this,_)}})),t(this,P).forEach(y=>{y.checkCurrent(c.path)});return}else t(this,P).forEach(y=>{y.checkCurrent(c.path)});o(this,K,c);try{let y=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var U;(U=this.preprocessor)==null||U.call(this,{url:c,resolve:r,reject:k,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),y=!1}if(!y||t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)});return}const $t={url:c,submorph:d};d?v||d.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,lt).forEach(r=>{var k,U;(k=r.firstElementChild)==null||k.classList.add("out"),(U=r.firstElementChild)==null||U.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:$t});const Mt=g(this,p,ft).call(this,t(this,E).pathname),A=g(this,p,ft).call(this,c.pathname);if(t(this,W).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield A==null?void 0:A.fetch(S,t(this,E).path,f),t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(A.clearScrollState(),A.clearDocumentState()),et&&A.clearState(),A.cloneDocument(),t(this,tt).textContent=A.title,document.body.appendChild(t(this,tt));const Ct=Dt(Ht({},$t),{document:A.document});v||Ct.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:Ct});const jt=Array.from(document.head.children),Gt=Array.from(A.document.head.children),Jt=g(this,p,ce).call(this,jt,Gt),de=g(this,p,Bt).call(this,jt,Jt),Rt=g(this,p,Bt).call(this,Gt,Jt).filter(r=>!this.excludeHeadChild(r));Rt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(Rt[k]=g(this,p,Ot).call(this,r))}),Rt.forEach(r=>{document.head.appendChild(r)});const Nt=Rt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(g(this,p,Kt).call(this,r))return!0});t(this,q).waitForHeadToLoad&&Nt.length&&(yield new Promise(r=>G(this,null,function*(){let k=0;try{for(var U=ie(Nt),me,O,N;me=!(O=yield U.next()).done;me=!1){const xt=O.value;xt.onload=()=>{k++,k===Nt.length&&r()}}}catch(O){N=[O]}finally{try{me&&(O=U.return)&&(yield O.call(U))}finally{if(N)throw N[0]}}}))),yield ae.wait(10);const Qt=[];v||de.forEach(r=>{r.hasAttribute("data-permanent")||(g(this,p,Kt).call(this,r)?Qt.push(r):r.remove())});const ue=g(this,p,Ft).call(this,A.document.body);!t(this,q).morphInsideScrollContainer&&!d&&g(this,p,Xt).call(this,A.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),pt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(u?location.search:""),hash:c.hash}),t(this,tt).remove(),o(this,_,t(this,E)),o(this,E,c);const qt=[];t(this,lt).forEach((r,k)=>{const U=ue[k],me=getComputedStyle(r).getPropertyValue("--morph-duration");let O=[],N=[];d?(d.forEach(m=>{const L=r.querySelector(m),C=U.querySelector(m);L&&C&&(N.push(L),O.push(C))}),N.forEach(m=>{m.parentElement&&qt.push(m.parentElement)})):(O.push(...U.childNodes),N.push(...r.childNodes),qt.push(r));const xt=[];v||N.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const fe=C.getAttribute("data-morph-transfer");xt.push({element:C,selector:fe})}))}),O.forEach(m=>{m instanceof HTMLElement&&(xt.forEach(L=>{const C=m.querySelector(L.selector);C&&C.replaceWith(A.document.importNode(L.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),d?v?O.forEach((m,L)=>{N[L]instanceof HTMLElement&&N[L].append(...m.childNodes)}):O.forEach((m,L)=>{var C;(C=N[L].parentElement)==null||C.insertBefore(m,N[L])}):r.prepend(...O),setTimeout(()=>{v||N.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var L;m instanceof HTMLElement&&((L=m.parentElement)==null||L.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const Zt=Dt(Ht({},Ct),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Zt});const pe=new Promise(m=>{setTimeout(()=>{v||N.forEach(L=>{L.remove()}),O.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),v||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Zt}),m()},(parseFloat(me)||0)*1e3+10)});t(this,X).push(pe)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-A.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:A.scrollState}),c.hash?(A.clearScrollState(),g(this,p,Yt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:b})):t(this,Y)?A.restoreScrollPosition():w||A.renewScrollPosition(),yield Promise.all(t(this,X)),v||Qt.forEach(r=>r.remove()),o(this,X,[]),qt.forEach(r=>{r.querySelectorAll("script").forEach(U=>{U.replaceWith(g(this,p,Ot).call(this,U))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:Ct}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(y){console.error(y)}o(this,K,void 0)})}addLink(e){t(this,P).push(new It(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,kt));t(this,P).push(...s.map(a=>new It(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,kt));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new It(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,yt).forEach(s=>s.destroy()),o(this,yt,e.map(s=>new Pe(s)))}};q=new WeakMap,lt=new WeakMap,P=new WeakMap,K=new WeakMap,E=new WeakMap,_=new WeakMap,X=new WeakMap,Y=new WeakMap,M=new WeakMap,St=new WeakMap,W=new WeakMap,yt=new WeakMap,tt=new WeakMap,ct=new WeakMap,dt=new WeakMap,At=new WeakMap,ut=new WeakMap,Pt=new WeakMap,p=new WeakSet,Ot=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},kt=new WeakMap,ft=function(e){const s=this.normalizePath(e);let a=t(this,W).get(s.pathname);return a||(a=new ne(this,s.pathname),t(this,W).set(s.pathname,a)),a},Ft=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ce=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Bt=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Kt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Xt=function(e){var s,a;(s=t(this,M))==null||s.removeEventListener("scroll",t(this,mt)),o(this,dt,0),o(this,ct,0),o(this,M,t(this,q).scrollSelector&&e.querySelector(t(this,q).scrollSelector)||window),o(this,St,t(this,M)===window),(a=t(this,M))==null||a.addEventListener("scroll",t(this,mt)),t(this,mt).call(this)},Yt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ae.scrollToElement(a,{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})},Ut=new WeakMap,mt=new WeakMap,gt.instance=null;let Vt=gt;exports.Morph=Vt;
|
|
1
|
+
"use strict";var ge=Object.defineProperty,Ee=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var _t=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var te=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),se=h=>{throw TypeError(h)};var ee=(h,e,s)=>e in h?ge(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Ht=(h,e)=>{for(var s in e||(e={}))be.call(e,s)&&ee(h,s,e[s]);if(_t)for(var s of _t(e))Le.call(e,s)&&ee(h,s,e[s]);return h},Dt=(h,e)=>Ee(h,ve(e));var zt=(h,e,s)=>e.has(h)||se("Cannot "+s);var t=(h,e,s)=>(zt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(zt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),g=(h,e,s)=>(zt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((a,n)=>{var v=d=>{try{u(s.next(d))}catch(b){n(b)}},f=d=>{try{u(s.throw(d))}catch(b){n(b)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(v,f);u((s=s.apply(h,e)).next())});var ie=(h,e,s)=>(e=h[te("asyncIterator")])?e.call(h):(h=h[te("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=v=>new Promise((f,u,d)=>(v=n.call(h,v),d=v.done,Promise.resolve(v.value).then(b=>f({value:b,done:d}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("../index-CKTweR3M.cjs"),D=require("../events-KVanG9sR.cjs"),ae=require("../scroll-DxcPU0vk.cjs");require("construct-style-sheets-polyfill");const pt=require("../url-C2kASACG.cjs"),oe=require("../string-DUXXtU8v.cjs"),Se=require("../math-GDWEqu7y.cjs"),ye=require("../css-value-parser/index.cjs");class he extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}re.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",he);var R,i,x,at,Tt,le,Et,nt;class It{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,Et,e=>{e.preventDefault(),g(this,x,le).call(this)});l(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,at),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,Et)),this.checkCurrent(location.href.replace(location.origin,""));const a=g(this,x,Tt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var b,et;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,at));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(b=t(this,i).getAttribute("data-associated-paths"))!=null&&b.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,v]=(et=t(this,x,at).split("#")[0])==null?void 0:et.split("?"),f=new URLSearchParams(v),u=new URLSearchParams(location.search);let d=0;for(const[w]of u)f.has(w)&&u.get(w)===f.get(w)&&d++;d?(t(this,i).classList.toggle("all-params-matched",u.size===d),t(this,i).classList.toggle("some-params-matched",u.size!==d)):!u.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const st=oe.camelToKebab(w);if(st.startsWith("match-param-")){const $=st.split("match-param-")[1],S=t(this,i).dataset[w],c=`param-${$}-matched`;u.has($)&&u.get($)===S||!u.has($)&&(S===""||S==="*"||S==="all"||S==="any"||S==="vse")?t(this,i).classList.add(c):t(this,i).classList.remove(c)}}}updatePagination(e,s){const a=g(this,x,Tt).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const v=t(this,i).getAttribute("href"),f=new URL(v,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",u),this.checkCurrent(u)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),v=t(this,i).getAttribute("href"),f=new URL(v,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Se.clamp(u,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?u<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):u>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,Et)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,at=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},Tt=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},le=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),v=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=v?ye.cssValueParser.parse(v):void 0,u=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),b=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),et=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,st=t(this,i).hasAttribute("data-clear-state");let $=t(this,x,at);if(t(this,i).hasAttribute("data-toggle-params")){const[c,wt]=t(this,x,at).split("?"),j=new URLSearchParams(wt),O=new URLSearchParams(location.search),it=new URLSearchParams;for(const[y]of j)(!O.has(y)||O.has(y)&&O.get(y)!==j.get(y))&&it.append(y,j.get(y));if(t(this,i).hasAttribute("data-merge-params"))for(const[y]of O)j.has(y)||it.append(y,O.get(y));$=`${c}?${it.toString()}`}const S=g(this,x,Tt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));S&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),S.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage-1,S.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(c=>{c.updatePagination(S.currentPage+1,S.selector)})),t(this,R).navigate($,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:d,submorph:w,clearState:st,keepScrollPosition:b,scrollBehaviour:et,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:!!S||t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},Et=new WeakMap,nt=new WeakMap;var H,rt,vt,Wt,bt;class Ae{constructor(e){l(this,vt);l(this,H);l(this,rt,[]);l(this,bt,()=>{g(this,vt,Wt).call(this)});o(this,H,e);for(const s in t(this,H).dataset){const a=oe.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],v=t(this,H).dataset[s];t(this,rt).push({name:n,value:v})}}document.addEventListener("morphURLParametersChange",t(this,bt)),g(this,vt,Wt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,bt))}}H=new WeakMap,rt=new WeakMap,vt=new WeakSet,Wt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,rt).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,H).hasAttribute("data-match-no-params")&&(s=!t(this,rt).filter(n=>e.has(n.name)).length);const a=t(this,H).getAttribute("data-hide-class");s?a?t(this,H).classList.remove(a):t(this,H).style.display="":a?t(this,H).classList.add(a):t(this,H).style.display="none"},bt=new WeakMap;const Pe=new DOMParser;var z,J,T,I,Q,B,ot,Z,K,Lt,ht;class ne{constructor(e,s){l(this,z);l(this,J);l(this,T,{x:0,y:0});l(this,I,null);l(this,Q,null);l(this,B,null);l(this,ot,null);l(this,Z,null);l(this,K,null);l(this,Lt);l(this,ht,!1);o(this,z,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,T)}get document(){return t(this,B)}needRavalidation(){o(this,ht,!0)}setHeaders(e){o(this,Lt,e)}setInitialDocument(e){o(this,I,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,a){return G(this,null,function*(){var n;if(!a&&!t(this,ht)){const u=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,K)||u||d)return t(this,K)}return o(this,K,new Promise(v=>G(this,null,function*(){try{o(this,Z,new AbortController);const u=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Ht({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,Lt))})).text(),d=Pe.parseFromString(u,"text/html");this.setInitialDocument(d),o(this,ht,!1)}catch(f){console.warn(f)}finally{o(this,Z,null),o(this,K,null),v()}}))),t(this,K)})}cloneDocument(){o(this,B,(t(this,Q)||t(this,I)).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,T).x=0,t(this,T).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,T).x=0,t(this,T).y=0):(t(this,T).x=t(this,z).scrollValue.left,t(this,T).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,T).y,left:t(this,T).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,ot,e)}clearState(){const e=t(this,ot);return o(this,ot,null),e}}z=new WeakMap,J=new WeakMap,T=new WeakMap,I=new WeakMap,Q=new WeakMap,B=new WeakMap,ot=new WeakMap,Z=new WeakMap,K=new WeakMap,Lt=new WeakMap,ht=new WeakMap;var q,lt,P,X,E,_,W,Y,M,St,V,yt,tt,ct,dt,At,ut,Pt,p,Ot,kt,ft,Ft,ce,Bt,Kt,Xt,Yt,Ut,mt;const gt=class gt{constructor(e){l(this,p);l(this,q,null);l(this,lt,null);l(this,P,[]);l(this,X);l(this,E,null);l(this,_);l(this,W,[]);l(this,Y,!1);l(this,M,null);l(this,St,!1);l(this,V,new Map);l(this,yt,[]);l(this,tt,null);l(this,ct,0);l(this,dt,0);l(this,At);l(this,ut);l(this,Pt);l(this,kt,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Ut,e=>G(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,ut)?void 0:t(this,At),revalidate:t(this,ut),keepScrollPosition:t(this,Pt)}),o(this,Y,!1)}));l(this,mt,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,dt),n=e-t(this,ct);o(this,dt,s),o(this,ct,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(re.isBrowser&&!gt.instance){gt.instance=this,o(this,q,{base:pt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,lt,g(this,p,Ft).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,E,s);const a=new ne(this,t(this,E).pathname);a.setInitialDocument(document),t(this,V).set(t(this,E).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,E).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Ut)),pt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new he),g(this,p,Xt).call(this,document)}}get currentURL(){return t(this,E)}get previousURL(){return t(this,_)}get links(){return t(this,P)}get scrollElement(){return t(this,M)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,St)?(e=window.scrollY,s=window.scrollX):(e=t(this,M).scrollTop,s=t(this,M).scrollLeft),{top:e,left:s}}get isNavigating(){return!!t(this,W).length}saveState(e){const s=t(this,V).get(t(this,E).path);s&&s.saveState(e)}getState(){const e=t(this,V).get(t(this,E).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return pt.splitPath(e,{base:t(this,q).base,trailingSlash:t(this,q).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,W).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=g(this,p,ft).call(this,e);a==null||a.fetch(e,t(this,E).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),a=g(this,p,ft).call(this,s.path);a==null||a.needRavalidation()}navigate($){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:v,revalidate:f,keepSearchParameters:u,submorph:d,submorphAppend:b,clearState:et,keepScrollPosition:w,mergeParams:st}={}){var wt,j,O,it;if(t(this,W).length)return;o(this,At,d),o(this,ut,f),o(this,Pt,w);const S=((wt=this.pathnameModifier)==null?void 0:wt.call(this,e))||e,c=this.normalizePath(S,{mergeParams:st});if(!f&&(((j=t(this,X))==null?void 0:j.pathname)===c.pathname||t(this,E).pathname===c.pathname)){w||g(this,p,Yt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((O=t(this,E))==null?void 0:O.parameters)!==c.parameters&&(o(this,_,t(this,E)),o(this,E,c),pt.changeHistory({action:((it=t(this,E))==null?void 0:it.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,E),previousURL:t(this,_)}})),t(this,P).forEach(y=>{y.checkCurrent(c.path)});return}else t(this,P).forEach(y=>{y.checkCurrent(c.path)});o(this,X,c);try{let y=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var U;(U=this.preprocessor)==null||U.call(this,{url:c,resolve:r,reject:k,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),y=!1}if(!y||t(this,X).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)});return}const $t={url:c,submorph:d};d?b||d.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,lt).forEach(r=>{var k,U;(k=r.firstElementChild)==null||k.classList.add("out"),(U=r.firstElementChild)==null||U.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:$t});const Mt=g(this,p,ft).call(this,t(this,E).pathname),A=g(this,p,ft).call(this,c.pathname);if(t(this,V).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield A==null?void 0:A.fetch(S,t(this,E).path,f),t(this,X).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(A.clearScrollState(),A.clearDocumentState()),et&&A.clearState(),A.cloneDocument(),t(this,tt).textContent=A.title,document.body.appendChild(t(this,tt));const Ct=Dt(Ht({},$t),{document:A.document});b||Ct.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:Ct});const jt=Array.from(document.head.children),Gt=Array.from(A.document.head.children),Jt=g(this,p,ce).call(this,jt,Gt),de=g(this,p,Bt).call(this,jt,Jt),Rt=g(this,p,Bt).call(this,Gt,Jt).filter(r=>!this.excludeHeadChild(r));Rt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(Rt[k]=g(this,p,Ot).call(this,r))}),Rt.forEach(r=>{document.head.appendChild(r)});const Nt=Rt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(g(this,p,Kt).call(this,r))return!0});t(this,q).waitForHeadToLoad&&Nt.length&&(yield new Promise(r=>G(this,null,function*(){let k=0;try{for(var U=ie(Nt),me,F,N;me=!(F=yield U.next()).done;me=!1){const xt=F.value;xt.onload=()=>{k++,k===Nt.length&&r()}}}catch(F){N=[F]}finally{try{me&&(F=U.return)&&(yield F.call(U))}finally{if(N)throw N[0]}}}))),yield ae.wait(10);const Qt=[];b||de.forEach(r=>{r.hasAttribute("data-permanent")||(g(this,p,Kt).call(this,r)?Qt.push(r):r.remove())});const ue=g(this,p,Ft).call(this,A.document.body);!t(this,q).morphInsideScrollContainer&&!d&&g(this,p,Xt).call(this,A.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),pt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(u?location.search:""),hash:c.hash}),t(this,tt).remove(),o(this,_,t(this,E)),o(this,E,c);const qt=[];t(this,lt).forEach((r,k)=>{const U=ue[k],me=getComputedStyle(r).getPropertyValue("--morph-duration");let F=[],N=[];d?(d.forEach(m=>{const L=r.querySelector(m),C=U.querySelector(m);L&&C&&(N.push(L),F.push(C))}),N.forEach(m=>{m.parentElement&&qt.push(m.parentElement)})):(F.push(...U.childNodes),N.push(...r.childNodes),qt.push(r));const xt=[];b||N.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const fe=C.getAttribute("data-morph-transfer");xt.push({element:C,selector:fe})}))}),F.forEach(m=>{m instanceof HTMLElement&&(xt.forEach(L=>{const C=m.querySelector(L.selector);C&&C.replaceWith(A.document.importNode(L.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),d?b?F.forEach((m,L)=>{N[L]instanceof HTMLElement&&N[L].append(...m.childNodes)}):F.forEach((m,L)=>{var C;(C=N[L].parentElement)==null||C.insertBefore(m,N[L])}):r.prepend(...F),setTimeout(()=>{b||N.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),F.forEach(m=>{var L;m instanceof HTMLElement&&((L=m.parentElement)==null||L.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const Zt=Dt(Ht({},Ct),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Zt});const pe=new Promise(m=>{setTimeout(()=>{b||N.forEach(L=>{L.remove()}),F.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),b||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Zt}),m()},(parseFloat(me)||0)*1e3+10)});t(this,W).push(pe)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-A.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:A.scrollState}),c.hash?(A.clearScrollState(),g(this,p,Yt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:v})):t(this,Y)?A.restoreScrollPosition():w||A.renewScrollPosition(),yield Promise.all(t(this,W)),b||Qt.forEach(r=>r.remove()),o(this,W,[]),qt.forEach(r=>{r.querySelectorAll("script").forEach(U=>{U.replaceWith(g(this,p,Ot).call(this,U))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,E).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:Ct}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(y){console.error(y)}o(this,X,void 0)})}addLink(e){t(this,P).push(new It(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,kt));t(this,P).push(...s.map(a=>new It(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,kt));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new It(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,yt).forEach(s=>s.destroy()),o(this,yt,e.map(s=>new Ae(s)))}};q=new WeakMap,lt=new WeakMap,P=new WeakMap,X=new WeakMap,E=new WeakMap,_=new WeakMap,W=new WeakMap,Y=new WeakMap,M=new WeakMap,St=new WeakMap,V=new WeakMap,yt=new WeakMap,tt=new WeakMap,ct=new WeakMap,dt=new WeakMap,At=new WeakMap,ut=new WeakMap,Pt=new WeakMap,p=new WeakSet,Ot=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},kt=new WeakMap,ft=function(e){const s=this.normalizePath(e);let a=t(this,V).get(s.pathname);return a||(a=new ne(this,s.pathname),t(this,V).set(s.pathname,a)),a},Ft=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ce=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Bt=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Kt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Xt=function(e){var s,a;(s=t(this,M))==null||s.removeEventListener("scroll",t(this,mt)),o(this,dt,0),o(this,ct,0),o(this,M,t(this,q).scrollSelector&&e.querySelector(t(this,q).scrollSelector)||window),o(this,St,t(this,M)===window),(a=t(this,M))==null||a.addEventListener("scroll",t(this,mt)),t(this,mt).call(this)},Yt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ae.scrollToElement(a,{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})},Ut=new WeakMap,mt=new WeakMap,gt.instance=null;let Vt=gt;exports.Morph=Vt;
|