aptechka 0.38.4 → 0.39.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/morph/index.cjs +1 -1
- package/lib/morph/index.js +56 -51
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +31 -31
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +1 -1
- package/lib/url-BnTGHSgP.js +25 -0
- package/lib/{url-qZNgg7IM.cjs → url-DELd-VFC.cjs} +1 -1
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +1 -1
- package/lib/url-BuZrUXAO.js +0 -25
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var it=(
|
|
1
|
+
"use strict";var it=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),st=s=>{throw TypeError(s)};var G=(s,t,i)=>t.has(s)||st("Cannot "+i);var e=(s,t,i)=>(G(s,t,"read from private field"),i?i.call(s):t.get(s)),o=(s,t,i)=>t.has(s)?st("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),u=(s,t,i,r)=>(G(s,t,"write to private field"),r?r.call(s,i):t.set(s,i),i),m=(s,t,i)=>(G(s,t,"access private method"),i);var T=(s,t,i)=>new Promise((r,n)=>{var d=l=>{try{p(i.next(l))}catch(b){n(b)}},E=l=>{try{p(i.throw(l))}catch(b){n(b)}},p=l=>l.done?r(l.value):Promise.resolve(l.value).then(d,E);p((i=i.apply(s,t)).next())});var nt=(s,t,i)=>(t=s[it("asyncIterator")])?t.call(s):(s=s[it("iterator")](),t={},i=(r,n)=>(n=s[r])&&(t[r]=d=>new Promise((E,p,l)=>(d=n.call(s,d),l=d.done,Promise.resolve(d.value).then(b=>E({value:b,done:l}),p)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const rt=require("../notifier/index.cjs"),ut=require("../browser-CpzFX2xg.cjs"),O=require("../url-DELd-VFC.cjs"),at=require("../loading/index.cjs");var y,h,f,k,A,C,M;class dt{constructor(t,i){o(this,y);o(this,h);o(this,f);o(this,k);o(this,A);o(this,C,t=>{t.preventDefault(),e(this,y).links.forEach(i=>{var r;e(this,f)===e(i,f)||(r=e(i,A))!=null&&r.includes(e(this,f))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,y).navigate(e(this,f),e(this,k))});o(this,M,()=>{e(this,y).prefetch(e(this,f)),e(this,h).removeEventListener("pointerenter",e(this,M))});var d,E;u(this,y,i),u(this,h,t),u(this,f,e(this,h).getAttribute("href")||"/"),u(this,k,e(this,h).getAttribute("data-history-action")||"push"),e(this,h).addEventListener("click",e(this,C));const r=i.normalizePath(e(this,f)),n=i.normalizePath(location.pathname);u(this,A,(d=e(this,h).getAttribute("data-match-paths"))==null?void 0:d.split(",").map(p=>i.normalizePath(p.trim()).pathname)),e(this,h).hasAttribute("data-include")?n.pathname.includes(r.pathname)&&e(this,h).classList.add("current"):r.pathname===n.pathname||(E=e(this,A))!=null&&E.includes(n.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,M))}destroy(){e(this,h).removeEventListener("click",e(this,C)),e(this,h).removeEventListener("pointerenter",e(this,M)),e(this,h).classList.remove("current")}}y=new WeakMap,h=new WeakMap,f=new WeakMap,k=new WeakMap,A=new WeakMap,C=new WeakMap,M=new WeakMap;var S,z,q,x,H,B,P,w,g,_,D,c,J,Q,U,ot,V,W;class mt{constructor(t){o(this,c);o(this,S,null);o(this,z,null);o(this,q,null);o(this,x,null);o(this,H,[]);o(this,B,new DOMParser);o(this,P,new Map);o(this,w);o(this,g,null);o(this,_,new rt.Notifier);o(this,D,new rt.Notifier);o(this,W,t=>{t.state&&this.navigate(t.state,"none")});if(ut.isBrowser){u(this,S,O.normalizeBase(t==null?void 0:t.base)),u(this,z,(t==null?void 0:t.waitForHeadToLoad)!==!1),u(this,q,(t==null?void 0:t.cachePages)!==!1),u(this,x,m(this,c,U).call(this,document.body));const i=this.normalizePath(location.pathname);u(this,g,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,g)),document.documentElement.setAttribute("data-current-leaf",i.leaf),m(this,c,Q).call(this),addEventListener("popstate",e(this,W)),O.changeHistory("replace",e(this,g),i.parameters,i.hash)}}get currentPathname(){return e(this,g)}get links(){return e(this,H)}normalizePath(t){return O.splitPath(t,e(this,S))}beforeNavigationEvent(t){return e(this,_).subscribe(t)}afterNavigationEvent(t){return e(this,D).subscribe(t)}prefetch(t){return T(this,null,function*(){const i=this.normalizePath(t);return m(this,c,J).call(this,i.pathname)})}navigate(t,i="push"){return T(this,null,function*(){var b;const r=this.normalizePath(t);let{pathname:n,hash:d,parameters:E,leaf:p}=r;if(e(this,w)===n||e(this,g)===n)return;u(this,w,n);const l=e(this,P).has(n);try{at.loading.add("__morph");let R=!0;if(e(this,_).notify({pathname:n,isCached:l}),this.preprocessor)try{yield new Promise((a,v)=>{var L;(L=this.preprocessor)==null||L.call(this,{pathname:n,resolve:a,reject:v,isCached:l})})}catch(a){a?console.error(a):console.log("Route change canceled"),R=!1}if(!R||e(this,w)!==n)return;const X=e(this,P).get(n)||(yield m(this,c,J).call(this,n));if(e(this,w)!==n)return;const Z=Array.from(document.head.children),$=Array.from(X.head.cloneNode(!0).children),tt=m(this,c,ot).call(this,Z,$),ht=m(this,c,V).call(this,Z,tt),F=m(this,c,V).call(this,$,tt);F.forEach((a,v)=>{if(a.tagName==="SCRIPT"&&a.getAttribute("src")){const L=document.createElement("script");L.type="module",L.src=a.getAttribute("src"),F[v]=L}}),F.forEach(a=>{document.head.appendChild(a)});const j=F.filter(a=>(a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK")&&a.getAttribute("rel")!=="canonical");e(this,z)&&j.length&&(yield new Promise(a=>T(this,null,function*(){let v=0;try{for(var L=nt(j),lt,K,I;lt=!(K=yield L.next()).done;lt=!1){const N=K.value;N.onload=()=>{v++,v===j.length&&a()}}}catch(K){I=[K]}finally{try{lt&&(K=L.return)&&(yield K.call(L))}finally{if(I)throw I[0]}}}))),ht.forEach(a=>{a.hasAttribute("data-permanent")||a.remove()}),u(this,g,n),O.changeHistory(i,n,E,d);const ct=m(this,c,U).call(this,X.body.cloneNode(!0));e(this,x).forEach((a,v)=>{const L=ct[v];let lt=[...a.childNodes],K=[...L.childNodes];lt.forEach(I=>{if(I instanceof HTMLElement){const N=I.getAttribute("data-remain");let et;K=K.filter(Y=>Y instanceof HTMLElement&&N&&Y.getAttribute("data-remain")===N?(et=Y,!1):!0),N&&et||I.remove()}else I.remove()}),a.append(...K)}),m(this,c,Q).call(this),document.documentElement.setAttribute("data-current-pathname",n),document.documentElement.setAttribute("data-current-leaf",p),(b=this.postprocessor)==null||b.call(this,{pathname:n,isCached:l}),e(this,D).notify({pathname:n,isCached:l}),at.loading.complete("__morph")}catch(R){console.error(R)}u(this,w,void 0)})}}S=new WeakMap,z=new WeakMap,q=new WeakMap,x=new WeakMap,H=new WeakMap,B=new WeakMap,P=new WeakMap,w=new WeakMap,g=new WeakMap,_=new WeakMap,D=new WeakMap,c=new WeakSet,J=function(t){return T(this,null,function*(){const i=e(this,P).get(t);if(i)return i;const n=yield(yield fetch(t)).text(),d=e(this,B).parseFromString(n,"text/html");return e(this,q)&&e(this,P).set(t,d),d})},Q=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var r;return(r=i.getAttribute("href"))==null?void 0:r.startsWith("/")});e(this,H).forEach(i=>i.destroy()),u(this,H,t.map(i=>new dt(i,this)))},U=function(t){return[...t.querySelectorAll("[data-morph]")]},ot=function(t,i){return t.filter(r=>i.find(n=>n.outerHTML===r.outerHTML))},V=function(t,i){return t.filter(r=>!i.find(n=>n.outerHTML===r.outerHTML))},W=new WeakMap;exports.Morph=mt;
|
package/lib/morph/index.js
CHANGED
|
@@ -7,23 +7,23 @@ var T = (s, t, i) => new Promise((r, n) => {
|
|
|
7
7
|
var d = (l) => {
|
|
8
8
|
try {
|
|
9
9
|
p(i.next(l));
|
|
10
|
-
} catch (
|
|
11
|
-
n(
|
|
10
|
+
} catch (L) {
|
|
11
|
+
n(L);
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, E = (l) => {
|
|
14
14
|
try {
|
|
15
15
|
p(i.throw(l));
|
|
16
|
-
} catch (
|
|
17
|
-
n(
|
|
16
|
+
} catch (L) {
|
|
17
|
+
n(L);
|
|
18
18
|
}
|
|
19
|
-
}, p = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(d,
|
|
19
|
+
}, p = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(d, E);
|
|
20
20
|
p((i = i.apply(s, t)).next());
|
|
21
21
|
});
|
|
22
|
-
var st = (s, t, i) => (t = s[et("asyncIterator")]) ? t.call(s) : (s = s[et("iterator")](), t = {}, i = (r, n) => (n = s[r]) && (t[r] = (d) => new Promise((
|
|
22
|
+
var st = (s, t, i) => (t = s[et("asyncIterator")]) ? t.call(s) : (s = s[et("iterator")](), t = {}, i = (r, n) => (n = s[r]) && (t[r] = (d) => new Promise((E, p, l) => (d = n.call(s, d), l = d.done, Promise.resolve(d.value).then((L) => E({ value: L, done: l }), p)))), i("next"), i("return"), t);
|
|
23
23
|
import { Notifier as nt } from "../notifier/index.js";
|
|
24
|
-
import { i as
|
|
25
|
-
import { n as
|
|
26
|
-
import { loading as
|
|
24
|
+
import { i as ut } from "../browser-0zX67oeU.js";
|
|
25
|
+
import { n as dt, c as rt, s as mt } from "../url-BnTGHSgP.js";
|
|
26
|
+
import { loading as at } from "../loading/index.js";
|
|
27
27
|
var A, h, f, k, y, C, H;
|
|
28
28
|
class ft {
|
|
29
29
|
constructor(t, i) {
|
|
@@ -41,19 +41,19 @@ class ft {
|
|
|
41
41
|
o(this, H, () => {
|
|
42
42
|
e(this, A).prefetch(e(this, f)), e(this, h).removeEventListener("pointerenter", e(this, H));
|
|
43
43
|
});
|
|
44
|
-
var d,
|
|
44
|
+
var d, E;
|
|
45
45
|
u(this, A, i), u(this, h, t), u(this, f, e(this, h).getAttribute("href") || "/"), u(this, k, e(this, h).getAttribute(
|
|
46
46
|
"data-history-action"
|
|
47
47
|
) || "push"), e(this, h).addEventListener("click", e(this, C));
|
|
48
48
|
const r = i.normalizePath(e(this, f)), n = i.normalizePath(location.pathname);
|
|
49
|
-
u(this, y, (d = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : d.split(",").map((p) => i.normalizePath(p.trim()).pathname)), e(this, h).hasAttribute("data-include") ? n.pathname.includes(r.pathname) && e(this, h).classList.add("current") : r.pathname === n.pathname || (
|
|
49
|
+
u(this, y, (d = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : d.split(",").map((p) => i.normalizePath(p.trim()).pathname)), e(this, h).hasAttribute("data-include") ? n.pathname.includes(r.pathname) && e(this, h).classList.add("current") : r.pathname === n.pathname || (E = e(this, y)) != null && E.includes(n.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));
|
|
50
50
|
}
|
|
51
51
|
destroy() {
|
|
52
52
|
e(this, h).removeEventListener("click", e(this, C)), e(this, h).removeEventListener("pointerenter", e(this, H)), e(this, h).classList.remove("current");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
A = new WeakMap(), h = new WeakMap(), f = new WeakMap(), k = new WeakMap(), y = new WeakMap(), C = new WeakMap(), H = new WeakMap();
|
|
56
|
-
var z, S, x, D, M, B, P,
|
|
56
|
+
var z, S, x, D, M, B, P, w, g, R, _, c, G, J, Q, ot, U, O;
|
|
57
57
|
class bt {
|
|
58
58
|
constructor(t) {
|
|
59
59
|
o(this, c);
|
|
@@ -64,33 +64,38 @@ class bt {
|
|
|
64
64
|
o(this, M, []);
|
|
65
65
|
o(this, B, new DOMParser());
|
|
66
66
|
o(this, P, /* @__PURE__ */ new Map());
|
|
67
|
-
o(this,
|
|
68
|
-
o(this,
|
|
67
|
+
o(this, w);
|
|
68
|
+
o(this, g, null);
|
|
69
69
|
o(this, R, new nt());
|
|
70
70
|
o(this, _, new nt());
|
|
71
71
|
o(this, O, (t) => {
|
|
72
72
|
t.state && this.navigate(t.state, "none");
|
|
73
73
|
});
|
|
74
|
-
if (
|
|
75
|
-
u(this, z,
|
|
74
|
+
if (ut) {
|
|
75
|
+
u(this, z, dt(t == null ? void 0 : t.base)), u(this, S, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), u(this, x, (t == null ? void 0 : t.cachePages) !== !1), u(this, D, m(this, c, Q).call(this, document.body));
|
|
76
76
|
const i = this.normalizePath(location.pathname);
|
|
77
|
-
u(this,
|
|
77
|
+
u(this, g, i.pathname), document.documentElement.setAttribute(
|
|
78
78
|
"data-current-pathname",
|
|
79
|
-
e(this,
|
|
79
|
+
e(this, g)
|
|
80
80
|
), document.documentElement.setAttribute(
|
|
81
81
|
"data-current-leaf",
|
|
82
82
|
i.leaf
|
|
83
|
-
), m(this, c, J).call(this), addEventListener("popstate", e(this, O))
|
|
83
|
+
), m(this, c, J).call(this), addEventListener("popstate", e(this, O)), rt(
|
|
84
|
+
"replace",
|
|
85
|
+
e(this, g),
|
|
86
|
+
i.parameters,
|
|
87
|
+
i.hash
|
|
88
|
+
);
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
get currentPathname() {
|
|
87
|
-
return e(this,
|
|
92
|
+
return e(this, g);
|
|
88
93
|
}
|
|
89
94
|
get links() {
|
|
90
95
|
return e(this, M);
|
|
91
96
|
}
|
|
92
97
|
normalizePath(t) {
|
|
93
|
-
return
|
|
98
|
+
return mt(t, e(this, z));
|
|
94
99
|
}
|
|
95
100
|
beforeNavigationEvent(t) {
|
|
96
101
|
return e(this, R).subscribe(t);
|
|
@@ -106,40 +111,40 @@ class bt {
|
|
|
106
111
|
}
|
|
107
112
|
navigate(t, i = "push") {
|
|
108
113
|
return T(this, null, function* () {
|
|
109
|
-
var
|
|
114
|
+
var L;
|
|
110
115
|
const r = this.normalizePath(t);
|
|
111
|
-
let { pathname: n, hash: d, parameters:
|
|
112
|
-
if (e(this,
|
|
116
|
+
let { pathname: n, hash: d, parameters: E, leaf: p } = r;
|
|
117
|
+
if (e(this, w) === n || e(this, g) === n)
|
|
113
118
|
return;
|
|
114
|
-
u(this,
|
|
119
|
+
u(this, w, n);
|
|
115
120
|
const l = e(this, P).has(n);
|
|
116
121
|
try {
|
|
117
|
-
|
|
122
|
+
at.add("__morph");
|
|
118
123
|
let F = !0;
|
|
119
124
|
if (e(this, R).notify({
|
|
120
125
|
pathname: n,
|
|
121
126
|
isCached: l
|
|
122
127
|
}), this.preprocessor)
|
|
123
128
|
try {
|
|
124
|
-
yield new Promise((a,
|
|
125
|
-
var
|
|
126
|
-
(
|
|
129
|
+
yield new Promise((a, v) => {
|
|
130
|
+
var b;
|
|
131
|
+
(b = this.preprocessor) == null || b.call(this, { pathname: n, resolve: a, reject: v, isCached: l });
|
|
127
132
|
});
|
|
128
133
|
} catch (a) {
|
|
129
134
|
a ? console.error(a) : console.log("Route change canceled"), F = !1;
|
|
130
135
|
}
|
|
131
|
-
if (!F || e(this,
|
|
136
|
+
if (!F || e(this, w) !== n)
|
|
132
137
|
return;
|
|
133
138
|
const V = e(this, P).get(n) || (yield m(this, c, G).call(this, n));
|
|
134
|
-
if (e(this,
|
|
139
|
+
if (e(this, w) !== n)
|
|
135
140
|
return;
|
|
136
141
|
const X = Array.from(document.head.children), Z = Array.from(
|
|
137
142
|
V.head.cloneNode(!0).children
|
|
138
|
-
), $ = m(this, c,
|
|
139
|
-
I.forEach((a,
|
|
143
|
+
), $ = m(this, c, ot).call(this, X, Z), ht = m(this, c, U).call(this, X, $), I = m(this, c, U).call(this, Z, $);
|
|
144
|
+
I.forEach((a, v) => {
|
|
140
145
|
if (a.tagName === "SCRIPT" && a.getAttribute("src")) {
|
|
141
|
-
const
|
|
142
|
-
|
|
146
|
+
const b = document.createElement("script");
|
|
147
|
+
b.type = "module", b.src = a.getAttribute("src"), I[v] = b;
|
|
143
148
|
}
|
|
144
149
|
}), I.forEach((a) => {
|
|
145
150
|
document.head.appendChild(a);
|
|
@@ -148,32 +153,32 @@ class bt {
|
|
|
148
153
|
(a) => (a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK") && a.getAttribute("rel") !== "canonical"
|
|
149
154
|
);
|
|
150
155
|
e(this, S) && W.length && (yield new Promise((a) => T(this, null, function* () {
|
|
151
|
-
let
|
|
156
|
+
let v = 0;
|
|
152
157
|
try {
|
|
153
|
-
for (var
|
|
158
|
+
for (var b = st(W), lt, K, q; lt = !(K = yield b.next()).done; lt = !1) {
|
|
154
159
|
const N = K.value;
|
|
155
160
|
N.onload = () => {
|
|
156
|
-
|
|
161
|
+
v++, v === W.length && a();
|
|
157
162
|
};
|
|
158
163
|
}
|
|
159
164
|
} catch (K) {
|
|
160
165
|
q = [K];
|
|
161
166
|
} finally {
|
|
162
167
|
try {
|
|
163
|
-
|
|
168
|
+
lt && (K = b.return) && (yield K.call(b));
|
|
164
169
|
} finally {
|
|
165
170
|
if (q)
|
|
166
171
|
throw q[0];
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
|
-
}))),
|
|
174
|
+
}))), ht.forEach((a) => {
|
|
170
175
|
a.hasAttribute("data-permanent") || a.remove();
|
|
171
|
-
}), u(this,
|
|
172
|
-
const
|
|
173
|
-
e(this, D).forEach((a,
|
|
174
|
-
const
|
|
175
|
-
let
|
|
176
|
-
|
|
176
|
+
}), u(this, g, n), rt(i, n, E, d);
|
|
177
|
+
const ct = m(this, c, Q).call(this, V.body.cloneNode(!0));
|
|
178
|
+
e(this, D).forEach((a, v) => {
|
|
179
|
+
const b = ct[v];
|
|
180
|
+
let lt = [...a.childNodes], K = [...b.childNodes];
|
|
181
|
+
lt.forEach((q) => {
|
|
177
182
|
if (q instanceof HTMLElement) {
|
|
178
183
|
const N = q.getAttribute("data-remain");
|
|
179
184
|
let tt;
|
|
@@ -183,15 +188,15 @@ class bt {
|
|
|
183
188
|
} else
|
|
184
189
|
q.remove();
|
|
185
190
|
}), a.append(...K);
|
|
186
|
-
}), m(this, c, J).call(this), document.documentElement.setAttribute("data-current-pathname", n), document.documentElement.setAttribute("data-current-leaf", p), (
|
|
191
|
+
}), m(this, c, J).call(this), document.documentElement.setAttribute("data-current-pathname", n), document.documentElement.setAttribute("data-current-leaf", p), (L = this.postprocessor) == null || L.call(this, { pathname: n, isCached: l }), e(this, _).notify({ pathname: n, isCached: l }), at.complete("__morph");
|
|
187
192
|
} catch (F) {
|
|
188
193
|
console.error(F);
|
|
189
194
|
}
|
|
190
|
-
u(this,
|
|
195
|
+
u(this, w, void 0);
|
|
191
196
|
});
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
|
-
z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), D = new WeakMap(), M = new WeakMap(), B = new WeakMap(), P = new WeakMap(),
|
|
199
|
+
z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), D = new WeakMap(), M = new WeakMap(), B = new WeakMap(), P = new WeakMap(), w = new WeakMap(), g = new WeakMap(), R = new WeakMap(), _ = new WeakMap(), c = new WeakSet(), G = function(t) {
|
|
195
200
|
return T(this, null, function* () {
|
|
196
201
|
const i = e(this, P).get(t);
|
|
197
202
|
if (i)
|
|
@@ -209,7 +214,7 @@ z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), D = new WeakMap(), M =
|
|
|
209
214
|
e(this, M).forEach((i) => i.destroy()), u(this, M, t.map((i) => new ft(i, this)));
|
|
210
215
|
}, Q = function(t) {
|
|
211
216
|
return [...t.querySelectorAll("[data-morph]")];
|
|
212
|
-
},
|
|
217
|
+
}, ot = function(t, i) {
|
|
213
218
|
return t.filter(
|
|
214
219
|
(r) => i.find(
|
|
215
220
|
(n) => n.outerHTML === r.outerHTML
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var G=
|
|
1
|
+
"use strict";var G=n=>{throw TypeError(n)};var N=(n,c,t)=>c.has(n)||G("Cannot "+t);var e=(n,c,t)=>(N(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?G("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(N(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),b=(n,c,t)=>(N(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),V=require("../Store-CDb6RMce.cjs"),I=require("../events-KVanG9sR.cjs"),X=require("../function-MthRj-GJ.cjs"),Y=require("../style-At6aDoqG.cjs"),J=require("../window-resizer/vanilla/index.cjs"),Z=require("../browser-CpzFX2xg.cjs");var A,d,q,w,p,g,u,v,m,f,y,S,l,K,T,D,k,j,C,_,M,x,U;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,A);s(this,d);s(this,q);s(this,w);s(this,p);s(this,g);s(this,u);s(this,v);s(this,m);s(this,f);s(this,y);s(this,S);s(this,T);s(this,k);s(this,C);s(this,_);s(this,M);s(this,x);i(this,A,-1),i(this,d,new V.Store(!1)),i(this,p,new E.CSSProperty(this,"--history",!1)),i(this,g,new E.CSSProperty(this,"--restore",!1)),i(this,u,new E.CSSProperty(this,"--dominance",0)),i(this,v,new E.CSSProperty(this,"--group","")),i(this,m,new E.CSSProperty(this,"--click-outside",!1)),i(this,f,new E.CSSProperty(this,"--escape",!1)),i(this,y,!1),this.open=t=>{if(e(this,d).current)return;i(this,S,t==null?void 0:t.trigger),e(this,d).current=!0,e(this,u).current&&(a.__opened=a.__opened.filter(o=>o!==this&&b(this,l,U).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,A,a.__opened.length-1),e(this,p).current&&e(this,y)&&history.pushState("","",e(this,l,K)),clearTimeout(e(this,q)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,S)}});const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,S)}}),i(this,w,void 0)};t!=null&&t.skipTransition?h():i(this,w,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,w)&&b(this,l,U).call(this,this,t)?(t.close(),!1):!0),b(this,l,D).call(this),this.classList.remove("opened"),this.classList.add("closing"),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})},Y.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,m).current&&b(this,l,j).call(this,()=>{var W;const h=t.composedPath();if(h.find(F=>F instanceof HTMLElement&&F.hasAttribute("data-popover-content")))return;const o=h[0],$=o instanceof HTMLElement&&(this.contains(o)||((W=this.shadowRoot)==null?void 0:W.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!$||P)&&this.close()})}),i(this,k,t=>{e(this,f).current&&b(this,l,j).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,C,()=>{i(this,y,!1),e(this,d).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),i(this,y,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,M).call(this)}),i(this,M,X.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,p)}get restore(){return e(this,g)}get dominance(){return e(this,u)}get group(){return e(this,v)}get clickOutside(){return e(this,m)}get escape(){return e(this,f)}get opened(){return e(this,d)}get lastTrigger(){return e(this,S)}connectedCallback(){e(this,p).observe(),e(this,g).observe(),e(this,u).observe(),e(this,v).observe(),e(this,m).observe(),e(this,f).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,C)),setTimeout(()=>{e(this,g).current?e(this,C).call(this):(b(this,l,D).call(this),i(this,y,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,p).close(),e(this,g).close(),e(this,u).close(),e(this,v).close(),e(this,m).close(),e(this,f).close(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,q)),clearTimeout(e(this,w)),removeEventListener("popstate",e(this,C)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height")}};A=new WeakMap,d=new WeakMap,q=new WeakMap,w=new WeakMap,p=new WeakMap,g=new WeakMap,u=new WeakMap,v=new WeakMap,m=new WeakMap,f=new WeakMap,y=new WeakMap,S=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},T=new WeakMap,D=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},k=new WeakMap,j=function(t){(a.__opened[e(this,A)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,u).current>h.dominance.current))&&t()},C=new WeakMap,_=new WeakMap,M=new WeakMap,x=new WeakMap,U=function(t,h){if(e(t,v).current===e(h,v).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let B=a;customElements.get("e-popover")||customElements.define("e-popover",B);var r,L,O,R,H,z;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,O,()=>{this.classList.add("triggered")});s(this,R,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,H,()=>{this.classList.remove("opened")});s(this,z,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});Z.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)&&(o.current!=="close"?(this.setAttribute("aria-has-popup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-has-popup"),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 $=this.closest("[popover-target]");if($)o=$;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,O)),e(this,r).addEventListener("popoverOpened",e(this,R)),e(this,r).addEventListener("popoverClosing",e(this,H)),e(this,r).addEventListener("popoverClosed",e(this,z))):console.warn(this,`target ${t} not found`)}e(this,L).observe()}disconnectedCallback(){e(this,L).unobserve(),this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,O)),e(this,r).removeEventListener("popoverOpened",e(this,R)),e(this,r).removeEventListener("popoverClosing",e(this,H)),e(this,r).removeEventListener("popoverClosed",e(this,z)))}}r=new WeakMap,L=new WeakMap,O=new WeakMap,R=new WeakMap,H=new WeakMap,z=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=B;
|
package/lib/popover/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var G = (
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var G = (n) => {
|
|
2
|
+
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var N = (
|
|
5
|
-
var e = (
|
|
4
|
+
var N = (n, c, t) => c.has(n) || G("Cannot " + t);
|
|
5
|
+
var e = (n, c, t) => (N(n, c, "read from private field"), t ? t.call(n) : c.get(n)), s = (n, c, t) => c.has(n) ? G("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(n) : c.set(n, t), i = (n, c, t, h) => (N(n, c, "write to private field"), h ? h.call(n, t) : c.set(n, t), t), b = (n, c, t) => (N(n, c, "access private method"), t);
|
|
6
6
|
import { CSSProperty as E } from "../css-property/index.js";
|
|
7
7
|
import { S as Q } from "../Store-OTdcl6SX.js";
|
|
8
8
|
import { d as q } from "../events-CsVF98U6.js";
|
|
@@ -10,7 +10,7 @@ import { d as V } from "../function-C10DGppn.js";
|
|
|
10
10
|
import { g as X } from "../style-j2TwriJ_.js";
|
|
11
11
|
import { windowResizer as J } from "../window-resizer/vanilla/index.js";
|
|
12
12
|
import { i as Y } from "../browser-0zX67oeU.js";
|
|
13
|
-
var C, d, H, T, p,
|
|
13
|
+
var C, d, H, T, p, g, u, v, m, f, L, w, l, K, k, D, A, U, S, _, M, P, W;
|
|
14
14
|
const a = class a extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
@@ -20,9 +20,9 @@ const a = class a extends HTMLElement {
|
|
|
20
20
|
s(this, H);
|
|
21
21
|
s(this, T);
|
|
22
22
|
s(this, p);
|
|
23
|
-
s(this, v);
|
|
24
23
|
s(this, g);
|
|
25
24
|
s(this, u);
|
|
25
|
+
s(this, v);
|
|
26
26
|
s(this, m);
|
|
27
27
|
s(this, f);
|
|
28
28
|
s(this, L);
|
|
@@ -33,16 +33,16 @@ const a = class a extends HTMLElement {
|
|
|
33
33
|
s(this, _);
|
|
34
34
|
s(this, M);
|
|
35
35
|
s(this, P);
|
|
36
|
-
i(this, C, -1), i(this, d, new Q(!1)), i(this, p, new E(this, "--history", !1)), i(this,
|
|
36
|
+
i(this, C, -1), i(this, d, new Q(!1)), i(this, p, new E(this, "--history", !1)), i(this, g, new E(this, "--restore", !1)), i(this, u, new E(this, "--dominance", 0)), i(this, v, new E(this, "--group", "")), i(this, m, new E(this, "--click-outside", !1)), i(this, f, new E(this, "--escape", !1)), i(this, L, !1), this.open = (t) => {
|
|
37
37
|
if (e(this, d).current)
|
|
38
38
|
return;
|
|
39
|
-
i(this, w, t == null ? void 0 : t.trigger), e(this, d).current = !0, e(this,
|
|
39
|
+
i(this, w, t == null ? void 0 : t.trigger), e(this, d).current = !0, e(this, u).current && (a.__opened = a.__opened.filter((o) => o !== this && b(this, l, W).call(this, this, o) ? (o.close(), !1) : !0)), a.__opened.push(this), i(this, C, a.__opened.length - 1), e(this, p).current && e(this, L) && history.pushState("", "", e(this, l, K)), clearTimeout(e(this, H)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", q(this, "popoverTriggered", {
|
|
40
40
|
custom: !0,
|
|
41
41
|
detail: {
|
|
42
42
|
trigger: e(this, w)
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
const
|
|
45
|
+
const h = () => {
|
|
46
46
|
addEventListener("click", e(this, k)), addEventListener("keydown", e(this, A)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"), q(this, "popoverOpened", {
|
|
47
47
|
custom: !0,
|
|
48
48
|
detail: {
|
|
@@ -50,7 +50,7 @@ const a = class a extends HTMLElement {
|
|
|
50
50
|
}
|
|
51
51
|
}), i(this, T, void 0);
|
|
52
52
|
};
|
|
53
|
-
t != null && t.skipTransition ?
|
|
53
|
+
t != null && t.skipTransition ? h() : i(this, T, setTimeout(h, 10));
|
|
54
54
|
}, this.close = () => {
|
|
55
55
|
e(this, d).current && (removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), e(this, d).current = !1, a.__opened = a.__opened.filter((t) => t === this ? !1 : !e(t, T) && b(this, l, W).call(this, this, t) ? (t.close(), !1) : !0), b(this, l, D).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", q(this, "popoverClosing", {
|
|
56
56
|
custom: !0
|
|
@@ -62,12 +62,12 @@ const a = class a extends HTMLElement {
|
|
|
62
62
|
}, i(this, k, (t) => {
|
|
63
63
|
e(this, m).current && b(this, l, U).call(this, () => {
|
|
64
64
|
var j;
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
65
|
+
const h = t.composedPath();
|
|
66
|
+
if (h.find(
|
|
67
67
|
(F) => F instanceof HTMLElement && F.hasAttribute("data-popover-content")
|
|
68
68
|
))
|
|
69
69
|
return;
|
|
70
|
-
const
|
|
70
|
+
const o = h[0], z = o instanceof HTMLElement && (this.contains(o) || ((j = this.shadowRoot) == null ? void 0 : j.contains(o))), x = o instanceof HTMLElement && o.hasAttribute("data-outside");
|
|
71
71
|
(!z || x) && this.close();
|
|
72
72
|
});
|
|
73
73
|
}), i(this, A, (t) => {
|
|
@@ -88,13 +88,13 @@ const a = class a extends HTMLElement {
|
|
|
88
88
|
return e(this, p);
|
|
89
89
|
}
|
|
90
90
|
get restore() {
|
|
91
|
-
return e(this,
|
|
91
|
+
return e(this, g);
|
|
92
92
|
}
|
|
93
93
|
get dominance() {
|
|
94
|
-
return e(this,
|
|
94
|
+
return e(this, u);
|
|
95
95
|
}
|
|
96
96
|
get group() {
|
|
97
|
-
return e(this,
|
|
97
|
+
return e(this, v);
|
|
98
98
|
}
|
|
99
99
|
get clickOutside() {
|
|
100
100
|
return e(this, m);
|
|
@@ -109,15 +109,15 @@ const a = class a extends HTMLElement {
|
|
|
109
109
|
return e(this, w);
|
|
110
110
|
}
|
|
111
111
|
connectedCallback() {
|
|
112
|
-
e(this, p).observe(), e(this,
|
|
113
|
-
e(this,
|
|
112
|
+
e(this, p).observe(), e(this, g).observe(), e(this, u).observe(), e(this, v).observe(), e(this, m).observe(), e(this, f).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, S)), setTimeout(() => {
|
|
113
|
+
e(this, g).current ? e(this, S).call(this) : (b(this, l, D).call(this), i(this, L, !0));
|
|
114
114
|
}, 0), J.subscribe(e(this, _));
|
|
115
115
|
}
|
|
116
116
|
disconnectedCallback() {
|
|
117
|
-
J.unsubscribe(e(this, _)), e(this, p).close(), e(this,
|
|
117
|
+
J.unsubscribe(e(this, _)), e(this, p).close(), e(this, g).close(), e(this, u).close(), e(this, v).close(), e(this, m).close(), e(this, f).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), a.__opened = a.__opened.filter((t) => t !== this), clearTimeout(e(this, H)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, S)), removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height");
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
C = new WeakMap(), d = new WeakMap(), H = new WeakMap(), T = new WeakMap(), p = new WeakMap(),
|
|
120
|
+
C = new WeakMap(), d = new WeakMap(), H = new WeakMap(), T = new WeakMap(), p = new WeakMap(), g = new WeakMap(), u = new WeakMap(), v = new WeakMap(), m = new WeakMap(), f = new WeakMap(), L = new WeakMap(), w = new WeakMap(), l = new WeakSet(), K = function() {
|
|
121
121
|
return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
|
|
122
122
|
}, k = new WeakMap(), D = function() {
|
|
123
123
|
if (e(this, p).current) {
|
|
@@ -125,9 +125,9 @@ C = new WeakMap(), d = new WeakMap(), H = new WeakMap(), T = new WeakMap(), p =
|
|
|
125
125
|
t.searchParams.delete(this.id), history.replaceState(null, "", t.href);
|
|
126
126
|
}
|
|
127
127
|
}, A = new WeakMap(), U = function(t) {
|
|
128
|
-
(a.__opened[e(this, C) - 1] || a.__opened.length === 1 || a.__opened.filter((
|
|
129
|
-
}, S = new WeakMap(), _ = new WeakMap(), M = new WeakMap(), P = new WeakMap(), W = function(t,
|
|
130
|
-
if (
|
|
128
|
+
(a.__opened[e(this, C) - 1] || a.__opened.length === 1 || a.__opened.filter((h) => h !== this).every((h) => e(this, u).current > h.dominance.current)) && t();
|
|
129
|
+
}, S = new WeakMap(), _ = new WeakMap(), M = new WeakMap(), P = new WeakMap(), W = function(t, h) {
|
|
130
|
+
if (e(t, v).current === e(h, v).current && t.dominance.current >= h.dominance.current)
|
|
131
131
|
return !0;
|
|
132
132
|
}, a.__opened = [];
|
|
133
133
|
let B = a;
|
|
@@ -166,26 +166,26 @@ class Z extends HTMLElement {
|
|
|
166
166
|
return e(this, r);
|
|
167
167
|
}
|
|
168
168
|
connectedCallback() {
|
|
169
|
-
var
|
|
170
|
-
e(this, y).subscribe((
|
|
171
|
-
e(this, r) && (
|
|
169
|
+
var h;
|
|
170
|
+
e(this, y).subscribe((o) => {
|
|
171
|
+
e(this, r) && (o.current !== "close" ? (this.setAttribute("aria-has-popup", "true"), this.setAttribute(
|
|
172
172
|
"aria-expanded",
|
|
173
173
|
e(this, r).opened.current ? "true" : "false"
|
|
174
174
|
), this.setAttribute("aria-controls", e(this, r).id || "")) : (this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
|
|
175
175
|
}), this.hasAttribute("tabindex") || (this.tabIndex = 0);
|
|
176
176
|
const t = this.getAttribute("target");
|
|
177
177
|
if (t) {
|
|
178
|
-
let
|
|
178
|
+
let o = null;
|
|
179
179
|
if (t === "parent") {
|
|
180
180
|
const z = this.closest("[popover-target]");
|
|
181
181
|
if (z)
|
|
182
|
-
|
|
182
|
+
o = z;
|
|
183
183
|
else {
|
|
184
184
|
const x = this.getRootNode();
|
|
185
|
-
x instanceof ShadowRoot ?
|
|
185
|
+
x instanceof ShadowRoot ? o = x.host.closest("[popover-target]") : x instanceof HTMLElement && (o = x.closest("[popover-target]"));
|
|
186
186
|
}
|
|
187
|
-
} else t === "sibling" ?
|
|
188
|
-
|
|
187
|
+
} else t === "sibling" ? o = (h = this.parentElement) == null ? void 0 : h.querySelector("[popover-target]") : o = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
|
|
188
|
+
o instanceof HTMLElement ? (i(this, r, o), e(this, r).addEventListener(
|
|
189
189
|
"popoverTriggered",
|
|
190
190
|
e(this, O)
|
|
191
191
|
), e(this, r).addEventListener(
|
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-DELd-VFC.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=>{e.state&&this.navigate(e.state,"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(s,h,c,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-BnTGHSgP.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 {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function h(t, n = "") {
|
|
2
|
+
n = n.endsWith("/") ? n.slice(0, -1) : n, t = t.replace(n, ""), t.startsWith("/") && (t = t.slice(1));
|
|
3
|
+
const c = t.split("#"), i = c[0].split("?");
|
|
4
|
+
let s = i[0].startsWith("/") ? i[0] : "/" + i[0];
|
|
5
|
+
s = s.endsWith("/") && s !== "/" ? s.slice(0, -1) : s;
|
|
6
|
+
const o = n + s, e = i == null ? void 0 : i[1], r = c == null ? void 0 : c[1];
|
|
7
|
+
return {
|
|
8
|
+
leaf: s,
|
|
9
|
+
pathname: o,
|
|
10
|
+
parameters: e,
|
|
11
|
+
hash: r
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function p(t = "/") {
|
|
15
|
+
return t.endsWith("/") || (t += "/"), t.startsWith("/") || (t += "/"), t;
|
|
16
|
+
}
|
|
17
|
+
function f(t, n, c, i) {
|
|
18
|
+
const s = c || location.search, o = i ? i.startsWith("#") ? i : "#" + i : "", e = s ? s.startsWith("?") ? s : "?" + s : "", r = `${n}${o}${e}`;
|
|
19
|
+
t === "push" ? history.pushState(r, "", r) : t === "replace" && history.replaceState(r, "", r);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
f as c,
|
|
23
|
+
p as n,
|
|
24
|
+
h as s
|
|
25
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function h(t,n=""){n=n.endsWith("/")?n.slice(0,-1):n,t=t.replace(n,""),t.startsWith("/")&&(t=t.slice(1));const r=t.split("#"),i=r[0].split("?");let s=i[0].startsWith("/")?i[0]:"/"+i[0];s=s.endsWith("/")&&s!=="/"?s.slice(0,-1):s;const o=n+s,e=i==null?void 0:i[1],c=r==null?void 0:r[1];return{leaf:s,pathname:o,parameters:e,hash:c}}function
|
|
1
|
+
"use strict";function h(t,n=""){n=n.endsWith("/")?n.slice(0,-1):n,t=t.replace(n,""),t.startsWith("/")&&(t=t.slice(1));const r=t.split("#"),i=r[0].split("?");let s=i[0].startsWith("/")?i[0]:"/"+i[0];s=s.endsWith("/")&&s!=="/"?s.slice(0,-1):s;const o=n+s,e=i==null?void 0:i[1],c=r==null?void 0:r[1];return{leaf:s,pathname:o,parameters:e,hash:c}}function p(t="/"){return t.endsWith("/")||(t+="/"),t.startsWith("/")||(t+="/"),t}function l(t,n,r,i){const s=r||location.search,o=i?i.startsWith("#")?i:"#"+i:"",e=s?s.startsWith("?")?s:"?"+s:"",c=`${n}${o}${e}`;t==="push"?history.pushState(c,"",c):t==="replace"&&history.replaceState(c,"",c)}exports.changeHistory=l;exports.normalizeBase=p;exports.splitPath=h;
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attributes-Bf2svn4j.cjs"),S=require("../browser-CpzFX2xg.cjs"),m=require("../canvas-CU5Xjahf.cjs"),p=require("../coordinates-D8Np3cPD.cjs"),d=require("../dom-JBOkFLTh.cjs"),o=require("../easings-GegIwET5.cjs"),I=require("../events-KVanG9sR.cjs"),h=require("../file-DSpfWdd9.cjs"),C=require("../function-MthRj-GJ.cjs"),T=require("../gestures-DHLrn6Q8.cjs"),O=require("../jss-GJLvaNfT.cjs"),f=require("../layout-8ryRAMGJ.cjs"),s=require("../math-GDWEqu7y.cjs"),l=require("../polyfills-BANSrI_m.cjs"),r=require("../object-CCiXnER2.cjs"),u=require("../string-DhgS_iFl.cjs"),y=require("../style-At6aDoqG.cjs"),g=require("../url-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../attributes-Bf2svn4j.cjs"),S=require("../browser-CpzFX2xg.cjs"),m=require("../canvas-CU5Xjahf.cjs"),p=require("../coordinates-D8Np3cPD.cjs"),d=require("../dom-JBOkFLTh.cjs"),o=require("../easings-GegIwET5.cjs"),I=require("../events-KVanG9sR.cjs"),h=require("../file-DSpfWdd9.cjs"),C=require("../function-MthRj-GJ.cjs"),T=require("../gestures-DHLrn6Q8.cjs"),O=require("../jss-GJLvaNfT.cjs"),f=require("../layout-8ryRAMGJ.cjs"),s=require("../math-GDWEqu7y.cjs"),l=require("../polyfills-BANSrI_m.cjs"),r=require("../object-CCiXnER2.cjs"),u=require("../string-DhgS_iFl.cjs"),y=require("../style-At6aDoqG.cjs"),g=require("../url-DELd-VFC.cjs");function P(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function w(t,e){const n=t.length;e=e%n;const a=new Array(n);for(let i=0;i<n;i++){const c=(i+e)%n;a[c]=t[i]}return a}function q(t,e=2){if(!+t)return"0 Bytes";const n=1024,a=e<0?0:e,i=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],c=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,c)).toFixed(a))} ${i[c]}`}function v(t,e){return t.x<e.x+e.width&&t.x>e.x&&t.y<e.y+e.height&&t.y>e.y}function x(t,e){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)<e.radius}function E(t,e){const n=t.style.getPropertyValue(e);if(n){const a=n.toString();return a.startsWith("var")?E(t,a.slice(4,-1)):a}}function Q(...t){const e={};return Array.from(document.styleSheets).forEach(n=>{Array.from(n.cssRules).forEach(a=>{a instanceof CSSStyleRule&&a.selectorText===":root"&&t.forEach(i=>{const c=E(a,i);c&&(e[i]=c)})})}),t.forEach(n=>{e[n]||console.warn(`variable named ${n} not found`)}),e}function B(t){const e=window.atob(t);return decodeURIComponent(window.escape(e))}function D(t){const e=window.unescape(encodeURIComponent(t));return window.btoa(e)}function A(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}exports.parseAttribute=b.parseAttribute;exports.parseAttributeValue=b.parseAttributeValue;exports.isBrowser=S.isBrowser;exports.contain=m.contain;exports.cover=m.cover;exports.fixPosition=m.fixPosition;exports.measureText=m.measureText;exports.getPointerPosition=p.getPointerPosition;exports.normalize=p.normalize;exports.screenToCartesian=p.screenToCartesian;exports.findParentElement=d.findParentElement;exports.findScrollParentElement=d.findScrollParentElement;exports.getAllParentElements=d.getAllParentElements;exports.getElement=d.getElement;exports.easeInCubic=o.easeInCubic;exports.easeInExpo=o.easeInExpo;exports.easeInOutCubic=o.easeInOutCubic;exports.easeInOutExpo=o.easeInOutExpo;exports.easeInOutQuad=o.easeInOutQuad;exports.easeInOutQuart=o.easeInOutQuart;exports.easeInOutQuint=o.easeInOutQuint;exports.easeInQuad=o.easeInQuad;exports.easeInQuart=o.easeInQuart;exports.easeInQuint=o.easeInQuint;exports.easeOutCubic=o.easeOutCubic;exports.easeOutExpo=o.easeOutExpo;exports.easeOutQuad=o.easeOutQuad;exports.easeOutQuart=o.easeOutQuart;exports.easeOutQuint=o.easeOutQuint;exports.linear=o.linear;exports.dispatchEvent=I.dispatchEvent;exports.createJSONAndSave=h.createJSONAndSave;exports.downloadURI=h.downloadURI;exports.debounce=C.debounce;exports.throttle=C.throttle;exports.setupDrag=T.setupDrag;exports.createStylesheet=O.createStylesheet;exports.styleToString=O.styleToString;exports.getCumulativeOffsetLeft=f.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=f.getCumulativeOffsetTop;exports.getCumulativePosition=f.getCumulativePosition;exports.calculateDistance=s.calculateDistance;exports.calculateDistanceWithRadius=s.calculateDistanceWithRadius;exports.clamp=s.clamp;exports.damp=s.damp;exports.lerp=s.lerp;exports.mapRange=s.mapRange;exports.round=s.round;exports.smootherstep=s.smootherstep;exports.smoothstep=s.smoothstep;exports.step=s.step;exports.loopNumber=l.loopNumber;exports.nullishCoalescing=l.nullishCoalescing;exports.preciseNumber=l.preciseNumber;exports.roundNumberTo=l.roundNumberTo;exports.toStep=l.toStep;exports.cloneDeep=r.cloneDeep;exports.compareObjects=r.compareObjects;exports.isESClass=r.isESClass;exports.isNullish=r.isNullish;exports.isObject=r.isObject;exports.mergeDeep=r.mergeDeep;exports.mixin=r.mixin;exports.omit=r.omit;exports.pick=r.pick;exports.camelToKebab=u.camelToKebab;exports.capitalize=u.capitalize;exports.generateId=u.generateId;exports.isUppercase=u.isUppercase;exports.kebabToCamel=u.kebabToCamel;exports.snakeToDotted=u.snakeToDotted;exports.toPascalCase=u.toPascalCase;exports.uncapitalize=u.uncapitalize;exports.getElementTransitionDurationMS=y.getElementTransitionDurationMS;exports.getElementTransitionDurationS=y.getElementTransitionDurationS;exports.changeHistory=g.changeHistory;exports.normalizeBase=g.normalizeBase;exports.splitPath=g.splitPath;exports.decode=D;exports.dotCircleCollision=x;exports.dotRectCollision=v;exports.encode=B;exports.formatBytes=q;exports.getRootVariables=Q;exports.insert=P;exports.shiftArray=w;exports.wait=A;
|
package/lib/utils/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { l as Te, n as ve, p as Ae, r as Qe, t as Re } from "../polyfills-CxfUK5
|
|
|
15
15
|
import { c as Me, d as ke, i as ze, b as Ne, a as Ve, m as je, e as Ue, o as $e, p as qe } from "../object-D6MVWB4l.js";
|
|
16
16
|
import { c as Ke, a as We, g as Ge, i as He, k as Je, s as Le, t as Ye, u as Ze } from "../string-f0Dnk0L1.js";
|
|
17
17
|
import { g as _e, a as ea } from "../style-j2TwriJ_.js";
|
|
18
|
-
import { c as ta, n as sa, s as oa } from "../url-
|
|
18
|
+
import { c as ta, n as sa, s as oa } from "../url-BnTGHSgP.js";
|
|
19
19
|
function i(a, e, ...t) {
|
|
20
20
|
return [...a.slice(0, e), ...t, ...a.slice(e)];
|
|
21
21
|
}
|
package/package.json
CHANGED
package/lib/url-BuZrUXAO.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function h(t, i = "") {
|
|
2
|
-
i = i.endsWith("/") ? i.slice(0, -1) : i, t = t.replace(i, ""), t.startsWith("/") && (t = t.slice(1));
|
|
3
|
-
const c = t.split("#"), n = c[0].split("?");
|
|
4
|
-
let s = n[0].startsWith("/") ? n[0] : "/" + n[0];
|
|
5
|
-
s = s.endsWith("/") && s !== "/" ? s.slice(0, -1) : s;
|
|
6
|
-
const o = i + s, e = n == null ? void 0 : n[1], r = c == null ? void 0 : c[1];
|
|
7
|
-
return {
|
|
8
|
-
leaf: s,
|
|
9
|
-
pathname: o,
|
|
10
|
-
parameters: e,
|
|
11
|
-
hash: r
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function l(t = "/") {
|
|
15
|
-
return t.endsWith("/") || (t += "/"), t.startsWith("/") || (t += "/"), t;
|
|
16
|
-
}
|
|
17
|
-
function p(t, i, c, n) {
|
|
18
|
-
const s = c || location.search, o = n ? n.startsWith("#") ? n : "#" + n : "", e = s ? s.startsWith("?") ? s : "?" + s : "", r = `${i}${o}${e}`;
|
|
19
|
-
t === "push" ? history.pushState(null, "", r) : t === "replace" && history.replaceState(null, "", r);
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
p as c,
|
|
23
|
-
l as n,
|
|
24
|
-
h as s
|
|
25
|
-
};
|