aptechka 0.1.9 → 0.1.10
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/Composed-C2Vv1xxR.cjs +1 -0
- package/lib/Composed-DhtYBEmo.js +79 -0
- package/lib/component/Component.d.ts +29 -0
- package/lib/component/hooks/animation.d.ts +9 -0
- package/lib/component/hooks/context.d.ts +2 -0
- package/lib/component/hooks/intersection.d.ts +4 -0
- package/lib/component/hooks/resize.d.ts +6 -0
- package/lib/component/hooks/shadow.d.ts +1 -0
- package/lib/component/hooks/stores.d.ts +6 -0
- package/lib/component/hooks/style.d.ts +2 -0
- package/lib/component/index.cjs +1 -0
- package/lib/component/index.d.ts +7 -0
- package/lib/component/index.js +187 -0
- package/lib/connector/index.cjs +1 -1
- package/lib/connector/index.js +1 -1
- package/lib/element-constructor/ElementConstructor.d.ts +1 -1
- package/lib/element-constructor/tags.d.ts +2 -3
- package/lib/element-resizer/index.cjs +1 -1
- package/lib/element-resizer/index.d.ts +1 -1
- package/lib/element-resizer/index.js +2 -1
- package/lib/en3/core/en3.d.ts +2 -2
- package/lib/en3/objects/En3Clip.d.ts +1 -1
- package/lib/intersector/index.cjs +1 -1
- package/lib/intersector/index.d.ts +1 -1
- package/lib/intersector/index.js +2 -1
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.d.ts +2 -2
- package/lib/layout-box/index.js +70 -72
- package/lib/object-C1ph624j.cjs +1 -0
- package/lib/object-DIPjdukP.js +73 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +79 -71
- package/lib/router/Route.d.ts +8 -2
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.d.ts +1 -2
- package/lib/router/index.js +139 -140
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +48 -111
- package/lib/ticker/index.cjs +1 -1
- package/lib/ticker/index.d.ts +1 -1
- package/lib/ticker/index.js +33 -37
- package/lib/utils/dom.d.ts +2 -2
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +113 -168
- package/lib/utils/object.d.ts +1 -0
- package/package.json +10 -2
- package/lib/router/RouteElement.d.ts +0 -14
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var st=Object.defineProperty;var Z=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i);var it=(i,t,s)=>t in i?st(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var I=(i,t,s)=>(it(i,typeof t!="symbol"?t+"":t,s),s),F=(i,t,s)=>{if(!t.has(i))throw TypeError("Cannot "+s)};var e=(i,t,s)=>(F(i,t,"read from private field"),s?s.call(i):t.get(i)),n=(i,t,s)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,s)},o=(i,t,s,r)=>(F(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s);var G=(i,t,s)=>(F(i,t,"access private method"),s);var D=(i,t,s)=>new Promise((r,f)=>{var h=u=>{try{d(s.next(u))}catch(T){f(T)}},a=u=>{try{d(s.throw(u))}catch(T){f(T)}},d=u=>u.done?r(u.value):Promise.resolve(u.value).then(h,a);d((s=s.apply(i,t)).next())});var J=(i,t,s)=>(t=i[Z("asyncIterator")])?t.call(i):(i=i[Z("iterator")](),t={},s=(r,f)=>(f=i[r])&&(t[r]=h=>new Promise((a,d,u)=>(h=f.call(i,h),u=h.done,Promise.resolve(h.value).then(T=>a({value:T,done:u}),d)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const rt=require("urlpattern-polyfill"),ot=require("../notifier/index.cjs"),_=require("../browser-CpzFX2xg.cjs"),nt=require("../function-MthRj-GJ.cjs"),$=require("../object-C1ph624j.cjs");var b,H,R,m,l,w,S,v,P,y,K,tt;class ht{constructor(t,s){n(this,K);n(this,b,void 0);n(this,H,void 0);n(this,R,void 0);n(this,m,void 0);n(this,l,void 0);n(this,w,void 0);n(this,S,void 0);n(this,v,null);n(this,P,[]);n(this,y,[]);o(this,b,t),o(this,H,s),o(this,R,new URLPattern({pathname:e(this,b)})),o(this,m,null),o(this,l,null),o(this,w,!1),o(this,S,null),_.isBrowser&&o(this,v,new MutationObserver(r=>{r[0].addedNodes.forEach(h=>{e(this,m)?e(this,y).push(h):e(this,P).push(h)})}))}get pattern(){return e(this,b)}get urlPattern(){return e(this,R)}get isActive(){return e(this,w)}get element(){return e(this,l)}get outlet(){return e(this,S)}testPathname(t){return this.urlPattern.test({pathname:t})}render(t,s){return D(this,null,function*(){var r,f;if(e(this,v).observe(document.head,{childList:!0,subtree:!0}),e(this,m))e(this,P).forEach(h=>{document.head.appendChild(h)});else{const h=yield e(this,H).call(this);if(o(this,y,[...e(this,P)]),typeof h.default=="function"&&(o(this,m,h.default),$.isESClass(h.default))){const a="e-"+((r=e(this,m))==null?void 0:r.name.toLowerCase());customElements.get(a)||customElements.define(a,h.default)}}if(yield G(this,K,tt).call(this),e(this,m)){const h=e(this,R).exec({pathname:s}),a=(h==null?void 0:h.pathname.groups)||{},d=Object.fromEntries(new URLSearchParams(location.search)),u={pathnameParams:a,searchParams:d};$.isESClass(e(this,m))?o(this,l,new(e(this,m))(u)):o(this,l,e(this,m).call(this,u)),t.appendChild(e(this,l)),o(this,S,e(this,l).querySelector("[data-outlet]")||((f=e(this,l).shadowRoot)==null?void 0:f.querySelector("[data-outlet]"))||e(this,l).shadowRoot||e(this,l)),o(this,w,!0)}e(this,v).disconnect()})}close(){var t;e(this,v).disconnect(),(t=e(this,l))==null||t.remove(),o(this,w,!1),e(this,y).forEach(s=>document.head.removeChild(s)),o(this,y,[])}getAnchorElements(){var s;let t=[];return e(this,l)&&(t=[...e(this,l).querySelectorAll("a")]),(s=e(this,l))!=null&&s.shadowRoot&&(t=[...t,...e(this,l).shadowRoot.querySelectorAll("a")]),t}}b=new WeakMap,H=new WeakMap,R=new WeakMap,m=new WeakMap,l=new WeakMap,w=new WeakMap,S=new WeakMap,v=new WeakMap,P=new WeakMap,y=new WeakMap,K=new WeakSet,tt=function(){return D(this,null,function*(){const t=e(this,P).filter(a=>a instanceof HTMLElement?a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK":!1);try{for(var s=J(t),r,f,h;r=!(f=yield s.next()).done;r=!1){const a=f.value;yield new Promise(d=>{a.onload=()=>{d()}})}}catch(f){h=[f]}finally{try{r&&(f=s.return)&&(yield f.call(s))}finally{if(h)throw h[0]}}})};var U,g,A,j,M;class at{constructor(t,s){n(this,U,void 0);n(this,g,void 0);n(this,A,void 0);n(this,j,void 0);n(this,M,t=>{t.preventDefault(),e(this,U).navigate(e(this,A),e(this,j))});o(this,U,t),o(this,g,s),o(this,A,e(this,g).getAttribute("href")||"/"),o(this,j,e(this,g).getAttribute("data-history-action")||"push"),e(this,g).addEventListener("click",e(this,M)),location.pathname===e(this,A)&&e(this,g).classList.add("current")}destroy(){e(this,g).removeEventListener("click",e(this,M)),e(this,g).classList.remove("current")}}U=new WeakMap,g=new WeakMap,A=new WeakMap,j=new WeakMap,M=new WeakMap;globalThis.URLPattern=rt.URLPattern;var k,q,p,C,x,E,N,B,W,Y,et,z;const O=class O{constructor(t){n(this,Y);n(this,k,null);n(this,q,void 0);n(this,p,[]);n(this,C,null);n(this,x,[]);n(this,E,void 0);n(this,N,null);n(this,B,new ot.Notifier);I(this,"preprocessor");I(this,"postprocessor");n(this,W,nt.debounce(()=>{const t=s=>s.split("/").length;o(this,p,e(this,p).sort((s,r)=>t(s.pattern)-t(r.pattern))),this.navigate(location.pathname.replace(e(this,q),""))},0));n(this,z,t=>{t.state&&this.navigate(t.state,"none")});o(this,q,(t==null?void 0:t.base)||""),O.active=this,_.isBrowser&&(o(this,k,(t==null?void 0:t.rootElement)||document.body),addEventListener("popstate",e(this,z)))}get currentPathname(){return e(this,N)}get candidatePathname(){return e(this,E)}get routes(){return e(this,p)}navigationEvent(t){return e(this,B).subscribe(t)}defineRoute(t,s){const r=new ht(t,s);e(this,p).push(r),e(this,W).call(this)}navigate(t,s="push"){return D(this,null,function*(){var u,V;if(e(this,E)===t||e(this,N)===t)return;O.active=this,o(this,E,t);const r=e(this,p).filter(c=>c.isActive),f=e(this,p).filter(c=>!r.includes(c)&&c.testPathname(t)),h=r.filter(c=>!c.testPathname(t)),a=r.filter(c=>c.testPathname(t));let d=!0;if(this.preprocessor)try{yield new Promise((c,L)=>{var X;(X=this.preprocessor)==null||X.call(this,{pathname:t,resolve:c,reject:L})})}catch(c){c?console.error(c):console.log("Route change canceled"),d=!1}if(d&&e(this,E)===t){o(this,C,a[a.length-1]),h.forEach(L=>{L.close()}),o(this,N,t);try{for(var T=J(f),ut,ft,dt;ut=!(ft=yield T.next()).done;ut=!1){const L=ft.value;yield L.render(((u=e(this,C))==null?void 0:u.outlet)||e(this,k),t),o(this,C,L)}}catch(ft){dt=[ft]}finally{try{ut&&(ft=T.return)&&(yield ft.call(T))}finally{if(dt)throw dt[0]}}const c=e(this,q)+t+location.search;s==="push"?history.pushState(c,"",c):s==="replace"&&history.replaceState(c,"",c),G(this,Y,et).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:t}),e(this,B).notify({pathname:t})}})}};k=new WeakMap,q=new WeakMap,p=new WeakMap,C=new WeakMap,x=new WeakMap,E=new WeakMap,N=new WeakMap,B=new WeakMap,W=new WeakMap,Y=new WeakSet,et=function(){const t=e(this,p).filter(r=>r.isActive),s=Array.from(new Set([...e(this,k).querySelectorAll("a"),...t.map(r=>r.getAnchorElements()).flat()].filter(r=>{var f;return(f=r.getAttribute("href"))==null?void 0:f.startsWith("/")})));e(this,x).forEach(r=>{r.destroy()}),o(this,x,s.map(r=>new at(this,r)))},z=new WeakMap,I(O,"active");let Q=O;exports.Router=Q;
|
package/lib/router/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { Router, type RouterPreprocessorEntry, type RouterPreprocessor, type RouterPostprocessor, type RouterAfterNavigationCallback, type RouterHistoryAction, type RouterParameters, } from './Router';
|
|
2
|
-
export {
|
|
3
|
-
export { type RouteModule } from './Route';
|
|
2
|
+
export { type RouteModule, type RouteParameters, type RouteURLParams, } from './Route';
|
package/lib/router/index.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var st = Object.defineProperty;
|
|
2
|
+
var V = (i, t) => (t = Symbol[i]) ? t : Symbol.for("Symbol." + i);
|
|
3
|
+
var it = (i, t, s) => t in i ? st(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
|
|
4
|
+
var B = (i, t, s) => (it(i, typeof t != "symbol" ? t + "" : t, s), s), z = (i, t, s) => {
|
|
5
5
|
if (!t.has(i))
|
|
6
6
|
throw TypeError("Cannot " + s);
|
|
7
7
|
};
|
|
8
|
-
var e = (i, t, s) => (
|
|
8
|
+
var e = (i, t, s) => (z(i, t, "read from private field"), s ? s.call(i) : t.get(i)), n = (i, t, s) => {
|
|
9
9
|
if (t.has(i))
|
|
10
10
|
throw TypeError("Cannot add the same private member more than once");
|
|
11
11
|
t instanceof WeakSet ? t.add(i) : t.set(i, s);
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
12
|
+
}, r = (i, t, s, o) => (z(i, t, "write to private field"), o ? o.call(i, s) : t.set(i, s), s);
|
|
13
|
+
var F = (i, t, s) => (z(i, t, "access private method"), s);
|
|
14
|
+
var D = (i, t, s) => new Promise((o, f) => {
|
|
15
|
+
var h = (u) => {
|
|
16
16
|
try {
|
|
17
|
-
d(s.next(
|
|
17
|
+
d(s.next(u));
|
|
18
18
|
} catch (T) {
|
|
19
|
-
|
|
19
|
+
f(T);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, a = (u) => {
|
|
22
22
|
try {
|
|
23
|
-
d(s.throw(
|
|
23
|
+
d(s.throw(u));
|
|
24
24
|
} catch (T) {
|
|
25
|
-
|
|
25
|
+
f(T);
|
|
26
26
|
}
|
|
27
|
-
}, d = (
|
|
27
|
+
}, d = (u) => u.done ? o(u.value) : Promise.resolve(u.value).then(h, a);
|
|
28
28
|
d((s = s.apply(i, t)).next());
|
|
29
29
|
});
|
|
30
|
-
var
|
|
30
|
+
var G = (i, t, s) => (t = i[V("asyncIterator")]) ? t.call(i) : (i = i[V("iterator")](), t = {}, s = (o, f) => (f = i[o]) && (t[o] = (h) => new Promise((a, d, u) => (h = f.call(i, h), u = h.done, Promise.resolve(h.value).then((T) => a({ value: T, done: u }), d)))), s("next"), s("return"), t);
|
|
31
31
|
import { URLPattern as ot } from "urlpattern-polyfill";
|
|
32
|
-
import { Notifier as
|
|
33
|
-
import { i as
|
|
34
|
-
import { d as
|
|
35
|
-
import {
|
|
36
|
-
var R, H, b, m,
|
|
37
|
-
class
|
|
32
|
+
import { Notifier as rt } from "../notifier/index.js";
|
|
33
|
+
import { i as _ } from "../browser-0zX67oeU.js";
|
|
34
|
+
import { d as nt } from "../function-C10DGppn.js";
|
|
35
|
+
import { i as X } from "../object-DIPjdukP.js";
|
|
36
|
+
var R, H, b, m, l, v, A, w, P, E, K, tt;
|
|
37
|
+
class ht {
|
|
38
38
|
constructor(t, s) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
e(this, m) ? e(this, E).push(
|
|
39
|
+
n(this, K);
|
|
40
|
+
n(this, R, void 0);
|
|
41
|
+
n(this, H, void 0);
|
|
42
|
+
n(this, b, void 0);
|
|
43
|
+
n(this, m, void 0);
|
|
44
|
+
n(this, l, void 0);
|
|
45
|
+
n(this, v, void 0);
|
|
46
|
+
n(this, A, void 0);
|
|
47
|
+
n(this, w, null);
|
|
48
|
+
n(this, P, []);
|
|
49
|
+
n(this, E, []);
|
|
50
|
+
r(this, R, t), r(this, H, s), r(this, b, new URLPattern({ pathname: e(this, R) })), r(this, m, null), r(this, l, null), r(this, v, !1), r(this, A, null), _ && r(this, w, new MutationObserver((o) => {
|
|
51
|
+
o[0].addedNodes.forEach((h) => {
|
|
52
|
+
e(this, m) ? e(this, E).push(h) : e(this, P).push(h);
|
|
53
53
|
});
|
|
54
54
|
}));
|
|
55
55
|
}
|
|
@@ -60,10 +60,10 @@ class ct {
|
|
|
60
60
|
return e(this, b);
|
|
61
61
|
}
|
|
62
62
|
get isActive() {
|
|
63
|
-
return e(this,
|
|
63
|
+
return e(this, v);
|
|
64
64
|
}
|
|
65
65
|
get element() {
|
|
66
|
-
return e(this,
|
|
66
|
+
return e(this, l);
|
|
67
67
|
}
|
|
68
68
|
get outlet() {
|
|
69
69
|
return e(this, A);
|
|
@@ -72,71 +72,84 @@ class ct {
|
|
|
72
72
|
return this.urlPattern.test({ pathname: t });
|
|
73
73
|
}
|
|
74
74
|
render(t, s) {
|
|
75
|
-
return
|
|
76
|
-
var
|
|
77
|
-
if (e(this,
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
return D(this, null, function* () {
|
|
76
|
+
var o, f;
|
|
77
|
+
if (e(this, w).observe(document.head, {
|
|
78
|
+
childList: !0,
|
|
79
|
+
subtree: !0
|
|
80
|
+
}), e(this, m))
|
|
81
|
+
e(this, P).forEach((h) => {
|
|
82
|
+
document.head.appendChild(h);
|
|
80
83
|
});
|
|
81
84
|
else {
|
|
82
|
-
const
|
|
83
|
-
|
|
85
|
+
const h = yield e(this, H).call(this);
|
|
86
|
+
if (r(this, E, [...e(this, P)]), typeof h.default == "function" && (r(this, m, h.default), X(h.default))) {
|
|
87
|
+
const a = "e-" + ((o = e(this, m)) == null ? void 0 : o.name.toLowerCase());
|
|
88
|
+
customElements.get(a) || customElements.define(a, h.default);
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
|
-
if (yield
|
|
86
|
-
const
|
|
87
|
-
|
|
91
|
+
if (yield F(this, K, tt).call(this), e(this, m)) {
|
|
92
|
+
const h = e(this, b).exec({ pathname: s }), a = (h == null ? void 0 : h.pathname.groups) || {}, d = Object.fromEntries(
|
|
93
|
+
new URLSearchParams(location.search)
|
|
94
|
+
), u = {
|
|
95
|
+
pathnameParams: a,
|
|
88
96
|
searchParams: d
|
|
89
97
|
};
|
|
90
|
-
|
|
98
|
+
X(e(this, m)) ? r(this, l, new (e(this, m))(
|
|
99
|
+
u
|
|
100
|
+
)) : r(this, l, e(this, m).call(this, u)), t.appendChild(e(this, l)), r(this, A, e(this, l).querySelector("[data-outlet]") || ((f = e(this, l).shadowRoot) == null ? void 0 : f.querySelector("[data-outlet]")) || e(this, l).shadowRoot || e(this, l)), r(this, v, !0);
|
|
91
101
|
}
|
|
92
|
-
e(this,
|
|
102
|
+
e(this, w).disconnect();
|
|
93
103
|
});
|
|
94
104
|
}
|
|
95
105
|
close() {
|
|
96
106
|
var t;
|
|
97
|
-
e(this,
|
|
107
|
+
e(this, w).disconnect(), (t = e(this, l)) == null || t.remove(), r(this, v, !1), e(this, E).forEach((s) => document.head.removeChild(s)), r(this, E, []);
|
|
98
108
|
}
|
|
99
109
|
getAnchorElements() {
|
|
100
110
|
var s;
|
|
101
111
|
let t = [];
|
|
102
|
-
return e(this,
|
|
112
|
+
return e(this, l) && (t = [...e(this, l).querySelectorAll("a")]), (s = e(this, l)) != null && s.shadowRoot && (t = [
|
|
113
|
+
...t,
|
|
114
|
+
...e(this, l).shadowRoot.querySelectorAll("a")
|
|
115
|
+
]), t;
|
|
103
116
|
}
|
|
104
117
|
}
|
|
105
|
-
R = new WeakMap(), H = new WeakMap(), b = new WeakMap(), m = new WeakMap(),
|
|
106
|
-
return
|
|
107
|
-
const t = e(this,
|
|
118
|
+
R = new WeakMap(), H = new WeakMap(), b = new WeakMap(), m = new WeakMap(), l = new WeakMap(), v = new WeakMap(), A = new WeakMap(), w = new WeakMap(), P = new WeakMap(), E = new WeakMap(), K = new WeakSet(), tt = function() {
|
|
119
|
+
return D(this, null, function* () {
|
|
120
|
+
const t = e(this, P).filter((a) => a instanceof HTMLElement ? a.tagName === "STYLE" || a.tagName === "SCRIPT" || a.tagName === "LINK" : !1);
|
|
108
121
|
try {
|
|
109
|
-
for (var s =
|
|
110
|
-
const
|
|
122
|
+
for (var s = G(t), o, f, h; o = !(f = yield s.next()).done; o = !1) {
|
|
123
|
+
const a = f.value;
|
|
111
124
|
yield new Promise((d) => {
|
|
112
|
-
|
|
125
|
+
a.onload = () => {
|
|
113
126
|
d();
|
|
114
127
|
};
|
|
115
128
|
});
|
|
116
129
|
}
|
|
117
|
-
} catch (
|
|
118
|
-
|
|
130
|
+
} catch (f) {
|
|
131
|
+
h = [f];
|
|
119
132
|
} finally {
|
|
120
133
|
try {
|
|
121
|
-
|
|
134
|
+
o && (f = s.return) && (yield f.call(s));
|
|
122
135
|
} finally {
|
|
123
|
-
if (
|
|
124
|
-
throw
|
|
136
|
+
if (h)
|
|
137
|
+
throw h[0];
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
140
|
});
|
|
128
141
|
};
|
|
129
142
|
var O, p, S, x, I;
|
|
130
|
-
class
|
|
143
|
+
class at {
|
|
131
144
|
constructor(t, s) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
145
|
+
n(this, O, void 0);
|
|
146
|
+
n(this, p, void 0);
|
|
147
|
+
n(this, S, void 0);
|
|
148
|
+
n(this, x, void 0);
|
|
149
|
+
n(this, I, (t) => {
|
|
137
150
|
t.preventDefault(), e(this, O).navigate(e(this, S), e(this, x));
|
|
138
151
|
});
|
|
139
|
-
|
|
152
|
+
r(this, O, t), r(this, p, s), r(this, S, e(this, p).getAttribute("href") || "/"), r(this, x, e(this, p).getAttribute("data-history-action") || "push"), e(this, p).addEventListener("click", e(this, I)), location.pathname === e(this, S) && e(this, p).classList.add("current");
|
|
140
153
|
}
|
|
141
154
|
destroy() {
|
|
142
155
|
e(this, p).removeEventListener("click", e(this, I)), e(this, p).classList.remove("current");
|
|
@@ -144,28 +157,28 @@ class lt {
|
|
|
144
157
|
}
|
|
145
158
|
O = new WeakMap(), p = new WeakMap(), S = new WeakMap(), x = new WeakMap(), I = new WeakMap();
|
|
146
159
|
globalThis.URLPattern = ot;
|
|
147
|
-
var k, N, g, C, M, L, q, j,
|
|
160
|
+
var k, N, g, C, M, L, q, j, W, Y, et, $;
|
|
148
161
|
const U = class U {
|
|
149
162
|
constructor(t) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
n(this, Y);
|
|
164
|
+
n(this, k, null);
|
|
165
|
+
n(this, N, void 0);
|
|
166
|
+
n(this, g, []);
|
|
167
|
+
n(this, C, null);
|
|
168
|
+
n(this, M, []);
|
|
169
|
+
n(this, L, void 0);
|
|
170
|
+
n(this, q, null);
|
|
171
|
+
n(this, j, new rt());
|
|
172
|
+
B(this, "preprocessor");
|
|
173
|
+
B(this, "postprocessor");
|
|
174
|
+
n(this, W, nt(() => {
|
|
162
175
|
const t = (s) => s.split("/").length;
|
|
163
|
-
|
|
176
|
+
r(this, g, e(this, g).sort((s, o) => t(s.pattern) - t(o.pattern))), this.navigate(location.pathname.replace(e(this, N), ""));
|
|
164
177
|
}, 0));
|
|
165
|
-
|
|
178
|
+
n(this, $, (t) => {
|
|
166
179
|
t.state && this.navigate(t.state, "none");
|
|
167
180
|
});
|
|
168
|
-
|
|
181
|
+
r(this, N, (t == null ? void 0 : t.base) || ""), U.active = this, _ && (r(this, k, (t == null ? void 0 : t.rootElement) || document.body), addEventListener("popstate", e(this, $)));
|
|
169
182
|
}
|
|
170
183
|
get currentPathname() {
|
|
171
184
|
return e(this, q);
|
|
@@ -180,87 +193,73 @@ const U = class U {
|
|
|
180
193
|
return e(this, j).subscribe(t);
|
|
181
194
|
}
|
|
182
195
|
defineRoute(t, s) {
|
|
183
|
-
const
|
|
184
|
-
e(this, g).push(
|
|
196
|
+
const o = new ht(t, s);
|
|
197
|
+
e(this, g).push(o), e(this, W).call(this);
|
|
185
198
|
}
|
|
186
199
|
navigate(t, s = "push") {
|
|
187
|
-
return
|
|
188
|
-
var
|
|
200
|
+
return D(this, null, function* () {
|
|
201
|
+
var u, J;
|
|
189
202
|
if (e(this, L) === t || e(this, q) === t)
|
|
190
203
|
return;
|
|
191
|
-
U.active = this,
|
|
192
|
-
const
|
|
193
|
-
(
|
|
194
|
-
),
|
|
204
|
+
U.active = this, r(this, L, t);
|
|
205
|
+
const o = e(this, g).filter((c) => c.isActive), f = e(this, g).filter(
|
|
206
|
+
(c) => !o.includes(c) && c.testPathname(t)
|
|
207
|
+
), h = o.filter((c) => !c.testPathname(t)), a = o.filter((c) => c.testPathname(t));
|
|
195
208
|
let d = !0;
|
|
196
209
|
if (this.preprocessor)
|
|
197
210
|
try {
|
|
198
|
-
yield new Promise((
|
|
199
|
-
var
|
|
200
|
-
(
|
|
211
|
+
yield new Promise((c, y) => {
|
|
212
|
+
var Q;
|
|
213
|
+
(Q = this.preprocessor) == null || Q.call(this, { pathname: t, resolve: c, reject: y });
|
|
201
214
|
});
|
|
202
|
-
} catch (
|
|
203
|
-
|
|
215
|
+
} catch (c) {
|
|
216
|
+
c ? console.error(c) : console.log("Route change canceled"), d = !1;
|
|
204
217
|
}
|
|
205
218
|
if (d && e(this, L) === t) {
|
|
206
|
-
|
|
219
|
+
r(this, C, a[a.length - 1]), h.forEach((y) => {
|
|
207
220
|
y.close();
|
|
208
|
-
}),
|
|
221
|
+
}), r(this, q, t);
|
|
209
222
|
try {
|
|
210
|
-
for (var T =
|
|
211
|
-
const y =
|
|
212
|
-
yield y.render(
|
|
223
|
+
for (var T = G(f), vt, wt, Pt; vt = !(wt = yield T.next()).done; vt = !1) {
|
|
224
|
+
const y = wt.value;
|
|
225
|
+
yield y.render(
|
|
226
|
+
((u = e(this, C)) == null ? void 0 : u.outlet) || e(this, k),
|
|
227
|
+
t
|
|
228
|
+
), r(this, C, y);
|
|
213
229
|
}
|
|
214
|
-
} catch (
|
|
215
|
-
|
|
230
|
+
} catch (wt) {
|
|
231
|
+
Pt = [wt];
|
|
216
232
|
} finally {
|
|
217
233
|
try {
|
|
218
|
-
|
|
234
|
+
vt && (wt = T.return) && (yield wt.call(T));
|
|
219
235
|
} finally {
|
|
220
|
-
if (
|
|
221
|
-
throw
|
|
236
|
+
if (Pt)
|
|
237
|
+
throw Pt[0];
|
|
222
238
|
}
|
|
223
239
|
}
|
|
224
|
-
const
|
|
225
|
-
s === "push" ? history.pushState(
|
|
240
|
+
const c = e(this, N) + t + location.search;
|
|
241
|
+
s === "push" ? history.pushState(c, "", c) : s === "replace" && history.replaceState(c, "", c), F(this, Y, et).call(this), (J = this.postprocessor) == null || J.call(this, { pathname: t }), e(this, j).notify({ pathname: t });
|
|
226
242
|
}
|
|
227
243
|
});
|
|
228
244
|
}
|
|
229
245
|
};
|
|
230
|
-
k = new WeakMap(), N = new WeakMap(), g = new WeakMap(), C = new WeakMap(), M = new WeakMap(), L = new WeakMap(), q = new WeakMap(), j = new WeakMap(),
|
|
231
|
-
const t = e(this, g).filter((
|
|
246
|
+
k = new WeakMap(), N = new WeakMap(), g = new WeakMap(), C = new WeakMap(), M = new WeakMap(), L = new WeakMap(), q = new WeakMap(), j = new WeakMap(), W = new WeakMap(), Y = new WeakSet(), et = function() {
|
|
247
|
+
const t = e(this, g).filter((o) => o.isActive), s = Array.from(
|
|
232
248
|
new Set(
|
|
233
249
|
[
|
|
234
250
|
...e(this, k).querySelectorAll("a"),
|
|
235
|
-
...t.map((
|
|
236
|
-
].filter((
|
|
237
|
-
var
|
|
238
|
-
return (
|
|
251
|
+
...t.map((o) => o.getAnchorElements()).flat()
|
|
252
|
+
].filter((o) => {
|
|
253
|
+
var f;
|
|
254
|
+
return (f = o.getAttribute("href")) == null ? void 0 : f.startsWith("/");
|
|
239
255
|
})
|
|
240
256
|
)
|
|
241
257
|
);
|
|
242
|
-
e(this, M).forEach((
|
|
243
|
-
|
|
244
|
-
}),
|
|
245
|
-
},
|
|
246
|
-
let
|
|
247
|
-
var B, D;
|
|
248
|
-
class Pt extends ht {
|
|
249
|
-
constructor(s) {
|
|
250
|
-
super();
|
|
251
|
-
o(this, B, void 0);
|
|
252
|
-
o(this, D, void 0);
|
|
253
|
-
n(this, B, s.pathnameParams), n(this, D, s.searchParams);
|
|
254
|
-
}
|
|
255
|
-
get pathnameParams() {
|
|
256
|
-
return e(this, B);
|
|
257
|
-
}
|
|
258
|
-
get searchParams() {
|
|
259
|
-
return e(this, D);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
B = new WeakMap(), D = new WeakMap();
|
|
258
|
+
e(this, M).forEach((o) => {
|
|
259
|
+
o.destroy();
|
|
260
|
+
}), r(this, M, s.map((o) => new at(this, o)));
|
|
261
|
+
}, $ = new WeakMap(), B(U, "active");
|
|
262
|
+
let Z = U;
|
|
263
263
|
export {
|
|
264
|
-
|
|
265
|
-
_ as Router
|
|
264
|
+
Z as Router
|
|
266
265
|
};
|
package/lib/store/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var g=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)};var u=(e,r,t)=>(g(e,r,"read from private field"),t?t.call(e):r.get(e)),l=(e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)},v=(e,r,t,s)=>(g(e,r,"write to private field"),s?s.call(e,t):r.set(e,t),t);var S=(e,r,t,s)=>({set _(o){v(e,r,o,t)},get _(){return u(e,r,s)}});var y=(e,r,t)=>new Promise((s,o)=>{var R=i=>{try{p(t.next(i))}catch(m){o(m)}},C=i=>{try{p(t.throw(i))}catch(m){o(m)}},p=i=>i.done?s(i.value):Promise.resolve(i.value).then(R,C);p((t=t.apply(e,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../Store-D0_rDIsE.cjs"),A=require("../Derived-SjPdLJiZ.cjs"),d=require("../Composed-C2Vv1xxR.cjs");var c,a,n;class D extends d.Resource{constructor(t,s,o=100){super(t,s,{manualControl:!0,skipSubscribeNotification:!0});l(this,c,void 0);l(this,a,void 0);l(this,n,0);v(this,a,o)}get step(){return u(this,n)}startAccumulating(){v(this,c,setInterval(()=>y(this,null,function*(){++S(this,n)._,this.refetch()}),u(this,a)))}stopAccumulating(){clearInterval(u(this,c))}close(){super.close(),this.stopAccumulating()}}c=new WeakMap,a=new WeakMap,n=new WeakMap;exports.Store=h.Store;exports.activeStores=h.activeStores;exports.storeRegistry=h.storeRegistry;exports.Derived=A.Derived;exports.Composed=d.Composed;exports.DerivedArray=d.DerivedArray;exports.Resource=d.Resource;exports.CumulativeResource=D;
|