aptechka 0.45.2 → 0.46.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/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +54 -54
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +24 -24
- package/package.json +1 -1
package/lib/accordion/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var I=s=>{throw TypeError(s)};var p=(s,i,t)=>i.has(s)||I("Cannot "+t);var e=(s,i,t)=>(p(s,i,"read from private field"),t?t.call(s):i.get(s)),n=(s,i,t)=>i.has(s)?I("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(s):i.set(s,t),c=(s,i,t,r)=>(p(s,i,"write to private field"),r?r.call(s,t):i.set(s,t),t),m=(s,i,t)=>(p(s,i,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("../attribute/index.cjs"),q=require("../index-Cqw2NKev.cjs"),C=require("../events-KVanG9sR.cjs"),H=require("../style-At6aDoqG.cjs");var d,l,f,h,E,u,o,x,A,y,b,M;class S{constructor(i,t){n(this,o);n(this,d,null);n(this,l,null);n(this,f,null);n(this,h,null);n(this,E);n(this,u,!1);n(this,A,()=>{e(this,u)?this.close():this.open()});n(this,y,()=>{e(this,u)&&(m(this,o,b).call(this,0,!0),m(this,o,b).call(this,e(this,o,x)))});t.firstElementChild instanceof HTMLElement&&t.lastElementChild instanceof HTMLElement?(c(this,d,i),c(this,l,t),c(this,f,t.firstElementChild),c(this,h,t.lastElementChild),e(this,h).style.overflow="hidden",e(this,d).axisAttribute.current==="y"?e(this,h).style.height="0px":e(this,h).style.width="0px",addEventListener("resize",e(this,y)),e(this,f).addEventListener("click",e(this,A)),e(this,l).hasAttribute("data-opened")&&this.open({skipTransition:!0})):i.removeItem(e(this,l))}get element(){return e(this,l)}destroy(){e(this,f)&&(e(this,l).classList.remove("opened","triggered"),e(this,l).removeAttribute("data-opened"),e(this,f).style.cursor="",m(this,o,b).call(this,void 0),removeEventListener("resize",e(this,y)),e(this,f).removeEventListener("click",e(this,A)),clearTimeout(e(this,E)))}open(i){i!=null&&i.skipTransition&&m(this,o,M).call(this),e(this,d).multipleAttribute.current||e(this,d).closeAll({exclude:e(this,l)}),c(this,u,!0),clearTimeout(e(this,E)),e(this,l).classList.add("triggered"),m(this,o,b).call(this,e(this,o,x)),setTimeout(()=>{e(this,l).classList.add("opened"),e(this,l).setAttribute("data-opened",""),c(this,E,setTimeout(()=>{window.dispatchEvent(new Event("resize"))},H.getElementTransitionDurationMS(e(this,h))))},0),C.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u)}})}close(i){i!=null&&i.skipTransition&&m(this,o,M).call(this),clearTimeout(e(this,E)),c(this,u,!1),e(this,l).classList.remove("opened"),m(this,o,b).call(this,0),c(this,E,setTimeout(()=>{e(this,l).classList.remove("triggered"),window.dispatchEvent(new Event("resize"))},H.getElementTransitionDurationMS(e(this,h)))),C.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u)}})}}d=new WeakMap,l=new WeakMap,f=new WeakMap,h=new WeakMap,E=new WeakMap,u=new WeakMap,o=new WeakSet,x=function(){return e(this,d).axisAttribute.current==="x"?e(this,h).scrollWidth:e(this,h).scrollHeight},A=new WeakMap,y=new WeakMap,b=function(i,t=!1){t&&(e(this,h).style.transition="all 0s",setTimeout(()=>{e(this,h).style.transition=""}));const r=e(this,d).axisAttribute.current==="x"?"width":"height";i!=null?e(this,h).style[r]=`${i}px`:e(this,h).style[r]=""},M=function(){e(this,h).style.transition="all 0s",setTimeout(()=>{e(this,h).style.transition=""},50)};var v,T,a,g,L,k;class O extends HTMLElement{constructor(){super();n(this,L);n(this,v,new z.Attribute(this,"axis","y"));n(this,T,new z.Attribute(this,"multiple",!1));n(this,a,[]);n(this,g,null);q.isBrowser&&c(this,g,new MutationObserver(t=>{t.forEach(r=>{r.removedNodes.forEach(w=>{w instanceof HTMLElement&&this.removeItem(w)}),r.addedNodes.forEach(w=>{w instanceof HTMLElement&&this.createItem(w)})})}))}get axisAttribute(){return e(this,v)}get multipleAttribute(){return e(this,T)}createItem(t){e(this,a).find(r=>r.element===t)||e(this,a).push(new S(this,t))}removeItem(t){c(this,a,e(this,a).filter(r=>{if(r.element!==t)return!0;r.destroy()}))}closeAll(t){e(this,a).forEach(r=>{(t==null?void 0:t.exclude)!==r.element&&r.close(t)})}openAll(t){e(this,a).forEach(r=>{(t==null?void 0:t.exclude)!==r.element&&r.open(t)})}connectedCallback(){e(this,v).observe(),e(this,T).observe(),e(this,g).observe(e(this,L,k),{childList:!0}),c(this,a,[...e(this,L,k).children].map(t=>{if(t instanceof HTMLElement)return new S(this,t)}).filter(t=>!!t))}disconnectedCallback(){e(this,v).unobserve(),e(this,T).unobserve(),e(this,g).disconnect()}}v=new WeakMap,T=new WeakMap,a=new WeakMap,g=new WeakMap,L=new WeakSet,k=function(){return this.shadowRoot?this.shadowRoot:this};q.isBrowser&&!customElements.get("e-accordion")&&customElements.define("e-accordion",O);exports.AccordionElement=O;
|
package/lib/accordion/index.js
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
1
|
var M = (s) => {
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (s, i, t) => (
|
|
6
|
-
import { Attribute as
|
|
4
|
+
var x = (s, i, t) => i.has(s) || M("Cannot " + t);
|
|
5
|
+
var e = (s, i, t) => (x(s, i, "read from private field"), t ? t.call(s) : i.get(s)), l = (s, i, t) => i.has(s) ? M("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), a = (s, i, t, r) => (x(s, i, "write to private field"), r ? r.call(s, t) : i.set(s, t), t), m = (s, i, t) => (x(s, i, "access private method"), t);
|
|
6
|
+
import { Attribute as z } from "../attribute/index.js";
|
|
7
7
|
import { i as R } from "../index-euf5anj6.js";
|
|
8
|
-
import { d as
|
|
9
|
-
import { g as
|
|
10
|
-
var d,
|
|
11
|
-
class
|
|
8
|
+
import { d as C } from "../events-CsVF98U6.js";
|
|
9
|
+
import { g as H } from "../style-j2TwriJ_.js";
|
|
10
|
+
var d, n, f, h, E, u, o, y, w, L, v, k;
|
|
11
|
+
class S {
|
|
12
12
|
constructor(i, t) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
l(this, o);
|
|
14
|
+
l(this, d, null);
|
|
15
|
+
l(this, n, null);
|
|
16
|
+
l(this, f, null);
|
|
17
|
+
l(this, h, null);
|
|
18
|
+
l(this, E);
|
|
19
|
+
l(this, u, !1);
|
|
20
|
+
l(this, w, () => {
|
|
21
21
|
e(this, u) ? this.close() : this.open();
|
|
22
22
|
});
|
|
23
|
-
|
|
24
|
-
e(this, u) && (m(this, o,
|
|
23
|
+
l(this, L, () => {
|
|
24
|
+
e(this, u) && (m(this, o, v).call(this, 0, !0), m(this, o, v).call(this, e(this, o, y)));
|
|
25
25
|
});
|
|
26
|
-
t.firstElementChild instanceof HTMLElement && t.lastElementChild instanceof HTMLElement ? (a(this, d, i), a(this,
|
|
26
|
+
t.firstElementChild instanceof HTMLElement && t.lastElementChild instanceof HTMLElement ? (a(this, d, i), a(this, n, t), a(this, f, t.firstElementChild), a(this, h, t.lastElementChild), e(this, h).style.overflow = "hidden", e(this, d).axisAttribute.current === "y" ? e(this, h).style.height = "0px" : e(this, h).style.width = "0px", addEventListener("resize", e(this, L)), e(this, f).addEventListener("click", e(this, w)), e(this, n).hasAttribute("data-opened") && this.open({ skipTransition: !0 })) : i.removeItem(e(this, n));
|
|
27
27
|
}
|
|
28
28
|
get element() {
|
|
29
|
-
return e(this,
|
|
29
|
+
return e(this, n);
|
|
30
30
|
}
|
|
31
31
|
destroy() {
|
|
32
|
-
e(this, f) && (e(this,
|
|
32
|
+
e(this, f) && (e(this, n).classList.remove("opened", "triggered"), e(this, n).removeAttribute("data-opened"), e(this, f).style.cursor = "", m(this, o, v).call(this, void 0), removeEventListener("resize", e(this, L)), e(this, f).removeEventListener("click", e(this, w)), clearTimeout(e(this, E)));
|
|
33
33
|
}
|
|
34
34
|
open(i) {
|
|
35
|
-
i != null && i.skipTransition && m(this, o, k).call(this), e(this, d).multipleAttribute.current || e(this, d).closeAll({ exclude: e(this,
|
|
36
|
-
e(this,
|
|
37
|
-
|
|
35
|
+
i != null && i.skipTransition && m(this, o, k).call(this), e(this, d).multipleAttribute.current || e(this, d).closeAll({ exclude: e(this, n) }), a(this, u, !0), clearTimeout(e(this, E)), e(this, n).classList.add("triggered"), m(this, o, v).call(this, e(this, o, y)), setTimeout(() => {
|
|
36
|
+
e(this, n).classList.add("opened"), e(this, n).setAttribute("data-opened", ""), a(this, E, setTimeout(() => {
|
|
37
|
+
window.dispatchEvent(new Event("resize"));
|
|
38
|
+
}, H(e(this, h))));
|
|
39
|
+
}, 0), C(this.element, "accordionItemToggle", {
|
|
38
40
|
bubbles: !0,
|
|
39
41
|
composed: !0,
|
|
40
42
|
detail: {
|
|
@@ -43,9 +45,9 @@ class z {
|
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
close(i) {
|
|
46
|
-
i != null && i.skipTransition && m(this, o, k).call(this), a(this, u, !1), e(this,
|
|
47
|
-
e(this,
|
|
48
|
-
},
|
|
48
|
+
i != null && i.skipTransition && m(this, o, k).call(this), clearTimeout(e(this, E)), a(this, u, !1), e(this, n).classList.remove("opened"), m(this, o, v).call(this, 0), a(this, E, setTimeout(() => {
|
|
49
|
+
e(this, n).classList.remove("triggered"), window.dispatchEvent(new Event("resize"));
|
|
50
|
+
}, H(e(this, h)))), C(this.element, "accordionItemToggle", {
|
|
49
51
|
bubbles: !0,
|
|
50
52
|
composed: !0,
|
|
51
53
|
detail: {
|
|
@@ -54,31 +56,29 @@ class z {
|
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
|
-
d = new WeakMap(),
|
|
58
|
-
return e(this,
|
|
59
|
-
}, w = function() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
t && (e(this, l).style.transition = "all 0s", setTimeout(() => {
|
|
63
|
-
e(this, l).style.transition = "";
|
|
59
|
+
d = new WeakMap(), n = new WeakMap(), f = new WeakMap(), h = new WeakMap(), E = new WeakMap(), u = new WeakMap(), o = new WeakSet(), y = function() {
|
|
60
|
+
return e(this, d).axisAttribute.current === "x" ? e(this, h).scrollWidth : e(this, h).scrollHeight;
|
|
61
|
+
}, w = new WeakMap(), L = new WeakMap(), v = function(i, t = !1) {
|
|
62
|
+
t && (e(this, h).style.transition = "all 0s", setTimeout(() => {
|
|
63
|
+
e(this, h).style.transition = "";
|
|
64
64
|
}));
|
|
65
65
|
const r = e(this, d).axisAttribute.current === "x" ? "width" : "height";
|
|
66
|
-
i != null ? e(this,
|
|
66
|
+
i != null ? e(this, h).style[r] = `${i}px` : e(this, h).style[r] = "";
|
|
67
67
|
}, k = function() {
|
|
68
|
-
e(this,
|
|
69
|
-
e(this,
|
|
68
|
+
e(this, h).style.transition = "all 0s", setTimeout(() => {
|
|
69
|
+
e(this, h).style.transition = "";
|
|
70
70
|
}, 50);
|
|
71
71
|
};
|
|
72
|
-
var
|
|
73
|
-
class
|
|
72
|
+
var b, T, c, g, A, I;
|
|
73
|
+
class N extends HTMLElement {
|
|
74
74
|
constructor() {
|
|
75
75
|
super();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
R && a(this,
|
|
76
|
+
l(this, A);
|
|
77
|
+
l(this, b, new z(this, "axis", "y"));
|
|
78
|
+
l(this, T, new z(this, "multiple", !1));
|
|
79
|
+
l(this, c, []);
|
|
80
|
+
l(this, g, null);
|
|
81
|
+
R && a(this, g, new MutationObserver((t) => {
|
|
82
82
|
t.forEach((r) => {
|
|
83
83
|
r.removedNodes.forEach((p) => {
|
|
84
84
|
p instanceof HTMLElement && this.removeItem(p);
|
|
@@ -89,13 +89,13 @@ class O extends HTMLElement {
|
|
|
89
89
|
}));
|
|
90
90
|
}
|
|
91
91
|
get axisAttribute() {
|
|
92
|
-
return e(this,
|
|
92
|
+
return e(this, b);
|
|
93
93
|
}
|
|
94
94
|
get multipleAttribute() {
|
|
95
|
-
return e(this,
|
|
95
|
+
return e(this, T);
|
|
96
96
|
}
|
|
97
97
|
createItem(t) {
|
|
98
|
-
e(this, c).find((r) => r.element === t) || e(this, c).push(new
|
|
98
|
+
e(this, c).find((r) => r.element === t) || e(this, c).push(new S(this, t));
|
|
99
99
|
}
|
|
100
100
|
removeItem(t) {
|
|
101
101
|
a(this, c, e(this, c).filter((r) => {
|
|
@@ -115,21 +115,21 @@ class O extends HTMLElement {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
connectedCallback() {
|
|
118
|
-
e(this,
|
|
118
|
+
e(this, b).observe(), e(this, T).observe(), e(this, g).observe(e(this, A, I), {
|
|
119
119
|
childList: !0
|
|
120
|
-
}), a(this, c, [...e(this,
|
|
120
|
+
}), a(this, c, [...e(this, A, I).children].map((t) => {
|
|
121
121
|
if (t instanceof HTMLElement)
|
|
122
|
-
return new
|
|
122
|
+
return new S(this, t);
|
|
123
123
|
}).filter((t) => !!t));
|
|
124
124
|
}
|
|
125
125
|
disconnectedCallback() {
|
|
126
|
-
e(this,
|
|
126
|
+
e(this, b).unobserve(), e(this, T).unobserve(), e(this, g).disconnect();
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
b = new WeakMap(), T = new WeakMap(), c = new WeakMap(), g = new WeakMap(), A = new WeakSet(), I = function() {
|
|
130
130
|
return this.shadowRoot ? this.shadowRoot : this;
|
|
131
131
|
};
|
|
132
|
-
R && !customElements.get("e-accordion") && customElements.define("e-accordion",
|
|
132
|
+
R && !customElements.get("e-accordion") && customElements.define("e-accordion", N);
|
|
133
133
|
export {
|
|
134
|
-
|
|
134
|
+
N as AccordionElement
|
|
135
135
|
};
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ft=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i),pt=i=>{throw TypeError(i)};var $=(i,t,s)=>t.has(i)||pt("Cannot "+s);var e=(i,t,s)=>($(i,t,"read from private field"),s?s.call(i):t.get(i)),o=(i,t,s)=>t.has(i)?pt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),a=(i,t,s,r)=>($(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),d=(i,t,s)=>($(i,t,"access private method"),s);var M=(i,t,s)=>new Promise((r,u)=>{var m=l=>{try{A(s.next(l))}catch(g){u(g)}},V=l=>{try{A(s.throw(l))}catch(g){u(g)}},A=l=>l.done?r(l.value):Promise.resolve(l.value).then(m,V);A((s=s.apply(i,t)).next())});var Et=(i,t,s)=>(t=i[ft("asyncIterator")])?t.call(i):(i=i[ft("iterator")](),t={},s=(r,u)=>(u=i[r])&&(t[r]=m=>new Promise((V,A,l)=>(m=u.call(i,m),l=m.done,Promise.resolve(m.value).then(g=>V({value:g,done:l}),A)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=require("../index-Cqw2NKev.cjs"),J=require("../events-KVanG9sR.cjs"),Tt=require("../polyfills-Df4r-ETT.cjs"),Ct=require("../scroll-DPDSZypW.cjs"),Q=require("../url-CLvdjbII.cjs"),Ht=require("../css-value-parser/index.cjs");class yt extends HTMLElement{connectedCallback(){const t={"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,r]of Object.entries(t))this.setAttribute(s,r)}}St.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",yt);var R,h,T,O,q;class gt{constructor(t,s){o(this,R);o(this,h);o(this,T);o(this,O,t=>{t.preventDefault();const s=e(this,h).getAttribute("data-history-action")||"push",r=e(this,h).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),m=u?Ht.cssValueParser.parse(u):void 0,V=e(this,h).hasAttribute("data-revalidate");e(this,R).navigate(e(this,T),{historyAction:s,centerScroll:r,offsetScroll:m,revalidate:V})});o(this,q,()=>{e(this,R).prefetch(e(this,T)),e(this,h).removeEventListener("pointerenter",e(this,q))});a(this,R,s),a(this,h,t),a(this,T,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,O));const r=s.normalizePath(e(this,T)),u=s.normalizePath(location.pathname);e(this,h).hasAttribute("data-include")&&u.pathname.includes(r.pathname)?e(this,h).classList.add("current"):r.pathname===u.pathname&&e(this,h).classList.add("current"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,q))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,O)),e(this,h).removeEventListener("pointerenter",e(this,q)),e(this,h).classList.remove("current")}}R=new WeakMap,h=new WeakMap,T=new WeakMap,O=new WeakMap,q=new WeakMap;var C,z,p,H,k,w;class vt{constructor(t,s,r){o(this,C);o(this,z);o(this,p,{x:0,y:0});o(this,H);o(this,k,null);o(this,w,null);a(this,C,t),a(this,z,s),a(this,H,r.cloneNode(!0))}get pathname(){return e(this,z)}get scrollState(){return e(this,p)}get document(){return e(this,w)}cloneDocument(){a(this,w,(e(this,k)||e(this,H)).cloneNode(!0))}get title(){let t="";if(e(this,w).title)t=e(this,w).title;else{const s=e(this,w).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,z)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,k,null)}saveScrollState(){e(this,H).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,C).scrollElement.scrollLeft,e(this,p).y=e(this,C).scrollElement.scrollTop)}saveDocumentState(){e(this,H).documentElement.hasAttribute("data-no-page-restoration")?a(this,k,null):a(this,k,document.cloneNode(!0))}restoreScrollPosition(){e(this,C).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}C=new WeakMap,z=new WeakMap,p=new WeakMap,H=new WeakMap,k=new WeakMap,w=new WeakMap;var b,W,v,U,P,f,j,x,N,F,I,D,c,tt,et,st,Lt,it,nt,rt,X;class kt{constructor(t){o(this,c);o(this,b,null);o(this,W,null);o(this,v,[]);o(this,U,new DOMParser);o(this,P);o(this,f,null);o(this,j);o(this,x,[]);o(this,N,!1);o(this,F,null);o(this,I,new Map);o(this,D,null);o(this,X,t=>M(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(a(this,N,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,N,!1))}));if(St.isBrowser){a(this,b,{base:Q.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,W,d(this,c,st).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,f,s.pathname),e(this,I).set(e(this,f),new vt(this,e(this,f),document)),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,X)),Q.changeHistory({action:"replace",pathname:e(this,f),searchParameters:s.parameters,hash:s.hash}),a(this,D,new yt),d(this,c,rt).call(this)}}get currentPathname(){return e(this,f)}get previousPathname(){return e(this,j)}get links(){return e(this,v)}get scrollElement(){return e(this,F)}normalizePath(t){return Q.splitPath(t,{base:e(this,b).base,trailingSlash:e(this,b).trailingSlash})}prefetch(t){return M(this,null,function*(){const s=this.normalizePath(t);d(this,c,et).call(this,s.pathname)})}navigate(V){return M(this,arguments,function*(t,{historyAction:s="push",centerScroll:r,offsetScroll:u,revalidate:m}={}){if(e(this,x).length)return;const A=this.normalizePath(t);let{pathname:l,hash:g,parameters:wt,leaf:bt}=A;if(!(e(this,P)===l||e(this,f)===l)){a(this,P,l);try{let _=!0;if(this.preprocessor)try{yield new Promise((n,y)=>{var L;(L=this.preprocessor)==null||L.call(this,{pathname:l,resolve:n,reject:y})})}catch(n){n?console.error(n):console.log("Route change canceled"),_=!1}if(!_||e(this,P)!==l)return;const ot=yield d(this,c,tt).call(this,e(this,f)),S=yield d(this,c,tt).call(this,l,m);if(e(this,P)!==l)return;ot.saveScrollState(),ot.saveDocumentState(),e(this,N)||(S.clearScrollState(),S.clearDocumentState()),S.cloneDocument(),e(this,D).textContent=S.title,document.body.appendChild(e(this,D));const at={pathname:l};J.dispatchEvent(document,"morphStart",{detail:at});const lt=Array.from(document.head.children),ct=Array.from(S.document.head.children),ht=d(this,c,Lt).call(this,lt,ct),Pt=d(this,c,it).call(this,lt,ht),K=d(this,c,it).call(this,ct,ht);K.forEach((n,y)=>{if(n.tagName==="SCRIPT"&&n.getAttribute("src")){const L=document.createElement("script");L.type="module",L.src=n.getAttribute("src"),K[y]=L}}),K.forEach(n=>{document.head.appendChild(n)});const Z=K.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(d(this,c,nt).call(this,n))return!0});e(this,b).waitForHeadToLoad&&Z.length&&(yield new Promise(n=>M(this,null,function*(){let y=0;try{for(var L=Et(Z),dt,B,mt;dt=!(B=yield L.next()).done;dt=!1){const Y=B.value;Y.onload=()=>{y++,y===Z.length&&n()}}}catch(B){mt=[B]}finally{try{dt&&(B=L.return)&&(yield B.call(L))}finally{if(mt)throw mt[0]}}})));const ut=[];Pt.forEach(n=>{n.hasAttribute("data-permanent")||(d(this,c,nt).call(this,n)?ut.push(n):n.remove())});const At=d(this,c,st).call(this,S.document.body);if(e(this,W).forEach((n,y)=>{const L=At[y],dt=getComputedStyle(n).getPropertyValue("--morph-duration"),B=[...L.childNodes];if(dt){const mt=[...n.childNodes];mt.forEach(E=>{E instanceof HTMLElement&&E.classList.add("old")}),B.forEach(E=>{E instanceof HTMLElement&&E.classList.add("new")}),n.prepend(...B),Tt.requestIdleCallback(()=>{B.forEach(E=>{E instanceof HTMLElement&&E.classList.add("in")})});const Y={morphElement:n,pathname:l};J.dispatchEvent(document,"morphNewChildrenAdded",{detail:Y});const Mt=new Promise(E=>{setTimeout(()=>{mt.forEach(G=>G.remove()),B.forEach(G=>{G instanceof HTMLElement&&G.classList.remove("in","new")}),J.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Y}),E()},(parseFloat(dt)||0)*1e3+10)});e(this,x).push(Mt)}else n.innerHTML="",n.append(...B)}),d(this,c,rt).call(this),g){S.clearScrollState();const n=document.getElementById(g);n instanceof HTMLElement&&Ct.scrollToElement(n,{scrollElement:e(this,F),behaviour:"instant",center:r,offset:u})}else e(this,N)&&S.restoreScrollPosition();yield Promise.all(e(this,x)),ut.forEach(n=>n.remove()),a(this,j,e(this,f)),a(this,f,l),a(this,x,[]),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",l),document.documentElement.setAttribute("data-current-leaf",bt),e(this,D).remove(),Q.changeHistory({action:s,pathname:l,searchParameters:wt,hash:g}),J.dispatchEvent(document,"morphComplete",{detail:at}),window.dispatchEvent(new Event("resize"))}catch(_){console.error(_)}a(this,P,void 0)}})}addLink(t){e(this,v).push(new gt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,v,e(this,v).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var r;return((r=s.getAttribute("href"))==null?void 0:r.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,v).forEach(s=>s.destroy()),a(this,v,t.map(s=>new gt(s,this)))}}b=new WeakMap,W=new WeakMap,v=new WeakMap,U=new WeakMap,P=new WeakMap,f=new WeakMap,j=new WeakMap,x=new WeakMap,N=new WeakMap,F=new WeakMap,I=new WeakMap,D=new WeakMap,c=new WeakSet,tt=function(t,s=!1){return M(this,null,function*(){let r=e(this,I).get(t);return(!r||s)&&(r=yield d(this,c,et).call(this,t)),r})},et=function(t){return M(this,null,function*(){const r=yield(yield fetch(t)).text(),u=e(this,U).parseFromString(r,"text/html"),m=new vt(this,t,u);return e(this,I).set(t,m),m})},st=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Lt=function(t,s){return t.filter(r=>s.find(u=>u.outerHTML===r.outerHTML))},it=function(t,s){return t.filter(r=>!s.find(u=>u.outerHTML===r.outerHTML))},nt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},rt=function(){a(this,F,document.querySelector(e(this,b).scrollSelector)||document.documentElement)},X=new WeakMap;exports.Morph=kt;
|
|
1
|
+
"use strict";var ft=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i),pt=i=>{throw TypeError(i)};var $=(i,t,s)=>t.has(i)||pt("Cannot "+s);var e=(i,t,s)=>($(i,t,"read from private field"),s?s.call(i):t.get(i)),o=(i,t,s)=>t.has(i)?pt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),a=(i,t,s,r)=>($(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),d=(i,t,s)=>($(i,t,"access private method"),s);var M=(i,t,s)=>new Promise((r,u)=>{var m=l=>{try{A(s.next(l))}catch(g){u(g)}},V=l=>{try{A(s.throw(l))}catch(g){u(g)}},A=l=>l.done?r(l.value):Promise.resolve(l.value).then(m,V);A((s=s.apply(i,t)).next())});var Et=(i,t,s)=>(t=i[ft("asyncIterator")])?t.call(i):(i=i[ft("iterator")](),t={},s=(r,u)=>(u=i[r])&&(t[r]=m=>new Promise((V,A,l)=>(m=u.call(i,m),l=m.done,Promise.resolve(m.value).then(g=>V({value:g,done:l}),A)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=require("../index-Cqw2NKev.cjs"),J=require("../events-KVanG9sR.cjs"),Tt=require("../polyfills-Df4r-ETT.cjs"),Ct=require("../scroll-DPDSZypW.cjs"),Q=require("../url-CLvdjbII.cjs"),Ht=require("../css-value-parser/index.cjs");class yt extends HTMLElement{connectedCallback(){const t={"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,r]of Object.entries(t))this.setAttribute(s,r)}}St.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",yt);var R,h,T,O,q;class gt{constructor(t,s){o(this,R);o(this,h);o(this,T);o(this,O,t=>{t.preventDefault();const s=e(this,h).getAttribute("data-history-action")||"push",r=e(this,h).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),m=u?Ht.cssValueParser.parse(u):void 0,V=e(this,h).hasAttribute("data-revalidate");e(this,R).navigate(e(this,T),{historyAction:s,centerScroll:r,offsetScroll:m,revalidate:V})});o(this,q,()=>{e(this,R).prefetch(e(this,T)),e(this,h).removeEventListener("pointerenter",e(this,q))});a(this,R,s),a(this,h,t),a(this,T,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,O));const r=s.normalizePath(e(this,T)),u=s.normalizePath(location.pathname);e(this,h).hasAttribute("data-include")&&u.pathname.includes(r.pathname)?e(this,h).classList.add("current"):r.pathname===u.pathname&&e(this,h).classList.add("current"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,q))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,O)),e(this,h).removeEventListener("pointerenter",e(this,q)),e(this,h).classList.remove("current")}}R=new WeakMap,h=new WeakMap,T=new WeakMap,O=new WeakMap,q=new WeakMap;var C,z,p,H,k,w;class vt{constructor(t,s,r){o(this,C);o(this,z);o(this,p,{x:0,y:0});o(this,H);o(this,k,null);o(this,w,null);a(this,C,t),a(this,z,s),a(this,H,r.cloneNode(!0))}get pathname(){return e(this,z)}get scrollState(){return e(this,p)}get document(){return e(this,w)}cloneDocument(){a(this,w,(e(this,k)||e(this,H)).cloneNode(!0))}get title(){let t="";if(e(this,w).title)t=e(this,w).title;else{const s=e(this,w).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,z)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,k,null)}saveScrollState(){e(this,H).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,C).scrollElement.scrollLeft,e(this,p).y=e(this,C).scrollElement.scrollTop)}saveDocumentState(){e(this,H).documentElement.hasAttribute("data-no-page-restoration")?a(this,k,null):a(this,k,document.cloneNode(!0))}restoreScrollPosition(){e(this,C).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}C=new WeakMap,z=new WeakMap,p=new WeakMap,H=new WeakMap,k=new WeakMap,w=new WeakMap;var b,W,S,U,P,f,j,x,N,F,I,D,c,tt,et,st,Lt,it,nt,rt,X;class kt{constructor(t){o(this,c);o(this,b,null);o(this,W,null);o(this,S,[]);o(this,U,new DOMParser);o(this,P);o(this,f,null);o(this,j);o(this,x,[]);o(this,N,!1);o(this,F,null);o(this,I,new Map);o(this,D,null);o(this,X,t=>M(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(a(this,N,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,N,!1))}));if(St.isBrowser){a(this,b,{base:Q.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,W,d(this,c,st).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,f,s.pathname),e(this,I).set(e(this,f),new vt(this,e(this,f),document)),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,X)),Q.changeHistory({action:"replace",pathname:e(this,f),searchParameters:s.parameters,hash:s.hash}),a(this,D,new yt),d(this,c,rt).call(this,document)}}get currentPathname(){return e(this,f)}get previousPathname(){return e(this,j)}get links(){return e(this,S)}get scrollElement(){return e(this,F)}normalizePath(t){return Q.splitPath(t,{base:e(this,b).base,trailingSlash:e(this,b).trailingSlash})}prefetch(t){return M(this,null,function*(){const s=this.normalizePath(t);d(this,c,et).call(this,s.pathname)})}navigate(V){return M(this,arguments,function*(t,{historyAction:s="push",centerScroll:r,offsetScroll:u,revalidate:m}={}){if(e(this,x).length)return;const A=this.normalizePath(t);let{pathname:l,hash:g,parameters:wt,leaf:bt}=A;if(!(e(this,P)===l||e(this,f)===l)){a(this,P,l);try{let _=!0;if(this.preprocessor)try{yield new Promise((n,y)=>{var L;(L=this.preprocessor)==null||L.call(this,{pathname:l,resolve:n,reject:y})})}catch(n){n?console.error(n):console.log("Route change canceled"),_=!1}if(!_||e(this,P)!==l)return;const ot=yield d(this,c,tt).call(this,e(this,f)),v=yield d(this,c,tt).call(this,l,m);if(e(this,P)!==l)return;ot.saveScrollState(),ot.saveDocumentState(),e(this,N)||(v.clearScrollState(),v.clearDocumentState()),v.cloneDocument(),e(this,D).textContent=v.title,document.body.appendChild(e(this,D));const at={pathname:l};J.dispatchEvent(document,"morphStart",{detail:at});const lt=Array.from(document.head.children),ct=Array.from(v.document.head.children),ht=d(this,c,Lt).call(this,lt,ct),Pt=d(this,c,it).call(this,lt,ht),K=d(this,c,it).call(this,ct,ht);K.forEach((n,y)=>{if(n.tagName==="SCRIPT"&&n.getAttribute("src")){const L=document.createElement("script");L.type="module",L.src=n.getAttribute("src"),K[y]=L}}),K.forEach(n=>{document.head.appendChild(n)});const Z=K.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(d(this,c,nt).call(this,n))return!0});e(this,b).waitForHeadToLoad&&Z.length&&(yield new Promise(n=>M(this,null,function*(){let y=0;try{for(var L=Et(Z),dt,B,mt;dt=!(B=yield L.next()).done;dt=!1){const Y=B.value;Y.onload=()=>{y++,y===Z.length&&n()}}}catch(B){mt=[B]}finally{try{dt&&(B=L.return)&&(yield B.call(L))}finally{if(mt)throw mt[0]}}})));const ut=[];Pt.forEach(n=>{n.hasAttribute("data-permanent")||(d(this,c,nt).call(this,n)?ut.push(n):n.remove())});const At=d(this,c,st).call(this,v.document.body);if(d(this,c,rt).call(this,v.document),document.documentElement.setAttribute("data-current-pathname",l),document.documentElement.setAttribute("data-current-leaf",bt),Q.changeHistory({action:s,pathname:l,searchParameters:wt,hash:g}),e(this,D).remove(),a(this,j,e(this,f)),a(this,f,l),e(this,W).forEach((n,y)=>{const L=At[y],dt=getComputedStyle(n).getPropertyValue("--morph-duration"),B=[...L.childNodes];if(dt){const mt=[...n.childNodes];mt.forEach(E=>{E instanceof HTMLElement&&E.classList.add("old")}),B.forEach(E=>{E instanceof HTMLElement&&E.classList.add("new")}),n.prepend(...B),Tt.requestIdleCallback(()=>{B.forEach(E=>{E instanceof HTMLElement&&E.classList.add("in")})});const Y={morphElement:n,pathname:l};J.dispatchEvent(document,"morphNewChildrenAdded",{detail:Y});const Mt=new Promise(E=>{setTimeout(()=>{mt.forEach(G=>G.remove()),B.forEach(G=>{G instanceof HTMLElement&&G.classList.remove("in","new")}),J.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Y}),E()},(parseFloat(dt)||0)*1e3+10)});e(this,x).push(Mt)}else n.innerHTML="",n.append(...B)}),g){v.clearScrollState();const n=document.getElementById(g);n instanceof HTMLElement&&Ct.scrollToElement(n,{scrollElement:e(this,F),behaviour:"instant",center:r,offset:u})}else e(this,N)&&v.restoreScrollPosition();yield Promise.all(e(this,x)),ut.forEach(n=>n.remove()),a(this,x,[]),this.findLinks(),J.dispatchEvent(document,"morphComplete",{detail:at}),window.dispatchEvent(new Event("resize"))}catch(_){console.error(_)}a(this,P,void 0)}})}addLink(t){e(this,S).push(new gt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,S,e(this,S).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var r;return((r=s.getAttribute("href"))==null?void 0:r.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,S).forEach(s=>s.destroy()),a(this,S,t.map(s=>new gt(s,this)))}}b=new WeakMap,W=new WeakMap,S=new WeakMap,U=new WeakMap,P=new WeakMap,f=new WeakMap,j=new WeakMap,x=new WeakMap,N=new WeakMap,F=new WeakMap,I=new WeakMap,D=new WeakMap,c=new WeakSet,tt=function(t,s=!1){return M(this,null,function*(){let r=e(this,I).get(t);return(!r||s)&&(r=yield d(this,c,et).call(this,t)),r})},et=function(t){return M(this,null,function*(){const r=yield(yield fetch(t)).text(),u=e(this,U).parseFromString(r,"text/html"),m=new vt(this,t,u);return e(this,I).set(t,m),m})},st=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Lt=function(t,s){return t.filter(r=>s.find(u=>u.outerHTML===r.outerHTML))},it=function(t,s){return t.filter(r=>!s.find(u=>u.outerHTML===r.outerHTML))},nt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},rt=function(t){a(this,F,t.querySelector(e(this,b).scrollSelector)||t.documentElement)},X=new WeakMap;exports.Morph=kt;
|
package/lib/morph/index.js
CHANGED
|
@@ -128,13 +128,13 @@ class Lt {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
C = new WeakMap(), q = new WeakMap(), p = new WeakMap(), H = new WeakMap(), k = new WeakMap(), y = new WeakMap();
|
|
131
|
-
var b, W,
|
|
131
|
+
var b, W, S, U, P, f, j, x, N, F, I, D, h, $, tt, et, wt, st, it, nt, X;
|
|
132
132
|
class Vt {
|
|
133
133
|
constructor(t) {
|
|
134
134
|
r(this, h);
|
|
135
135
|
r(this, b, null);
|
|
136
136
|
r(this, W, null);
|
|
137
|
-
r(this,
|
|
137
|
+
r(this, S, []);
|
|
138
138
|
r(this, U, new DOMParser());
|
|
139
139
|
r(this, P);
|
|
140
140
|
r(this, f, null);
|
|
@@ -173,7 +173,7 @@ class Vt {
|
|
|
173
173
|
pathname: e(this, f),
|
|
174
174
|
searchParameters: s.parameters,
|
|
175
175
|
hash: s.hash
|
|
176
|
-
}), a(this, D, new vt()), d(this, h, nt).call(this);
|
|
176
|
+
}), a(this, D, new vt()), d(this, h, nt).call(this, document);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
get currentPathname() {
|
|
@@ -183,7 +183,7 @@ class Vt {
|
|
|
183
183
|
return e(this, j);
|
|
184
184
|
}
|
|
185
185
|
get links() {
|
|
186
|
-
return e(this,
|
|
186
|
+
return e(this, S);
|
|
187
187
|
}
|
|
188
188
|
get scrollElement() {
|
|
189
189
|
return e(this, F);
|
|
@@ -230,17 +230,17 @@ class Vt {
|
|
|
230
230
|
}
|
|
231
231
|
if (!K || e(this, P) !== l)
|
|
232
232
|
return;
|
|
233
|
-
const ot = yield d(this, h, $).call(this, e(this, f)),
|
|
233
|
+
const ot = yield d(this, h, $).call(this, e(this, f)), L = yield d(this, h, $).call(this, l, m);
|
|
234
234
|
if (e(this, P) !== l)
|
|
235
235
|
return;
|
|
236
|
-
ot.saveScrollState(), ot.saveDocumentState(), e(this, N) || (
|
|
236
|
+
ot.saveScrollState(), ot.saveDocumentState(), e(this, N) || (L.clearScrollState(), L.clearDocumentState()), L.cloneDocument(), e(this, D).textContent = L.title, document.body.appendChild(e(this, D));
|
|
237
237
|
const rt = {
|
|
238
238
|
pathname: l
|
|
239
239
|
};
|
|
240
240
|
Q(document, "morphStart", {
|
|
241
241
|
detail: rt
|
|
242
242
|
});
|
|
243
|
-
const at = Array.from(document.head.children), lt = Array.from(
|
|
243
|
+
const at = Array.from(document.head.children), lt = Array.from(L.document.head.children), ht = d(this, h, wt).call(this, at, lt), Pt = d(this, h, st).call(this, at, ht), Y = d(this, h, st).call(this, lt, ht);
|
|
244
244
|
Y.forEach((n, v) => {
|
|
245
245
|
if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
|
|
246
246
|
const w = document.createElement("script");
|
|
@@ -279,8 +279,13 @@ class Vt {
|
|
|
279
279
|
Pt.forEach((n) => {
|
|
280
280
|
n.hasAttribute("data-permanent") || (d(this, h, it).call(this, n) ? ct.push(n) : n.remove());
|
|
281
281
|
});
|
|
282
|
-
const At = d(this, h, et).call(this,
|
|
283
|
-
if (
|
|
282
|
+
const At = d(this, h, et).call(this, L.document.body);
|
|
283
|
+
if (d(this, h, nt).call(this, L.document), document.documentElement.setAttribute("data-current-pathname", l), document.documentElement.setAttribute("data-current-leaf", bt), Et({
|
|
284
|
+
action: s,
|
|
285
|
+
pathname: l,
|
|
286
|
+
searchParameters: yt,
|
|
287
|
+
hash: g
|
|
288
|
+
}), e(this, D).remove(), a(this, j, e(this, f)), a(this, f, l), e(this, W).forEach((n, v) => {
|
|
284
289
|
const w = At[v], ut = getComputedStyle(n).getPropertyValue("--morph-duration"), B = [...w.childNodes];
|
|
285
290
|
if (ut) {
|
|
286
291
|
const dt = [...n.childNodes];
|
|
@@ -312,8 +317,8 @@ class Vt {
|
|
|
312
317
|
e(this, x).push(Mt);
|
|
313
318
|
} else
|
|
314
319
|
n.innerHTML = "", n.append(...B);
|
|
315
|
-
}),
|
|
316
|
-
|
|
320
|
+
}), g) {
|
|
321
|
+
L.clearScrollState();
|
|
317
322
|
const n = document.getElementById(g);
|
|
318
323
|
n instanceof HTMLElement && Ct(n, {
|
|
319
324
|
scrollElement: e(this, F),
|
|
@@ -321,13 +326,8 @@ class Vt {
|
|
|
321
326
|
center: o,
|
|
322
327
|
offset: u
|
|
323
328
|
});
|
|
324
|
-
} else e(this, N) &&
|
|
325
|
-
yield Promise.all(e(this, x)), ct.forEach((n) => n.remove()), a(this,
|
|
326
|
-
action: s,
|
|
327
|
-
pathname: l,
|
|
328
|
-
searchParameters: yt,
|
|
329
|
-
hash: g
|
|
330
|
-
}), Q(document, "morphComplete", {
|
|
329
|
+
} else e(this, N) && L.restoreScrollPosition();
|
|
330
|
+
yield Promise.all(e(this, x)), ct.forEach((n) => n.remove()), a(this, x, []), this.findLinks(), Q(document, "morphComplete", {
|
|
331
331
|
detail: rt
|
|
332
332
|
}), window.dispatchEvent(new Event("resize"));
|
|
333
333
|
} catch (K) {
|
|
@@ -338,7 +338,7 @@ class Vt {
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
addLink(t) {
|
|
341
|
-
e(this,
|
|
341
|
+
e(this, S).push(new gt(t, this));
|
|
342
342
|
}
|
|
343
343
|
addLinks(t) {
|
|
344
344
|
t.forEach((s) => {
|
|
@@ -346,7 +346,7 @@ class Vt {
|
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
removeLink(t) {
|
|
349
|
-
a(this,
|
|
349
|
+
a(this, S, e(this, S).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
350
350
|
}
|
|
351
351
|
findLinks() {
|
|
352
352
|
const t = [
|
|
@@ -357,10 +357,10 @@ class Vt {
|
|
|
357
357
|
return ((o = s.getAttribute("href")) == null ? void 0 : o.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
|
|
358
358
|
}
|
|
359
359
|
);
|
|
360
|
-
e(this,
|
|
360
|
+
e(this, S).forEach((s) => s.destroy()), a(this, S, t.map((s) => new gt(s, this)));
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
b = new WeakMap(), W = new WeakMap(),
|
|
363
|
+
b = new WeakMap(), W = new WeakMap(), S = new WeakMap(), U = new WeakMap(), P = new WeakMap(), f = new WeakMap(), j = new WeakMap(), x = new WeakMap(), N = new WeakMap(), F = new WeakMap(), I = new WeakMap(), D = new WeakMap(), h = new WeakSet(), $ = function(t, s = !1) {
|
|
364
364
|
return M(this, null, function* () {
|
|
365
365
|
let o = e(this, I).get(t);
|
|
366
366
|
return (!o || s) && (o = yield d(this, h, tt).call(this, t)), o;
|
|
@@ -387,8 +387,8 @@ b = new WeakMap(), W = new WeakMap(), L = new WeakMap(), U = new WeakMap(), P =
|
|
|
387
387
|
);
|
|
388
388
|
}, it = function(t) {
|
|
389
389
|
return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
|
|
390
|
-
}, nt = function() {
|
|
391
|
-
a(this, F,
|
|
390
|
+
}, nt = function(t) {
|
|
391
|
+
a(this, F, t.querySelector(e(this, b).scrollSelector) || t.documentElement);
|
|
392
392
|
}, X = new WeakMap();
|
|
393
393
|
export {
|
|
394
394
|
Vt as Morph
|