aptechka 0.82.3 → 0.82.5
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/jsx/ComponentElement.d.ts +1 -0
- package/lib/jsx/index.cjs +1 -1
- package/lib/jsx/index.js +2 -2
- package/lib/jsx/plugins/hmr.d.ts +13 -0
- package/lib/jsx/type.d.ts +4 -0
- package/lib/render-B3Hf-O7M.js +205 -0
- package/lib/render-BWjKu0M_.cjs +1 -0
- package/lib/router/Route.d.ts +9 -0
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +152 -137
- package/package.json +4 -5
- package/lib/render-CiA0mn5V.js +0 -205
- package/lib/render-DBQUdpsp.cjs +0 -1
|
@@ -5,6 +5,7 @@ export declare const activeComponent: {
|
|
|
5
5
|
};
|
|
6
6
|
export declare class ComponentElement extends HTMLElement {
|
|
7
7
|
#private;
|
|
8
|
+
__props__: any;
|
|
8
9
|
constructor();
|
|
9
10
|
addConnectCallback(callback: ComponentConnectCallback): void;
|
|
10
11
|
addDisconnectCallback(callback: ComponentDisconnectCallback): void;
|
package/lib/jsx/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var d=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var l=(t,e,o)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,f=(t,e)=>{for(var o in e||(e={}))p.call(e,o)&&l(t,o,e[o]);if(d)for(var o of d(e))v.call(e,o)&&l(t,o,e[o]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../render-
|
|
1
|
+
"use strict";var y=Object.defineProperty;var d=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var l=(t,e,o)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,f=(t,e)=>{for(var o in e||(e={}))p.call(e,o)&&l(t,o,e[o]);if(d)for(var o of d(e))v.call(e,o)&&l(t,o,e[o]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../render-BWjKu0M_.cjs"),h=require("../string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const D=require("../Store-1JrMCgdX.cjs"),a=require("../Composed-CSeUTRCg.cjs"),S=require("../DerivedArray-B8A0-8uT.cjs");function w(){return{value:null}}function m(t){n.activeComponent.current.addConnectCallback(t)}function R(t){n.activeComponent.current.addDisconnectCallback(t)}function A(t){const e=n.activeComponent.current.attachInternals();return t==null||t(e),e}function x(t,e){const o=n.activeComponent.current.attachShadow(f({mode:"open"},t));return e==null||e(o),o}function C(t){const e=new CSSStyleSheet;return e.replaceSync(t),e}function g(t){let e="";const o=(s,r)=>{r&&(e+=`${r} {`);for(const[u,c]of Object.entries(s))typeof c=="object"&&c!==null?o(c,u):e+=`${h.camelToKebab(u)}: ${c};`;r&&(e+="}")};return o(t),e}function T(t,e){const o=C(e),s=[];for(const r of t.adoptedStyleSheets)Array.from(o.cssRules).filter(c=>!Array.from(r.cssRules).some(i=>i.cssText===c.cssText)).forEach(c=>{const i=r.insertRule(c.cssText);s.push(()=>r.deleteRule(i))});return()=>s.forEach(r=>r())}function b(t){const e=document.createElement("style");return e.textContent=t,document.head.appendChild(e),()=>e.remove()}function q(t){const e=g(t);if(n.activeComponent.current.shadowRoot){n.activeComponent.current.shadowRoot.adoptedStyleSheets=[...n.activeComponent.current.shadowRoot.adoptedStyleSheets,C(e)];return}m(o=>{const s=o.getRootNode();if(s===document){if(!Array.from(document.head.querySelectorAll("style")).find(u=>u.textContent===e))return b(e)}else if(s instanceof ShadowRoot)return T(s,e)})}function j(...t){const e=new D.Store(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function E(...t){const e=new a.Derived(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function K(...t){const e=new S.DerivedArray(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function I(...t){const e=new S.DerivedKeyedArray(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function O(...t){const e=new a.Resource(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}function $(...t){const e=new a.Composed(...t);return n.activeComponent.current&&n.activeComponent.current.addDisconnectCallback(()=>{e.close()}),e}exports.Fragment=n.Fragment;exports.h=n.h;exports.render=n.render;exports.useComposedStore=$;exports.useConnect=m;exports.useDerivedArrayStore=K;exports.useDerivedKeyedArrayStore=I;exports.useDerivedStore=E;exports.useDisconnect=R;exports.useInternals=A;exports.useRef=w;exports.useResourceStore=O;exports.useShadow=x;exports.useStore=j;exports.useStylesheet=q;
|
package/lib/jsx/index.js
CHANGED
|
@@ -9,8 +9,8 @@ var d = (t, e, n) => e in t ? S(t, e, { enumerable: !0, configurable: !0, writab
|
|
|
9
9
|
y.call(e, n) && d(t, n, e[n]);
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { a as r } from "../render-
|
|
13
|
-
import { F as V, h as W, r as X } from "../render-
|
|
12
|
+
import { a as r } from "../render-B3Hf-O7M.js";
|
|
13
|
+
import { F as V, h as W, r as X } from "../render-B3Hf-O7M.js";
|
|
14
14
|
import { c as h } from "../string-BlMQbe8b.js";
|
|
15
15
|
import "construct-style-sheets-polyfill";
|
|
16
16
|
import "../index-LReFyN6i.js";
|
package/lib/jsx/type.d.ts
CHANGED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
var O = Object.defineProperty, R = Object.defineProperties;
|
|
2
|
+
var q = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var _ = Object.getOwnPropertySymbols;
|
|
4
|
+
var B = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var L = (r) => {
|
|
6
|
+
throw TypeError(r);
|
|
7
|
+
};
|
|
8
|
+
var w = (r, s, t) => s in r ? O(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t, y = (r, s) => {
|
|
9
|
+
for (var t in s || (s = {}))
|
|
10
|
+
B.call(s, t) && w(r, t, s[t]);
|
|
11
|
+
if (_)
|
|
12
|
+
for (var t of _(s))
|
|
13
|
+
H.call(s, t) && w(r, t, s[t]);
|
|
14
|
+
return r;
|
|
15
|
+
}, N = (r, s) => R(r, q(s));
|
|
16
|
+
var D = (r, s, t) => s.has(r) || L("Cannot " + t);
|
|
17
|
+
var u = (r, s, t) => (D(r, s, "read from private field"), t ? t.call(r) : s.get(r)), m = (r, s, t) => s.has(r) ? L("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), C = (r, s, t, o) => (D(r, s, "write to private field"), o ? o.call(r, t) : s.set(r, t), t);
|
|
18
|
+
import { S as l } from "./Store-CgQ3ReoB.js";
|
|
19
|
+
import { c as K } from "./string-BlMQbe8b.js";
|
|
20
|
+
import "construct-style-sheets-polyfill";
|
|
21
|
+
import "./index-LReFyN6i.js";
|
|
22
|
+
import { connector as M } from "./connector/index.js";
|
|
23
|
+
import { a as P } from "./DerivedArray-DG9iR0mf.js";
|
|
24
|
+
const J = { current: null };
|
|
25
|
+
var b, p;
|
|
26
|
+
class X extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
m(this, b, []);
|
|
30
|
+
m(this, p, []);
|
|
31
|
+
J.current = this;
|
|
32
|
+
}
|
|
33
|
+
addConnectCallback(t) {
|
|
34
|
+
u(this, b).push(t);
|
|
35
|
+
}
|
|
36
|
+
addDisconnectCallback(t) {
|
|
37
|
+
u(this, p).push(t);
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
u(this, b).forEach((t) => {
|
|
41
|
+
const o = t(this);
|
|
42
|
+
o && u(this, p).push(o);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
u(this, p).forEach((t) => {
|
|
47
|
+
t(this);
|
|
48
|
+
}), C(this, b, []), C(this, p, []);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
b = new WeakMap(), p = new WeakMap();
|
|
52
|
+
function E(r, s, t) {
|
|
53
|
+
const o = s.subscribe((c) => {
|
|
54
|
+
t(c);
|
|
55
|
+
});
|
|
56
|
+
M.subscribe(r, {
|
|
57
|
+
disconnectCallback: () => {
|
|
58
|
+
o();
|
|
59
|
+
},
|
|
60
|
+
maxWaitSec: 20,
|
|
61
|
+
unsubscribeAfterDisconnect: !0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function W(r, s) {
|
|
65
|
+
s && (s instanceof l ? E(r, s, (t) => {
|
|
66
|
+
t.previous && r.classList.remove(t.previous.toString()), t.current && r.classList.add(t.current.toString());
|
|
67
|
+
}) : typeof s == "object" && !Array.isArray(s) ? Object.entries(s).forEach(([t, o]) => {
|
|
68
|
+
o instanceof l ? E(r, o, (c) => {
|
|
69
|
+
r.classList.toggle(t, !!c.current);
|
|
70
|
+
}) : o && r.classList.add(t);
|
|
71
|
+
}) : Array.isArray(s) ? s.forEach((t) => {
|
|
72
|
+
typeof t == "string" ? r.classList.add(t) : W(r, t);
|
|
73
|
+
}) : s.toString().split(" ").map((t) => r.classList.add(t.trim())));
|
|
74
|
+
}
|
|
75
|
+
function $(r, s) {
|
|
76
|
+
s && (typeof s == "object" ? Object.entries(s).forEach(([t, o]) => {
|
|
77
|
+
o instanceof l ? E(r, o, (c) => {
|
|
78
|
+
var n;
|
|
79
|
+
r.style[t] = (n = c.current) == null ? void 0 : n.toString();
|
|
80
|
+
}) : (typeof o == "number" || typeof o == "string" || typeof o == "boolean") && (r.style[t] = o.toString());
|
|
81
|
+
}) : typeof s == "string" && (r.style = s));
|
|
82
|
+
}
|
|
83
|
+
function A(r, s, t) {
|
|
84
|
+
s === "ref" && t ? Array.isArray(t) ? t.forEach((o) => {
|
|
85
|
+
typeof o == "object" && "value" in o && (o.value = r);
|
|
86
|
+
}) : typeof t == "object" && "value" in t && (t.value = r) : s === "className" || s === "class" ? W(r, t) : s === "style" ? $(r, t) : typeof t == "number" ? s === "tabIndex" ? r.setAttribute("tabindex", t.toString()) : A(r, s, t.toString()) : typeof t == "string" ? s === "htmlFor" ? r.setAttribute("for", t) : r.setAttribute(s, t) : typeof t == "boolean" ? t ? r.setAttribute(s, "") : r.removeAttribute(s) : t instanceof l && E(r, t, (o) => {
|
|
87
|
+
s in r ? r[s] = o.current : A(r, s, o.current);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function z(r, s) {
|
|
91
|
+
for (const [t, o] of Object.entries(s != null ? s : {}))
|
|
92
|
+
typeof o == "function" && t.startsWith("on") ? r.addEventListener(
|
|
93
|
+
t.replace("on", "").toLowerCase(),
|
|
94
|
+
o
|
|
95
|
+
) : A(r, t, o);
|
|
96
|
+
}
|
|
97
|
+
function I(r) {
|
|
98
|
+
const s = [];
|
|
99
|
+
return r.forEach((t) => {
|
|
100
|
+
t != null && (typeof t == "number" ? s.push(t.toString()) : Array.isArray(t) ? t.forEach((o) => {
|
|
101
|
+
s.push(...I(o));
|
|
102
|
+
}) : s.push(t));
|
|
103
|
+
}), s;
|
|
104
|
+
}
|
|
105
|
+
function Q(r, s) {
|
|
106
|
+
const t = [...r.childNodes].filter((e) => e.__storeId === s.id), o = s.current, c = Array.isArray(o) ? o : [o], n = [];
|
|
107
|
+
if (c.forEach((e) => {
|
|
108
|
+
let i = null;
|
|
109
|
+
typeof e == "boolean" || typeof e == "number" || typeof e == "string" ? i = document.createTextNode(e.toString()) : e instanceof Node && (i = e), i && (i.__storeId = s.id, n.push(i));
|
|
110
|
+
}), s instanceof P) {
|
|
111
|
+
const e = [];
|
|
112
|
+
n.forEach((i, f) => {
|
|
113
|
+
const a = t.find(
|
|
114
|
+
(h) => h.__key === i.__key
|
|
115
|
+
);
|
|
116
|
+
a ? a.isEqualNode(i) ? e.push(a) : (a.replaceWith(i), e.push(i)) : (e.push(i), r.appendChild(i));
|
|
117
|
+
}), t.forEach((i) => {
|
|
118
|
+
e.includes(i) || i.remove();
|
|
119
|
+
});
|
|
120
|
+
} else
|
|
121
|
+
n.forEach((e, i) => {
|
|
122
|
+
var a;
|
|
123
|
+
const f = t[i];
|
|
124
|
+
if (f)
|
|
125
|
+
f.isEqualNode(e) || (f.replaceWith(e), t[i] = e);
|
|
126
|
+
else {
|
|
127
|
+
const h = t[t.length - 1];
|
|
128
|
+
h ? (a = h.parentNode) == null || a.insertBefore(
|
|
129
|
+
e,
|
|
130
|
+
h.nextSibling
|
|
131
|
+
) : r.appendChild(e);
|
|
132
|
+
}
|
|
133
|
+
}), t.slice(n.length).forEach((e) => {
|
|
134
|
+
e.remove();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
class g {
|
|
138
|
+
constructor(s, t, o) {
|
|
139
|
+
this.tag = s, this.attributes = t, this.children = o;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
class S {
|
|
143
|
+
constructor(s, t, o) {
|
|
144
|
+
this.tag = s, this.attributes = t, this.children = o;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function d(r, s, t, o = !1) {
|
|
148
|
+
const c = I(t);
|
|
149
|
+
z(r, s), c.forEach((n) => {
|
|
150
|
+
if (n instanceof l)
|
|
151
|
+
E(r, n, () => {
|
|
152
|
+
Q(r, n);
|
|
153
|
+
});
|
|
154
|
+
else if (n instanceof g)
|
|
155
|
+
n.tag === "shadow" && r.shadowRoot ? d(
|
|
156
|
+
r.shadowRoot,
|
|
157
|
+
n.attributes,
|
|
158
|
+
n.children
|
|
159
|
+
) : d(r, n.attributes, n.children);
|
|
160
|
+
else if (n instanceof S) {
|
|
161
|
+
let e = null;
|
|
162
|
+
n.tag === "svg" ? (e = document.createElementNS(
|
|
163
|
+
"http://www.w3.org/2000/svg",
|
|
164
|
+
"svg"
|
|
165
|
+
), d(e, n.attributes, n.children, !0)) : e = o ? document.createElementNS("http://www.w3.org/2000/svg", n.tag) : document.createElement(n.tag), d(e, n.attributes, n.children, o), r.append(e);
|
|
166
|
+
} else
|
|
167
|
+
r.append(n);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function U(r, s, ...t) {
|
|
171
|
+
var o;
|
|
172
|
+
if (typeof r == "string")
|
|
173
|
+
return r === "component" ? new g(r, s, t) : r === "shadow" ? new g(r, s, t) : new S(r, s, t);
|
|
174
|
+
{
|
|
175
|
+
if (r === F)
|
|
176
|
+
return F(t);
|
|
177
|
+
if (r.template)
|
|
178
|
+
return r(y({}, s));
|
|
179
|
+
const c = `e-${K(r.name)}`;
|
|
180
|
+
let n = customElements.get(c);
|
|
181
|
+
n || (n = (o = class extends X {
|
|
182
|
+
constructor() {
|
|
183
|
+
super();
|
|
184
|
+
}
|
|
185
|
+
}, o.formAssociated = r.formAssociated, o), customElements.define(c, n));
|
|
186
|
+
const e = new n(), i = N(y({}, s), {
|
|
187
|
+
children: t
|
|
188
|
+
}), f = r(i);
|
|
189
|
+
return __JSX_HMR_DEV__ && (e.__props__ = i), (f instanceof g || f instanceof S) && (f != null && f.children || f.attributes) && d(e, f.attributes, f.children), e;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function F(r) {
|
|
193
|
+
const s = document.createDocumentFragment();
|
|
194
|
+
return d(s, void 0, r), s;
|
|
195
|
+
}
|
|
196
|
+
function T(r, s, t) {
|
|
197
|
+
const o = /* @__PURE__ */ U(s, y({}, t));
|
|
198
|
+
return r.append(o), o;
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
F,
|
|
202
|
+
J as a,
|
|
203
|
+
U as h,
|
|
204
|
+
T as r
|
|
205
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var R=Object.defineProperty,B=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var q=r=>{throw TypeError(r)};var L=(r,e,t)=>e in r?R(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e)=>{for(var t in e||(e={}))K.call(e,t)&&L(r,t,e[t]);if(w)for(var t of w(e))M.call(e,t)&&L(r,t,e[t]);return r},N=(r,e)=>B(r,H(e));var D=(r,e,t)=>e.has(r)||q("Cannot "+t);var p=(r,e,t)=>(D(r,e,"read from private field"),t?t.call(r):e.get(r)),S=(r,e,t)=>e.has(r)?q("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),C=(r,e,t,s)=>(D(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);const l=require("./Store-1JrMCgdX.cjs"),P=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");require("./index-CKTweR3M.cjs");const J=require("./connector/index.cjs"),X=require("./DerivedArray-B8A0-8uT.cjs"),F={current:null};var b,u;class $ extends HTMLElement{constructor(){super();S(this,b,[]);S(this,u,[]);F.current=this}addConnectCallback(t){p(this,b).push(t)}addDisconnectCallback(t){p(this,u).push(t)}connectedCallback(){p(this,b).forEach(t=>{const s=t(this);s&&p(this,u).push(s)})}disconnectedCallback(){p(this,u).forEach(t=>{t(this)}),C(this,b,[]),C(this,u,[])}}b=new WeakMap,u=new WeakMap;function g(r,e,t){const s=e.subscribe(f=>{t(f)});J.connector.subscribe(r,{disconnectCallback:()=>{s()},maxWaitSec:20,unsubscribeAfterDisconnect:!0})}function W(r,e){e&&(e instanceof l.Store?g(r,e,t=>{t.previous&&r.classList.remove(t.previous.toString()),t.current&&r.classList.add(t.current.toString())}):typeof e=="object"&&!Array.isArray(e)?Object.entries(e).forEach(([t,s])=>{s instanceof l.Store?g(r,s,f=>{r.classList.toggle(t,!!f.current)}):s&&r.classList.add(t)}):Array.isArray(e)?e.forEach(t=>{typeof t=="string"?r.classList.add(t):W(r,t)}):e.toString().split(" ").map(t=>r.classList.add(t.trim())))}function z(r,e){e&&(typeof e=="object"?Object.entries(e).forEach(([t,s])=>{s instanceof l.Store?g(r,s,f=>{var o;r.style[t]=(o=f.current)==null?void 0:o.toString()}):(typeof s=="number"||typeof s=="string"||typeof s=="boolean")&&(r.style[t]=s.toString())}):typeof e=="string"&&(r.style=e))}function A(r,e,t){e==="ref"&&t?Array.isArray(t)?t.forEach(s=>{typeof s=="object"&&"value"in s&&(s.value=r)}):typeof t=="object"&&"value"in t&&(t.value=r):e==="className"||e==="class"?W(r,t):e==="style"?z(r,t):typeof t=="number"?e==="tabIndex"?r.setAttribute("tabindex",t.toString()):A(r,e,t.toString()):typeof t=="string"?e==="htmlFor"?r.setAttribute("for",t):r.setAttribute(e,t):typeof t=="boolean"?t?r.setAttribute(e,""):r.removeAttribute(e):t instanceof l.Store&&g(r,t,s=>{e in r?r[e]=s.current:A(r,e,s.current)})}function Q(r,e){for(const[t,s]of Object.entries(e!=null?e:{}))typeof s=="function"&&t.startsWith("on")?r.addEventListener(t.replace("on","").toLowerCase(),s):A(r,t,s)}function I(r){const e=[];return r.forEach(t=>{t!=null&&(typeof t=="number"?e.push(t.toString()):Array.isArray(t)?t.forEach(s=>{e.push(...I(s))}):e.push(t))}),e}function U(r,e){const t=[...r.childNodes].filter(n=>n.__storeId===e.id),s=e.current,f=Array.isArray(s)?s:[s],o=[];if(f.forEach(n=>{let i=null;typeof n=="boolean"||typeof n=="number"||typeof n=="string"?i=document.createTextNode(n.toString()):n instanceof Node&&(i=n),i&&(i.__storeId=e.id,o.push(i))}),e instanceof X.DerivedKeyedArray){const n=[];o.forEach((i,c)=>{const a=t.find(h=>h.__key===i.__key);a?a.isEqualNode(i)?n.push(a):(a.replaceWith(i),n.push(i)):(n.push(i),r.appendChild(i))}),t.forEach(i=>{n.includes(i)||i.remove()})}else o.forEach((n,i)=>{var a;const c=t[i];if(c)c.isEqualNode(n)||(c.replaceWith(n),t[i]=n);else{const h=t[t.length-1];h?(a=h.parentNode)==null||a.insertBefore(n,h.nextSibling):r.appendChild(n)}}),t.slice(o.length).forEach(n=>{n.remove()})}class E{constructor(e,t,s){this.tag=e,this.attributes=t,this.children=s}}class _{constructor(e,t,s){this.tag=e,this.attributes=t,this.children=s}}function d(r,e,t,s=!1){const f=I(t);Q(r,e),f.forEach(o=>{if(o instanceof l.Store)g(r,o,()=>{U(r,o)});else if(o instanceof E)o.tag==="shadow"&&r.shadowRoot?d(r.shadowRoot,o.attributes,o.children):d(r,o.attributes,o.children);else if(o instanceof _){let n=null;o.tag==="svg"?(n=document.createElementNS("http://www.w3.org/2000/svg","svg"),d(n,o.attributes,o.children,!0)):n=s?document.createElementNS("http://www.w3.org/2000/svg",o.tag):document.createElement(o.tag),d(n,o.attributes,o.children,s),r.append(n)}else r.append(o)})}function O(r,e,...t){var s;if(typeof r=="string")return r==="component"?new E(r,e,t):r==="shadow"?new E(r,e,t):new _(r,e,t);{if(r===m)return m(t);if(r.template)return r(y({},e));const f=`e-${P.camelToKebab(r.name)}`;let o=customElements.get(f);o||(o=(s=class extends ${constructor(){super()}},s.formAssociated=r.formAssociated,s),customElements.define(f,o));const n=new o,i=N(y({},e),{children:t}),c=r(i);return __JSX_HMR_DEV__&&(n.__props__=i),(c instanceof E||c instanceof _)&&(c!=null&&c.children||c.attributes)&&d(n,c.attributes,c.children),n}}function m(r){const e=document.createDocumentFragment();return d(e,void 0,r),e}function V(r,e,t){const s=O(e,y({},t));return r.append(s),s}exports.Fragment=m;exports.activeComponent=F;exports.h=O;exports.render=V;
|
package/lib/router/Route.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export type HeadNode = HTMLStyleElement | HTMLScriptElement | HTMLLinkElement;
|
|
|
6
6
|
export interface RouteParameters {
|
|
7
7
|
urlPatternResult: URLPatternResult;
|
|
8
8
|
}
|
|
9
|
+
export interface RouteEvents {
|
|
10
|
+
__hmrInstanceReplace: CustomEvent<{
|
|
11
|
+
element: HTMLElement;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
9
14
|
export declare class Route {
|
|
10
15
|
#private;
|
|
11
16
|
constructor(pattern: string, module: RouteModule);
|
|
@@ -17,3 +22,7 @@ export declare class Route {
|
|
|
17
22
|
render(container: Element | ShadowRoot, url: URL): Promise<void>;
|
|
18
23
|
close(): void;
|
|
19
24
|
}
|
|
25
|
+
declare global {
|
|
26
|
+
interface HTMLElementEventMap extends RouteEvents {
|
|
27
|
+
}
|
|
28
|
+
}
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ue=Object.defineProperty,ce=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var Y=i=>{throw TypeError(i)};var W=(i,e,s)=>e in i?ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,$=(i,e)=>{for(var s in e||(e={}))me.call(e,s)&&W(i,s,e[s]);if(K)for(var s of K(e))fe.call(e,s)&&W(i,s,e[s]);return i},G=(i,e)=>ce(i,de(e));var U=(i,e,s)=>e.has(i)||Y("Cannot "+s);var t=(i,e,s)=>(U(i,e,"read from private field"),s?s.call(i):e.get(i)),n=(i,e,s)=>e.has(i)?Y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),h=(i,e,s,r)=>(U(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),d=(i,e,s)=>(U(i,e,"access private method"),s);var J=(i,e,s,r)=>({set _(a){h(i,e,a,s)},get _(){return t(i,e,r)}});var R=(i,e,s)=>new Promise((r,a)=>{var o=f=>{try{g(s.next(f))}catch(N){a(N)}},C=f=>{try{g(s.throw(f))}catch(N){a(N)}},g=f=>f.done?r(f.value):Promise.resolve(f.value).then(o,C);g((s=s.apply(i,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pe=require("../history/index.cjs"),ge=require("../LocalLinks-Bua7BGRF.cjs"),Re=require("../PageAnnouncerElement-C4k2kDJ5.cjs"),we=require("../PageScroll-C7QBpx0G.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const Q=require("../url-CPgw9bd5.cjs"),ve=require("urlpattern-polyfill"),Pe=require("../render-BWjKu0M_.cjs"),be=require("../object-baN9pgbU.cjs");var S,H,q,p,u,T,M,v,P,b,l,X,Z,ee,te,se,ie,re,ae,B,y;class ye{constructor(e,s){n(this,l);n(this,S);n(this,H);n(this,q);n(this,p,null);n(this,u,null);n(this,T,!1);n(this,M,null);n(this,v);n(this,P,[]);n(this,b,[]);n(this,y,e=>{t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),h(this,u,e.detail.element),t(this,u).addEventListener("__hmrInstanceReplace",t(this,y))});h(this,S,e),h(this,H,s),h(this,q,new URLPattern({pathname:t(this,S)})),h(this,v,new MutationObserver(d(this,l,re).bind(this)))}get pattern(){return t(this,S)}get isActive(){return t(this,T)}get element(){return t(this,u)}get nest(){return t(this,M)}testPathname(e){return t(this,q).test({pathname:e})}render(e,s){return R(this,null,function*(){t(this,v).observe(document.head,{childList:!0,subtree:!0}),t(this,p)?d(this,l,Z).call(this):yield d(this,l,X).call(this),yield d(this,l,ae).call(this),t(this,p)&&(yield d(this,l,ee).call(this,e,s)),t(this,v).disconnect()})}close(){d(this,l,se).call(this)}}S=new WeakMap,H=new WeakMap,q=new WeakMap,p=new WeakMap,u=new WeakMap,T=new WeakMap,M=new WeakMap,v=new WeakMap,P=new WeakMap,b=new WeakMap,l=new WeakSet,X=function(){return R(this,null,function*(){const e=yield t(this,H).call(this);h(this,b,[...t(this,P)]),typeof e.default=="function"&&h(this,p,e.default)})},Z=function(){t(this,P).forEach(e=>{document.head.appendChild(e.cloneNode(!0))})},ee=function(e,s){return R(this,null,function*(){var o;const a={urlPatternResult:t(this,q).exec({pathname:s.pathname})};be.isESClass(t(this,p))?(h(this,u,new(t(this,p))(a)),e.appendChild(t(this,u))):h(this,u,Pe.render(e,t(this,p),a)),(o=t(this,u))==null||o.addEventListener("__hmrInstanceReplace",t(this,y)),d(this,l,te).call(this),h(this,T,!0)})},te=function(){var e;t(this,u)&&h(this,M,t(this,u).querySelector("[data-nest]")||((e=t(this,u).shadowRoot)==null?void 0:e.querySelector("[data-nest]"))||t(this,u).shadowRoot||t(this,u))},se=function(){t(this,v).disconnect(),t(this,u)&&(t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),t(this,u).remove()),h(this,T,!1),d(this,l,ie).call(this)},ie=function(){t(this,b).forEach(e=>{e.parentNode===document.head&&document.head.removeChild(e)}),h(this,b,[])},re=function(e){e.forEach(s=>{s.addedNodes.forEach(r=>{t(this,p)?t(this,b).push(r):t(this,P).push(r)})})},ae=function(){return R(this,null,function*(){const e=t(this,P).filter(d(this,l,B));yield Promise.all(e.map(s=>new Promise(r=>{d(this,l,B).call(this,s)?s.onload=()=>r():r()})))})},B=function(e){return e instanceof HTMLElement&&(e.tagName==="STYLE"||e.tagName==="SCRIPT"||e.tagName==="LINK")},y=new WeakMap;globalThis.URLPattern=ve.URLPattern;var c,L,k,E,I,_,w,A,m,ne,he,le,z,oe;class Le{constructor(e){n(this,m);n(this,c,null);n(this,L,null);n(this,k,null);n(this,E,null);n(this,I,null);n(this,_,0);n(this,w,[]);n(this,A,null);h(this,c,G($({},e),{rootElement:(e==null?void 0:e.rootElement)||document.body,base:Q.normalizeBase(e==null?void 0:e.base)})),h(this,I,new Re.PageAnnouncerElement),h(this,L,new we.PageScroll(t(this,c).scrollSelector)),t(this,L).update(),h(this,k,new ge.LocalLinks({base:t(this,c).base,trailingSlash:t(this,c).trailingSlash,includeAnchor:e==null?void 0:e.includeAnchor,onClick:(s,r)=>{try{this.navigate(s,r)}catch(a){window.location.assign(s)}}})),t(this,k).update(),h(this,E,new pe.History({onPop:s=>{this.navigate(s)}}))}history(){return t(this,E)}get scroll(){return scroll}get routes(){return t(this,w)}run(){d(this,m,oe).call(this),this.navigate(new URL(location.href),{revalidate:!0})}defineRoute(e,s){const r=new ye(e,s);t(this,w).push(r)}navigate(e,s){return R(this,null,function*(){var O,j,x,V,D,F;const r=t(this,E).isBack,a=++J(this,_)._;let o=Q.normalizeURL(e,{base:t(this,c).base,trailingSlash:t(this,c).trailingSlash});if(t(this,c).urlModifier&&(o=t(this,c).urlModifier(o)),!(yield d(this,m,ne).call(this,o))||t(this,_)!==a||(yield(j=(O=t(this,c)).beforeNavigation)==null?void 0:j.call(O),t(this,_)!==a))return;const{activeRoutes:C,newRoutes:g,oldRoutes:f,keepRoutes:N}=d(this,m,he).call(this,o);h(this,A,(x=N[N.length-1])!=null?x:null),r||(t(this,E).push(o),((V=s==null?void 0:s.keepScrollPosition)==null||V)&&t(this,L).element.scrollTo({top:0,behavior:"instant"})),t(this,I).create(document,o.pathname),t(this,c).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>d(this,m,z).call(this,f,g,o)).finished:yield d(this,m,z).call(this,f,g,o),t(this,L).update(),t(this,k).update(),t(this,I).done(),yield(F=(D=t(this,c)).afterNavigation)==null?void 0:F.call(D)})}}c=new WeakMap,L=new WeakMap,k=new WeakMap,E=new WeakMap,I=new WeakMap,_=new WeakMap,w=new WeakMap,A=new WeakMap,m=new WeakSet,ne=function(e){return R(this,null,function*(){if(!t(this,c).preprocessor)return!0;try{return yield new Promise((s,r)=>{var a,o;(o=(a=t(this,c)).preprocessor)==null||o.call(a,{url:e,resolve:s,reject:r})}),!0}catch(s){return console.error(s!=null?s:"Route change canceled"),!1}})},he=function(e){let s=e.pathname.replace(t(this,c).base,"");s.startsWith("/")||(s=`/${s}`);const r=t(this,w).filter(a=>a.isActive);return{activeRoutes:r,newRoutes:t(this,w).filter(a=>!r.includes(a)&&a.testPathname(s)),oldRoutes:r.filter(a=>!a.testPathname(s)),keepRoutes:r.filter(a=>a.testPathname(s))}},le=function(e){e.forEach(s=>s.close())},z=function(e,s,r){return R(this,null,function*(){var a,o;d(this,m,le).call(this,e);for(const C of s){const g=(o=(a=t(this,A))==null?void 0:a.nest)!=null?o:t(this,c).rootElement;yield C.render(g,r),h(this,A,C)}})},oe=function(){t(this,w).sort((e,s)=>{const r=e.pattern.split("/").length,a=s.pattern.split("/").length;return r-a})};exports.Router=Le;
|
package/lib/router/index.js
CHANGED
|
@@ -1,253 +1,268 @@
|
|
|
1
|
-
var
|
|
1
|
+
var lt = Object.defineProperty, ct = Object.defineProperties;
|
|
2
2
|
var ut = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var K = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var dt = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Y = (i) => {
|
|
6
6
|
throw TypeError(i);
|
|
7
7
|
};
|
|
8
|
-
var W = (i, t,
|
|
9
|
-
for (var
|
|
10
|
-
|
|
8
|
+
var W = (i, t, s) => t in i ? lt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s, j = (i, t) => {
|
|
9
|
+
for (var s in t || (t = {}))
|
|
10
|
+
dt.call(t, s) && W(i, s, t[s]);
|
|
11
11
|
if (K)
|
|
12
|
-
for (var
|
|
13
|
-
|
|
12
|
+
for (var s of K(t))
|
|
13
|
+
mt.call(t, s) && W(i, s, t[s]);
|
|
14
14
|
return i;
|
|
15
|
-
}, G = (i, t) =>
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var J = (i, t,
|
|
15
|
+
}, G = (i, t) => ct(i, ut(t));
|
|
16
|
+
var B = (i, t, s) => t.has(i) || Y("Cannot " + s);
|
|
17
|
+
var e = (i, t, s) => (B(i, t, "read from private field"), s ? s.call(i) : t.get(i)), n = (i, t, s) => t.has(i) ? Y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), h = (i, t, s, a) => (B(i, t, "write to private field"), a ? a.call(i, s) : t.set(i, s), s), d = (i, t, s) => (B(i, t, "access private method"), s);
|
|
18
|
+
var J = (i, t, s, a) => ({
|
|
19
19
|
set _(r) {
|
|
20
|
-
h(i, t, r,
|
|
20
|
+
h(i, t, r, s);
|
|
21
21
|
},
|
|
22
22
|
get _() {
|
|
23
|
-
return
|
|
23
|
+
return e(i, t, a);
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
var
|
|
27
|
-
var
|
|
26
|
+
var w = (i, t, s) => new Promise((a, r) => {
|
|
27
|
+
var l = (f) => {
|
|
28
28
|
try {
|
|
29
|
-
|
|
30
|
-
} catch (
|
|
31
|
-
r(
|
|
29
|
+
R(s.next(f));
|
|
30
|
+
} catch (E) {
|
|
31
|
+
r(E);
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, A = (f) => {
|
|
34
34
|
try {
|
|
35
|
-
|
|
36
|
-
} catch (
|
|
37
|
-
r(
|
|
35
|
+
R(s.throw(f));
|
|
36
|
+
} catch (E) {
|
|
37
|
+
r(E);
|
|
38
38
|
}
|
|
39
|
-
},
|
|
40
|
-
|
|
39
|
+
}, R = (f) => f.done ? a(f.value) : Promise.resolve(f.value).then(l, A);
|
|
40
|
+
R((s = s.apply(i, t)).next());
|
|
41
41
|
});
|
|
42
|
-
import { History as
|
|
43
|
-
import { L as
|
|
44
|
-
import { P as
|
|
42
|
+
import { History as ft } from "../history/index.js";
|
|
43
|
+
import { L as pt } from "../LocalLinks-TQkTpAMx.js";
|
|
44
|
+
import { P as Rt } from "../PageAnnouncerElement-sfh0_4vl.js";
|
|
45
45
|
import { P as wt } from "../PageScroll-cQ3B5-6N.js";
|
|
46
46
|
import "construct-style-sheets-polyfill";
|
|
47
47
|
import "../index-LReFyN6i.js";
|
|
48
|
-
import { a as gt, n as
|
|
48
|
+
import { a as gt, n as vt } from "../url-DAl-mgbC.js";
|
|
49
49
|
import { URLPattern as Pt } from "urlpattern-polyfill";
|
|
50
|
-
import { r as
|
|
50
|
+
import { r as Lt } from "../render-B3Hf-O7M.js";
|
|
51
51
|
import { i as bt } from "../object-CcMK4y_r.js";
|
|
52
|
-
var
|
|
52
|
+
var S, U, T, p, c, I, M, v, P, L, o, Q, X, Z, tt, et, st, it, at, z, b;
|
|
53
53
|
class Nt {
|
|
54
|
-
constructor(t,
|
|
54
|
+
constructor(t, s) {
|
|
55
55
|
n(this, o);
|
|
56
|
-
n(this, E);
|
|
57
|
-
n(this, M);
|
|
58
56
|
n(this, S);
|
|
57
|
+
n(this, U);
|
|
58
|
+
n(this, T);
|
|
59
59
|
n(this, p, null);
|
|
60
|
-
n(this,
|
|
61
|
-
n(this,
|
|
62
|
-
n(this,
|
|
63
|
-
n(this,
|
|
64
|
-
n(this,
|
|
65
|
-
n(this,
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
n(this, c, null);
|
|
61
|
+
n(this, I, !1);
|
|
62
|
+
n(this, M, null);
|
|
63
|
+
n(this, v);
|
|
64
|
+
n(this, P, []);
|
|
65
|
+
n(this, L, []);
|
|
66
|
+
n(this, b, (t) => {
|
|
67
|
+
e(this, c).removeEventListener(
|
|
68
|
+
"__hmrInstanceReplace",
|
|
69
|
+
e(this, b)
|
|
70
|
+
), h(this, c, t.detail.element), e(this, c).addEventListener(
|
|
71
|
+
"__hmrInstanceReplace",
|
|
72
|
+
e(this, b)
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
h(this, S, t), h(this, U, s), h(this, T, new URLPattern({ pathname: e(this, S) })), h(this, v, new MutationObserver(
|
|
76
|
+
d(this, o, it).bind(this)
|
|
68
77
|
));
|
|
69
78
|
}
|
|
70
79
|
get pattern() {
|
|
71
|
-
return
|
|
80
|
+
return e(this, S);
|
|
72
81
|
}
|
|
73
82
|
get isActive() {
|
|
74
|
-
return
|
|
83
|
+
return e(this, I);
|
|
75
84
|
}
|
|
76
85
|
get element() {
|
|
77
|
-
return
|
|
86
|
+
return e(this, c);
|
|
78
87
|
}
|
|
79
88
|
get nest() {
|
|
80
|
-
return
|
|
89
|
+
return e(this, M);
|
|
81
90
|
}
|
|
82
91
|
testPathname(t) {
|
|
83
|
-
return
|
|
92
|
+
return e(this, T).test({ pathname: t });
|
|
84
93
|
}
|
|
85
|
-
render(t,
|
|
86
|
-
return
|
|
87
|
-
|
|
94
|
+
render(t, s) {
|
|
95
|
+
return w(this, null, function* () {
|
|
96
|
+
e(this, v).observe(document.head, {
|
|
88
97
|
childList: !0,
|
|
89
98
|
subtree: !0
|
|
90
|
-
}),
|
|
99
|
+
}), e(this, p) ? d(this, o, X).call(this) : yield d(this, o, Q).call(this), yield d(this, o, at).call(this), e(this, p) && (yield d(this, o, Z).call(this, t, s)), e(this, v).disconnect();
|
|
91
100
|
});
|
|
92
101
|
}
|
|
93
102
|
close() {
|
|
94
|
-
|
|
103
|
+
d(this, o, et).call(this);
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
|
-
|
|
98
|
-
return
|
|
99
|
-
const t = yield
|
|
100
|
-
h(this,
|
|
106
|
+
S = new WeakMap(), U = new WeakMap(), T = new WeakMap(), p = new WeakMap(), c = new WeakMap(), I = new WeakMap(), M = new WeakMap(), v = new WeakMap(), P = new WeakMap(), L = new WeakMap(), o = new WeakSet(), Q = function() {
|
|
107
|
+
return w(this, null, function* () {
|
|
108
|
+
const t = yield e(this, U).call(this);
|
|
109
|
+
h(this, L, [...e(this, P)]), typeof t.default == "function" && h(this, p, t.default);
|
|
101
110
|
});
|
|
102
111
|
}, X = function() {
|
|
103
|
-
|
|
112
|
+
e(this, P).forEach((t) => {
|
|
104
113
|
document.head.appendChild(t.cloneNode(!0));
|
|
105
114
|
});
|
|
106
|
-
}, Z = function(t,
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
}, Z = function(t, s) {
|
|
116
|
+
return w(this, null, function* () {
|
|
117
|
+
var l;
|
|
118
|
+
const r = { urlPatternResult: e(this, T).exec({ pathname: s.pathname }) };
|
|
119
|
+
bt(e(this, p)) ? (h(this, c, new (e(this, p))(r)), t.appendChild(e(this, c))) : h(this, c, Lt(
|
|
110
120
|
t,
|
|
111
|
-
|
|
121
|
+
e(this, p),
|
|
112
122
|
r
|
|
113
|
-
)),
|
|
123
|
+
)), (l = e(this, c)) == null || l.addEventListener(
|
|
124
|
+
"__hmrInstanceReplace",
|
|
125
|
+
e(this, b)
|
|
126
|
+
), d(this, o, tt).call(this), h(this, I, !0);
|
|
114
127
|
});
|
|
115
|
-
}, _ = function() {
|
|
116
|
-
var t;
|
|
117
|
-
s(this, d) && h(this, B, s(this, d).querySelector("[data-nest]") || ((t = s(this, d).shadowRoot) == null ? void 0 : t.querySelector("[data-nest]")) || s(this, d).shadowRoot || s(this, d));
|
|
118
128
|
}, tt = function() {
|
|
119
129
|
var t;
|
|
120
|
-
|
|
130
|
+
e(this, c) && h(this, M, e(this, c).querySelector("[data-nest]") || ((t = e(this, c).shadowRoot) == null ? void 0 : t.querySelector("[data-nest]")) || e(this, c).shadowRoot || e(this, c));
|
|
121
131
|
}, et = function() {
|
|
122
|
-
|
|
132
|
+
e(this, v).disconnect(), e(this, c) && (e(this, c).removeEventListener(
|
|
133
|
+
"__hmrInstanceReplace",
|
|
134
|
+
e(this, b)
|
|
135
|
+
), e(this, c).remove()), h(this, I, !1), d(this, o, st).call(this);
|
|
136
|
+
}, st = function() {
|
|
137
|
+
e(this, L).forEach((t) => {
|
|
123
138
|
t.parentNode === document.head && document.head.removeChild(t);
|
|
124
|
-
}), h(this,
|
|
125
|
-
},
|
|
126
|
-
t.forEach((
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
}), h(this, L, []);
|
|
140
|
+
}, it = function(t) {
|
|
141
|
+
t.forEach((s) => {
|
|
142
|
+
s.addedNodes.forEach((a) => {
|
|
143
|
+
e(this, p) ? e(this, L).push(a) : e(this, P).push(a);
|
|
129
144
|
});
|
|
130
145
|
});
|
|
131
|
-
},
|
|
132
|
-
return
|
|
133
|
-
const t =
|
|
146
|
+
}, at = function() {
|
|
147
|
+
return w(this, null, function* () {
|
|
148
|
+
const t = e(this, P).filter(d(this, o, z));
|
|
134
149
|
yield Promise.all(
|
|
135
150
|
t.map(
|
|
136
|
-
(
|
|
137
|
-
|
|
151
|
+
(s) => new Promise((a) => {
|
|
152
|
+
d(this, o, z).call(this, s) ? s.onload = () => a() : a();
|
|
138
153
|
})
|
|
139
154
|
)
|
|
140
155
|
);
|
|
141
156
|
});
|
|
142
157
|
}, z = function(t) {
|
|
143
158
|
return t instanceof HTMLElement && (t.tagName === "STYLE" || t.tagName === "SCRIPT" || t.tagName === "LINK");
|
|
144
|
-
};
|
|
159
|
+
}, b = new WeakMap();
|
|
145
160
|
globalThis.URLPattern = Pt;
|
|
146
|
-
var
|
|
147
|
-
class
|
|
161
|
+
var u, N, k, y, C, H, g, _, m, rt, nt, ht, O, ot;
|
|
162
|
+
class Bt {
|
|
148
163
|
constructor(t) {
|
|
149
164
|
n(this, m);
|
|
150
|
-
n(this,
|
|
165
|
+
n(this, u, null);
|
|
151
166
|
n(this, N, null);
|
|
152
167
|
n(this, k, null);
|
|
153
168
|
n(this, y, null);
|
|
154
169
|
n(this, C, null);
|
|
155
170
|
n(this, H, 0);
|
|
156
|
-
n(this,
|
|
157
|
-
n(this,
|
|
158
|
-
h(this,
|
|
171
|
+
n(this, g, []);
|
|
172
|
+
n(this, _, null);
|
|
173
|
+
h(this, u, G(j({}, t), {
|
|
159
174
|
rootElement: (t == null ? void 0 : t.rootElement) || document.body,
|
|
160
175
|
base: gt(t == null ? void 0 : t.base)
|
|
161
|
-
})), h(this, C, new
|
|
162
|
-
base:
|
|
163
|
-
trailingSlash:
|
|
176
|
+
})), h(this, C, new Rt()), h(this, N, new wt(e(this, u).scrollSelector)), e(this, N).update(), h(this, k, new pt({
|
|
177
|
+
base: e(this, u).base,
|
|
178
|
+
trailingSlash: e(this, u).trailingSlash,
|
|
164
179
|
includeAnchor: t == null ? void 0 : t.includeAnchor,
|
|
165
|
-
onClick: (
|
|
180
|
+
onClick: (s, a) => {
|
|
166
181
|
try {
|
|
167
|
-
this.navigate(
|
|
182
|
+
this.navigate(s, a);
|
|
168
183
|
} catch (r) {
|
|
169
|
-
window.location.assign(
|
|
184
|
+
window.location.assign(s);
|
|
170
185
|
}
|
|
171
186
|
}
|
|
172
|
-
})),
|
|
173
|
-
onPop: (
|
|
174
|
-
this.navigate(
|
|
187
|
+
})), e(this, k).update(), h(this, y, new ft({
|
|
188
|
+
onPop: (s) => {
|
|
189
|
+
this.navigate(s);
|
|
175
190
|
}
|
|
176
191
|
}));
|
|
177
192
|
}
|
|
178
193
|
history() {
|
|
179
|
-
return
|
|
194
|
+
return e(this, y);
|
|
180
195
|
}
|
|
181
196
|
get scroll() {
|
|
182
197
|
return scroll;
|
|
183
198
|
}
|
|
184
199
|
get routes() {
|
|
185
|
-
return
|
|
200
|
+
return e(this, g);
|
|
186
201
|
}
|
|
187
202
|
run() {
|
|
188
|
-
|
|
203
|
+
d(this, m, ot).call(this), this.navigate(new URL(location.href), { revalidate: !0 });
|
|
189
204
|
}
|
|
190
|
-
defineRoute(t,
|
|
191
|
-
const a = new Nt(t,
|
|
192
|
-
|
|
205
|
+
defineRoute(t, s) {
|
|
206
|
+
const a = new Nt(t, s);
|
|
207
|
+
e(this, g).push(a);
|
|
193
208
|
}
|
|
194
|
-
navigate(t,
|
|
195
|
-
return
|
|
209
|
+
navigate(t, s) {
|
|
210
|
+
return w(this, null, function* () {
|
|
196
211
|
var q, x, V, $, D, F;
|
|
197
|
-
const a =
|
|
198
|
-
let
|
|
199
|
-
base:
|
|
200
|
-
trailingSlash:
|
|
212
|
+
const a = e(this, y).isBack, r = ++J(this, H)._;
|
|
213
|
+
let l = vt(t, {
|
|
214
|
+
base: e(this, u).base,
|
|
215
|
+
trailingSlash: e(this, u).trailingSlash
|
|
201
216
|
});
|
|
202
|
-
if (
|
|
217
|
+
if (e(this, u).urlModifier && (l = e(this, u).urlModifier(l)), !(yield d(this, m, rt).call(this, l)) || e(this, H) !== r || (yield (x = (q = e(this, u)).beforeNavigation) == null ? void 0 : x.call(q), e(this, H) !== r))
|
|
203
218
|
return;
|
|
204
|
-
const { activeRoutes:
|
|
205
|
-
h(this,
|
|
219
|
+
const { activeRoutes: A, newRoutes: R, oldRoutes: f, keepRoutes: E } = d(this, m, nt).call(this, l);
|
|
220
|
+
h(this, _, (V = E[E.length - 1]) != null ? V : null), a || (e(this, y).push(l), (($ = s == null ? void 0 : s.keepScrollPosition) == null || $) && e(this, N).element.scrollTo({ top: 0, behavior: "instant" })), e(this, C).create(document, l.pathname), e(this, u).viewTransition && document.startViewTransition ? yield document.startViewTransition(() => d(this, m, O).call(this, f, R, l)).finished : yield d(this, m, O).call(this, f, R, l), e(this, N).update(), e(this, k).update(), e(this, C).done(), yield (F = (D = e(this, u)).afterNavigation) == null ? void 0 : F.call(D);
|
|
206
221
|
});
|
|
207
222
|
}
|
|
208
223
|
}
|
|
209
|
-
|
|
210
|
-
return
|
|
211
|
-
if (!
|
|
224
|
+
u = new WeakMap(), N = new WeakMap(), k = new WeakMap(), y = new WeakMap(), C = new WeakMap(), H = new WeakMap(), g = new WeakMap(), _ = new WeakMap(), m = new WeakSet(), rt = function(t) {
|
|
225
|
+
return w(this, null, function* () {
|
|
226
|
+
if (!e(this, u).preprocessor)
|
|
212
227
|
return !0;
|
|
213
228
|
try {
|
|
214
|
-
return yield new Promise((
|
|
215
|
-
var r,
|
|
216
|
-
(
|
|
229
|
+
return yield new Promise((s, a) => {
|
|
230
|
+
var r, l;
|
|
231
|
+
(l = (r = e(this, u)).preprocessor) == null || l.call(r, { url: t, resolve: s, reject: a });
|
|
217
232
|
}), !0;
|
|
218
|
-
} catch (
|
|
219
|
-
return console.error(
|
|
233
|
+
} catch (s) {
|
|
234
|
+
return console.error(s != null ? s : "Route change canceled"), !1;
|
|
220
235
|
}
|
|
221
236
|
});
|
|
222
|
-
},
|
|
223
|
-
let
|
|
224
|
-
|
|
225
|
-
const a =
|
|
237
|
+
}, nt = function(t) {
|
|
238
|
+
let s = t.pathname.replace(e(this, u).base, "");
|
|
239
|
+
s.startsWith("/") || (s = `/${s}`);
|
|
240
|
+
const a = e(this, g).filter((r) => r.isActive);
|
|
226
241
|
return {
|
|
227
242
|
activeRoutes: a,
|
|
228
|
-
newRoutes:
|
|
229
|
-
(r) => !a.includes(r) && r.testPathname(
|
|
243
|
+
newRoutes: e(this, g).filter(
|
|
244
|
+
(r) => !a.includes(r) && r.testPathname(s)
|
|
230
245
|
),
|
|
231
|
-
oldRoutes: a.filter((r) => !r.testPathname(
|
|
232
|
-
keepRoutes: a.filter((r) => r.testPathname(
|
|
246
|
+
oldRoutes: a.filter((r) => !r.testPathname(s)),
|
|
247
|
+
keepRoutes: a.filter((r) => r.testPathname(s))
|
|
233
248
|
};
|
|
234
|
-
},
|
|
235
|
-
t.forEach((
|
|
236
|
-
}, O = function(t,
|
|
237
|
-
return
|
|
238
|
-
var r,
|
|
239
|
-
|
|
240
|
-
for (const
|
|
241
|
-
const
|
|
242
|
-
yield
|
|
249
|
+
}, ht = function(t) {
|
|
250
|
+
t.forEach((s) => s.close());
|
|
251
|
+
}, O = function(t, s, a) {
|
|
252
|
+
return w(this, null, function* () {
|
|
253
|
+
var r, l;
|
|
254
|
+
d(this, m, ht).call(this, t);
|
|
255
|
+
for (const A of s) {
|
|
256
|
+
const R = (l = (r = e(this, _)) == null ? void 0 : r.nest) != null ? l : e(this, u).rootElement;
|
|
257
|
+
yield A.render(R, a), h(this, _, A);
|
|
243
258
|
}
|
|
244
259
|
});
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
const a = t.pattern.split("/").length, r =
|
|
260
|
+
}, ot = function() {
|
|
261
|
+
e(this, g).sort((t, s) => {
|
|
262
|
+
const a = t.pattern.split("/").length, r = s.pattern.split("/").length;
|
|
248
263
|
return a - r;
|
|
249
264
|
});
|
|
250
265
|
};
|
|
251
266
|
export {
|
|
252
|
-
|
|
267
|
+
Bt as Router
|
|
253
268
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aptechka",
|
|
3
|
-
"version": "0.82.
|
|
3
|
+
"version": "0.82.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/denisavitski/aptechka.git"
|
|
@@ -454,18 +454,17 @@
|
|
|
454
454
|
"tsx": "^4.20.3",
|
|
455
455
|
"vite": "^7.0.6",
|
|
456
456
|
"vite-plugin-dts": "^4.5.4",
|
|
457
|
-
"vite-plugin-htmc": "0.1.16"
|
|
457
|
+
"vite-plugin-htmc": "0.1.16",
|
|
458
|
+
"prettier-plugin-organize-imports": "^4.2.0",
|
|
459
|
+
"csstype": "^3.1.3"
|
|
458
460
|
},
|
|
459
461
|
"dependencies": {
|
|
460
462
|
"construct-style-sheets-polyfill": "^3.1.0",
|
|
461
|
-
"csstype": "^3.1.3",
|
|
462
|
-
"prettier-plugin-organize-imports": "^4.2.0",
|
|
463
463
|
"three": "^0.179.1",
|
|
464
464
|
"urlpattern-polyfill": "^10.1.0"
|
|
465
465
|
},
|
|
466
466
|
"peerDependencies": {
|
|
467
467
|
"construct-style-sheets-polyfill": "^3.1.0",
|
|
468
|
-
"prettier-plugin-organize-imports": "^4.2.0",
|
|
469
468
|
"three": "^0.179.1",
|
|
470
469
|
"urlpattern-polyfill": "^10.1.0"
|
|
471
470
|
}
|
package/lib/render-CiA0mn5V.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
var O = Object.defineProperty, q = Object.defineProperties;
|
|
2
|
-
var B = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var S = Object.getOwnPropertySymbols;
|
|
4
|
-
var K = Object.prototype.hasOwnProperty, P = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var L = (r) => {
|
|
6
|
-
throw TypeError(r);
|
|
7
|
-
};
|
|
8
|
-
var w = (r, s, t) => s in r ? O(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t, E = (r, s) => {
|
|
9
|
-
for (var t in s || (s = {}))
|
|
10
|
-
K.call(s, t) && w(r, t, s[t]);
|
|
11
|
-
if (S)
|
|
12
|
-
for (var t of S(s))
|
|
13
|
-
P.call(s, t) && w(r, t, s[t]);
|
|
14
|
-
return r;
|
|
15
|
-
}, N = (r, s) => q(r, B(s));
|
|
16
|
-
var _ = (r, s, t) => s.has(r) || L("Cannot " + t);
|
|
17
|
-
var p = (r, s, t) => (_(r, s, "read from private field"), t ? t.call(r) : s.get(r)), m = (r, s, t) => s.has(r) ? L("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), C = (r, s, t, o) => (_(r, s, "write to private field"), o ? o.call(r, t) : s.set(r, t), t);
|
|
18
|
-
import { S as l } from "./Store-CgQ3ReoB.js";
|
|
19
|
-
import { c as R } from "./string-BlMQbe8b.js";
|
|
20
|
-
import "construct-style-sheets-polyfill";
|
|
21
|
-
import "./index-LReFyN6i.js";
|
|
22
|
-
import { connector as H } from "./connector/index.js";
|
|
23
|
-
import { a as M } from "./DerivedArray-DG9iR0mf.js";
|
|
24
|
-
const $ = { current: null };
|
|
25
|
-
var b, u;
|
|
26
|
-
class z extends HTMLElement {
|
|
27
|
-
constructor() {
|
|
28
|
-
super();
|
|
29
|
-
m(this, b, []);
|
|
30
|
-
m(this, u, []);
|
|
31
|
-
$.current = this;
|
|
32
|
-
}
|
|
33
|
-
addConnectCallback(t) {
|
|
34
|
-
p(this, b).push(t);
|
|
35
|
-
}
|
|
36
|
-
addDisconnectCallback(t) {
|
|
37
|
-
p(this, u).push(t);
|
|
38
|
-
}
|
|
39
|
-
connectedCallback() {
|
|
40
|
-
p(this, b).forEach((t) => {
|
|
41
|
-
const o = t(this);
|
|
42
|
-
o && p(this, u).push(o);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
disconnectedCallback() {
|
|
46
|
-
p(this, u).forEach((t) => {
|
|
47
|
-
t(this);
|
|
48
|
-
}), C(this, b, []), C(this, u, []);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
b = new WeakMap(), u = new WeakMap();
|
|
52
|
-
function y(r, s, t) {
|
|
53
|
-
const o = s.subscribe((f) => {
|
|
54
|
-
t(f);
|
|
55
|
-
});
|
|
56
|
-
H.subscribe(r, {
|
|
57
|
-
disconnectCallback: () => {
|
|
58
|
-
o();
|
|
59
|
-
},
|
|
60
|
-
maxWaitSec: 20,
|
|
61
|
-
unsubscribeAfterDisconnect: !0
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function F(r, s) {
|
|
65
|
-
s && (s instanceof l ? y(r, s, (t) => {
|
|
66
|
-
t.previous && r.classList.remove(t.previous.toString()), t.current && r.classList.add(t.current.toString());
|
|
67
|
-
}) : typeof s == "object" && !Array.isArray(s) ? Object.entries(s).forEach(([t, o]) => {
|
|
68
|
-
o instanceof l ? y(r, o, (f) => {
|
|
69
|
-
r.classList.toggle(t, !!f.current);
|
|
70
|
-
}) : o && r.classList.add(t);
|
|
71
|
-
}) : Array.isArray(s) ? s.forEach((t) => {
|
|
72
|
-
typeof t == "string" ? r.classList.add(t) : F(r, t);
|
|
73
|
-
}) : s.toString().split(" ").map((t) => r.classList.add(t.trim())));
|
|
74
|
-
}
|
|
75
|
-
function J(r, s) {
|
|
76
|
-
s && (typeof s == "object" ? Object.entries(s).forEach(([t, o]) => {
|
|
77
|
-
o instanceof l ? y(r, o, (f) => {
|
|
78
|
-
var e;
|
|
79
|
-
r.style[t] = (e = f.current) == null ? void 0 : e.toString();
|
|
80
|
-
}) : (typeof o == "number" || typeof o == "string" || typeof o == "boolean") && (r.style[t] = o.toString());
|
|
81
|
-
}) : typeof s == "string" && (r.style = s));
|
|
82
|
-
}
|
|
83
|
-
function A(r, s, t) {
|
|
84
|
-
s === "ref" && t ? Array.isArray(t) ? t.forEach((o) => {
|
|
85
|
-
typeof o == "object" && "value" in o && (o.value = r);
|
|
86
|
-
}) : typeof t == "object" && "value" in t && (t.value = r) : s === "className" || s === "class" ? F(r, t) : s === "style" ? J(r, t) : typeof t == "number" ? s === "tabIndex" ? r.setAttribute("tabindex", t.toString()) : A(r, s, t.toString()) : typeof t == "string" ? s === "htmlFor" ? r.setAttribute("for", t) : r.setAttribute(s, t) : typeof t == "boolean" ? t ? r.setAttribute(s, "") : r.removeAttribute(s) : t instanceof l && y(r, t, (o) => {
|
|
87
|
-
s in r ? r[s] = o.current : A(r, s, o.current);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function Q(r, s) {
|
|
91
|
-
for (const [t, o] of Object.entries(s != null ? s : {}))
|
|
92
|
-
typeof o == "function" && t.startsWith("on") ? r.addEventListener(
|
|
93
|
-
t.replace("on", "").toLowerCase(),
|
|
94
|
-
o
|
|
95
|
-
) : A(r, t, o);
|
|
96
|
-
}
|
|
97
|
-
function W(r) {
|
|
98
|
-
const s = [];
|
|
99
|
-
return r.forEach((t) => {
|
|
100
|
-
t != null && (typeof t == "number" ? s.push(t.toString()) : Array.isArray(t) ? t.forEach((o) => {
|
|
101
|
-
s.push(...W(o));
|
|
102
|
-
}) : s.push(t));
|
|
103
|
-
}), s;
|
|
104
|
-
}
|
|
105
|
-
function U(r, s) {
|
|
106
|
-
const t = [...r.childNodes].filter((n) => n.__storeId === s.id), o = s.current, f = Array.isArray(o) ? o : [o], e = [];
|
|
107
|
-
if (f.forEach((n) => {
|
|
108
|
-
let i = null;
|
|
109
|
-
typeof n == "boolean" || typeof n == "number" || typeof n == "string" ? i = document.createTextNode(n.toString()) : n instanceof Node && (i = n), i && (i.__storeId = s.id, e.push(i));
|
|
110
|
-
}), s instanceof M) {
|
|
111
|
-
const n = [];
|
|
112
|
-
e.forEach((i, c) => {
|
|
113
|
-
const a = t.find(
|
|
114
|
-
(h) => h.__key === i.__key
|
|
115
|
-
);
|
|
116
|
-
a ? a.isEqualNode(i) ? n.push(a) : (a.replaceWith(i), n.push(i)) : (n.push(i), r.appendChild(i));
|
|
117
|
-
}), t.forEach((i) => {
|
|
118
|
-
n.includes(i) || i.remove();
|
|
119
|
-
});
|
|
120
|
-
} else
|
|
121
|
-
e.forEach((n, i) => {
|
|
122
|
-
var a;
|
|
123
|
-
const c = t[i];
|
|
124
|
-
if (c)
|
|
125
|
-
c.isEqualNode(n) || (c.replaceWith(n), t[i] = n);
|
|
126
|
-
else {
|
|
127
|
-
const h = t[t.length - 1];
|
|
128
|
-
h ? (a = h.parentNode) == null || a.insertBefore(
|
|
129
|
-
n,
|
|
130
|
-
h.nextSibling
|
|
131
|
-
) : r.appendChild(n);
|
|
132
|
-
}
|
|
133
|
-
}), t.slice(e.length).forEach((n) => {
|
|
134
|
-
n.remove();
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
class g {
|
|
138
|
-
constructor(s, t, o) {
|
|
139
|
-
this.tag = s, this.attributes = t, this.children = o;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
class I {
|
|
143
|
-
constructor(s, t, o) {
|
|
144
|
-
this.tag = s, this.attributes = t, this.children = o;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function d(r, s, t, o = !1) {
|
|
148
|
-
const f = W(t);
|
|
149
|
-
Q(r, s), f.forEach((e) => {
|
|
150
|
-
if (e instanceof l)
|
|
151
|
-
y(r, e, () => {
|
|
152
|
-
U(r, e);
|
|
153
|
-
});
|
|
154
|
-
else if (e instanceof g)
|
|
155
|
-
e.tag === "shadow" && r.shadowRoot ? d(
|
|
156
|
-
r.shadowRoot,
|
|
157
|
-
e.attributes,
|
|
158
|
-
e.children
|
|
159
|
-
) : d(r, e.attributes, e.children);
|
|
160
|
-
else if (e instanceof I) {
|
|
161
|
-
let n = null;
|
|
162
|
-
e.tag === "svg" ? (n = document.createElementNS(
|
|
163
|
-
"http://www.w3.org/2000/svg",
|
|
164
|
-
"svg"
|
|
165
|
-
), d(n, e.attributes, e.children, !0)) : n = o ? document.createElementNS("http://www.w3.org/2000/svg", e.tag) : document.createElement(e.tag), d(n, e.attributes, e.children, o), r.append(n);
|
|
166
|
-
} else
|
|
167
|
-
r.append(e);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function X(r, s, ...t) {
|
|
171
|
-
var o;
|
|
172
|
-
if (typeof r == "string")
|
|
173
|
-
return r === "component" ? new g(r, s, t) : r === "shadow" ? new g(r, s, t) : new I(r, s, t);
|
|
174
|
-
{
|
|
175
|
-
if (r === D)
|
|
176
|
-
return D(t);
|
|
177
|
-
if (r.template)
|
|
178
|
-
return r(E({}, s));
|
|
179
|
-
const f = `e-${R(r.name)}`;
|
|
180
|
-
let e = customElements.get(f);
|
|
181
|
-
e || (e = (o = class extends z {
|
|
182
|
-
constructor() {
|
|
183
|
-
super();
|
|
184
|
-
}
|
|
185
|
-
}, o.formAssociated = r.formAssociated, o), customElements.define(f, e));
|
|
186
|
-
const n = new e(), i = N(E({}, s), {
|
|
187
|
-
children: t
|
|
188
|
-
}), c = r(i);
|
|
189
|
-
return c instanceof g && (c != null && c.children || c.attributes) && d(n, c.attributes, c.children), n;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function D(r) {
|
|
193
|
-
const s = document.createDocumentFragment();
|
|
194
|
-
return d(s, void 0, r), s;
|
|
195
|
-
}
|
|
196
|
-
function T(r, s, t) {
|
|
197
|
-
const o = /* @__PURE__ */ X(s, E({}, t));
|
|
198
|
-
return r.append(o), o;
|
|
199
|
-
}
|
|
200
|
-
export {
|
|
201
|
-
D as F,
|
|
202
|
-
$ as a,
|
|
203
|
-
X as h,
|
|
204
|
-
T as r
|
|
205
|
-
};
|
package/lib/render-DBQUdpsp.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty,K=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var _=r=>{throw TypeError(r)};var L=(r,e,t)=>e in r?B(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e)=>{for(var t in e||(e={}))R.call(e,t)&&L(r,t,e[t]);if(w)for(var t of w(e))H.call(e,t)&&L(r,t,e[t]);return r},q=(r,e)=>K(r,P(e));var N=(r,e,t)=>e.has(r)||_("Cannot "+t);var p=(r,e,t)=>(N(r,e,"read from private field"),t?t.call(r):e.get(r)),S=(r,e,t)=>e.has(r)?_("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),C=(r,e,t,s)=>(N(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t);const l=require("./Store-1JrMCgdX.cjs"),M=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");require("./index-CKTweR3M.cjs");const $=require("./connector/index.cjs"),z=require("./DerivedArray-B8A0-8uT.cjs"),D={current:null};var b,u;class J extends HTMLElement{constructor(){super();S(this,b,[]);S(this,u,[]);D.current=this}addConnectCallback(t){p(this,b).push(t)}addDisconnectCallback(t){p(this,u).push(t)}connectedCallback(){p(this,b).forEach(t=>{const s=t(this);s&&p(this,u).push(s)})}disconnectedCallback(){p(this,u).forEach(t=>{t(this)}),C(this,b,[]),C(this,u,[])}}b=new WeakMap,u=new WeakMap;function g(r,e,t){const s=e.subscribe(c=>{t(c)});$.connector.subscribe(r,{disconnectCallback:()=>{s()},maxWaitSec:20,unsubscribeAfterDisconnect:!0})}function F(r,e){e&&(e instanceof l.Store?g(r,e,t=>{t.previous&&r.classList.remove(t.previous.toString()),t.current&&r.classList.add(t.current.toString())}):typeof e=="object"&&!Array.isArray(e)?Object.entries(e).forEach(([t,s])=>{s instanceof l.Store?g(r,s,c=>{r.classList.toggle(t,!!c.current)}):s&&r.classList.add(t)}):Array.isArray(e)?e.forEach(t=>{typeof t=="string"?r.classList.add(t):F(r,t)}):e.toString().split(" ").map(t=>r.classList.add(t.trim())))}function Q(r,e){e&&(typeof e=="object"?Object.entries(e).forEach(([t,s])=>{s instanceof l.Store?g(r,s,c=>{var o;r.style[t]=(o=c.current)==null?void 0:o.toString()}):(typeof s=="number"||typeof s=="string"||typeof s=="boolean")&&(r.style[t]=s.toString())}):typeof e=="string"&&(r.style=e))}function A(r,e,t){e==="ref"&&t?Array.isArray(t)?t.forEach(s=>{typeof s=="object"&&"value"in s&&(s.value=r)}):typeof t=="object"&&"value"in t&&(t.value=r):e==="className"||e==="class"?F(r,t):e==="style"?Q(r,t):typeof t=="number"?e==="tabIndex"?r.setAttribute("tabindex",t.toString()):A(r,e,t.toString()):typeof t=="string"?e==="htmlFor"?r.setAttribute("for",t):r.setAttribute(e,t):typeof t=="boolean"?t?r.setAttribute(e,""):r.removeAttribute(e):t instanceof l.Store&&g(r,t,s=>{e in r?r[e]=s.current:A(r,e,s.current)})}function U(r,e){for(const[t,s]of Object.entries(e!=null?e:{}))typeof s=="function"&&t.startsWith("on")?r.addEventListener(t.replace("on","").toLowerCase(),s):A(r,t,s)}function W(r){const e=[];return r.forEach(t=>{t!=null&&(typeof t=="number"?e.push(t.toString()):Array.isArray(t)?t.forEach(s=>{e.push(...W(s))}):e.push(t))}),e}function X(r,e){const t=[...r.childNodes].filter(n=>n.__storeId===e.id),s=e.current,c=Array.isArray(s)?s:[s],o=[];if(c.forEach(n=>{let i=null;typeof n=="boolean"||typeof n=="number"||typeof n=="string"?i=document.createTextNode(n.toString()):n instanceof Node&&(i=n),i&&(i.__storeId=e.id,o.push(i))}),e instanceof z.DerivedKeyedArray){const n=[];o.forEach((i,f)=>{const a=t.find(h=>h.__key===i.__key);a?a.isEqualNode(i)?n.push(a):(a.replaceWith(i),n.push(i)):(n.push(i),r.appendChild(i))}),t.forEach(i=>{n.includes(i)||i.remove()})}else o.forEach((n,i)=>{var a;const f=t[i];if(f)f.isEqualNode(n)||(f.replaceWith(n),t[i]=n);else{const h=t[t.length-1];h?(a=h.parentNode)==null||a.insertBefore(n,h.nextSibling):r.appendChild(n)}}),t.slice(o.length).forEach(n=>{n.remove()})}class E{constructor(e,t,s){this.tag=e,this.attributes=t,this.children=s}}class I{constructor(e,t,s){this.tag=e,this.attributes=t,this.children=s}}function d(r,e,t,s=!1){const c=W(t);U(r,e),c.forEach(o=>{if(o instanceof l.Store)g(r,o,()=>{X(r,o)});else if(o instanceof E)o.tag==="shadow"&&r.shadowRoot?d(r.shadowRoot,o.attributes,o.children):d(r,o.attributes,o.children);else if(o instanceof I){let n=null;o.tag==="svg"?(n=document.createElementNS("http://www.w3.org/2000/svg","svg"),d(n,o.attributes,o.children,!0)):n=s?document.createElementNS("http://www.w3.org/2000/svg",o.tag):document.createElement(o.tag),d(n,o.attributes,o.children,s),r.append(n)}else r.append(o)})}function O(r,e,...t){var s;if(typeof r=="string")return r==="component"?new E(r,e,t):r==="shadow"?new E(r,e,t):new I(r,e,t);{if(r===m)return m(t);if(r.template)return r(y({},e));const c=`e-${M.camelToKebab(r.name)}`;let o=customElements.get(c);o||(o=(s=class extends J{constructor(){super()}},s.formAssociated=r.formAssociated,s),customElements.define(c,o));const n=new o,i=q(y({},e),{children:t}),f=r(i);return f instanceof E&&(f!=null&&f.children||f.attributes)&&d(n,f.attributes,f.children),n}}function m(r){const e=document.createDocumentFragment();return d(e,void 0,r),e}function Y(r,e,t){const s=O(e,y({},t));return r.append(s),s}exports.Fragment=m;exports.activeComponent=D;exports.h=O;exports.render=Y;
|