aptechka 0.43.4 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +43 -43
- package/lib/morph/Morph.d.ts +11 -2
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +252 -200
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +1 -1
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +4 -3
- package/lib/url-Bn9ZrvT3.cjs +1 -0
- package/lib/url-D0bFvcuq.js +49 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/url.d.ts +10 -1
- package/package.json +1 -1
- package/lib/url-CHQeS8b5.cjs +0 -1
- package/lib/url-DqQuzXwT.js +0 -37
package/lib/accordion/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var M=s=>{throw TypeError(s)};var
|
|
1
|
+
"use strict";var M=s=>{throw TypeError(s)};var x=(s,i,t)=>i.has(s)||M("Cannot "+t);var e=(s,i,t)=>(x(s,i,"read from private field"),t?t.call(s):i.get(s)),n=(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),c=(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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../attribute/index.cjs"),q=require("../browser-CpzFX2xg.cjs"),H=require("../events-KVanG9sR.cjs"),R=require("../style-At6aDoqG.cjs");var d,h,f,l,E,u,o,N,w,y,L,b,k;class S{constructor(i,t){n(this,o);n(this,d,null);n(this,h,null);n(this,f,null);n(this,l,null);n(this,E);n(this,u,!1);n(this,y,()=>{e(this,u)?this.close():this.open()});n(this,L,()=>{e(this,u)&&(m(this,o,b).call(this,0,!0),m(this,o,b).call(this,e(this,o,w)))});t.firstElementChild instanceof HTMLElement&&t.lastElementChild instanceof HTMLElement?(c(this,d,i),c(this,h,t),c(this,f,t.firstElementChild),c(this,l,t.lastElementChild),e(this,l).style.overflow="hidden",e(this,d).axisAttribute.current==="y"?e(this,l).style.height="0px":e(this,l).style.width="0px",addEventListener("resize",e(this,L)),e(this,f).addEventListener("click",e(this,y)),e(this,h).hasAttribute("data-opened")&&this.open({skipTransition:!0})):i.removeItem(e(this,h))}get element(){return e(this,h)}destroy(){e(this,f)&&(e(this,h).classList.remove("opened","triggered"),e(this,h).removeAttribute("data-opened"),e(this,f).style.cursor="",m(this,o,b).call(this,void 0),removeEventListener("resize",e(this,L)),e(this,f).removeEventListener("click",e(this,y)),clearTimeout(e(this,E)))}open(i){i!=null&&i.skipTransition&&m(this,o,k).call(this),e(this,d).multipleAttribute.current||e(this,d).closeAll({exclude:e(this,h)}),c(this,u,!0),clearTimeout(e(this,E)),e(this,h).classList.add("triggered"),m(this,o,b).call(this,e(this,o,w)),setTimeout(()=>{e(this,h).classList.add("opened"),e(this,h).setAttribute("data-opened","")},0),H.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u)}})}close(i){i!=null&&i.skipTransition&&m(this,o,k).call(this),c(this,u,!1),e(this,h).classList.remove("opened"),m(this,o,b).call(this,0),c(this,E,setTimeout(()=>{e(this,h).classList.remove("triggered")},R.getElementTransitionDurationMS(e(this,l)))),H.dispatchEvent(this.element,"accordionItemToggle",{bubbles:!0,composed:!0,detail:{opened:e(this,u)}})}}d=new WeakMap,h=new WeakMap,f=new WeakMap,l=new WeakMap,E=new WeakMap,u=new WeakMap,o=new WeakSet,N=function(){return e(this,h).parentElement||e(this,h).getRootNode()},w=function(){return e(this,d).axisAttribute.current==="x"?e(this,l).scrollWidth:e(this,l).scrollHeight},y=new WeakMap,L=new WeakMap,b=function(i,t=!1){t&&(e(this,l).style.transition="all 0s",setTimeout(()=>{e(this,l).style.transition=""}));const r=e(this,d).axisAttribute.current==="x"?"width":"height";i!=null?e(this,l).style[r]=`${i}px`:e(this,l).style[r]=""},k=function(){e(this,l).style.transition="all 0s",setTimeout(()=>{e(this,l).style.transition=""},50)};var v,g,a,T,p,I;class z extends HTMLElement{constructor(){super();n(this,p);n(this,v,new C.Attribute(this,"axis","y"));n(this,g,new C.Attribute(this,"multiple",!1));n(this,a,[]);n(this,T,null);q.isBrowser&&c(this,T,new MutationObserver(t=>{t.forEach(r=>{r.removedNodes.forEach(A=>{A instanceof HTMLElement&&this.removeItem(A)}),r.addedNodes.forEach(A=>{A instanceof HTMLElement&&this.createItem(A)})})}))}get axisAttribute(){return e(this,v)}get multipleAttribute(){return e(this,g)}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,g).observe(),e(this,T).observe(e(this,p,I),{childList:!0}),c(this,a,[...e(this,p,I).children].map(t=>{if(t instanceof HTMLElement)return new S(this,t)}).filter(t=>!!t))}disconnectedCallback(){e(this,v).unobserve(),e(this,g).unobserve(),e(this,T).disconnect()}}v=new WeakMap,g=new WeakMap,a=new WeakMap,T=new WeakMap,p=new WeakSet,I=function(){return this.shadowRoot?this.shadowRoot:this};customElements.get("e-accordion")||customElements.define("e-accordion",z);exports.AccordionElement=z;
|
package/lib/accordion/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
var M = (s) => {
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (s, i, t) => (
|
|
4
|
+
var y = (s, i, t) => i.has(s) || M("Cannot " + t);
|
|
5
|
+
var e = (s, i, t) => (y(s, i, "read from private field"), t ? t.call(s) : i.get(s)), n = (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) => (y(s, i, "write to private field"), r ? r.call(s, t) : i.set(s, t), t), m = (s, i, t) => (y(s, i, "access private method"), t);
|
|
6
6
|
import { Attribute as C } from "../attribute/index.js";
|
|
7
7
|
import { i as R } from "../browser-0zX67oeU.js";
|
|
8
8
|
import { d as H } from "../events-CsVF98U6.js";
|
|
9
9
|
import { g as S } from "../style-j2TwriJ_.js";
|
|
10
|
-
var d,
|
|
10
|
+
var d, h, f, l, E, u, o, N, w, L, A, b, k;
|
|
11
11
|
class z {
|
|
12
12
|
constructor(i, t) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
n(this, o);
|
|
14
|
+
n(this, d, null);
|
|
15
|
+
n(this, h, null);
|
|
16
|
+
n(this, f, null);
|
|
17
|
+
n(this, l, null);
|
|
18
|
+
n(this, E);
|
|
19
|
+
n(this, u, !1);
|
|
20
|
+
n(this, L, () => {
|
|
21
21
|
e(this, u) ? this.close() : this.open();
|
|
22
22
|
});
|
|
23
|
-
|
|
24
|
-
e(this, u) && (m(this, o,
|
|
23
|
+
n(this, A, () => {
|
|
24
|
+
e(this, u) && (m(this, o, b).call(this, 0, !0), m(this, o, b).call(this, e(this, o, w)));
|
|
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, h, t), a(this, f, t.firstElementChild), a(this, l, t.lastElementChild), e(this, l).style.overflow = "hidden", e(this, d).axisAttribute.current === "y" ? e(this, l).style.height = "0px" : e(this, l).style.width = "0px", addEventListener("resize", e(this, A)), e(this, f).addEventListener("click", e(this, L)), e(this, h).hasAttribute("data-opened") && this.open({ skipTransition: !0 })) : i.removeItem(e(this, h));
|
|
27
27
|
}
|
|
28
28
|
get element() {
|
|
29
|
-
return e(this,
|
|
29
|
+
return e(this, h);
|
|
30
30
|
}
|
|
31
31
|
destroy() {
|
|
32
|
-
e(this, f) && (e(this,
|
|
32
|
+
e(this, f) && (e(this, h).classList.remove("opened", "triggered"), e(this, h).removeAttribute("data-opened"), e(this, f).style.cursor = "", m(this, o, b).call(this, void 0), removeEventListener("resize", e(this, A)), e(this, f).removeEventListener("click", e(this, L)), 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,
|
|
35
|
+
i != null && i.skipTransition && m(this, o, k).call(this), e(this, d).multipleAttribute.current || e(this, d).closeAll({ exclude: e(this, h) }), a(this, u, !0), clearTimeout(e(this, E)), e(this, h).classList.add("triggered"), m(this, o, b).call(this, e(this, o, w)), setTimeout(() => {
|
|
36
|
+
e(this, h).classList.add("opened"), e(this, h).setAttribute("data-opened", "");
|
|
37
37
|
}, 0), H(this.element, "accordionItemToggle", {
|
|
38
38
|
bubbles: !0,
|
|
39
39
|
composed: !0,
|
|
@@ -43,9 +43,9 @@ class z {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
close(i) {
|
|
46
|
-
i != null && i.skipTransition && m(this, o, k).call(this), a(this, u, !1), e(this,
|
|
47
|
-
e(this,
|
|
48
|
-
}, S(e(this,
|
|
46
|
+
i != null && i.skipTransition && m(this, o, k).call(this), a(this, u, !1), e(this, h).classList.remove("opened"), m(this, o, b).call(this, 0), a(this, E, setTimeout(() => {
|
|
47
|
+
e(this, h).classList.remove("triggered");
|
|
48
|
+
}, S(e(this, l)))), H(this.element, "accordionItemToggle", {
|
|
49
49
|
bubbles: !0,
|
|
50
50
|
composed: !0,
|
|
51
51
|
detail: {
|
|
@@ -54,36 +54,36 @@ class z {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
d = new WeakMap(),
|
|
58
|
-
return e(this,
|
|
57
|
+
d = new WeakMap(), h = new WeakMap(), f = new WeakMap(), l = new WeakMap(), E = new WeakMap(), u = new WeakMap(), o = new WeakSet(), N = function() {
|
|
58
|
+
return e(this, h).parentElement || e(this, h).getRootNode();
|
|
59
59
|
}, w = function() {
|
|
60
|
-
return e(this, d).axisAttribute.current === "x" ? e(this,
|
|
61
|
-
},
|
|
62
|
-
t && (e(this,
|
|
63
|
-
e(this,
|
|
60
|
+
return e(this, d).axisAttribute.current === "x" ? e(this, l).scrollWidth : e(this, l).scrollHeight;
|
|
61
|
+
}, L = new WeakMap(), A = new WeakMap(), b = function(i, t = !1) {
|
|
62
|
+
t && (e(this, l).style.transition = "all 0s", setTimeout(() => {
|
|
63
|
+
e(this, l).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, l).style[r] = `${i}px` : e(this, l).style[r] = "";
|
|
67
67
|
}, k = function() {
|
|
68
|
-
e(this,
|
|
69
|
-
e(this,
|
|
68
|
+
e(this, l).style.transition = "all 0s", setTimeout(() => {
|
|
69
|
+
e(this, l).style.transition = "";
|
|
70
70
|
}, 50);
|
|
71
71
|
};
|
|
72
|
-
var v, g, c, T,
|
|
72
|
+
var v, g, c, T, x, I;
|
|
73
73
|
class O extends HTMLElement {
|
|
74
74
|
constructor() {
|
|
75
75
|
super();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
n(this, x);
|
|
77
|
+
n(this, v, new C(this, "axis", "y"));
|
|
78
|
+
n(this, g, new C(this, "multiple", !1));
|
|
79
|
+
n(this, c, []);
|
|
80
|
+
n(this, T, null);
|
|
81
81
|
R && a(this, T, new MutationObserver((t) => {
|
|
82
82
|
t.forEach((r) => {
|
|
83
|
-
r.removedNodes.forEach((
|
|
84
|
-
|
|
85
|
-
}), r.addedNodes.forEach((
|
|
86
|
-
|
|
83
|
+
r.removedNodes.forEach((p) => {
|
|
84
|
+
p instanceof HTMLElement && this.removeItem(p);
|
|
85
|
+
}), r.addedNodes.forEach((p) => {
|
|
86
|
+
p instanceof HTMLElement && this.createItem(p);
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
}));
|
|
@@ -115,9 +115,9 @@ class O extends HTMLElement {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
connectedCallback() {
|
|
118
|
-
e(this, v).observe(), e(this, g).observe(), e(this, T).observe(e(this,
|
|
118
|
+
e(this, v).observe(), e(this, g).observe(), e(this, T).observe(e(this, x, I), {
|
|
119
119
|
childList: !0
|
|
120
|
-
}), a(this, c, [...e(this,
|
|
120
|
+
}), a(this, c, [...e(this, x, I).children].map((t) => {
|
|
121
121
|
if (t instanceof HTMLElement)
|
|
122
122
|
return new z(this, t);
|
|
123
123
|
}).filter((t) => !!t));
|
|
@@ -126,7 +126,7 @@ class O extends HTMLElement {
|
|
|
126
126
|
e(this, v).unobserve(), e(this, g).unobserve(), e(this, T).disconnect();
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
v = new WeakMap(), g = new WeakMap(), c = new WeakMap(), T = new WeakMap(),
|
|
129
|
+
v = new WeakMap(), g = new WeakMap(), c = new WeakMap(), T = new WeakMap(), x = new WeakSet(), I = function() {
|
|
130
130
|
return this.shadowRoot ? this.shadowRoot : this;
|
|
131
131
|
};
|
|
132
132
|
customElements.get("e-accordion") || customElements.define("e-accordion", O);
|
package/lib/morph/Morph.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface MorphTransitionEntry extends MorphNavigationEntry {
|
|
|
15
15
|
newDocument: Document;
|
|
16
16
|
}
|
|
17
17
|
export interface MorphChildrenActionEntry {
|
|
18
|
-
|
|
18
|
+
morphElement: HTMLElement;
|
|
19
19
|
pathname: string;
|
|
20
20
|
isCached: boolean;
|
|
21
21
|
state?: any;
|
|
@@ -27,9 +27,18 @@ export interface MorphPreprocessorEntry extends MorphNavigationEntry {
|
|
|
27
27
|
export type MorphPreprocessor = (entry: MorphPreprocessorEntry) => void;
|
|
28
28
|
export type MorphNavigationCallback = (entry: MorphNavigationEntry) => void;
|
|
29
29
|
export type MorphPostprocessor = MorphNavigationCallback;
|
|
30
|
+
export interface MorphScrollState {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
selector: string;
|
|
34
|
+
}
|
|
30
35
|
export interface MorphNavigateOptions {
|
|
31
36
|
historyAction?: ChangeHistoryAction;
|
|
32
37
|
state?: any;
|
|
38
|
+
saveScrollState?: MorphScrollState;
|
|
39
|
+
saveDocumentState?: boolean;
|
|
40
|
+
restoreScrollState?: boolean;
|
|
41
|
+
restoreDocumentState?: boolean;
|
|
33
42
|
}
|
|
34
43
|
export interface MorphEvents {
|
|
35
44
|
morphStart: CustomEvent<MorphTransitionEntry>;
|
|
@@ -53,7 +62,7 @@ export declare class Morph {
|
|
|
53
62
|
hash: string;
|
|
54
63
|
};
|
|
55
64
|
prefetch(path: string): Promise<Document>;
|
|
56
|
-
navigate(path: string, { historyAction, state }?: MorphNavigateOptions): Promise<void>;
|
|
65
|
+
navigate(path: string, { historyAction, state, saveScrollState, saveDocumentState, restoreDocumentState, restoreScrollState, }?: MorphNavigateOptions): Promise<void>;
|
|
57
66
|
addLink(element: HTMLAnchorElement): void;
|
|
58
67
|
addLinks(elements: Array<HTMLAnchorElement>): void;
|
|
59
68
|
removeLink(element: HTMLAnchorElement): void;
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),ut=r=>{throw TypeError(r)};var $=(r,t,s)=>t.has(r)||ut("Cannot "+s);var e=(r,t,s)=>($(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>t.has(r)?ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),c=(r,t,s,n)=>($(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s),y=(r,t,s)=>($(r,t,"access private method"),s);var D=(r,t,s)=>new Promise((n,l)=>{var d=m=>{try{E(s.next(m))}catch(P){l(P)}},o=m=>{try{E(s.throw(m))}catch(P){l(P)}},E=m=>m.done?n(m.value):Promise.resolve(m.value).then(d,o);E((s=s.apply(r,t)).next())});var mt=(r,t,s)=>(t=r[dt("asyncIterator")])?t.call(r):(r=r[dt("iterator")](),t={},s=(n,l)=>(l=r[n])&&(t[n]=d=>new Promise((o,E,m)=>(d=l.call(r,d),m=d.done,Promise.resolve(d.value).then(P=>o({value:P,done:m}),E)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const yt=require("../browser-CpzFX2xg.cjs"),J=require("../events-KVanG9sR.cjs"),Q=require("../url-CHQeS8b5.cjs"),ft=require("../loading/index.cjs");class gt extends HTMLElement{constructor(){super()}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,n]of Object.entries(t))this.setAttribute(s,n)}}customElements.get("morph-announcer")||customElements.define("morph-announcer",gt);var T,h,g,q,R,k,O,H;class pt{constructor(t,s){a(this,T);a(this,h);a(this,g);a(this,q);a(this,R);a(this,k);a(this,O,t=>{t.preventDefault(),e(this,T).links.forEach(s=>{var n;e(this,g)===e(s,g)||(n=e(s,k))!=null&&n.includes(e(this,g))?e(s,h).classList.add("clicked"):e(s,h).classList.remove("clicked")}),e(this,T).navigate(e(this,g),{historyAction:e(this,q),state:e(this,R)})});a(this,H,()=>{e(this,T).prefetch(e(this,g)),e(this,h).removeEventListener("pointerenter",e(this,H))});var d,o;c(this,T,s),c(this,h,t),c(this,g,e(this,h).getAttribute("href")||"/"),c(this,q,e(this,h).getAttribute("data-history-action")||"push"),c(this,R,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,O));const n=s.normalizePath(e(this,g)),l=s.normalizePath(location.pathname);c(this,k,(d=e(this,h).getAttribute("data-match-paths"))==null?void 0:d.split(",").map(E=>s.normalizePath(E.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(n.pathname)&&e(this,h).classList.add("current"):n.pathname===l.pathname||(o=e(this,k))!=null&&o.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,H))}get element(){return e(this,h)}destroy(){e(this,h).removeEventListener("click",e(this,O)),e(this,h).removeEventListener("pointerenter",e(this,H)),e(this,h).classList.remove("current")}}T=new WeakMap,h=new WeakMap,g=new WeakMap,q=new WeakMap,R=new WeakMap,k=new WeakMap,O=new WeakMap,H=new WeakMap;var _,F,I,j,N,v,U,M,b,L,B,W,C,A,u,tt,et,Lt,st,X;class bt{constructor(t){a(this,u);a(this,_,null);a(this,F,null);a(this,I,null);a(this,j,!1);a(this,N,null);a(this,v,[]);a(this,U,new DOMParser);a(this,M,new Map);a(this,b);a(this,L,null);a(this,B);a(this,W);a(this,C,[]);a(this,A,null);a(this,X,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(yt.isBrowser){c(this,_,Q.normalizeBase(t==null?void 0:t.base)),c(this,F,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,I,(t==null?void 0:t.cachePages)!==!1),c(this,j,(t==null?void 0:t.trailingSlash)||!1),c(this,N,y(this,u,et).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);c(this,L,s.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,L)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,X)),Q.changeHistory("replace",e(this,L),s.parameters,s.hash),e(this,N).map(n=>[...n.children]).flat().forEach(n=>{n instanceof HTMLElement&&n.classList.add("current")}),c(this,A,new gt)}}get currentPathname(){return e(this,L)}get previousPathname(){return e(this,B)}get currentState(){return e(this,W)}get links(){return e(this,v)}normalizePath(t){return Q.splitPath(t,e(this,_),e(this,j))}prefetch(t){return D(this,null,function*(){const s=this.normalizePath(t);return y(this,u,tt).call(this,s.pathname)})}navigate(l){return D(this,arguments,function*(t,{historyAction:s="push",state:n}={}){var it;if(e(this,C).length)return;const d=this.normalizePath(t);let{pathname:o,hash:E,parameters:m,leaf:P}=d;if(e(this,b)===o||e(this,L)===o)return;c(this,W,n),c(this,b,o);const Y=e(this,M).has(o);try{ft.loading.add("__morph");let K=!0;if(this.preprocessor)try{yield new Promise((i,f)=>{var w;(w=this.preprocessor)==null||w.call(this,{pathname:o,resolve:i,reject:f,isCached:Y,state:n})})}catch(i){i?console.error(i):console.log("Route change canceled"),K=!1}if(!K||e(this,b)!==o)return;const S=(e(this,M).get(o)||(yield y(this,u,tt).call(this,o))).cloneNode(!0);if(e(this,b)!==o)return;if(S.title)e(this,A).textContent=S.title;else{const i=S.querySelector("h1"),f=(i==null?void 0:i.innerText)||(i==null?void 0:i.textContent)||o;e(this,A).textContent=f}document.body.appendChild(e(this,A));const nt={pathname:o,isCached:Y,state:n,newDocument:S};J.dispatchEvent(document,"morphStart",{detail:nt});const rt=Array.from(document.head.children),at=Array.from(S.head.children),ot=y(this,u,Lt).call(this,rt,at),Et=y(this,u,st).call(this,rt,ot),V=y(this,u,st).call(this,at,ot);V.forEach((i,f)=>{if(i.tagName==="SCRIPT"&&i.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=i.getAttribute("src"),V[f]=w}}),V.forEach(i=>{document.head.appendChild(i)});const Z=V.filter(i=>!i.hasAttribute("data-no-waiting")&&(i.tagName==="STYLE"||i.tagName==="SCRIPT"||i.tagName==="LINK")&&i.getAttribute("rel")!=="canonical");e(this,F)&&Z.length&&(yield new Promise(i=>D(this,null,function*(){let f=0;try{for(var w=mt(Z),ct,x,lt;ct=!(x=yield w.next()).done;ct=!1){const G=x.value;G.onload=()=>{f++,f===Z.length&&i()}}}catch(x){lt=[x]}finally{try{ct&&(x=w.return)&&(yield x.call(w))}finally{if(lt)throw lt[0]}}})));const ht=[];Et.forEach(i=>{i.hasAttribute("data-permanent")||(i.tagName==="SCRIPT"||i.tagName==="STYLE"||i.getAttribute("rel")==="stylesheet"?ht.push(i):i.remove())}),c(this,B,e(this,L)),c(this,L,o),Q.changeHistory(s,o,m,E);const vt=y(this,u,et).call(this,S.body);e(this,N).forEach((i,f)=>{const w=vt[f++],ct=getComputedStyle(i).getPropertyValue("--morph-duration"),x=[...w.childNodes];if(ct){const lt=[...i.childNodes];lt.forEach(p=>{p instanceof HTMLElement&&p.classList.add("old")}),x.forEach(p=>{p instanceof HTMLElement&&p.classList.add("new")}),i.append(...x),setTimeout(()=>{x.forEach(p=>{p instanceof HTMLElement&&p.classList.add("in")})},10);const G={element:i,pathname:o,isCached:Y,state:n};J.dispatchEvent(document,"morphNewChildrenAdded",{detail:G});const wt=new Promise(p=>{setTimeout(()=>{lt.forEach(z=>z.remove()),x.forEach(z=>{z instanceof HTMLElement&&(z.classList.remove("new","in"),z.classList.add("current"))}),J.dispatchEvent(document,"morphOldChildrenRemoved",{detail:G}),p()},(parseFloat(ct)||0)*1e3+10)});e(this,C).push(wt)}else i.innerHTML="",i.append(...x)}),yield Promise.all(e(this,C)),ht.forEach(i=>i.remove()),c(this,C,[]),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",o),document.documentElement.setAttribute("data-current-leaf",P),e(this,A).remove(),(it=this.postprocessor)==null||it.call(this,{pathname:o,isCached:Y,state:n}),J.dispatchEvent(document,"morphComplete",{detail:nt}),ft.loading.complete("__morph")}catch(K){console.error(K)}c(this,b,void 0)})}addLink(t){e(this,v).push(new pt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){c(this,v,e(this,v).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var n;return((n=s.getAttribute("href"))==null?void 0:n.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,v).forEach(s=>s.destroy()),c(this,v,t.map(s=>new pt(s,this)))}}_=new WeakMap,F=new WeakMap,I=new WeakMap,j=new WeakMap,N=new WeakMap,v=new WeakMap,U=new WeakMap,M=new WeakMap,b=new WeakMap,L=new WeakMap,B=new WeakMap,W=new WeakMap,C=new WeakMap,A=new WeakMap,u=new WeakSet,tt=function(t){return D(this,null,function*(){const s=e(this,M).get(t);if(s)return s;const l=yield(yield fetch(t)).text(),d=e(this,U).parseFromString(l,"text/html");return e(this,I)&&e(this,M).set(t,d),d})},et=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Lt=function(t,s){return t.filter(n=>s.find(l=>l.outerHTML===n.outerHTML))},st=function(t,s){return t.filter(n=>!s.find(l=>l.outerHTML===n.outerHTML))},X=new WeakMap;exports.Morph=bt;
|
|
1
|
+
"use strict";var Et=(r,e)=>(e=Symbol[r])?e:Symbol.for("Symbol."+r),St=r=>{throw TypeError(r)};var ot=(r,e,s)=>e.has(r)||St("Cannot "+s);var t=(r,e,s)=>(ot(r,e,"read from private field"),s?s.call(r):e.get(r)),o=(r,e,s)=>e.has(r)?St("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,s),a=(r,e,s,n)=>(ot(r,e,"write to private field"),n?n.call(r,s):e.set(r,s),s),A=(r,e,s)=>(ot(r,e,"access private method"),s);var _=(r,e,s)=>new Promise((n,c)=>{var d=f=>{try{p(s.next(f))}catch(M){c(M)}},y=f=>{try{p(s.throw(f))}catch(M){c(M)}},p=f=>f.done?n(f.value):Promise.resolve(f.value).then(d,y);p((s=s.apply(r,e)).next())});var wt=(r,e,s)=>(e=r[Et("asyncIterator")])?e.call(r):(r=r[Et("iterator")](),e={},s=(n,c)=>(c=r[n])&&(e[n]=d=>new Promise((y,p,f)=>(d=c.call(r,d),f=d.done,Promise.resolve(d.value).then(M=>y({value:M,done:f}),p)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xt=require("../browser-CpzFX2xg.cjs"),st=require("../events-KVanG9sR.cjs"),it=require("../url-Bn9ZrvT3.cjs"),Dt=require("../dom-JBOkFLTh.cjs"),yt=require("../loading/index.cjs");class At extends HTMLElement{constructor(){super()}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,n]of Object.entries(e))this.setAttribute(s,n)}}customElements.get("morph-announcer")||customElements.define("morph-announcer",At);var C,h,v,F,L,B,j,W,Y,x,K,D;class bt{constructor(e,s){o(this,C);o(this,h);o(this,v);o(this,F);o(this,L,null);o(this,B,!1);o(this,j,!1);o(this,W,!1);o(this,Y);o(this,x);o(this,K,e=>{e.preventDefault(),t(this,C).links.forEach(n=>{var c;t(this,v)===t(n,v)||(c=t(n,x))!=null&&c.includes(t(this,v))?t(n,h).classList.add("clicked"):t(n,h).classList.remove("clicked")});let s;t(this,L)&&(s={x:t(this,L).scrollLeft,y:t(this,L).scrollTop,selector:t(this,L).id?"#"+t(this,L).id:""}),t(this,C).navigate(t(this,v),{historyAction:t(this,F),state:t(this,Y),saveScrollState:s,saveDocumentState:t(this,B),restoreDocumentState:t(this,W),restoreScrollState:t(this,j)})});o(this,D,()=>{t(this,C).prefetch(t(this,v)),t(this,h).removeEventListener("pointerenter",t(this,D))});var y,p;a(this,C,s),a(this,h,e),a(this,v,t(this,h).getAttribute("href")||"/"),a(this,F,t(this,h).getAttribute("data-history-action")||"push");const n=t(this,h).getAttribute("data-save-scroll-state");typeof n=="string"&&(n===""?a(this,L,Dt.findScrollParentElement(t(this,h))):a(this,L,document.getElementById(n))),a(this,B,t(this,h).hasAttribute("data-save-document-state")),a(this,W,t(this,h).hasAttribute("data-restore-document-state")),a(this,j,t(this,h).hasAttribute("data-restore-scroll-state")),a(this,Y,t(this,h).getAttribute("data-state")||void 0),t(this,h).addEventListener("click",t(this,K));const c=s.normalizePath(t(this,v)),d=s.normalizePath(location.pathname);a(this,x,(y=t(this,h).getAttribute("data-match-paths"))==null?void 0:y.split(",").map(f=>s.normalizePath(f.trim()).pathname)),t(this,h).hasAttribute("data-include")?d.pathname.includes(c.pathname)&&t(this,h).classList.add("current"):c.pathname===d.pathname||(p=t(this,x))!=null&&p.includes(d.pathname)?(t(this,h).classList.add("current"),t(this,h).classList.add("clicked")):t(this,h).classList.remove("clicked"),t(this,h).hasAttribute("data-prefetch")&&t(this,h).addEventListener("pointerenter",t(this,D))}get element(){return t(this,h)}destroy(){t(this,h).removeEventListener("click",t(this,K)),t(this,h).removeEventListener("pointerenter",t(this,D)),t(this,h).classList.remove("current")}}C=new WeakMap,h=new WeakMap,v=new WeakMap,F=new WeakMap,L=new WeakMap,B=new WeakMap,j=new WeakMap,W=new WeakMap,Y=new WeakMap,x=new WeakMap,K=new WeakMap,D=new WeakMap;var V,G,J,Q,q,S,nt,k,P,E,U,X,H,w,z,R,T,m,ht,ct,Pt,lt,at;class qt{constructor(e){o(this,m);o(this,V,null);o(this,G,null);o(this,J,null);o(this,Q,!1);o(this,q,null);o(this,S,[]);o(this,nt,new DOMParser);o(this,k,new Map);o(this,P);o(this,E,null);o(this,U);o(this,X);o(this,H,[]);o(this,w);o(this,z);o(this,R,!1);o(this,T,null);o(this,at,e=>{var s;(s=e.state)!=null&&s.path&&(a(this,R,!0),this.navigate(e.state.path,{historyAction:"none"}),a(this,R,!1))});if(xt.isBrowser){a(this,V,it.normalizeBase(e==null?void 0:e.base)),a(this,G,(e==null?void 0:e.waitForHeadToLoad)!==!1),a(this,J,(e==null?void 0:e.cachePages)!==!1),a(this,Q,(e==null?void 0:e.trailingSlash)||!1),a(this,q,A(this,m,ct).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,E,s.pathname),document.documentElement.setAttribute("data-current-pathname",t(this,E)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",t(this,at)),it.changeHistory({action:"replace",pathname:t(this,E),searchParameters:s.parameters,hash:s.hash}),t(this,q).map(n=>[...n.children]).flat().forEach(n=>{n instanceof HTMLElement&&n.classList.add("current")}),a(this,T,new At)}}get currentPathname(){return t(this,E)}get previousPathname(){return t(this,U)}get currentState(){return t(this,X)}get links(){return t(this,S)}normalizePath(e){return it.splitPath(e,t(this,V),t(this,Q))}prefetch(e){return _(this,null,function*(){const s=this.normalizePath(e);return A(this,m,ht).call(this,s.pathname)})}navigate(f){return _(this,arguments,function*(e,{historyAction:s="push",state:n,saveScrollState:c,saveDocumentState:d,restoreDocumentState:y,restoreScrollState:p}={}){var dt;if(t(this,H).length)return;t(this,R)||(y||a(this,z,void 0),p||a(this,w,void 0));const M=this.normalizePath(e);let{pathname:l,hash:Tt,parameters:Mt,leaf:Ct}=M;if(t(this,P)===l||t(this,E)===l)return;a(this,X,n),a(this,P,l);const Z=t(this,k).has(l);try{yt.loading.add("__morph");let $=!0;if(this.preprocessor)try{yield new Promise((i,g)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:l,resolve:i,reject:g,isCached:Z,state:n})})}catch(i){i?console.error(i):console.log("Route change canceled"),$=!1}if(!$||t(this,P)!==l)return;const N=(t(this,z)||t(this,k).get(l)||(yield A(this,m,ht).call(this,l))).cloneNode(!0);if(t(this,P)!==l)return;if(a(this,z,d?document.cloneNode(!0):void 0),N.title)t(this,T).textContent=N.title;else{const i=N.querySelector("h1"),g=(i==null?void 0:i.innerText)||(i==null?void 0:i.textContent)||l;t(this,T).textContent=g}document.body.appendChild(t(this,T));const ut={pathname:l,isCached:Z,state:n,newDocument:N};st.dispatchEvent(document,"morphStart",{detail:ut});const mt=Array.from(document.head.children),ft=Array.from(N.head.children),pt=A(this,m,Pt).call(this,mt,ft),kt=A(this,m,lt).call(this,mt,pt),tt=A(this,m,lt).call(this,ft,pt);tt.forEach((i,g)=>{if(i.tagName==="SCRIPT"&&i.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=i.getAttribute("src"),tt[g]=b}}),tt.forEach(i=>{document.head.appendChild(i)});const rt=tt.filter(i=>!i.hasAttribute("data-no-waiting")&&(i.tagName==="STYLE"||i.tagName==="SCRIPT"||i.tagName==="LINK")&&i.getAttribute("rel")!=="canonical");t(this,G)&&rt.length&&(yield new Promise(i=>_(this,null,function*(){let g=0;try{for(var b=wt(rt),vt,I,Lt;vt=!(I=yield b.next()).done;vt=!1){const et=I.value;et.onload=()=>{g++,g===rt.length&&i()}}}catch(I){Lt=[I]}finally{try{vt&&(I=b.return)&&(yield I.call(b))}finally{if(Lt)throw Lt[0]}}})));const gt=[];kt.forEach(i=>{i.hasAttribute("data-permanent")||(i.tagName==="SCRIPT"||i.tagName==="STYLE"||i.getAttribute("rel")==="stylesheet"?gt.push(i):i.remove())}),a(this,U,t(this,E)),a(this,E,l),it.changeHistory({action:s,pathname:l,searchParameters:Mt,hash:Tt});const Ht=A(this,m,ct).call(this,N.body);t(this,q).forEach((i,g)=>{const b=Ht[g++],vt=getComputedStyle(i).getPropertyValue("--morph-duration"),I=[...b.childNodes];if(vt){const Lt=[...i.childNodes];if(Lt.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old")}),I.forEach(u=>{u instanceof HTMLElement&&(u.classList.remove("current"),u.classList.add("new"))}),i.prepend(...I),t(this,w)){const u=document.querySelector(t(this,w).selector);u&&u.scroll({top:t(this,w).y,left:t(this,w).x,behavior:"auto"})}setTimeout(()=>{I.forEach(u=>{u instanceof HTMLElement&&u.classList.add("in")})},10);const et={morphElement:i,pathname:l,isCached:Z,state:n};st.dispatchEvent(document,"morphNewChildrenAdded",{detail:et});const Nt=new Promise(u=>{setTimeout(()=>{Lt.forEach(O=>O.remove()),I.forEach(O=>{O instanceof HTMLElement&&(O.classList.remove("new","in"),O.classList.add("current"))}),st.dispatchEvent(document,"morphOldChildrenRemoved",{detail:et}),u()},(parseFloat(vt)||0)*1e3+10)});t(this,H).push(Nt)}else i.innerHTML="",i.append(...I)}),yield Promise.all(t(this,H)),gt.forEach(i=>i.remove()),a(this,H,[]),a(this,w,c),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",l),document.documentElement.setAttribute("data-current-leaf",Ct),t(this,T).remove(),(dt=this.postprocessor)==null||dt.call(this,{pathname:l,isCached:Z,state:n}),st.dispatchEvent(document,"morphComplete",{detail:ut}),yt.loading.complete("__morph")}catch($){console.error($)}a(this,P,void 0)})}addLink(e){t(this,S).push(new bt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){a(this,S,t(this,S).filter(s=>s.element===e?(s.destroy(),!1):!0))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(s=>{var n;return((n=s.getAttribute("href"))==null?void 0:n.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});t(this,S).forEach(s=>s.destroy()),a(this,S,e.map(s=>new bt(s,this)))}}V=new WeakMap,G=new WeakMap,J=new WeakMap,Q=new WeakMap,q=new WeakMap,S=new WeakMap,nt=new WeakMap,k=new WeakMap,P=new WeakMap,E=new WeakMap,U=new WeakMap,X=new WeakMap,H=new WeakMap,w=new WeakMap,z=new WeakMap,R=new WeakMap,T=new WeakMap,m=new WeakSet,ht=function(e){return _(this,null,function*(){const s=t(this,k).get(e);if(s)return s;const c=yield(yield fetch(e)).text(),d=t(this,nt).parseFromString(c,"text/html");return t(this,J)&&t(this,k).set(e,d),d})},ct=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},Pt=function(e,s){return e.filter(n=>s.find(c=>c.outerHTML===n.outerHTML))},lt=function(e,s){return e.filter(n=>!s.find(c=>c.outerHTML===n.outerHTML))},at=new WeakMap;exports.Morph=qt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,282 +1,334 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var vt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), Et = (r) => {
|
|
2
|
+
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var d = (
|
|
4
|
+
var rt = (r, e, s) => e.has(r) || Et("Cannot " + s);
|
|
5
|
+
var t = (r, e, s) => (rt(r, e, "read from private field"), s ? s.call(r) : e.get(r)), o = (r, e, s) => e.has(r) ? Et("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), a = (r, e, s, n) => (rt(r, e, "write to private field"), n ? n.call(r, s) : e.set(r, s), s), b = (r, e, s) => (rt(r, e, "access private method"), s);
|
|
6
|
+
var O = (r, e, s) => new Promise((n, c) => {
|
|
7
|
+
var d = (f) => {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
11
|
-
|
|
9
|
+
p(s.next(f));
|
|
10
|
+
} catch (C) {
|
|
11
|
+
c(C);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, y = (f) => {
|
|
14
14
|
try {
|
|
15
|
-
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
15
|
+
p(s.throw(f));
|
|
16
|
+
} catch (C) {
|
|
17
|
+
c(C);
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
|
|
19
|
+
}, p = (f) => f.done ? n(f.value) : Promise.resolve(f.value).then(d, y);
|
|
20
|
+
p((s = s.apply(r, e)).next());
|
|
21
21
|
});
|
|
22
|
-
var
|
|
23
|
-
import { i as
|
|
24
|
-
import { d as
|
|
25
|
-
import { n as
|
|
26
|
-
import {
|
|
27
|
-
|
|
22
|
+
var St = (r, e, s) => (e = r[vt("asyncIterator")]) ? e.call(r) : (r = r[vt("iterator")](), e = {}, s = (n, c) => (c = r[n]) && (e[n] = (d) => new Promise((y, p, f) => (d = c.call(r, d), f = d.done, Promise.resolve(d.value).then((C) => y({ value: C, done: f }), p)))), s("next"), s("return"), e);
|
|
23
|
+
import { i as xt } from "../browser-0zX67oeU.js";
|
|
24
|
+
import { d as st } from "../events-CsVF98U6.js";
|
|
25
|
+
import { n as Dt, c as wt, s as zt } from "../url-D0bFvcuq.js";
|
|
26
|
+
import { f as Rt } from "../dom-CVWzyXPH.js";
|
|
27
|
+
import { loading as yt } from "../loading/index.js";
|
|
28
|
+
class bt extends HTMLElement {
|
|
28
29
|
constructor() {
|
|
29
30
|
super();
|
|
30
31
|
}
|
|
31
32
|
connectedCallback() {
|
|
32
|
-
const
|
|
33
|
+
const e = {
|
|
33
34
|
"aria-live": "assertive",
|
|
34
35
|
"aria-atomic": "true",
|
|
35
36
|
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"
|
|
36
37
|
};
|
|
37
|
-
for (const [s, n] of Object.entries(
|
|
38
|
+
for (const [s, n] of Object.entries(e))
|
|
38
39
|
this.setAttribute(s, n);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
customElements.get("morph-announcer") || customElements.define("morph-announcer",
|
|
42
|
-
var
|
|
43
|
-
class
|
|
44
|
-
constructor(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
customElements.get("morph-announcer") || customElements.define("morph-announcer", bt);
|
|
43
|
+
var M, h, L, _, v, B, W, Y, j, x, K, D;
|
|
44
|
+
class At {
|
|
45
|
+
constructor(e, s) {
|
|
46
|
+
o(this, M);
|
|
47
|
+
o(this, h);
|
|
48
|
+
o(this, L);
|
|
49
|
+
o(this, _);
|
|
50
|
+
o(this, v, null);
|
|
51
|
+
o(this, B, !1);
|
|
52
|
+
o(this, W, !1);
|
|
53
|
+
o(this, Y, !1);
|
|
54
|
+
o(this, j);
|
|
55
|
+
o(this, x);
|
|
56
|
+
o(this, K, (e) => {
|
|
57
|
+
e.preventDefault(), t(this, M).links.forEach((n) => {
|
|
58
|
+
var c;
|
|
59
|
+
t(this, L) === t(n, L) || (c = t(n, x)) != null && c.includes(t(this, L)) ? t(n, h).classList.add("clicked") : t(n, h).classList.remove("clicked");
|
|
60
|
+
});
|
|
61
|
+
let s;
|
|
62
|
+
t(this, v) && (s = {
|
|
63
|
+
x: t(this, v).scrollLeft,
|
|
64
|
+
y: t(this, v).scrollTop,
|
|
65
|
+
selector: t(this, v).id ? "#" + t(this, v).id : ""
|
|
66
|
+
}), t(this, M).navigate(t(this, L), {
|
|
67
|
+
historyAction: t(this, _),
|
|
68
|
+
state: t(this, j),
|
|
69
|
+
saveScrollState: s,
|
|
70
|
+
saveDocumentState: t(this, B),
|
|
71
|
+
restoreDocumentState: t(this, Y),
|
|
72
|
+
restoreScrollState: t(this, W)
|
|
58
73
|
});
|
|
59
74
|
});
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
o(this, D, () => {
|
|
76
|
+
t(this, M).prefetch(t(this, L)), t(this, h).removeEventListener("pointerenter", t(this, D));
|
|
62
77
|
});
|
|
63
|
-
var
|
|
64
|
-
|
|
78
|
+
var y, p;
|
|
79
|
+
a(this, M, s), a(this, h, e), a(this, L, t(this, h).getAttribute("href") || "/"), a(this, _, t(this, h).getAttribute(
|
|
65
80
|
"data-history-action"
|
|
66
|
-
) || "push")
|
|
67
|
-
const n =
|
|
68
|
-
|
|
81
|
+
) || "push");
|
|
82
|
+
const n = t(this, h).getAttribute(
|
|
83
|
+
"data-save-scroll-state"
|
|
84
|
+
);
|
|
85
|
+
typeof n == "string" && (n === "" ? a(this, v, Rt(t(this, h))) : a(this, v, document.getElementById(n))), a(this, B, t(this, h).hasAttribute(
|
|
86
|
+
"data-save-document-state"
|
|
87
|
+
)), a(this, Y, t(this, h).hasAttribute(
|
|
88
|
+
"data-restore-document-state"
|
|
89
|
+
)), a(this, W, t(this, h).hasAttribute(
|
|
90
|
+
"data-restore-scroll-state"
|
|
91
|
+
)), a(this, j, t(this, h).getAttribute("data-state") || void 0), t(this, h).addEventListener("click", t(this, K));
|
|
92
|
+
const c = s.normalizePath(t(this, L)), d = s.normalizePath(location.pathname);
|
|
93
|
+
a(this, x, (y = t(this, h).getAttribute("data-match-paths")) == null ? void 0 : y.split(",").map((f) => s.normalizePath(f.trim()).pathname)), t(this, h).hasAttribute("data-include") ? d.pathname.includes(c.pathname) && t(this, h).classList.add("current") : c.pathname === d.pathname || (p = t(this, x)) != null && p.includes(d.pathname) ? (t(this, h).classList.add("current"), t(this, h).classList.add("clicked")) : t(this, h).classList.remove("clicked"), t(this, h).hasAttribute("data-prefetch") && t(this, h).addEventListener("pointerenter", t(this, D));
|
|
69
94
|
}
|
|
70
95
|
get element() {
|
|
71
|
-
return
|
|
96
|
+
return t(this, h);
|
|
72
97
|
}
|
|
73
98
|
destroy() {
|
|
74
|
-
|
|
99
|
+
t(this, h).removeEventListener("click", t(this, K)), t(this, h).removeEventListener("pointerenter", t(this, D)), t(this, h).classList.remove("current");
|
|
75
100
|
}
|
|
76
101
|
}
|
|
77
|
-
|
|
78
|
-
var
|
|
79
|
-
class
|
|
80
|
-
constructor(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
M = new WeakMap(), h = new WeakMap(), L = new WeakMap(), _ = new WeakMap(), v = new WeakMap(), B = new WeakMap(), W = new WeakMap(), Y = new WeakMap(), j = new WeakMap(), x = new WeakMap(), K = new WeakMap(), D = new WeakMap();
|
|
103
|
+
var V, G, J, Q, z, S, it, k, P, E, U, X, H, w, R, I, T, m, ot, ht, Pt, ct, nt;
|
|
104
|
+
class Yt {
|
|
105
|
+
constructor(e) {
|
|
106
|
+
o(this, m);
|
|
107
|
+
o(this, V, null);
|
|
108
|
+
o(this, G, null);
|
|
109
|
+
o(this, J, null);
|
|
110
|
+
o(this, Q, !1);
|
|
111
|
+
o(this, z, null);
|
|
112
|
+
o(this, S, []);
|
|
113
|
+
o(this, it, new DOMParser());
|
|
114
|
+
o(this, k, /* @__PURE__ */ new Map());
|
|
115
|
+
o(this, P);
|
|
116
|
+
o(this, E, null);
|
|
117
|
+
o(this, U);
|
|
118
|
+
o(this, X);
|
|
119
|
+
o(this, H, []);
|
|
120
|
+
o(this, w);
|
|
121
|
+
o(this, R);
|
|
122
|
+
o(this, I, !1);
|
|
123
|
+
o(this, T, null);
|
|
124
|
+
o(this, nt, (e) => {
|
|
125
|
+
var s;
|
|
126
|
+
(s = e.state) != null && s.path && (a(this, I, !0), this.navigate(e.state.path, { historyAction: "none" }), a(this, I, !1));
|
|
98
127
|
});
|
|
99
|
-
if (
|
|
100
|
-
|
|
128
|
+
if (xt) {
|
|
129
|
+
a(this, V, Dt(e == null ? void 0 : e.base)), a(this, G, (e == null ? void 0 : e.waitForHeadToLoad) !== !1), a(this, J, (e == null ? void 0 : e.cachePages) !== !1), a(this, Q, (e == null ? void 0 : e.trailingSlash) || !1), a(this, z, b(this, m, ht).call(this, document.body));
|
|
101
130
|
const s = this.normalizePath(
|
|
102
131
|
location.pathname + location.hash
|
|
103
132
|
);
|
|
104
|
-
|
|
133
|
+
a(this, E, s.pathname), document.documentElement.setAttribute(
|
|
105
134
|
"data-current-pathname",
|
|
106
|
-
|
|
135
|
+
t(this, E)
|
|
107
136
|
), document.documentElement.setAttribute(
|
|
108
137
|
"data-current-leaf",
|
|
109
138
|
s.leaf
|
|
110
|
-
), this.findLinks(), addEventListener("popstate",
|
|
111
|
-
"replace",
|
|
112
|
-
|
|
113
|
-
s.parameters,
|
|
114
|
-
s.hash
|
|
115
|
-
),
|
|
139
|
+
), this.findLinks(), addEventListener("popstate", t(this, nt)), wt({
|
|
140
|
+
action: "replace",
|
|
141
|
+
pathname: t(this, E),
|
|
142
|
+
searchParameters: s.parameters,
|
|
143
|
+
hash: s.hash
|
|
144
|
+
}), t(this, z).map((n) => [...n.children]).flat().forEach((n) => {
|
|
116
145
|
n instanceof HTMLElement && n.classList.add("current");
|
|
117
|
-
}),
|
|
146
|
+
}), a(this, T, new bt());
|
|
118
147
|
}
|
|
119
148
|
}
|
|
120
149
|
get currentPathname() {
|
|
121
|
-
return
|
|
150
|
+
return t(this, E);
|
|
122
151
|
}
|
|
123
152
|
get previousPathname() {
|
|
124
|
-
return
|
|
153
|
+
return t(this, U);
|
|
125
154
|
}
|
|
126
155
|
get currentState() {
|
|
127
|
-
return
|
|
156
|
+
return t(this, X);
|
|
128
157
|
}
|
|
129
158
|
get links() {
|
|
130
|
-
return
|
|
159
|
+
return t(this, S);
|
|
131
160
|
}
|
|
132
|
-
normalizePath(
|
|
133
|
-
return
|
|
161
|
+
normalizePath(e) {
|
|
162
|
+
return zt(e, t(this, V), t(this, Q));
|
|
134
163
|
}
|
|
135
|
-
prefetch(
|
|
136
|
-
return
|
|
137
|
-
const s = this.normalizePath(
|
|
138
|
-
return
|
|
164
|
+
prefetch(e) {
|
|
165
|
+
return O(this, null, function* () {
|
|
166
|
+
const s = this.normalizePath(e);
|
|
167
|
+
return b(this, m, ot).call(this, s.pathname);
|
|
139
168
|
});
|
|
140
169
|
}
|
|
141
|
-
navigate(
|
|
142
|
-
return
|
|
143
|
-
|
|
144
|
-
|
|
170
|
+
navigate(f) {
|
|
171
|
+
return O(this, arguments, function* (e, {
|
|
172
|
+
historyAction: s = "push",
|
|
173
|
+
state: n,
|
|
174
|
+
saveScrollState: c,
|
|
175
|
+
saveDocumentState: d,
|
|
176
|
+
restoreDocumentState: y,
|
|
177
|
+
restoreScrollState: p
|
|
178
|
+
} = {}) {
|
|
179
|
+
var lt;
|
|
180
|
+
if (t(this, H).length)
|
|
145
181
|
return;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
182
|
+
t(this, I) || (y || a(this, R, void 0), p || a(this, w, void 0));
|
|
183
|
+
const C = this.normalizePath(e);
|
|
184
|
+
let { pathname: l, hash: Tt, parameters: Ct, leaf: Mt } = C;
|
|
185
|
+
if (t(this, P) === l || t(this, E) === l)
|
|
149
186
|
return;
|
|
150
|
-
|
|
151
|
-
const
|
|
187
|
+
a(this, X, n), a(this, P, l);
|
|
188
|
+
const Z = t(this, k).has(l);
|
|
152
189
|
try {
|
|
153
|
-
|
|
154
|
-
let
|
|
190
|
+
yt.add("__morph");
|
|
191
|
+
let $ = !0;
|
|
155
192
|
if (this.preprocessor)
|
|
156
193
|
try {
|
|
157
|
-
yield new Promise((i,
|
|
158
|
-
var
|
|
159
|
-
(
|
|
194
|
+
yield new Promise((i, g) => {
|
|
195
|
+
var A;
|
|
196
|
+
(A = this.preprocessor) == null || A.call(this, { pathname: l, resolve: i, reject: g, isCached: Z, state: n });
|
|
160
197
|
});
|
|
161
198
|
} catch (i) {
|
|
162
|
-
i ? console.error(i) : console.log("Route change canceled"),
|
|
199
|
+
i ? console.error(i) : console.log("Route change canceled"), $ = !1;
|
|
163
200
|
}
|
|
164
|
-
if (
|
|
201
|
+
if (!$ || t(this, P) !== l)
|
|
165
202
|
return;
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
203
|
+
const N = (t(this, R) || t(this, k).get(l) || (yield b(this, m, ot).call(this, l))).cloneNode(!0);
|
|
204
|
+
if (t(this, P) !== l)
|
|
168
205
|
return;
|
|
169
|
-
if (
|
|
170
|
-
|
|
206
|
+
if (a(this, R, d ? document.cloneNode(!0) : void 0), N.title)
|
|
207
|
+
t(this, T).textContent = N.title;
|
|
171
208
|
else {
|
|
172
|
-
const i =
|
|
173
|
-
|
|
209
|
+
const i = N.querySelector("h1"), g = (i == null ? void 0 : i.innerText) || (i == null ? void 0 : i.textContent) || l;
|
|
210
|
+
t(this, T).textContent = g;
|
|
174
211
|
}
|
|
175
|
-
document.body.appendChild(
|
|
176
|
-
const
|
|
177
|
-
pathname:
|
|
178
|
-
isCached:
|
|
212
|
+
document.body.appendChild(t(this, T));
|
|
213
|
+
const dt = {
|
|
214
|
+
pathname: l,
|
|
215
|
+
isCached: Z,
|
|
179
216
|
state: n,
|
|
180
|
-
newDocument:
|
|
217
|
+
newDocument: N
|
|
181
218
|
};
|
|
182
|
-
|
|
183
|
-
detail:
|
|
219
|
+
st(document, "morphStart", {
|
|
220
|
+
detail: dt
|
|
184
221
|
});
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
),
|
|
188
|
-
|
|
222
|
+
const ut = Array.from(document.head.children), mt = Array.from(
|
|
223
|
+
N.head.children
|
|
224
|
+
), ft = b(this, m, Pt).call(this, ut, mt), kt = b(this, m, ct).call(this, ut, ft), tt = b(this, m, ct).call(this, mt, ft);
|
|
225
|
+
tt.forEach((i, g) => {
|
|
189
226
|
if (i.tagName === "SCRIPT" && i.getAttribute("src")) {
|
|
190
|
-
const
|
|
191
|
-
|
|
227
|
+
const A = document.createElement("script");
|
|
228
|
+
A.type = "module", A.src = i.getAttribute("src"), tt[g] = A;
|
|
192
229
|
}
|
|
193
|
-
}),
|
|
230
|
+
}), tt.forEach((i) => {
|
|
194
231
|
document.head.appendChild(i);
|
|
195
232
|
});
|
|
196
|
-
const
|
|
233
|
+
const at = tt.filter(
|
|
197
234
|
(i) => !i.hasAttribute("data-no-waiting") && (i.tagName === "STYLE" || i.tagName === "SCRIPT" || i.tagName === "LINK") && i.getAttribute("rel") !== "canonical"
|
|
198
235
|
);
|
|
199
|
-
|
|
200
|
-
let
|
|
236
|
+
t(this, G) && at.length && (yield new Promise((i) => O(this, null, function* () {
|
|
237
|
+
let g = 0;
|
|
201
238
|
try {
|
|
202
|
-
for (var
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
239
|
+
for (var A = St(at), gt, q, Lt; gt = !(q = yield A.next()).done; gt = !1) {
|
|
240
|
+
const et = q.value;
|
|
241
|
+
et.onload = () => {
|
|
242
|
+
g++, g === at.length && i();
|
|
206
243
|
};
|
|
207
244
|
}
|
|
208
|
-
} catch (
|
|
209
|
-
|
|
245
|
+
} catch (q) {
|
|
246
|
+
Lt = [q];
|
|
210
247
|
} finally {
|
|
211
248
|
try {
|
|
212
|
-
|
|
249
|
+
gt && (q = A.return) && (yield q.call(A));
|
|
213
250
|
} finally {
|
|
214
|
-
if (
|
|
215
|
-
throw
|
|
251
|
+
if (Lt)
|
|
252
|
+
throw Lt[0];
|
|
216
253
|
}
|
|
217
254
|
}
|
|
218
255
|
})));
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
i.hasAttribute("data-permanent") || (i.tagName === "SCRIPT" || i.tagName === "STYLE" || i.getAttribute("rel") === "stylesheet" ?
|
|
222
|
-
}),
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
256
|
+
const pt = [];
|
|
257
|
+
kt.forEach((i) => {
|
|
258
|
+
i.hasAttribute("data-permanent") || (i.tagName === "SCRIPT" || i.tagName === "STYLE" || i.getAttribute("rel") === "stylesheet" ? pt.push(i) : i.remove());
|
|
259
|
+
}), a(this, U, t(this, E)), a(this, E, l), wt({
|
|
260
|
+
action: s,
|
|
261
|
+
pathname: l,
|
|
262
|
+
searchParameters: Ct,
|
|
263
|
+
hash: Tt
|
|
264
|
+
});
|
|
265
|
+
const Ht = b(this, m, ht).call(this, N.body);
|
|
266
|
+
t(this, z).forEach((i, g) => {
|
|
267
|
+
const A = Ht[g++], gt = getComputedStyle(i).getPropertyValue("--morph-duration"), q = [...A.childNodes];
|
|
268
|
+
if (gt) {
|
|
269
|
+
const Lt = [...i.childNodes];
|
|
270
|
+
if (Lt.forEach((u) => {
|
|
271
|
+
u instanceof HTMLElement && u.classList.add("old");
|
|
272
|
+
}), q.forEach((u) => {
|
|
273
|
+
u instanceof HTMLElement && (u.classList.remove("current"), u.classList.add("new"));
|
|
274
|
+
}), i.prepend(...q), t(this, w)) {
|
|
275
|
+
const u = document.querySelector(
|
|
276
|
+
t(this, w).selector
|
|
277
|
+
);
|
|
278
|
+
u && u.scroll({
|
|
279
|
+
top: t(this, w).y,
|
|
280
|
+
left: t(this, w).x,
|
|
281
|
+
behavior: "auto"
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
setTimeout(() => {
|
|
285
|
+
q.forEach((u) => {
|
|
286
|
+
u instanceof HTMLElement && u.classList.add("in");
|
|
235
287
|
});
|
|
236
288
|
}, 10);
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
pathname:
|
|
240
|
-
isCached:
|
|
289
|
+
const et = {
|
|
290
|
+
morphElement: i,
|
|
291
|
+
pathname: l,
|
|
292
|
+
isCached: Z,
|
|
241
293
|
state: n
|
|
242
294
|
};
|
|
243
|
-
|
|
244
|
-
detail:
|
|
295
|
+
st(document, "morphNewChildrenAdded", {
|
|
296
|
+
detail: et
|
|
245
297
|
});
|
|
246
|
-
const
|
|
298
|
+
const Nt = new Promise((u) => {
|
|
247
299
|
setTimeout(() => {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}),
|
|
251
|
-
detail:
|
|
252
|
-
}),
|
|
253
|
-
}, (parseFloat(
|
|
300
|
+
Lt.forEach((F) => F.remove()), q.forEach((F) => {
|
|
301
|
+
F instanceof HTMLElement && (F.classList.remove("new", "in"), F.classList.add("current"));
|
|
302
|
+
}), st(document, "morphOldChildrenRemoved", {
|
|
303
|
+
detail: et
|
|
304
|
+
}), u();
|
|
305
|
+
}, (parseFloat(gt) || 0) * 1e3 + 10);
|
|
254
306
|
});
|
|
255
|
-
|
|
307
|
+
t(this, H).push(Nt);
|
|
256
308
|
} else
|
|
257
|
-
i.innerHTML = "", i.append(...
|
|
258
|
-
}), yield Promise.all(
|
|
259
|
-
detail:
|
|
260
|
-
}),
|
|
261
|
-
} catch (
|
|
262
|
-
console.error(
|
|
309
|
+
i.innerHTML = "", i.append(...q);
|
|
310
|
+
}), yield Promise.all(t(this, H)), pt.forEach((i) => i.remove()), a(this, H, []), a(this, w, c), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", l), document.documentElement.setAttribute("data-current-leaf", Mt), t(this, T).remove(), (lt = this.postprocessor) == null || lt.call(this, { pathname: l, isCached: Z, state: n }), st(document, "morphComplete", {
|
|
311
|
+
detail: dt
|
|
312
|
+
}), yt.complete("__morph");
|
|
313
|
+
} catch ($) {
|
|
314
|
+
console.error($);
|
|
263
315
|
}
|
|
264
|
-
|
|
316
|
+
a(this, P, void 0);
|
|
265
317
|
});
|
|
266
318
|
}
|
|
267
|
-
addLink(
|
|
268
|
-
|
|
319
|
+
addLink(e) {
|
|
320
|
+
t(this, S).push(new At(e, this));
|
|
269
321
|
}
|
|
270
|
-
addLinks(
|
|
271
|
-
|
|
322
|
+
addLinks(e) {
|
|
323
|
+
e.forEach((s) => {
|
|
272
324
|
this.addLink(s);
|
|
273
325
|
});
|
|
274
326
|
}
|
|
275
|
-
removeLink(
|
|
276
|
-
|
|
327
|
+
removeLink(e) {
|
|
328
|
+
a(this, S, t(this, S).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
|
|
277
329
|
}
|
|
278
330
|
findLinks() {
|
|
279
|
-
const
|
|
331
|
+
const e = [
|
|
280
332
|
...document.documentElement.querySelectorAll("a")
|
|
281
333
|
].filter(
|
|
282
334
|
(s) => {
|
|
@@ -284,33 +336,33 @@ class Ht {
|
|
|
284
336
|
return ((n = s.getAttribute("href")) == null ? void 0 : n.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
|
|
285
337
|
}
|
|
286
338
|
);
|
|
287
|
-
|
|
339
|
+
t(this, S).forEach((s) => s.destroy()), a(this, S, e.map((s) => new At(s, this)));
|
|
288
340
|
}
|
|
289
341
|
}
|
|
290
|
-
|
|
291
|
-
return
|
|
292
|
-
const s =
|
|
342
|
+
V = new WeakMap(), G = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), z = new WeakMap(), S = new WeakMap(), it = new WeakMap(), k = new WeakMap(), P = new WeakMap(), E = new WeakMap(), U = new WeakMap(), X = new WeakMap(), H = new WeakMap(), w = new WeakMap(), R = new WeakMap(), I = new WeakMap(), T = new WeakMap(), m = new WeakSet(), ot = function(e) {
|
|
343
|
+
return O(this, null, function* () {
|
|
344
|
+
const s = t(this, k).get(e);
|
|
293
345
|
if (s)
|
|
294
346
|
return s;
|
|
295
|
-
const
|
|
296
|
-
return
|
|
347
|
+
const c = yield (yield fetch(e)).text(), d = t(this, it).parseFromString(c, "text/html");
|
|
348
|
+
return t(this, J) && t(this, k).set(e, d), d;
|
|
297
349
|
});
|
|
298
|
-
},
|
|
299
|
-
const s = [...
|
|
300
|
-
return s.length ? s : [
|
|
301
|
-
},
|
|
302
|
-
return
|
|
350
|
+
}, ht = function(e) {
|
|
351
|
+
const s = [...e.querySelectorAll("[data-morph]")];
|
|
352
|
+
return s.length ? s : [e];
|
|
353
|
+
}, Pt = function(e, s) {
|
|
354
|
+
return e.filter(
|
|
303
355
|
(n) => s.find(
|
|
304
|
-
(
|
|
356
|
+
(c) => c.outerHTML === n.outerHTML
|
|
305
357
|
)
|
|
306
358
|
);
|
|
307
|
-
},
|
|
308
|
-
return
|
|
359
|
+
}, ct = function(e, s) {
|
|
360
|
+
return e.filter(
|
|
309
361
|
(n) => !s.find(
|
|
310
|
-
(
|
|
362
|
+
(c) => c.outerHTML === n.outerHTML
|
|
311
363
|
)
|
|
312
364
|
);
|
|
313
|
-
},
|
|
365
|
+
}, nt = new WeakMap();
|
|
314
366
|
export {
|
|
315
|
-
|
|
367
|
+
Yt as Morph
|
|
316
368
|
};
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var F=n=>{throw TypeError(n)};var W=(n,c,t)=>c.has(n)||F("Cannot "+t);var e=(n,c,t)=>(W(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?F("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(W(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),v=(n,c,t)=>(W(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),X=require("../Store-C2J4Q87x.cjs"),I=require("../events-KVanG9sR.cjs"),Y=require("../function-MthRj-GJ.cjs"),Z=require("../style-At6aDoqG.cjs"),G=require("../url-
|
|
1
|
+
"use strict";var F=n=>{throw TypeError(n)};var W=(n,c,t)=>c.has(n)||F("Cannot "+t);var e=(n,c,t)=>(W(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?F("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(W(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),v=(n,c,t)=>(W(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),X=require("../Store-C2J4Q87x.cjs"),I=require("../events-KVanG9sR.cjs"),Y=require("../function-MthRj-GJ.cjs"),Z=require("../style-At6aDoqG.cjs"),G=require("../url-Bn9ZrvT3.cjs"),J=require("../window-resizer/index.cjs"),ee=require("../browser-CpzFX2xg.cjs");var C,d,O,S,u,m,p,g,f,y,b,w,l,K,T,N,A,B,k,_,R,x,D;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,C);s(this,d);s(this,O);s(this,S);s(this,u);s(this,m);s(this,p);s(this,g);s(this,f);s(this,y);s(this,b);s(this,w);s(this,T);s(this,A);s(this,k);s(this,_);s(this,R);s(this,x);this.urlValue="",i(this,C,-1),i(this,d,new X.Store(!1)),i(this,u,new E.CSSProperty(this,"--history",!1)),i(this,m,new E.CSSProperty(this,"--restore",!1)),i(this,p,new E.CSSProperty(this,"--dominance",0)),i(this,g,new E.CSSProperty(this,"--group","")),i(this,f,new E.CSSProperty(this,"--click-outside",!1)),i(this,y,new E.CSSProperty(this,"--escape",!1)),i(this,b,!1),this.open=t=>{if(e(this,d).current)return;i(this,w,t==null?void 0:t.trigger),e(this,p).current&&(a.__opened=a.__opened.filter(o=>o!==this&&v(this,l,D).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,C,a.__opened.length-1),clearTimeout(e(this,O)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,w)}}),e(this,u).current&&e(this,b)&&history.pushState(history.state,"",e(this,l,K)),e(this,d).current=!0;const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,A)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,w)}}),i(this,S,void 0),this.setAttribute("aria-hidden","false")};t!=null&&t.skipTransition?h():i(this,S,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,S)&&v(this,l,D).call(this,this,t)?(t.close(),!1):!0),v(this,l,N).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.setAttribute("aria-hidden","true"),this.style.opacity="0",I.dispatchEvent(this,"popoverClosing",{custom:!0}),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",I.dispatchEvent(this,"popoverClosed",{custom:!0})},Z.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,f).current&&v(this,l,B).call(this,()=>{var U;const h=t.composedPath();if(h.find(j=>j instanceof HTMLElement&&j.hasAttribute("data-popover-content")))return;const o=h[0],z=o instanceof Node&&(this.contains(o)||((U=this.shadowRoot)==null?void 0:U.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!z||P)&&this.close()})}),i(this,A,t=>{e(this,y).current&&v(this,l,B).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,k,()=>{i(this,b,!1),e(this,d).current&&e(this,u).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,u).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),i(this,b,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,R).call(this)}),i(this,R,Y.debounce(()=>{e(this,x).call(this)},10)),i(this,x,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,u)}get restore(){return e(this,m)}get dominance(){return e(this,p)}get group(){return e(this,g)}get clickOutside(){return e(this,f)}get escape(){return e(this,y)}get opened(){return e(this,d)}get lastTrigger(){return e(this,w)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,d).current&&G.updateSearchParameter(this.id,t)}connectedCallback(){e(this,u).observe(),e(this,m).observe(),e(this,p).observe(),e(this,g).observe(),e(this,f).observe(),e(this,y).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("role","dialog"),this.setAttribute("aria-hidden","true"),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,k)),setTimeout(()=>{e(this,m).current?(this.urlValue=G.parseSearchParameters(location.search)[this.id],e(this,k).call(this)):(v(this,l,N).call(this),i(this,b,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,u).close(),e(this,m).close(),e(this,p).close(),e(this,g).close(),e(this,f).close(),e(this,y).close(),this.style.opacity="",this.style.display="",this.removeAttribute("role"),this.removeAttribute("aria-hidden"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,O)),clearTimeout(e(this,S)),removeEventListener("popstate",e(this,k)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),v(this,l,N).call(this)}};C=new WeakMap,d=new WeakMap,O=new WeakMap,S=new WeakMap,u=new WeakMap,m=new WeakMap,p=new WeakMap,g=new WeakMap,f=new WeakMap,y=new WeakMap,b=new WeakMap,w=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},T=new WeakMap,N=function(){if(e(this,u).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},A=new WeakMap,B=function(t){(a.__opened[e(this,C)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,p).current>h.dominance.current))&&t()},k=new WeakMap,_=new WeakMap,R=new WeakMap,x=new WeakMap,D=function(t,h){if(e(t,g).current===e(h,g).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let q=a;customElements.get("e-popover")||customElements.define("e-popover",q);var r,L,V,M,$,H;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,V,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,$,()=>{this.classList.remove("opened")});s(this,H,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});ee.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=e(this,L).current;t==="open"||t==="toggle"&&!e(this,r).opened.current?e(this,r).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,r).opened.current)&&e(this,r).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,L)}get popoverElement(){return e(this,r)}connectedCallback(){var h;e(this,L).subscribe(o=>{e(this,r)instanceof q&&(o.current!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let o=null;if(t==="parent"){const z=this.closest("[popover-target]");if(z)o=z;else{const P=this.getRootNode();P instanceof ShadowRoot?o=P.host.closest("[popover-target]"):P instanceof HTMLElement&&(o=P.closest("[popover-target]"))}}else t==="sibling"?o=(h=this.parentElement)==null?void 0:h.querySelector("[popover-target]"):o=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);o instanceof HTMLElement?(i(this,r,o),e(this,r).addEventListener("popoverTriggered",e(this,V)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,$)),e(this,r).addEventListener("popoverClosed",e(this,H))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,L).observe()}disconnectedCallback(){e(this,L).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,V)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,$)),e(this,r).removeEventListener("popoverClosed",e(this,H)))}}r=new WeakMap,L=new WeakMap,V=new WeakMap,M=new WeakMap,$=new WeakMap,H=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=q;
|
package/lib/popover/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { S as K } from "../Store-Cm3LPXlx.js";
|
|
|
8
8
|
import { d as z } from "../events-CsVF98U6.js";
|
|
9
9
|
import { d as Q } from "../function-C10DGppn.js";
|
|
10
10
|
import { g as X } from "../style-j2TwriJ_.js";
|
|
11
|
-
import { u as Y, p as Z } from "../url-
|
|
11
|
+
import { u as Y, p as Z } from "../url-D0bFvcuq.js";
|
|
12
12
|
import { windowResizer as G } from "../window-resizer/index.js";
|
|
13
13
|
import { i as ee } from "../browser-0zX67oeU.js";
|
|
14
14
|
var x, d, V, T, p, v, u, g, f, y, L, w, l, J, A, N, k, B, S, _, O, P, D;
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var M=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-
|
|
1
|
+
"use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var M=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-Bn9ZrvT3.cjs"),ot=require("../object-CCiXnER2.cjs");var R,O,A,p,m,v,k,L,b,E,x,et;class ct{constructor(e,s){r(this,x);r(this,R);r(this,O);r(this,A);r(this,p);r(this,m);r(this,v);r(this,k);r(this,L,null);r(this,b,[]);r(this,E,[]);a(this,R,e),a(this,O,s),a(this,A,new URLPattern({pathname:t(this,R)})),a(this,p,null),a(this,m,null),a(this,v,!1),a(this,k,null),tt.isBrowser&&a(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,v)}get element(){return t(this,m)}get nest(){return t(this,k)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return M(this,null,function*(){var i,h;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(a(this,E,[...t(this,b)]),typeof o.default=="function"&&(a(this,p,o.default),ot.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield W(this,x,et).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),d={pathnameParams:c,searchParams:f};a(this,m,new(t(this,p))(d)),e.appendChild(t(this,m)),a(this,k,t(this,m).querySelector("[data-nest]")||((h=t(this,m).shadowRoot)==null?void 0:h.querySelector("[data-nest]"))||t(this,m).shadowRoot||t(this,m)),a(this,v,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,m))==null||e.remove(),a(this,v,!1),t(this,E).forEach(s=>document.head.removeChild(s)),a(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,m)&&(e=[...t(this,m).querySelectorAll("a")]),(s=t(this,m))!=null&&s.shadowRoot&&(e=[...e,...t(this,m).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,m=new WeakMap,v=new WeakMap,k=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,x=new WeakSet,et=function(){return M(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=Y(e),i,h,o;i=!(h=yield s.next()).done;i=!1){const c=h.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(h){o=[h]}finally{try{i&&(h=s.return)&&(yield h.call(s))}finally{if(o)throw o[0]}}})};var S,u,P,U,q,j;class lt{constructor(e,s){r(this,S);r(this,u);r(this,P);r(this,U);r(this,q);r(this,j,e=>{e.preventDefault(),t(this,S).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,u).classList.add("clicked"):t(s,u).classList.remove("clicked")}),t(this,S).navigate(t(this,P),t(this,U))});var o,c;a(this,S,e),a(this,u,s),a(this,P,t(this,u).getAttribute("href")||"/"),a(this,U,t(this,u).getAttribute("data-history-action")||"push"),t(this,u).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),h=e.normalizePath(location.pathname);a(this,q,(o=t(this,u).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,u).hasAttribute("data-include")?h.pathname.includes(i.pathname)&&t(this,u).classList.add("current"):i.pathname===h.pathname||(c=t(this,q))!=null&&c.includes(h.pathname)?(t(this,u).classList.add("current"),t(this,u).classList.add("clicked")):t(this,u).classList.remove("clicked")}destroy(){t(this,u).removeEventListener("click",t(this,j)),t(this,u).classList.remove("current")}}S=new WeakMap,u=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=at.URLPattern;var N,C,g,z,T,y,H,B,I,_,st,D;class ut{constructor(e){r(this,_);r(this,N,null);r(this,C,null);r(this,g,[]);r(this,z,null);r(this,T,[]);r(this,y);r(this,H,null);r(this,B,new rt.Notifier);r(this,I,ht.debounce(()=>{const e=s=>s.split("/").length;a(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));r(this,D,e=>{var s;(s=e.state)!=null&&s.path&&this.navigate(e.state.path,"none")});tt.isBrowser&&(e!=null&&e.base?a(this,C,F.normalizeBase(e.base)):a(this,C,"/"),a(this,N,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,D)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,B).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,I).call(this)}navigate(e,s="push"){return M(this,null,function*(){var Q,V;const i=this.normalizePath(e);let{pathname:h,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===h||t(this,H)===h)return;a(this,y,h);const d=t(this,g).filter(l=>l.isActive),w=t(this,g).filter(l=>!d.includes(l)&&l.testPathname(f)),it=d.filter(l=>!l.testPathname(f)),G=d.filter(l=>l.testPathname(f));let J=!0;if(this.preprocessor)try{yield new Promise((l,nt)=>{var X;(X=this.preprocessor)==null||X.call(this,{path:i,resolve:l,reject:nt})})}catch(l){l?console.error(l):console.log("Route change canceled"),J=!1}if(J&&t(this,y)===h){a(this,z,G[G.length-1]),it.forEach(l=>{l.close()}),a(this,H,h),F.changeHistory({action:s,pathname:h,searchParameters:c,hash:o});try{for(var ft=Y(w),pt,gt,Pt;pt=!(gt=yield ft.next()).done;pt=!1){const l=gt.value;yield l.render(((Q=t(this,z))==null?void 0:Q.nest)||t(this,N),h),a(this,z,l)}}catch(gt){Pt=[gt]}finally{try{pt&&(gt=ft.return)&&(yield gt.call(ft))}finally{if(Pt)throw Pt[0]}}W(this,_,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,B).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,t(this,C))}}N=new WeakMap,C=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,B=new WeakMap,I=new WeakMap,_=new WeakSet,st=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,N).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var h;return(h=i.getAttribute("href"))==null?void 0:h.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),a(this,T,s.map(i=>new lt(this,i)))},D=new WeakMap;exports.Router=ut;
|
package/lib/router/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { URLPattern as at } from "urlpattern-polyfill";
|
|
|
24
24
|
import { Notifier as nt } from "../notifier/index.js";
|
|
25
25
|
import { i as _ } from "../browser-0zX67oeU.js";
|
|
26
26
|
import { d as ht } from "../function-C10DGppn.js";
|
|
27
|
-
import { n as rt, c as ot, s as ct } from "../url-
|
|
27
|
+
import { n as rt, c as ot, s as ct } from "../url-D0bFvcuq.js";
|
|
28
28
|
import { i as lt } from "../object-D6MVWB4l.js";
|
|
29
29
|
var y, U, A, p, d, L, k, v, E, R, M, tt;
|
|
30
30
|
class ut {
|
|
@@ -174,7 +174,8 @@ class vt {
|
|
|
174
174
|
n(this, g, t(this, g).sort((s, i) => e(s.pattern) - e(i.pattern))), this.navigate(location.pathname);
|
|
175
175
|
}, 0));
|
|
176
176
|
h(this, K, (e) => {
|
|
177
|
-
|
|
177
|
+
var s;
|
|
178
|
+
(s = e.state) != null && s.path && this.navigate(e.state.path, "none");
|
|
178
179
|
});
|
|
179
180
|
_ && (e != null && e.base ? n(this, z, rt(e.base)) : n(this, z, "/"), n(this, C, (e == null ? void 0 : e.rootElement) || document.body), addEventListener("popstate", t(this, K)));
|
|
180
181
|
}
|
|
@@ -221,7 +222,7 @@ class vt {
|
|
|
221
222
|
if (G && t(this, b) === r) {
|
|
222
223
|
n(this, q, F[F.length - 1]), st.forEach((l) => {
|
|
223
224
|
l.close();
|
|
224
|
-
}), n(this, T, r), ot(s, r, c, o);
|
|
225
|
+
}), n(this, T, r), ot({ action: s, pathname: r, searchParameters: c, hash: o });
|
|
225
226
|
try {
|
|
226
227
|
for (var bt = $(w), yt, At, kt; yt = !(At = yield bt.next()).done; yt = !1) {
|
|
227
228
|
const l = At.value;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var P=Object.defineProperty,S=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var n=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var c=(t,s,a)=>s in t?P(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,i=(t,s)=>{for(var a in s||(s={}))u.call(s,a)&&c(t,a,s[a]);if(n)for(var a of n(s))p.call(s,a)&&c(t,a,s[a]);return t},o=(t,s)=>S(t,W(s));function y(t,s="",a=!1){s=s.endsWith("/")?s.slice(0,-1):s,t=t.replace(s,""),t.startsWith("/")&&(t=t.slice(1));const h=t.split("#"),e=h[0].split("?");let r=e[0].startsWith("/")?e[0]:"/"+e[0];a?r=!r.endsWith("/")&&r!=="/"?r+"/":r:r=r.endsWith("/")&&r!=="/"?r.slice(0,-1):r;const f=s+r,m=e==null?void 0:e[1],l=h==null?void 0:h[1];return{leaf:r,pathname:f,parameters:m,hash:l}}function d(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function g(t){const s=(t==null?void 0:t.searchParameters)||location.search,a=t.hash?t.hash.startsWith("#")?t.hash:"#"+t.hash:"",h=s?s.startsWith("?")?s:"?"+s:"",e=`${t.pathname}${a}${h}`,r=o(i({},t.state),{path:e});t.action==="push"?history.pushState(r,"",e):t.action==="replace"&&history.replaceState(r,"",e)}function $(t){const s=new URLSearchParams(t),a={};for(const[h,e]of s)a[h]=e;return a}function w(t,s){const a=new URL(location.href),h=(s==null?void 0:s.toString())||"";a.searchParams.set(t,h),history.replaceState(history.state,"",a.href)}exports.changeHistory=g;exports.normalizeBase=d;exports.parseSearchParameters=$;exports.splitPath=y;exports.updateSearchParameter=w;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var W = Object.defineProperty, P = Object.defineProperties;
|
|
2
|
+
var u = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var h = Object.getOwnPropertySymbols;
|
|
4
|
+
var S = Object.prototype.hasOwnProperty, p = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var c = (t, s, a) => s in t ? W(t, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[s] = a, o = (t, s) => {
|
|
6
|
+
for (var a in s || (s = {}))
|
|
7
|
+
S.call(s, a) && c(t, a, s[a]);
|
|
8
|
+
if (h)
|
|
9
|
+
for (var a of h(s))
|
|
10
|
+
p.call(s, a) && c(t, a, s[a]);
|
|
11
|
+
return t;
|
|
12
|
+
}, i = (t, s) => P(t, u(s));
|
|
13
|
+
function d(t, s = "", a = !1) {
|
|
14
|
+
s = s.endsWith("/") ? s.slice(0, -1) : s, t = t.replace(s, ""), t.startsWith("/") && (t = t.slice(1));
|
|
15
|
+
const n = t.split("#"), e = n[0].split("?");
|
|
16
|
+
let r = e[0].startsWith("/") ? e[0] : "/" + e[0];
|
|
17
|
+
a ? r = !r.endsWith("/") && r !== "/" ? r + "/" : r : r = r.endsWith("/") && r !== "/" ? r.slice(0, -1) : r;
|
|
18
|
+
const f = s + r, l = e == null ? void 0 : e[1], m = n == null ? void 0 : n[1];
|
|
19
|
+
return {
|
|
20
|
+
leaf: r,
|
|
21
|
+
pathname: f,
|
|
22
|
+
parameters: l,
|
|
23
|
+
hash: m
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function $(t = "/") {
|
|
27
|
+
return t.endsWith("/") || (t += "/"), t.startsWith("/") || (t += "/"), t;
|
|
28
|
+
}
|
|
29
|
+
function g(t) {
|
|
30
|
+
const s = (t == null ? void 0 : t.searchParameters) || location.search, a = t.hash ? t.hash.startsWith("#") ? t.hash : "#" + t.hash : "", n = s ? s.startsWith("?") ? s : "?" + s : "", e = `${t.pathname}${a}${n}`, r = i(o({}, t.state), { path: e });
|
|
31
|
+
t.action === "push" ? history.pushState(r, "", e) : t.action === "replace" && history.replaceState(r, "", e);
|
|
32
|
+
}
|
|
33
|
+
function w(t) {
|
|
34
|
+
const s = new URLSearchParams(t), a = {};
|
|
35
|
+
for (const [n, e] of s)
|
|
36
|
+
a[n] = e;
|
|
37
|
+
return a;
|
|
38
|
+
}
|
|
39
|
+
function L(t, s) {
|
|
40
|
+
const a = new URL(location.href), n = (s == null ? void 0 : s.toString()) || "";
|
|
41
|
+
a.searchParams.set(t, n), history.replaceState(history.state, "", a.href);
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
g as c,
|
|
45
|
+
$ as n,
|
|
46
|
+
w as p,
|
|
47
|
+
d as s,
|
|
48
|
+
L as u
|
|
49
|
+
};
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attributes-Bf2svn4j.cjs"),I=require("../browser-CpzFX2xg.cjs"),f=require("../canvas-CU5Xjahf.cjs"),h=require("../coordinates-D8Np3cPD.cjs"),u=require("../dom-JBOkFLTh.cjs"),s=require("../easings-GegIwET5.cjs"),v=require("../events-KVanG9sR.cjs"),y=require("../file-DSpfWdd9.cjs"),C=require("../function-MthRj-GJ.cjs"),w=require("../gestures-DHLrn6Q8.cjs"),T=require("../jss-GJLvaNfT.cjs"),d=require("../layout-Ctc2p3uz.cjs"),i=require("../math-GDWEqu7y.cjs"),p=require("../polyfills-BANSrI_m.cjs"),c=require("../object-CCiXnER2.cjs"),l=require("../string-DhgS_iFl.cjs"),O=require("../style-At6aDoqG.cjs"),m=require("../url-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attributes-Bf2svn4j.cjs"),I=require("../browser-CpzFX2xg.cjs"),f=require("../canvas-CU5Xjahf.cjs"),h=require("../coordinates-D8Np3cPD.cjs"),u=require("../dom-JBOkFLTh.cjs"),s=require("../easings-GegIwET5.cjs"),v=require("../events-KVanG9sR.cjs"),y=require("../file-DSpfWdd9.cjs"),C=require("../function-MthRj-GJ.cjs"),w=require("../gestures-DHLrn6Q8.cjs"),T=require("../jss-GJLvaNfT.cjs"),d=require("../layout-Ctc2p3uz.cjs"),i=require("../math-GDWEqu7y.cjs"),p=require("../polyfills-BANSrI_m.cjs"),c=require("../object-CCiXnER2.cjs"),l=require("../string-DhgS_iFl.cjs"),O=require("../style-At6aDoqG.cjs"),m=require("../url-Bn9ZrvT3.cjs");function q(t,e,...o){return[...t.slice(0,e),...o,...t.slice(e)]}function Q(t,e){const o=t.length;e=e%o;const n=new Array(o);for(let a=0;a<o;a++){const r=(a+e)%o;n[r]=t[a]}return n}function B(t,e=2){if(!+t)return"0 Bytes";const o=1024,n=e<0?0:e,a=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=Math.floor(Math.log(t)/Math.log(o));return`${parseFloat((t/Math.pow(o,r)).toFixed(n))} ${a[r]}`}function D(t){if(navigator.clipboard)navigator.clipboard.writeText(t).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(e=>{console.error("Failed to copy text to clipboard:",e)});else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.top="0",e.style.left="0",document.body.appendChild(e),e.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(o){console.error("Failed to copy text to clipboard:",o)}document.body.removeChild(e)}}function A(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function R(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function S(t,e){const o=t.style.getPropertyValue(e);if(o){const n=o.toString();return n.startsWith("var")?S(t,n.slice(4,-1)):n}}function N(...t){const e={};return Array.from(document.styleSheets).forEach(o=>{Array.from(o.cssRules).forEach(n=>{n instanceof CSSStyleRule&&n.selectorText===":root"&&t.forEach(a=>{const r=S(n,a);r&&(e[a]=r)})})}),t.forEach(o=>{e[o]||console.warn(`variable named ${o} not found`)}),e}function z(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function M(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}function V(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}function j(t,{behaviour:e="instant",offset:o=0,center:n=!1}={}){var r;const a=u.getElement(t);if(a){const g=u.findScrollParentElement(a),E=d.getCumulativeOffsetTop(a),x=(typeof o=="number"?o:((r=u.getElement(o))==null?void 0:r.offsetHeight)||0)*-1,P=n?innerHeight/2*-1+a.offsetHeight/2:0;g==null||g.scroll({top:E+x+P,behavior:e})}}function U(t,e){if(t){const n=t.content.cloneNode(!0).firstElementChild;return n&&(e==null||e(n)),n}return null}exports.parseAttribute=b.parseAttribute;exports.parseAttributeValue=b.parseAttributeValue;exports.isBrowser=I.isBrowser;exports.contain=f.contain;exports.cover=f.cover;exports.fixPosition=f.fixPosition;exports.measureText=f.measureText;exports.getPointerPosition=h.getPointerPosition;exports.normalize=h.normalize;exports.screenToCartesian=h.screenToCartesian;exports.findParentElement=u.findParentElement;exports.findScrollParentElement=u.findScrollParentElement;exports.getAllParentElements=u.getAllParentElements;exports.getElement=u.getElement;exports.easeInCubic=s.easeInCubic;exports.easeInExpo=s.easeInExpo;exports.easeInOutCubic=s.easeInOutCubic;exports.easeInOutExpo=s.easeInOutExpo;exports.easeInOutQuad=s.easeInOutQuad;exports.easeInOutQuart=s.easeInOutQuart;exports.easeInOutQuint=s.easeInOutQuint;exports.easeInQuad=s.easeInQuad;exports.easeInQuart=s.easeInQuart;exports.easeInQuint=s.easeInQuint;exports.easeOutCubic=s.easeOutCubic;exports.easeOutExpo=s.easeOutExpo;exports.easeOutQuad=s.easeOutQuad;exports.easeOutQuart=s.easeOutQuart;exports.easeOutQuint=s.easeOutQuint;exports.linear=s.linear;exports.dispatchEvent=v.dispatchEvent;exports.createJSONAndSave=y.createJSONAndSave;exports.downloadURI=y.downloadURI;exports.debounce=C.debounce;exports.throttle=C.throttle;exports.setupDrag=w.setupDrag;exports.createStylesheet=T.createStylesheet;exports.styleToString=T.styleToString;exports.getCumulativeOffsetLeft=d.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=d.getCumulativeOffsetTop;exports.getCumulativePosition=d.getCumulativePosition;exports.getStickyOffset=d.getStickyOffset;exports.calculateDistance=i.calculateDistance;exports.calculateDistanceWithRadius=i.calculateDistanceWithRadius;exports.clamp=i.clamp;exports.damp=i.damp;exports.lerp=i.lerp;exports.mapRange=i.mapRange;exports.round=i.round;exports.smootherstep=i.smootherstep;exports.smoothstep=i.smoothstep;exports.step=i.step;exports.loopNumber=p.loopNumber;exports.nullishCoalescing=p.nullishCoalescing;exports.preciseNumber=p.preciseNumber;exports.roundNumberTo=p.roundNumberTo;exports.toStep=p.toStep;exports.cloneDeep=c.cloneDeep;exports.compareObjects=c.compareObjects;exports.isESClass=c.isESClass;exports.isNullish=c.isNullish;exports.isObject=c.isObject;exports.mergeDeep=c.mergeDeep;exports.mixin=c.mixin;exports.omit=c.omit;exports.pick=c.pick;exports.camelToKebab=l.camelToKebab;exports.capitalize=l.capitalize;exports.generateId=l.generateId;exports.isUppercase=l.isUppercase;exports.kebabToCamel=l.kebabToCamel;exports.snakeToDotted=l.snakeToDotted;exports.toPascalCase=l.toPascalCase;exports.uncapitalize=l.uncapitalize;exports.getElementTransitionDurationMS=O.getElementTransitionDurationMS;exports.getElementTransitionDurationS=O.getElementTransitionDurationS;exports.changeHistory=m.changeHistory;exports.normalizeBase=m.normalizeBase;exports.parseSearchParameters=m.parseSearchParameters;exports.splitPath=m.splitPath;exports.updateSearchParameter=m.updateSearchParameter;exports.cloneTemplateContent=U;exports.copyTextToClipboard=D;exports.decode=M;exports.dotCircleCollision=R;exports.dotRectCollision=A;exports.encode=z;exports.formatBytes=B;exports.getRootVariables=N;exports.insert=q;exports.scrollToElement=j;exports.shiftArray=Q;exports.wait=V;
|
package/lib/utils/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { l as Fe, n as je, p as He, r as Ue, t as ke } from "../polyfills-CxfUK5
|
|
|
17
17
|
import { c as qe, d as Ke, i as We, b as Ge, a as Je, m as Le, e as Ye, o as Ze, p as Xe } from "../object-D6MVWB4l.js";
|
|
18
18
|
import { c as et, a as tt, g as ot, i as st, k as at, s as nt, t as rt, u as it } from "../string-f0Dnk0L1.js";
|
|
19
19
|
import { g as lt, a as ut } from "../style-j2TwriJ_.js";
|
|
20
|
-
import { c as pt, n as mt, p as dt, s as xt, u as ht } from "../url-
|
|
20
|
+
import { c as pt, n as mt, p as dt, s as xt, u as ht } from "../url-D0bFvcuq.js";
|
|
21
21
|
function h(t, e, ...o) {
|
|
22
22
|
return [...t.slice(0, e), ...o, ...t.slice(e)];
|
|
23
23
|
}
|
package/lib/utils/url.d.ts
CHANGED
|
@@ -6,7 +6,16 @@ export declare function splitPath(value: string, base?: string, trailingSlash?:
|
|
|
6
6
|
};
|
|
7
7
|
export declare function normalizeBase(base?: string): string;
|
|
8
8
|
export type ChangeHistoryAction = 'replace' | 'push' | 'none';
|
|
9
|
-
export
|
|
9
|
+
export interface ChangeHistoryParameters {
|
|
10
|
+
action: ChangeHistoryAction;
|
|
11
|
+
pathname: string;
|
|
12
|
+
searchParameters?: string | undefined;
|
|
13
|
+
hash?: string | undefined;
|
|
14
|
+
state?: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare function changeHistory(p: ChangeHistoryParameters): void;
|
|
10
19
|
export declare function parseSearchParameters(search: string): {
|
|
11
20
|
[key: string]: string;
|
|
12
21
|
};
|
package/package.json
CHANGED
package/lib/url-CHQeS8b5.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function h(t,r="",c=!1){r=r.endsWith("/")?r.slice(0,-1):r,t=t.replace(r,""),t.startsWith("/")&&(t=t.slice(1));const e=t.split("#"),n=e[0].split("?");let s=n[0].startsWith("/")?n[0]:"/"+n[0];c?s=!s.endsWith("/")&&s!=="/"?s+"/":s:s=s.endsWith("/")&&s!=="/"?s.slice(0,-1):s;const i=r+s,a=n==null?void 0:n[1],o=e==null?void 0:e[1];return{leaf:s,pathname:i,parameters:a,hash:o}}function p(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function f(t,r,c,e){const n=c||location.search,s=e?e.startsWith("#")?e:"#"+e:"",i=n?n.startsWith("?")?n:"?"+n:"",a=`${r}${s}${i}`;t==="push"?history.pushState(a,"",a):t==="replace"&&history.replaceState(a,"",a)}function l(t){const r=new URLSearchParams(t),c={};for(const[e,n]of r)c[e]=n;return c}function m(t,r){const c=new URL(location.href),e=(r==null?void 0:r.toString())||"";c.searchParams.set(t,e),history.replaceState(history.state,"",c.href)}exports.changeHistory=f;exports.normalizeBase=p;exports.parseSearchParameters=l;exports.splitPath=h;exports.updateSearchParameter=m;
|
package/lib/url-DqQuzXwT.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
function h(t, s = "", c = !1) {
|
|
2
|
-
s = s.endsWith("/") ? s.slice(0, -1) : s, t = t.replace(s, ""), t.startsWith("/") && (t = t.slice(1));
|
|
3
|
-
const n = t.split("#"), e = n[0].split("?");
|
|
4
|
-
let r = e[0].startsWith("/") ? e[0] : "/" + e[0];
|
|
5
|
-
c ? r = !r.endsWith("/") && r !== "/" ? r + "/" : r : r = r.endsWith("/") && r !== "/" ? r.slice(0, -1) : r;
|
|
6
|
-
const i = s + r, o = e == null ? void 0 : e[1], a = n == null ? void 0 : n[1];
|
|
7
|
-
return {
|
|
8
|
-
leaf: r,
|
|
9
|
-
pathname: i,
|
|
10
|
-
parameters: o,
|
|
11
|
-
hash: a
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function f(t = "/") {
|
|
15
|
-
return t.endsWith("/") || (t += "/"), t.startsWith("/") || (t += "/"), t;
|
|
16
|
-
}
|
|
17
|
-
function p(t, s, c, n) {
|
|
18
|
-
const e = c || location.search, r = n ? n.startsWith("#") ? n : "#" + n : "", i = e ? e.startsWith("?") ? e : "?" + e : "", o = `${s}${r}${i}`;
|
|
19
|
-
t === "push" ? history.pushState(o, "", o) : t === "replace" && history.replaceState(o, "", o);
|
|
20
|
-
}
|
|
21
|
-
function l(t) {
|
|
22
|
-
const s = new URLSearchParams(t), c = {};
|
|
23
|
-
for (const [n, e] of s)
|
|
24
|
-
c[n] = e;
|
|
25
|
-
return c;
|
|
26
|
-
}
|
|
27
|
-
function W(t, s) {
|
|
28
|
-
const c = new URL(location.href), n = (s == null ? void 0 : s.toString()) || "";
|
|
29
|
-
c.searchParams.set(t, n), history.replaceState(history.state, "", c.href);
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
p as c,
|
|
33
|
-
f as n,
|
|
34
|
-
l as p,
|
|
35
|
-
h as s,
|
|
36
|
-
W as u
|
|
37
|
-
};
|