aptechka 0.79.0 → 0.80.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/{Animation-BDEX44-i.js → Animation-C4tLEBGM.js} +2 -2
- package/lib/{Animation-hZcAchp_.cjs → Animation-jmvFcNfM.cjs} +1 -1
- package/lib/Composed-BB1MtFiT.js +70 -0
- package/lib/Composed-CSeUTRCg.cjs +1 -0
- package/lib/{Damped-z9Uaw2MJ.cjs → Damped-77Urmi3q.cjs} +1 -1
- package/lib/{Damped-CtQmJ52v.js → Damped-DVG5nrYV.js} +2 -2
- package/lib/DerivedArray-B8A0-8uT.cjs +1 -0
- package/lib/DerivedArray-D3scYQdp.js +59 -0
- package/lib/{DragControls-K67-diF5.cjs → DragControls-BlL26P1V.cjs} +1 -1
- package/lib/{DragControls-DyIrD3GV.js → DragControls-Cm_88cLt.js} +4 -4
- package/lib/{SourceElement-VVdVc1d-.cjs → SourceElement-BBfaAgwe.cjs} +1 -1
- package/lib/{SourceElement-BnMxiOqY.js → SourceElement-BiNNtaz9.js} +2 -2
- package/lib/Store-1JrMCgdX.cjs +1 -0
- package/lib/{Store-0BVty6AZ.js → Store-BtVtCGLk.js} +52 -35
- package/lib/{Tweened-BlZB0vl4.js → Tweened-C1lnK6n9.js} +2 -2
- package/lib/{Tweened-mvHucL4Y.cjs → Tweened-CXQrFQth.cjs} +1 -1
- package/lib/{Viewport-DB0qAZPJ.cjs → Viewport-Cx50Hufs.cjs} +1 -1
- package/lib/{Viewport-DA10iWAO.js → Viewport-DbN_JWBM.js} +2 -2
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +1 -1
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +3 -3
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +3 -3
- package/lib/billboard/index.cjs +1 -1
- package/lib/billboard/index.js +2 -2
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +2 -2
- package/lib/connector/index.cjs +1 -1
- package/lib/connector/index.js +2 -1
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +1 -1
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.js +3 -3
- package/lib/css-value-parser/index.cjs +1 -1
- package/lib/css-value-parser/index.js +1 -1
- package/lib/dev/index.cjs +1 -1
- package/lib/dev/index.js +2 -2
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +1 -1
- package/lib/{dom-CVWzyXPH.js → dom-fgxIeFxm.js} +22 -7
- package/lib/dom-hTEdqeoj.cjs +1 -0
- package/lib/element-linked-store/index.cjs +1 -1
- package/lib/element-linked-store/index.js +2 -2
- package/lib/element-resizer/index.cjs +1 -1
- package/lib/element-resizer/index.js +2 -2
- package/lib/en3/index.cjs +1 -1
- package/lib/en3/index.js +2 -2
- package/lib/iframe/index.cjs +1 -1
- package/lib/iframe/index.js +3 -3
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +4 -4
- package/lib/{index-DekP7OZe.cjs → index-CKTweR3M.cjs} +1 -1
- package/lib/{index-Bv9zgfdb.js → index-JqYHGoo6.js} +1 -1
- package/lib/intersector/index.cjs +1 -1
- package/lib/intersector/index.js +2 -2
- package/lib/jsx/ComponentElement.d.ts +13 -0
- package/lib/jsx/h.d.ts +3 -0
- package/lib/jsx/hooks/common.d.ts +1 -0
- package/lib/jsx/hooks/component/lifecycle.d.ts +4 -0
- package/lib/jsx/hooks/component/useInternals.d.ts +2 -0
- package/lib/jsx/hooks/component/useShadow.d.ts +2 -0
- package/lib/jsx/hooks/component/useStylesheet.d.ts +8 -0
- package/lib/jsx/hooks/store.d.ts +8 -0
- package/lib/jsx/index.cjs +1 -0
- package/lib/jsx/index.d.ts +9 -0
- package/lib/jsx/index.js +140 -0
- package/lib/jsx/render.d.ts +1 -0
- package/lib/jsx/type.d.ts +224 -0
- package/lib/jsx/utils/attributes/class.d.ts +5 -0
- package/lib/jsx/utils/attributes/setAttributes.d.ts +2 -0
- package/lib/jsx/utils/attributes/style.d.ts +6 -0
- package/lib/jsx/utils/children/filterChildren.d.ts +2 -0
- package/lib/jsx/utils/children/findTextNode.d.ts +1 -0
- package/lib/jsx/utils/children/removeChildren.d.ts +1 -0
- package/lib/jsx/utils/children/storeChildren.d.ts +2 -0
- package/lib/jsx/utils/elementStoreSubscription.d.ts +2 -0
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.js +2 -2
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.js +2 -2
- package/lib/loading/index.cjs +1 -1
- package/lib/loading/index.js +1 -1
- package/lib/masonry-layout/index.cjs +1 -1
- package/lib/masonry-layout/index.js +2 -2
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +2 -2
- package/lib/morph/Morph.d.ts +3 -21
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +3 -3
- package/lib/need_redo_tweaker/element-constructor/ElementConstructor.d.ts +1 -1
- package/lib/need_redo_tweaker/index.cjs +1 -1
- package/lib/need_redo_tweaker/index.js +8 -8
- package/lib/pixel-perfect/index.cjs +1 -1
- package/lib/pixel-perfect/index.js +3 -3
- package/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +4 -4
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +3 -3
- package/lib/radio/index.cjs +1 -1
- package/lib/radio/index.js +1 -1
- package/lib/render-BCEBRfHS.js +196 -0
- package/lib/render-Rv0UMACs.cjs +1 -0
- package/lib/router/Link.d.ts +3 -1
- package/lib/router/Route.d.ts +9 -10
- package/lib/router/Router.d.ts +13 -13
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.d.ts +2 -2
- package/lib/router/index.js +267 -216
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +8 -8
- package/lib/{scroll-DNGJVxa2.js → scroll-7JSxRKFK.js} +2 -2
- package/lib/{scroll-CIdNtj3G.cjs → scroll-DxcPU0vk.cjs} +1 -1
- package/lib/scroll-entries/index.cjs +1 -1
- package/lib/scroll-entries/index.js +1 -1
- package/lib/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +4 -4
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +3 -3
- package/lib/size-element/index.cjs +1 -1
- package/lib/size-element/index.js +1 -1
- package/lib/slicer/SlicerElement.d.ts +1 -1
- package/lib/slicer/index.cjs +1 -1
- package/lib/slicer/index.js +13 -13
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +1 -1
- package/lib/store/DerivedArray.d.ts +11 -1
- package/lib/store/Store.d.ts +5 -0
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +10 -87
- package/lib/{stylesheet-HWF2a3nr.cjs → stylesheet-BcwbfhBp.cjs} +1 -1
- package/lib/{stylesheet-DpnWNVyD.js → stylesheet-JlRFfJIc.js} +1 -1
- package/lib/ticker/index.cjs +1 -1
- package/lib/ticker/index.js +2 -2
- package/lib/url-C2kASACG.cjs +1 -0
- package/lib/{url-Ddgqz4Q_.js → url-CGbjOTU4.js} +17 -17
- package/lib/utils/dom.d.ts +2 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +102 -100
- package/lib/utils/url.d.ts +3 -2
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +3 -3
- package/lib/window-resizer/index.cjs +1 -1
- package/lib/window-resizer/index.js +1 -1
- package/lib/youtube/index.cjs +1 -1
- package/lib/youtube/index.js +3 -3
- package/package.json +21 -11
- package/lib/Store-Cd1GlEmZ.cjs +0 -1
- package/lib/dom-JBOkFLTh.cjs +0 -1
- package/lib/url-VIZgwj_h.cjs +0 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
var O = Object.defineProperty, q = Object.defineProperties;
|
|
2
|
+
var w = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var g = Object.getOwnPropertySymbols;
|
|
4
|
+
var B = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var _ = (r) => {
|
|
6
|
+
throw TypeError(r);
|
|
7
|
+
};
|
|
8
|
+
var L = (r, o, t) => o in r ? O(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t, A = (r, o) => {
|
|
9
|
+
for (var t in o || (o = {}))
|
|
10
|
+
B.call(o, t) && L(r, t, o[t]);
|
|
11
|
+
if (g)
|
|
12
|
+
for (var t of g(o))
|
|
13
|
+
K.call(o, t) && L(r, t, o[t]);
|
|
14
|
+
return r;
|
|
15
|
+
}, N = (r, o) => q(r, w(o));
|
|
16
|
+
var D = (r, o, t) => o.has(r) || _("Cannot " + t);
|
|
17
|
+
var u = (r, o, t) => (D(r, o, "read from private field"), t ? t.call(r) : o.get(r)), m = (r, o, t) => o.has(r) ? _("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(r) : o.set(r, t), S = (r, o, t, s) => (D(r, o, "write to private field"), s ? s.call(r, t) : o.set(r, t), t);
|
|
18
|
+
import { S as h } from "./Store-BtVtCGLk.js";
|
|
19
|
+
import { c as R } from "./string-BlMQbe8b.js";
|
|
20
|
+
import "construct-style-sheets-polyfill";
|
|
21
|
+
import "./index-JqYHGoo6.js";
|
|
22
|
+
import { connector as H } from "./connector/index.js";
|
|
23
|
+
import { a as M } from "./DerivedArray-D3scYQdp.js";
|
|
24
|
+
const P = { current: null };
|
|
25
|
+
var d, p;
|
|
26
|
+
class $ extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
m(this, d, []);
|
|
30
|
+
m(this, p, []);
|
|
31
|
+
P.current = this;
|
|
32
|
+
}
|
|
33
|
+
addConnectCallback(t) {
|
|
34
|
+
u(this, d).push(t);
|
|
35
|
+
}
|
|
36
|
+
addDisconnectCallback(t) {
|
|
37
|
+
u(this, p).push(t);
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
u(this, d).forEach((t) => {
|
|
41
|
+
const s = t(this);
|
|
42
|
+
s && u(this, p).push(s);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
u(this, p).forEach((t) => {
|
|
47
|
+
t(this);
|
|
48
|
+
}), S(this, d, []), S(this, p, []);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
d = new WeakMap(), p = new WeakMap();
|
|
52
|
+
function l(r, o, t) {
|
|
53
|
+
const s = o.subscribe((i) => {
|
|
54
|
+
t(i);
|
|
55
|
+
});
|
|
56
|
+
H.subscribe(r, {
|
|
57
|
+
disconnectCallback: () => {
|
|
58
|
+
s();
|
|
59
|
+
},
|
|
60
|
+
maxWaitSec: 20,
|
|
61
|
+
unsubscribeAfterDisconnect: !0
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function W(r, o) {
|
|
65
|
+
o && (o instanceof h ? l(r, o, (t) => {
|
|
66
|
+
t.previous && r.classList.remove(t.previous.toString()), t.current && r.classList.add(t.current.toString());
|
|
67
|
+
}) : typeof o == "object" && !Array.isArray(o) ? Object.entries(o).forEach(([t, s]) => {
|
|
68
|
+
s instanceof h ? l(r, s, (i) => {
|
|
69
|
+
r.classList.toggle(t, !!i.current);
|
|
70
|
+
}) : s && r.classList.add(t);
|
|
71
|
+
}) : Array.isArray(o) ? o.forEach((t) => {
|
|
72
|
+
typeof t == "string" ? r.classList.add(t) : W(r, t);
|
|
73
|
+
}) : o.toString().split(" ").map((t) => r.classList.add(t.trim())));
|
|
74
|
+
}
|
|
75
|
+
function z(r, o) {
|
|
76
|
+
o && (typeof o == "object" ? Object.entries(o).forEach(([t, s]) => {
|
|
77
|
+
s instanceof h ? l(r, s, (i) => {
|
|
78
|
+
var f;
|
|
79
|
+
r.style[t] = (f = i.current) == null ? void 0 : f.toString();
|
|
80
|
+
}) : (typeof s == "number" || typeof s == "string" || typeof s == "boolean") && (r.style[t] = s.toString());
|
|
81
|
+
}) : typeof o == "string" && (r.style = o));
|
|
82
|
+
}
|
|
83
|
+
function C(r, o, t) {
|
|
84
|
+
o === "ref" && t ? Array.isArray(t) ? t.forEach((s) => {
|
|
85
|
+
typeof s == "object" && "value" in s && (s.value = r);
|
|
86
|
+
}) : typeof t == "object" && "value" in t && (t.value = r) : o === "className" || o === "class" ? W(r, t) : o === "style" ? z(r, t) : typeof t == "number" ? o === "tabIndex" ? r.setAttribute("tabindex", t.toString()) : C(r, o, t.toString()) : typeof t == "string" ? o === "htmlFor" ? r.setAttribute("for", t) : r.setAttribute(o, t) : typeof t == "boolean" ? t ? r.setAttribute(o, "") : r.removeAttribute(o) : t instanceof h && l(r, t, (s) => {
|
|
87
|
+
o in r ? r[o] = s.current : C(r, o, s.current);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function G(r, o) {
|
|
91
|
+
for (const [t, s] of Object.entries(o != null ? o : {}))
|
|
92
|
+
typeof s == "function" && t.startsWith("on") ? r.addEventListener(
|
|
93
|
+
t.replace("on", "").toLowerCase(),
|
|
94
|
+
s
|
|
95
|
+
) : C(r, t, s);
|
|
96
|
+
}
|
|
97
|
+
function I(r) {
|
|
98
|
+
const o = [];
|
|
99
|
+
return r.forEach((t) => {
|
|
100
|
+
t != null && (typeof t == "number" ? o.push(t.toString()) : Array.isArray(t) ? t.forEach((s) => {
|
|
101
|
+
o.push(...I(s));
|
|
102
|
+
}) : o.push(t));
|
|
103
|
+
}), o;
|
|
104
|
+
}
|
|
105
|
+
function J(r, o) {
|
|
106
|
+
const t = [...r.childNodes].filter((n) => n.__storeId === o.id), s = o.current, i = Array.isArray(s) ? s : [s], f = [];
|
|
107
|
+
if (i.forEach((n) => {
|
|
108
|
+
let e = null;
|
|
109
|
+
typeof n == "boolean" || typeof n == "number" || typeof n == "string" ? e = document.createTextNode(n.toString()) : n instanceof Node && (e = n), e && (e.__storeId = o.id, f.push(e));
|
|
110
|
+
}), o instanceof M) {
|
|
111
|
+
const n = [];
|
|
112
|
+
f.forEach((e, c) => {
|
|
113
|
+
const a = t.find(
|
|
114
|
+
(b) => b.__key === e.__key
|
|
115
|
+
);
|
|
116
|
+
a ? a.isEqualNode(e) ? n.push(a) : (a.replaceWith(e), n.push(e)) : (n.push(e), r.appendChild(e));
|
|
117
|
+
}), t.forEach((e) => {
|
|
118
|
+
n.includes(e) || e.remove();
|
|
119
|
+
});
|
|
120
|
+
} else
|
|
121
|
+
f.forEach((n, e) => {
|
|
122
|
+
var a;
|
|
123
|
+
const c = t[e];
|
|
124
|
+
if (c)
|
|
125
|
+
c.isEqualNode(n) || (c.replaceWith(n), t[e] = n);
|
|
126
|
+
else {
|
|
127
|
+
const b = t[t.length - 1];
|
|
128
|
+
b ? (a = b.parentNode) == null || a.insertBefore(
|
|
129
|
+
n,
|
|
130
|
+
b.nextSibling
|
|
131
|
+
) : r.appendChild(n);
|
|
132
|
+
}
|
|
133
|
+
}), t.slice(f.length).forEach((n) => {
|
|
134
|
+
n.remove();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
class E {
|
|
138
|
+
constructor(o, t, s) {
|
|
139
|
+
this.tag = o, this.attributes = t, this.children = s;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function y(r, o, t) {
|
|
143
|
+
const s = I(t);
|
|
144
|
+
G(r, o), s.forEach((i) => {
|
|
145
|
+
i instanceof h ? l(r, i, () => {
|
|
146
|
+
J(r, i);
|
|
147
|
+
}) : i instanceof E ? i.tag === "shadow" && r.shadowRoot ? y(
|
|
148
|
+
r.shadowRoot,
|
|
149
|
+
i.attributes,
|
|
150
|
+
i.children
|
|
151
|
+
) : y(r, i.attributes, i.children) : r.append(i);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function Q(r, o, ...t) {
|
|
155
|
+
var s;
|
|
156
|
+
if (typeof r == "string") {
|
|
157
|
+
if (r === "component")
|
|
158
|
+
return new E(r, o, t);
|
|
159
|
+
if (r === "shadow")
|
|
160
|
+
return new E(r, o, t);
|
|
161
|
+
{
|
|
162
|
+
const i = document.createElement(r);
|
|
163
|
+
return y(i, o, t), i;
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
if (r === F)
|
|
167
|
+
return F(t);
|
|
168
|
+
if (r.template)
|
|
169
|
+
return r(A({}, o));
|
|
170
|
+
const i = `e-${R(r.name)}`;
|
|
171
|
+
let f = customElements.get(i);
|
|
172
|
+
f || (f = (s = class extends $ {
|
|
173
|
+
constructor() {
|
|
174
|
+
super();
|
|
175
|
+
}
|
|
176
|
+
}, s.formAssociated = r.formAssociated, s), customElements.define(i, f));
|
|
177
|
+
const n = new f(), e = N(A({}, o), {
|
|
178
|
+
children: t
|
|
179
|
+
}), c = r(e);
|
|
180
|
+
return c instanceof E && (c != null && c.children || c.attributes) && y(n, c.attributes, c.children), n;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function F(r) {
|
|
184
|
+
const o = document.createDocumentFragment();
|
|
185
|
+
return y(o, void 0, r), o;
|
|
186
|
+
}
|
|
187
|
+
function k(r, o, t) {
|
|
188
|
+
const s = /* @__PURE__ */ Q(o, A({}, t));
|
|
189
|
+
return r.append(s), s;
|
|
190
|
+
}
|
|
191
|
+
export {
|
|
192
|
+
F,
|
|
193
|
+
P as a,
|
|
194
|
+
Q as h,
|
|
195
|
+
k as r
|
|
196
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var w=Object.defineProperty,B=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var q=r=>{throw TypeError(r)};var m=(r,o,t)=>o in r?w(r,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[o]=t,A=(r,o)=>{for(var t in o||(o={}))R.call(o,t)&&m(r,t,o[t]);if(_)for(var t of _(o))H.call(o,t)&&m(r,t,o[t]);return r},N=(r,o)=>B(r,K(o));var D=(r,o,t)=>o.has(r)||q("Cannot "+t);var p=(r,o,t)=>(D(r,o,"read from private field"),t?t.call(r):o.get(r)),S=(r,o,t)=>o.has(r)?q("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(r):o.set(r,t),g=(r,o,t,e)=>(D(r,o,"write to private field"),e?e.call(r,t):o.set(r,t),t);const h=require("./Store-1JrMCgdX.cjs"),M=require("./string-DUXXtU8v.cjs");require("construct-style-sheets-polyfill");require("./index-CKTweR3M.cjs");const P=require("./connector/index.cjs"),$=require("./DerivedArray-B8A0-8uT.cjs"),F={current:null};var d,u;class z extends HTMLElement{constructor(){super();S(this,d,[]);S(this,u,[]);F.current=this}addConnectCallback(t){p(this,d).push(t)}addDisconnectCallback(t){p(this,u).push(t)}connectedCallback(){p(this,d).forEach(t=>{const e=t(this);e&&p(this,u).push(e)})}disconnectedCallback(){p(this,u).forEach(t=>{t(this)}),g(this,d,[]),g(this,u,[])}}d=new WeakMap,u=new WeakMap;function l(r,o,t){const e=o.subscribe(s=>{t(s)});P.connector.subscribe(r,{disconnectCallback:()=>{e()},maxWaitSec:20,unsubscribeAfterDisconnect:!0})}function W(r,o){o&&(o instanceof h.Store?l(r,o,t=>{t.previous&&r.classList.remove(t.previous.toString()),t.current&&r.classList.add(t.current.toString())}):typeof o=="object"&&!Array.isArray(o)?Object.entries(o).forEach(([t,e])=>{e instanceof h.Store?l(r,e,s=>{r.classList.toggle(t,!!s.current)}):e&&r.classList.add(t)}):Array.isArray(o)?o.forEach(t=>{typeof t=="string"?r.classList.add(t):W(r,t)}):o.toString().split(" ").map(t=>r.classList.add(t.trim())))}function G(r,o){o&&(typeof o=="object"?Object.entries(o).forEach(([t,e])=>{e instanceof h.Store?l(r,e,s=>{var c;r.style[t]=(c=s.current)==null?void 0:c.toString()}):(typeof e=="number"||typeof e=="string"||typeof e=="boolean")&&(r.style[t]=e.toString())}):typeof o=="string"&&(r.style=o))}function C(r,o,t){o==="ref"&&t?Array.isArray(t)?t.forEach(e=>{typeof e=="object"&&"value"in e&&(e.value=r)}):typeof t=="object"&&"value"in t&&(t.value=r):o==="className"||o==="class"?W(r,t):o==="style"?G(r,t):typeof t=="number"?o==="tabIndex"?r.setAttribute("tabindex",t.toString()):C(r,o,t.toString()):typeof t=="string"?o==="htmlFor"?r.setAttribute("for",t):r.setAttribute(o,t):typeof t=="boolean"?t?r.setAttribute(o,""):r.removeAttribute(o):t instanceof h.Store&&l(r,t,e=>{o in r?r[o]=e.current:C(r,o,e.current)})}function J(r,o){for(const[t,e]of Object.entries(o!=null?o:{}))typeof e=="function"&&t.startsWith("on")?r.addEventListener(t.replace("on","").toLowerCase(),e):C(r,t,e)}function I(r){const o=[];return r.forEach(t=>{t!=null&&(typeof t=="number"?o.push(t.toString()):Array.isArray(t)?t.forEach(e=>{o.push(...I(e))}):o.push(t))}),o}function Q(r,o){const t=[...r.childNodes].filter(n=>n.__storeId===o.id),e=o.current,s=Array.isArray(e)?e:[e],c=[];if(s.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=o.id,c.push(i))}),o instanceof $.DerivedKeyedArray){const n=[];c.forEach((i,f)=>{const a=t.find(b=>b.__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 c.forEach((n,i)=>{var a;const f=t[i];if(f)f.isEqualNode(n)||(f.replaceWith(n),t[i]=n);else{const b=t[t.length-1];b?(a=b.parentNode)==null||a.insertBefore(n,b.nextSibling):r.appendChild(n)}}),t.slice(c.length).forEach(n=>{n.remove()})}class E{constructor(o,t,e){this.tag=o,this.attributes=t,this.children=e}}function y(r,o,t){const e=I(t);J(r,o),e.forEach(s=>{s instanceof h.Store?l(r,s,()=>{Q(r,s)}):s instanceof E?s.tag==="shadow"&&r.shadowRoot?y(r.shadowRoot,s.attributes,s.children):y(r,s.attributes,s.children):r.append(s)})}function O(r,o,...t){var e;if(typeof r=="string"){if(r==="component")return new E(r,o,t);if(r==="shadow")return new E(r,o,t);{const s=document.createElement(r);return y(s,o,t),s}}else{if(r===L)return L(t);if(r.template)return r(A({},o));const s=`e-${M.camelToKebab(r.name)}`;let c=customElements.get(s);c||(c=(e=class extends z{constructor(){super()}},e.formAssociated=r.formAssociated,e),customElements.define(s,c));const n=new c,i=N(A({},o),{children:t}),f=r(i);return f instanceof E&&(f!=null&&f.children||f.attributes)&&y(n,f.attributes,f.children),n}}function L(r){const o=document.createDocumentFragment();return y(o,void 0,r),o}function U(r,o,t){const e=O(o,A({},t));return r.append(e),e}exports.Fragment=L;exports.activeComponent=F;exports.h=O;exports.render=U;
|
package/lib/router/Link.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { SplitPathResult } from '../utils';
|
|
1
2
|
import { Router } from './Router';
|
|
2
3
|
export declare class Link {
|
|
3
4
|
#private;
|
|
4
|
-
constructor(router: Router, element:
|
|
5
|
+
constructor(router: Router, element: HTMLAnchorElement);
|
|
6
|
+
checkCurrent(url: SplitPathResult): void;
|
|
5
7
|
destroy(): void;
|
|
6
8
|
}
|
package/lib/router/Route.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
export type RouteModule = () => Promise<
|
|
2
|
-
|
|
3
|
-
[key in T]: string;
|
|
1
|
+
export type RouteModule = () => Promise<{
|
|
2
|
+
default?: RouteComponent;
|
|
4
3
|
}>;
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export type RouteComponent = CustomElementConstructor | JSX.Component;
|
|
5
|
+
export type HeadNode = HTMLStyleElement | HTMLScriptElement | HTMLLinkElement;
|
|
6
|
+
export interface RouteParameters {
|
|
7
|
+
urlPatternResult: URLPatternResult;
|
|
8
|
+
}
|
|
9
9
|
export declare class Route {
|
|
10
10
|
#private;
|
|
11
11
|
constructor(pattern: string, module: RouteModule);
|
|
12
12
|
get pattern(): string;
|
|
13
|
-
get urlPattern(): URLPattern;
|
|
14
13
|
get isActive(): boolean;
|
|
15
14
|
get element(): HTMLElement | null;
|
|
16
|
-
get nest():
|
|
15
|
+
get nest(): Element | ShadowRoot | null;
|
|
17
16
|
testPathname(pathname: string): boolean;
|
|
18
|
-
render(
|
|
17
|
+
render(container: Element | ShadowRoot, pathname: string): Promise<void>;
|
|
19
18
|
close(): void;
|
|
20
19
|
getAnchorElements(): HTMLAnchorElement[];
|
|
21
20
|
}
|
package/lib/router/Router.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Route, RouteModule } from './Route';
|
|
1
|
+
import { ChangeHistoryAction, SplitPathResult } from '../utils';
|
|
3
2
|
import { Link } from './Link';
|
|
3
|
+
import { Route, RouteModule } from './Route';
|
|
4
4
|
export interface RouterPreprocessorEntry {
|
|
5
|
-
path:
|
|
5
|
+
path: SplitPathResult;
|
|
6
6
|
resolve: () => void;
|
|
7
7
|
reject: () => void;
|
|
8
8
|
}
|
|
@@ -15,6 +15,10 @@ export interface RouterAfterNavigationEntry {
|
|
|
15
15
|
pathname: string;
|
|
16
16
|
}
|
|
17
17
|
export type RouterAfterNavigationCallback = (entry: RouterAfterNavigationEntry) => void;
|
|
18
|
+
export interface RouterNavigateOptions {
|
|
19
|
+
historyAction?: ChangeHistoryAction;
|
|
20
|
+
revalidate?: boolean;
|
|
21
|
+
}
|
|
18
22
|
export interface RouterParameters {
|
|
19
23
|
rootElement?: HTMLElement;
|
|
20
24
|
base?: string;
|
|
@@ -24,18 +28,14 @@ export declare class Router {
|
|
|
24
28
|
preprocessor?: RouterPreprocessor;
|
|
25
29
|
postprocessor?: RouterPostprocessor;
|
|
26
30
|
constructor(parameters?: RouterParameters);
|
|
27
|
-
get
|
|
28
|
-
get
|
|
31
|
+
get candidateURL(): SplitPathResult | null;
|
|
32
|
+
get currentURL(): SplitPathResult;
|
|
29
33
|
get routes(): Route[];
|
|
30
34
|
get links(): Link[];
|
|
35
|
+
run(): void;
|
|
36
|
+
destroy(): void;
|
|
31
37
|
navigationEvent(callback: RouterAfterNavigationCallback): () => void;
|
|
32
38
|
defineRoute(pattern: string, module: RouteModule): void;
|
|
33
|
-
navigate(path: string,
|
|
34
|
-
normalizePath(path: string):
|
|
35
|
-
leaf: string;
|
|
36
|
-
pathname: string;
|
|
37
|
-
parameters: string;
|
|
38
|
-
hash: string;
|
|
39
|
-
path: string;
|
|
40
|
-
};
|
|
39
|
+
navigate(path: string, options?: RouterNavigateOptions): Promise<void>;
|
|
40
|
+
normalizePath(path: string): SplitPathResult;
|
|
41
41
|
}
|
package/lib/router/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Y=c=>{throw TypeError(c)};var F=(c,t,s)=>t.has(c)||Y("Cannot "+s);var e=(c,t,s)=>(F(c,t,"read from private field"),s?s.call(c):t.get(c)),a=(c,t,s)=>t.has(c)?Y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,s),h=(c,t,s,i)=>(F(c,t,"write to private field"),i?i.call(c,s):t.set(c,s),s),n=(c,t,s)=>(F(c,t,"access private method"),s);var g=(c,t,s)=>new Promise((i,l)=>{var m=f=>{try{L(s.next(f))}catch(D){l(D)}},w=f=>{try{L(s.throw(f))}catch(D){l(D)}},L=f=>f.done?i(f.value):Promise.resolve(f.value).then(m,w);L((s=s.apply(c,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../notifier/index.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const x=require("../url-C2kASACG.cjs"),ft=require("urlpattern-polyfill"),gt=require("../render-Rv0UMACs.cjs"),Rt=require("../dom-hTEdqeoj.cjs"),_=require("../object-CCiXnER2.cjs");var b,y,B,G,H;class yt{constructor(t,s){a(this,B);a(this,b);a(this,y);a(this,H,t=>{t.preventDefault();const s=e(this,B,G),i=e(this,y).getAttribute("data-history-action")||"push";e(this,b).navigate(s,{historyAction:i})});h(this,b,t),h(this,y,s),e(this,y).addEventListener("click",e(this,H))}checkCurrent(t){}destroy(){e(this,y).removeEventListener("click",e(this,H)),e(this,y).classList.remove("current")}}b=new WeakMap,y=new WeakMap,B=new WeakSet,G=function(){const t=new URL(e(this,y).href);return e(this,b).normalizePath(t.pathname+t.search+t.hash).path},H=new WeakMap;var C,T,S,d,u,k,M,P,A,N,o,J,Q,V,X,Z,$,tt,et,st,K;class vt{constructor(t,s){a(this,o);a(this,C);a(this,T);a(this,S);a(this,d,null);a(this,u,null);a(this,k,!1);a(this,M,null);a(this,P);a(this,A,[]);a(this,N,[]);h(this,C,t),h(this,T,s),h(this,S,new URLPattern({pathname:e(this,C)})),h(this,P,new MutationObserver(n(this,o,et).bind(this)))}get pattern(){return e(this,C)}get isActive(){return e(this,k)}get element(){return e(this,u)}get nest(){return e(this,M)}testPathname(t){return e(this,S).test({pathname:t})}render(t,s){return g(this,null,function*(){e(this,P).observe(document.head,{childList:!0,subtree:!0}),e(this,d)?n(this,o,V).call(this):yield n(this,o,J).call(this),yield n(this,o,st).call(this),e(this,d)&&(yield n(this,o,X).call(this,t,s)),e(this,P).disconnect()})}close(){n(this,o,$).call(this)}getAnchorElements(){const t=[];return e(this,u)&&(t.push(...e(this,u).querySelectorAll("a")),Rt.traverseShadowRoots(e(this,u),s=>{t.push(...s.shadowRoot.querySelectorAll("a"))})),t}}C=new WeakMap,T=new WeakMap,S=new WeakMap,d=new WeakMap,u=new WeakMap,k=new WeakMap,M=new WeakMap,P=new WeakMap,A=new WeakMap,N=new WeakMap,o=new WeakSet,J=function(){return g(this,null,function*(){const t=yield e(this,T).call(this);h(this,N,[...e(this,A)]),typeof t.default=="function"&&(h(this,d,t.default),yield n(this,o,Q).call(this))})},Q=function(){return g(this,null,function*(){if(e(this,d)&&_.isESClass(e(this,d))){const t=`e-${e(this,d).name.toLowerCase()}`;customElements.get(t)||customElements.define(t,e(this,d))}})},V=function(){e(this,A).forEach(t=>{document.head.appendChild(t.cloneNode(!0))})},X=function(t,s){return g(this,null,function*(){const l={urlPatternResult:e(this,S).exec({pathname:s})};_.isESClass(e(this,d))?(h(this,u,new(e(this,d))(l)),t.appendChild(e(this,u))):h(this,u,gt.render(t,e(this,d),l)),n(this,o,Z).call(this),h(this,k,!0)})},Z=function(){var t;e(this,u)&&h(this,M,e(this,u).querySelector("[data-nest]")||((t=e(this,u).shadowRoot)==null?void 0:t.querySelector("[data-nest]"))||e(this,u).shadowRoot||e(this,u))},$=function(){var t;e(this,P).disconnect(),(t=e(this,u))==null||t.remove(),h(this,k,!1),n(this,o,tt).call(this)},tt=function(){e(this,N).forEach(t=>{t.parentNode===document.head&&document.head.removeChild(t)}),h(this,N,[])},et=function(t){t.forEach(s=>{s.addedNodes.forEach(i=>{e(this,d)?e(this,N).push(i):e(this,A).push(i)})})},st=function(){return g(this,null,function*(){const t=e(this,A).filter(n(this,o,K));yield Promise.all(t.map(s=>new Promise(i=>{n(this,o,K).call(this,s)?s.onload=()=>i():i()})))})},K=function(t){return t instanceof HTMLElement&&(t.tagName==="STYLE"||t.tagName==="SCRIPT"||t.tagName==="LINK")};globalThis.URLPattern=ft.URLPattern;var q,I,R,U,E,v,j,p,z,r,it,at,rt,ht,nt,ot,ct,lt,ut,W,dt,mt,O;class wt{constructor(t){a(this,r);a(this,q);a(this,I);a(this,R,[]);a(this,U,null);a(this,E,[]);a(this,v,null);a(this,j,null);a(this,p,null);a(this,z,new pt.Notifier);a(this,O,t=>{var s;(s=t.state)!=null&&s.path&&this.navigate(t.state.path,{historyAction:"none"})});var s;h(this,I,t!=null&&t.base?x.normalizeBase(t.base):"/"),h(this,q,(s=t==null?void 0:t.rootElement)!=null?s:document.body),h(this,p,this.normalizePath(location.pathname+location.search+location.hash)),n(this,r,it).call(this)}get candidateURL(){return e(this,v)}get currentURL(){return e(this,p)}get routes(){return e(this,R)}get links(){return e(this,E)}run(){n(this,r,lt).call(this),this.navigate(e(this,p).path,{revalidate:!0})}destroy(){removeEventListener("popstate",e(this,O)),n(this,r,W).call(this),e(this,R).forEach(t=>t.close()),e(this,z).close()}navigationEvent(t){return e(this,z).subscribe(t)}defineRoute(t,s){const i=new vt(t,s);e(this,R).push(i)}navigate(t,s){return g(this,null,function*(){var l,m,w;const i=this.normalizePath(t);if(!(s!=null&&s.revalidate)&&(((l=e(this,v))==null?void 0:l.pathname)===i.pathname||e(this,p).pathname===i.pathname)){((m=e(this,p))==null?void 0:m.parameters)!==i.parameters&&(h(this,j,e(this,p)),h(this,p,i),x.changeHistory({action:((w=e(this,p))==null?void 0:w.hash)!==i.hash?"replace":(s==null?void 0:s.historyAction)||"push",pathname:i.pathname,searchParameters:i.parameters,hash:i.hash})),e(this,E).forEach(L=>{L.checkCurrent(i)});return}h(this,v,i),(yield n(this,r,at).call(this,e(this,v)))&&i.path===e(this,v).path&&(yield n(this,r,rt).call(this,e(this,v),s))})}normalizePath(t){return x.splitPath(t,{base:e(this,I)})}}q=new WeakMap,I=new WeakMap,R=new WeakMap,U=new WeakMap,E=new WeakMap,v=new WeakMap,j=new WeakMap,p=new WeakMap,z=new WeakMap,r=new WeakSet,it=function(){addEventListener("popstate",e(this,O))},at=function(t){return g(this,null,function*(){if(!this.preprocessor)return!0;try{return yield new Promise((s,i)=>{var l;(l=this.preprocessor)==null||l.call(this,{path:t,resolve:s,reject:i})}),!0}catch(s){return console.error(s!=null?s:"Route change canceled"),!1}})},rt=function(i){return g(this,arguments,function*(t,s={}){var f;const{activeRoutes:l,newRoutes:m,oldRoutes:w,keepRoutes:L}=n(this,r,ht).call(this,t.leaf);h(this,U,(f=L[L.length-1])!=null?f:null),n(this,r,nt).call(this,w),h(this,p,t),x.changeHistory({action:s.historyAction||"push",pathname:t.pathname,searchParameters:t.parameters,hash:t.hash}),yield n(this,r,ot).call(this,m,t.leaf),n(this,r,ut).call(this),n(this,r,ct).call(this,t.pathname)})},ht=function(t){const s=e(this,R).filter(i=>i.isActive);return{activeRoutes:s,newRoutes:e(this,R).filter(i=>!s.includes(i)&&i.testPathname(t)),oldRoutes:s.filter(i=>!i.testPathname(t)),keepRoutes:s.filter(i=>i.testPathname(t))}},nt=function(t){t.forEach(s=>s.close())},ot=function(t,s){return g(this,null,function*(){var i,l;for(const m of t){const w=(l=(i=e(this,U))==null?void 0:i.nest)!=null?l:e(this,q);yield m.render(w,s),h(this,U,m)}})},ct=function(t){var s;(s=this.postprocessor)==null||s.call(this,{pathname:t}),e(this,z).notify({pathname:t})},lt=function(){e(this,R).sort((t,s)=>{const i=t.pattern.split("/").length,l=s.pattern.split("/").length;return i-l})},ut=function(){n(this,r,W).call(this),n(this,r,dt).call(this)},W=function(){e(this,E).forEach(t=>t.destroy()),h(this,E,[])},dt=function(){const t=e(this,R).filter(i=>i.isActive),s=n(this,r,mt).call(this,t);h(this,E,s.map(i=>new yt(this,i)))},mt=function(t){const s=Array.from(e(this,q).querySelectorAll("a")),i=t.flatMap(l=>l.getAnchorElements());return Array.from(new Set([...s,...i].filter(l=>{var m;return(m=l.getAttribute("href"))==null?void 0:m.startsWith("/")})))},O=new WeakMap;exports.Router=wt;
|
package/lib/router/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Router, type
|
|
2
|
-
export { type RouteModule, type RouteParameters
|
|
1
|
+
export { Router, type RouterAfterNavigationCallback, type RouterParameters, type RouterPostprocessor, type RouterPreprocessor, type RouterPreprocessorEntry, } from './Router';
|
|
2
|
+
export { type RouteModule, type RouteParameters } from './Route';
|