lithent 1.14.1 → 1.15.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/dist/diff.d.ts +3 -0
- package/dist/lithent.mjs +205 -200
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/universalRef.d.ts +1 -1
- package/dist/wDom.d.ts +13 -1
- package/examples/dist/assets/index-B-8ORC6a.js +2 -0
- package/examples/dist/assets/index-B-8ORC6a.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/helper/dist/hook/store.d.ts +4 -1
- package/helper/dist/lithentHelper.mjs +77 -78
- package/helper/dist/lithentHelper.mjs.map +1 -1
- package/helper/dist/lithentHelper.umd.js +1 -1
- package/helper/dist/lithentHelper.umd.js.map +1 -1
- package/helper/src/hook/store.ts +46 -44
- package/helper/src/tests/store.tsx +3 -16
- package/helper/src/tests/storeObserver.tsx +19 -7
- package/package.json +13 -4
- package/src/diff.ts +44 -0
- package/src/render.ts +78 -51
- package/src/types/index.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/redraw.ts +9 -7
- package/src/utils/universalRef.ts +9 -2
- package/src/wDom.ts +43 -2
- package/ssr/dist/helper/index.d.ts +8 -0
- package/ssr/dist/hydration.d.ts +5 -0
- package/ssr/dist/index.d.ts +8 -0
- package/ssr/dist/lithentSsr.mjs +156 -0
- package/ssr/dist/lithentSsr.mjs.map +1 -0
- package/ssr/dist/lithentSsr.umd.js +2 -0
- package/ssr/dist/lithentSsr.umd.js.map +1 -0
- package/ssr/dist/renderToString.d.ts +5 -0
- package/ssr/dist/tests/tostring.d.ts +2 -0
- package/ssr/package.json +37 -0
- package/ssr/src/helper/index.ts +55 -0
- package/ssr/src/hydration.ts +156 -0
- package/ssr/src/index.ts +32 -0
- package/ssr/src/renderToString.ts +97 -0
- package/ssr/src/tests/tostring.tsx +41 -0
- package/examples/dist/assets/index-49a-yvJN.js +0 -2
- package/examples/dist/assets/index-49a-yvJN.js.map +0 -1
package/dist/diff.d.ts
CHANGED
package/dist/lithent.mjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const R = (e) => typeof e == "object" && !("resolve" in e),
|
|
1
|
+
const R = (e) => typeof e == "object" && !("resolve" in e), a = (e, t) => R(e) && e.type === t, pe = (e, t) => "ctor" in e ? e.ctor === (t == null ? void 0 : t.ctor) : e === (t == null ? void 0 : t.ctor), he = (e, t) => {
|
|
2
2
|
var s, c;
|
|
3
3
|
return R(e) && (t == null ? void 0 : t.type) === "fragment" && ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length);
|
|
4
|
-
},
|
|
4
|
+
}, ie = (e, t) => {
|
|
5
5
|
var s, c;
|
|
6
6
|
return R(e) && (t == null ? void 0 : t.type) === "element" && (t == null ? void 0 : t.tag) === e.tag && ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length);
|
|
7
|
-
},
|
|
7
|
+
}, X = (e, t) => R(e) && (t == null ? void 0 : t.type) === e.type, ye = (e, t) => {
|
|
8
8
|
var s, c;
|
|
9
9
|
return R(e) && (t == null ? void 0 : t.type) === e.type && (E(o((e.children || [])[0])) && E(o(((t == null ? void 0 : t.children) || [])[0])) || ((s = t == null ? void 0 : t.children) == null ? void 0 : s.length) === ((c = e == null ? void 0 : e.children) == null ? void 0 : c.length));
|
|
10
10
|
}, o = (e) => {
|
|
11
11
|
var t, s;
|
|
12
12
|
return ((t = e == null ? void 0 : e.compProps) == null ? void 0 : t.key) ?? ((s = e == null ? void 0 : e.props) == null ? void 0 : s.key);
|
|
13
|
-
},
|
|
13
|
+
}, C = (e) => e && ["fragment", "loop"].includes(e), T = (e) => typeof e == "function" && !g(e) || typeof e == "object" && "resolve" in e, g = (e) => typeof e == "function" && e === J, m = (e) => R(e) && !e.type, E = (e) => e != null, Y = (e, t) => e === "style" && typeof t == "object", ve = (e, t) => e === "ref" && typeof t == "object", Ce = (e, t) => {
|
|
14
14
|
const s = Object.getOwnPropertyDescriptor(
|
|
15
15
|
e.constructor.prototype,
|
|
16
16
|
t
|
|
17
17
|
);
|
|
18
18
|
return s && s.get && s.set;
|
|
19
|
-
},
|
|
19
|
+
}, Re = (e) => {
|
|
20
20
|
let t = "et";
|
|
21
|
-
return
|
|
22
|
-
},
|
|
23
|
-
c:
|
|
24
|
-
l:
|
|
25
|
-
t:
|
|
26
|
-
e:
|
|
27
|
-
f:
|
|
28
|
-
et:
|
|
29
|
-
},
|
|
21
|
+
return T(e) ? t = "c" : a(e, "fragment") ? t = "f" : a(e, "element") ? t = "e" : a(e, "loop") ? t = "l" : a(e, "text") ? t = "t" : m(e) && (t = "et"), t;
|
|
22
|
+
}, ke = {
|
|
23
|
+
c: pe,
|
|
24
|
+
l: ye,
|
|
25
|
+
t: X,
|
|
26
|
+
e: ie,
|
|
27
|
+
f: he,
|
|
28
|
+
et: X
|
|
29
|
+
}, v = Symbol.for("lithentWDomSymbol"), k = { value: "" }, S = { value: {} }, O = { value: !1 }, f = /* @__PURE__ */ new WeakMap(), Ee = (e) => {
|
|
30
30
|
f.set(e, {
|
|
31
31
|
vd: { value: null },
|
|
32
32
|
up: () => {
|
|
@@ -38,131 +38,131 @@ const R = (e) => typeof e == "object" && !("resolve" in e), N = (e, t) => R(e) &
|
|
|
38
38
|
mts: [],
|
|
39
39
|
umts: []
|
|
40
40
|
});
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
f.get(
|
|
41
|
+
}, x = () => S.value, Z = (e, t) => f.get(e) ? f.get(e)[t] : null, Pe = (e) => S.value = e, Se = (e) => {
|
|
42
|
+
S.value = e, Ee(e);
|
|
43
|
+
}, i = (e) => e.getParent && e.getParent(), P = Object.entries, w = Object.keys, b = Object.assign, lt = (e) => typeof e == "object" && !Array.isArray(e) && !Object.getOwnPropertySymbols(e).includes(v), xe = (e) => {
|
|
44
|
+
f.get(x()).umts.push(e);
|
|
45
45
|
}, U = (e) => {
|
|
46
46
|
const { compKey: t } = e;
|
|
47
|
-
t &&
|
|
48
|
-
},
|
|
47
|
+
t && Ne(t), W(e);
|
|
48
|
+
}, W = (e) => {
|
|
49
49
|
(e.children || []).forEach((t) => {
|
|
50
|
-
t.compKey ? U(t) :
|
|
50
|
+
t.compKey ? U(t) : W(t);
|
|
51
51
|
});
|
|
52
|
-
},
|
|
52
|
+
}, Ne = (e) => {
|
|
53
53
|
const t = f.get(e);
|
|
54
54
|
t && (t.umts.forEach((s) => s()), t.umts = [], f.delete(e));
|
|
55
55
|
};
|
|
56
|
-
let
|
|
56
|
+
let Q = [];
|
|
57
57
|
const I = () => {
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
e.compKey &&
|
|
61
|
-
}, ft = (e) => f.get(
|
|
58
|
+
Q.forEach((e) => Te(e)), Q = [];
|
|
59
|
+
}, ae = (e) => {
|
|
60
|
+
e.compKey && Q.push(e);
|
|
61
|
+
}, ft = (e) => f.get(x()).mts.push(e), Te = (e) => {
|
|
62
62
|
const { compKey: t } = e;
|
|
63
63
|
if (t) {
|
|
64
|
-
const s = f.get(t), c = s == null ? void 0 : s.mts,
|
|
65
|
-
|
|
66
|
-
const u =
|
|
67
|
-
u &&
|
|
64
|
+
const s = f.get(t), c = s == null ? void 0 : s.mts, r = s == null ? void 0 : s.upS;
|
|
65
|
+
S.value = t, r && (r.value = 0), c && (s.mts = [], c.forEach((n) => {
|
|
66
|
+
const u = n();
|
|
67
|
+
u && xe(u);
|
|
68
68
|
}));
|
|
69
69
|
}
|
|
70
|
-
},
|
|
71
|
-
const s = f.get(
|
|
72
|
-
if (
|
|
70
|
+
}, H = (e, t = () => []) => {
|
|
71
|
+
const s = f.get(x()), { upD: c, upS: r } = s, n = c[r.value];
|
|
72
|
+
if (n && Ue(n, t())) {
|
|
73
73
|
const u = e();
|
|
74
74
|
u && s.upCB.push(u);
|
|
75
75
|
}
|
|
76
|
-
c[
|
|
76
|
+
c[r.value] = t(), r.value += 1;
|
|
77
77
|
}, be = (e) => {
|
|
78
78
|
const { compKey: t } = e;
|
|
79
79
|
if (t) {
|
|
80
|
-
const s = f.get(t), c = s == null ? void 0 : s.upCB,
|
|
81
|
-
|
|
80
|
+
const s = f.get(t), c = s == null ? void 0 : s.upCB, r = s == null ? void 0 : s.upS;
|
|
81
|
+
S.value = t, r && (r.value = 0), e.ctor && c && (s.upCB = [], c.forEach((n) => n()));
|
|
82
82
|
}
|
|
83
|
-
},
|
|
84
|
-
t ?? (t = document.body), e.
|
|
85
|
-
const
|
|
86
|
-
return s ? (e.afterElement = s, t.insertBefore(
|
|
87
|
-
var
|
|
88
|
-
const n = (
|
|
89
|
-
n && U(n), F(n || e),
|
|
83
|
+
}, Ue = (e, t) => e.length ? e.some((s, c) => s !== t[c]) : !0, Fe = (e) => e === "className" ? "class" : e, D = (e) => e.replace(/^on(.*)/, (t, s) => s.toLowerCase()), z = () => new DocumentFragment(), V = (e) => document.createElement(e), ot = (e, t, s, c) => {
|
|
84
|
+
e.isRoot = !0, t ?? (t = document.body), e.wrapElement = t;
|
|
85
|
+
const r = L(e, c);
|
|
86
|
+
return s ? (e.afterElement = s, t.insertBefore(r, s)) : c || (t.tagName === "HTML" ? t.replaceWith(r) : t.appendChild(r)), I(), () => {
|
|
87
|
+
var u;
|
|
88
|
+
const n = (u = f.get(e.compProps || {})) == null ? void 0 : u.vd.value;
|
|
89
|
+
n && U(n), F(n || e), Le(n || e);
|
|
90
90
|
};
|
|
91
|
-
},
|
|
91
|
+
}, ee = (e) => {
|
|
92
92
|
const { needRerender: t } = e;
|
|
93
93
|
t && t !== "N" && ({
|
|
94
94
|
A: G,
|
|
95
95
|
D: $,
|
|
96
|
-
R:
|
|
96
|
+
R: Me,
|
|
97
97
|
U: B,
|
|
98
98
|
CNSU: B,
|
|
99
|
-
SR:
|
|
100
|
-
SU:
|
|
99
|
+
SR: ce,
|
|
100
|
+
SU: Ae
|
|
101
101
|
}[t](e), delete e.needRerender, delete e.oldChildren, delete e.oldProps);
|
|
102
102
|
}, F = (e) => {
|
|
103
|
-
e.props && e.el &&
|
|
103
|
+
e.props && e.el && ue(e.props, e.el), (e.children || []).forEach((t) => {
|
|
104
104
|
F(t);
|
|
105
105
|
});
|
|
106
|
-
},
|
|
107
|
-
|
|
106
|
+
}, Le = (e) => {
|
|
107
|
+
te(e, e.wrapElement);
|
|
108
108
|
}, $ = (e) => {
|
|
109
|
-
e.oldProps && e.el &&
|
|
109
|
+
e.oldProps && e.el && ue(e.oldProps, e.el), te(
|
|
110
110
|
e,
|
|
111
|
-
|
|
111
|
+
A(i(e))
|
|
112
112
|
);
|
|
113
|
-
},
|
|
113
|
+
}, te = (e, t) => {
|
|
114
114
|
var s, c;
|
|
115
|
-
t && e.el && ([1, 3].includes((s = e.el) == null ? void 0 : s.nodeType) ? t.removeChild(e.el) : ((c = e.el) == null ? void 0 : c.nodeType) === 11 &&
|
|
116
|
-
},
|
|
115
|
+
t && e.el && ([1, 3].includes((s = e.el) == null ? void 0 : s.nodeType) ? t.removeChild(e.el) : ((c = e.el) == null ? void 0 : c.nodeType) === 11 && se(e), delete e.el);
|
|
116
|
+
}, se = (e, t) => {
|
|
117
117
|
((e == null ? void 0 : e.oldChildren) || (e == null ? void 0 : e.children) || []).forEach((s) => {
|
|
118
|
-
var
|
|
119
|
-
const c = (
|
|
120
|
-
c && ([1, 3].includes(c) ?
|
|
118
|
+
var r;
|
|
119
|
+
const c = (r = s.el) == null ? void 0 : r.nodeType;
|
|
120
|
+
c && ([1, 3].includes(c) ? s.el.tagName === "HTML" ? s.el.innerHTML = "" : s.el.remove() : c === 11 && se(s));
|
|
121
121
|
});
|
|
122
|
-
},
|
|
122
|
+
}, ce = (e) => {
|
|
123
123
|
$(e), G(e);
|
|
124
|
-
},
|
|
125
|
-
if (B(e),
|
|
126
|
-
const s =
|
|
124
|
+
}, Ae = (e) => {
|
|
125
|
+
if (B(e), i(e).needRerender !== "CNSU") {
|
|
126
|
+
const s = ne(e);
|
|
127
127
|
G(e, s);
|
|
128
128
|
}
|
|
129
129
|
}, G = (e, t) => {
|
|
130
130
|
t || (t = L(e));
|
|
131
|
-
const s =
|
|
131
|
+
const s = i(e);
|
|
132
132
|
if (s.type) {
|
|
133
|
-
const c =
|
|
134
|
-
t && c && (e.tag !== "portal" && (
|
|
133
|
+
const c = A(s), n = s.type === "loop" && s.needRerender && s.needRerender !== "CNSU" ? j(s, i(s)) : j(e, s);
|
|
134
|
+
t && c && (e.tag !== "portal" && (n ? c.insertBefore(t, n) : c.appendChild(t)), I());
|
|
135
135
|
}
|
|
136
|
-
},
|
|
137
|
-
const c =
|
|
136
|
+
}, ne = (e) => C(e.type) ? ((e == null ? void 0 : e.children) || []).reduce((t, s) => {
|
|
137
|
+
const c = ne(s);
|
|
138
138
|
return c && t.appendChild(c), t;
|
|
139
|
-
}, z()) : e.el,
|
|
140
|
-
const s = t.children || [],
|
|
139
|
+
}, z()) : e.el, j = (e, t) => {
|
|
140
|
+
const s = t.children || [], r = s.indexOf(e) + 1, n = s.slice(r), u = re(n), l = t.type || "";
|
|
141
141
|
if (u)
|
|
142
142
|
return u;
|
|
143
|
-
if (!t.isRoot &&
|
|
144
|
-
return
|
|
145
|
-
if (t.isRoot &&
|
|
143
|
+
if (!t.isRoot && C(l))
|
|
144
|
+
return j(t, i(t));
|
|
145
|
+
if (t.isRoot && C(l) && t.afterElement)
|
|
146
146
|
return t.afterElement;
|
|
147
|
-
},
|
|
147
|
+
}, re = (e) => e.reduce(
|
|
148
148
|
(t, s) => {
|
|
149
|
-
const c = s.type,
|
|
150
|
-
return t || (
|
|
149
|
+
const c = s.type, r = s.el, n = c && C(c);
|
|
150
|
+
return t || (n ? re(s.children || []) : r && r.nodeType !== 11 ? r : t);
|
|
151
151
|
},
|
|
152
152
|
void 0
|
|
153
|
-
),
|
|
154
|
-
const t =
|
|
153
|
+
), Me = (e) => {
|
|
154
|
+
const t = i(e), s = e.el;
|
|
155
155
|
if (t.type && s)
|
|
156
156
|
if (s.nodeType === 11)
|
|
157
|
-
|
|
157
|
+
ce(e);
|
|
158
158
|
else {
|
|
159
|
-
const c =
|
|
160
|
-
c && e.tag !== "portal" && c.replaceChild(
|
|
159
|
+
const c = A(t), r = L(e);
|
|
160
|
+
c && e.tag !== "portal" && c.replaceChild(r, s), I();
|
|
161
161
|
}
|
|
162
|
-
},
|
|
162
|
+
}, ue = (e, t) => {
|
|
163
163
|
P(e || {}).forEach(([s, c]) => {
|
|
164
164
|
s.match(/^on/) && t.removeEventListener(
|
|
165
|
-
|
|
165
|
+
D(s),
|
|
166
166
|
c
|
|
167
167
|
);
|
|
168
168
|
});
|
|
@@ -170,106 +170,111 @@ const I = () => {
|
|
|
170
170
|
var s;
|
|
171
171
|
const t = e.el;
|
|
172
172
|
if (e.type === "text") {
|
|
173
|
-
|
|
173
|
+
Oe(e);
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
if (t) {
|
|
177
|
-
const { oldProps: c, props:
|
|
178
|
-
|
|
177
|
+
const { oldProps: c, props: r } = e;
|
|
178
|
+
le(r, t, c), delete e.oldProps, e.tag === "input" && (t.value = String(((s = e == null ? void 0 : e.props) == null ? void 0 : s.value) || ""));
|
|
179
179
|
}
|
|
180
|
-
(e.children || []).forEach((c) =>
|
|
181
|
-
},
|
|
180
|
+
(e.children || []).forEach((c) => ee(c)), be(e);
|
|
181
|
+
}, Oe = (e) => {
|
|
182
182
|
const t = e.el;
|
|
183
183
|
t && (t.nodeValue = String(e.text));
|
|
184
|
-
},
|
|
185
|
-
const
|
|
186
|
-
P(e || {}).forEach(([n,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
}, le = (e, t, s, c) => {
|
|
185
|
+
const r = { ...s };
|
|
186
|
+
P(e || {}).forEach(([n, u]) => {
|
|
187
|
+
c && n.match(/^on/) ? K(
|
|
188
|
+
t,
|
|
189
|
+
n,
|
|
190
|
+
u,
|
|
191
|
+
r[n]
|
|
192
|
+
) : (n === "key" || u === r[n] || n === "portal" && typeof u == "object" || (n === "innerHTML" && typeof u == "string" ? t.innerHTML = u : Y(n, u) ? Be(
|
|
193
|
+
u,
|
|
194
|
+
Y(n, r.style) ? r.style : {},
|
|
190
195
|
t
|
|
191
|
-
) :
|
|
196
|
+
) : ve(n, u) ? u.value = t : n.match(/^on/) ? K(
|
|
192
197
|
t,
|
|
193
198
|
n,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
) : n && (n !== "type" &&
|
|
197
|
-
|
|
199
|
+
u,
|
|
200
|
+
r[n]
|
|
201
|
+
) : n && (n !== "type" && Ce(t, n) ? t[n] = u : Qe(
|
|
202
|
+
Fe(n),
|
|
198
203
|
t,
|
|
199
|
-
|
|
200
|
-
))), delete
|
|
201
|
-
}),
|
|
204
|
+
u
|
|
205
|
+
))), delete r[n]);
|
|
206
|
+
}), w(r).forEach(
|
|
202
207
|
(n) => t.removeAttribute(n)
|
|
203
208
|
);
|
|
204
|
-
},
|
|
209
|
+
}, Qe = (e, t, s) => {
|
|
205
210
|
k.value && e !== "xmlns" ? t.setAttributeNS(null, e, s) : t.setAttribute(e, s);
|
|
206
|
-
}, L = (e) => {
|
|
207
|
-
let
|
|
208
|
-
const { type:
|
|
209
|
-
return
|
|
210
|
-
}, je = (e, t) => {
|
|
211
|
-
const
|
|
212
|
-
(
|
|
211
|
+
}, L = (e, t) => {
|
|
212
|
+
let s;
|
|
213
|
+
const { type: c, tag: r, text: n, props: u, children: l = [] } = e, p = C(c);
|
|
214
|
+
return r === "svg" && (k.value = String(u == null ? void 0 : u.xmlns)), t ? s = e.el : (p ? s = z() : c === "element" && r ? r === "portal" && (u != null && u.portal) ? s = u.portal : s = k.value ? document.createElementNS(k.value, r) : V(r) : c === "text" && E(n) ? s = document.createTextNode(String(n)) : s = V("e"), e.el = s), je(l, s, t), le(u, s, null, t), ae(e), r === "svg" && (k.value = ""), s;
|
|
215
|
+
}, je = (e, t, s) => {
|
|
216
|
+
const c = e.reduce(
|
|
217
|
+
(r, n) => {
|
|
213
218
|
if (n.type) {
|
|
214
|
-
const
|
|
215
|
-
n.tag !== "portal" &&
|
|
219
|
+
const u = L(n, s);
|
|
220
|
+
n.tag !== "portal" && !s && r.appendChild(u);
|
|
216
221
|
}
|
|
217
|
-
return
|
|
222
|
+
return r;
|
|
218
223
|
},
|
|
219
224
|
z()
|
|
220
225
|
);
|
|
221
|
-
t &&
|
|
222
|
-
},
|
|
223
|
-
const
|
|
224
|
-
c !== s && (c && e.removeEventListener(
|
|
226
|
+
!s && t && c.hasChildNodes() && t.appendChild(c);
|
|
227
|
+
}, K = (e, t, s, c) => {
|
|
228
|
+
const r = D(t);
|
|
229
|
+
c !== s && (c && e.removeEventListener(r, c), s && e.addEventListener(r, s));
|
|
225
230
|
}, Be = (e, t, s) => {
|
|
226
|
-
const c = { ...t },
|
|
227
|
-
|
|
228
|
-
n
|
|
231
|
+
const c = { ...t }, r = s == null ? void 0 : s.style;
|
|
232
|
+
r && (P(e).forEach(([n, u]) => {
|
|
233
|
+
r[n] = u, delete c[n];
|
|
229
234
|
}), P(c).forEach(
|
|
230
|
-
([
|
|
235
|
+
([n]) => r[n] = ""
|
|
231
236
|
));
|
|
232
|
-
},
|
|
233
|
-
const t =
|
|
234
|
-
return e.isRoot && t ? e.wrapElement : t ?
|
|
235
|
-
},
|
|
237
|
+
}, A = (e) => {
|
|
238
|
+
const t = C(e.type);
|
|
239
|
+
return e.isRoot && t ? e.wrapElement : t ? A(i(e)) : e.el;
|
|
240
|
+
}, M = (e, t) => qe(
|
|
236
241
|
e,
|
|
237
|
-
|
|
242
|
+
ke[Re(e)](e, t),
|
|
238
243
|
t
|
|
239
244
|
), qe = (e, t, s) => {
|
|
240
|
-
const c =
|
|
245
|
+
const c = Xe(e, t, s), r = [
|
|
241
246
|
c,
|
|
242
247
|
t,
|
|
243
248
|
s
|
|
244
|
-
],
|
|
245
|
-
return u || (c.children =
|
|
249
|
+
], n = Ie(...r), u = n === "N";
|
|
250
|
+
return u || (c.children = Ye(...r)), c.needRerender = n, _e(c, s, n), !u && s && (s.isLegacy = !0, delete s.children), c;
|
|
246
251
|
}, _e = (e, t, s) => {
|
|
247
252
|
s !== "A" && t && (e.el = t.el), s && ["D", "R", "SR"].includes(s) && (t && (U(t), F(t)), e.oldChildren = t == null ? void 0 : t.children), e.oldProps = t == null ? void 0 : t.props;
|
|
248
253
|
}, Ie = (e, t, s) => {
|
|
249
|
-
const c = s && s.type,
|
|
254
|
+
const c = s && s.type, r = m(e), n = e.isRoot, u = s && i(s), l = !n && (u == null ? void 0 : u.type), p = o(e), h = l === "loop" && E(p), y = e.type === "text" && t && e.text === (s == null ? void 0 : s.text), N = e === s;
|
|
250
255
|
let d;
|
|
251
|
-
return
|
|
256
|
+
return r ? d = "D" : y || N ? d = "N" : c ? t ? d = h ? "SU" : "U" : d = h ? "SR" : "R" : d = "A", e.type === "loop" && d === "U" && s && ze(e, s) && (d = "CNSU"), d;
|
|
252
257
|
}, ze = (e, t) => {
|
|
253
258
|
const s = [...(t == null ? void 0 : t.children) || []], c = [...(e == null ? void 0 : e.children) || []].filter(
|
|
254
259
|
(u) => s.find((l) => o(u) === o(l))
|
|
255
|
-
),
|
|
260
|
+
), r = s.filter(
|
|
256
261
|
(u) => c.find((l) => o(u) === o(l))
|
|
257
262
|
);
|
|
258
|
-
let
|
|
259
|
-
return
|
|
263
|
+
let n = r.length === c.length;
|
|
264
|
+
return n && (n = r.every(
|
|
260
265
|
(u, l) => o(u) === o(c[l])
|
|
261
|
-
)),
|
|
266
|
+
)), n;
|
|
262
267
|
}, $e = (e, t) => {
|
|
263
|
-
e && t !== e && (
|
|
268
|
+
e && t !== e && (w(e).forEach((s) => delete e[s]), P(t || {}).forEach(([s, c]) => e[s] = c));
|
|
264
269
|
}, Ge = (e, t) => {
|
|
265
270
|
e && t !== e && (e.splice(0, e.length), t && t.forEach((s) => e.push(s)));
|
|
266
|
-
},
|
|
267
|
-
const { compProps: s, compChild: c } = e, { props:
|
|
268
|
-
return s && $e(s,
|
|
269
|
-
},
|
|
270
|
-
(t) =>
|
|
271
|
-
),
|
|
272
|
-
(s, c) =>
|
|
271
|
+
}, Je = (e, t) => {
|
|
272
|
+
const { compProps: s, compChild: c } = e, { props: r, children: n } = t;
|
|
273
|
+
return s && $e(s, r), c && Ge(c, n), e.reRender && e.reRender();
|
|
274
|
+
}, Xe = (e, t, s) => T(e) ? t && s ? Je(s, e) : e.resolve() : e, Ye = (e, t, s) => t && s ? He(e, s) : Ze(e), Ze = (e) => (e.children || []).map(
|
|
275
|
+
(t) => b(M(t), { getParent: () => e })
|
|
276
|
+
), He = (e, t) => e.type === "loop" && E(o((e.children || [])[0])) ? Ve(e, t) : (e.children || []).map(
|
|
277
|
+
(s, c) => b(M(s, (t.children || [])[c]), {
|
|
273
278
|
getParent: () => e
|
|
274
279
|
})
|
|
275
280
|
), Ve = (e, t) => {
|
|
@@ -277,13 +282,13 @@ const I = () => {
|
|
|
277
282
|
e,
|
|
278
283
|
t
|
|
279
284
|
);
|
|
280
|
-
return c.forEach((
|
|
281
|
-
U(
|
|
285
|
+
return c.forEach((r) => {
|
|
286
|
+
U(r), F(r), $(r);
|
|
282
287
|
}), s;
|
|
283
288
|
}, Ke = (e, t) => {
|
|
284
289
|
const s = [...e.children || []], c = [...t.children || []];
|
|
285
|
-
return [s.map((
|
|
286
|
-
const u = ge(
|
|
290
|
+
return [s.map((n) => {
|
|
291
|
+
const u = ge(n, c), l = M(n, u);
|
|
287
292
|
return u && c.splice(c.indexOf(u), 1), l.getParent = () => e, l;
|
|
288
293
|
}), c];
|
|
289
294
|
}, ge = (e, t) => t.find(
|
|
@@ -291,9 +296,9 @@ const I = () => {
|
|
|
291
296
|
), q = /* @__PURE__ */ new Map();
|
|
292
297
|
let _ = !1;
|
|
293
298
|
const me = (e, t) => {
|
|
294
|
-
f.get(e).up = () => {
|
|
299
|
+
f.get(e) && (f.get(e).up = () => {
|
|
295
300
|
q.set(e, t), _ || (_ = !0, queueMicrotask(We));
|
|
296
|
-
};
|
|
301
|
+
});
|
|
297
302
|
}, we = (e) => () => {
|
|
298
303
|
var c;
|
|
299
304
|
const t = (c = f.get(e)) == null ? void 0 : c.up;
|
|
@@ -304,105 +309,105 @@ const me = (e, t) => {
|
|
|
304
309
|
e();
|
|
305
310
|
}), q.clear(), _ = !1;
|
|
306
311
|
}, dt = (e, t = () => []) => {
|
|
307
|
-
f.get(
|
|
312
|
+
f.get(x()).upR.push(() => H(e, t)), H(e, t);
|
|
308
313
|
}, De = () => {
|
|
309
314
|
var t;
|
|
310
|
-
const e = (t = f.get(
|
|
315
|
+
const e = (t = f.get(x())) == null ? void 0 : t.upR;
|
|
311
316
|
e != null && e.length && e.forEach((s) => s());
|
|
312
|
-
},
|
|
317
|
+
}, J = (e, ...t) => ({
|
|
313
318
|
type: "fragment",
|
|
314
|
-
[
|
|
319
|
+
[v]: !0,
|
|
315
320
|
children: t
|
|
316
321
|
}), et = (e, t, ...s) => {
|
|
317
|
-
const c = { value: void 0 },
|
|
318
|
-
return
|
|
322
|
+
const c = { value: void 0 }, r = t || {}, n = de(c, s), u = rt(e, r, n);
|
|
323
|
+
return T(u) || (c.value = u), u;
|
|
319
324
|
}, pt = (e, t) => et("portal", { portal: t }, e), ht = (e) => (t, s) => e, tt = (e, t, s, c) => {
|
|
320
325
|
var y;
|
|
321
326
|
if (c.isLegacy)
|
|
322
327
|
return;
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
+
O.value = !0;
|
|
329
|
+
const r = fe(e, t, s), n = M(r, c), { isRoot: u, getParent: l, wrapElement: p, afterElement: h } = c;
|
|
330
|
+
if (n.getParent = l, !u && l) {
|
|
331
|
+
const N = ((y = l()) == null ? void 0 : y.children) || [], d = N.indexOf(c);
|
|
332
|
+
N.splice(d, 1, n);
|
|
328
333
|
} else
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
const
|
|
334
|
+
n.isRoot = !0, n.wrapElement = p, n.afterElement = h;
|
|
335
|
+
O.value = !1, ee(n);
|
|
336
|
+
}, fe = (e, t, s) => ({ tagName: e.name, ctor: e, props: t, children: s, resolve: (u = t) => {
|
|
337
|
+
Se(u);
|
|
338
|
+
const p = e(t, s)(we(u), t, s);
|
|
334
339
|
return st(
|
|
335
|
-
|
|
340
|
+
p,
|
|
336
341
|
u,
|
|
337
342
|
e,
|
|
338
343
|
t,
|
|
339
344
|
s
|
|
340
345
|
);
|
|
341
|
-
} }), st = (e, t, s, c,
|
|
342
|
-
let
|
|
343
|
-
u.reRender && (
|
|
344
|
-
const
|
|
345
|
-
return
|
|
346
|
-
}, u =
|
|
346
|
+
} }), st = (e, t, s, c, r) => {
|
|
347
|
+
let n = e, u = e(c);
|
|
348
|
+
u.reRender && (n = (p) => {
|
|
349
|
+
const h = e(p), y = J({}, h);
|
|
350
|
+
return h.getParent = () => y, y;
|
|
351
|
+
}, u = n(c));
|
|
347
352
|
const l = ct(
|
|
348
|
-
|
|
353
|
+
n,
|
|
349
354
|
t,
|
|
350
355
|
s,
|
|
351
356
|
c,
|
|
352
|
-
|
|
357
|
+
r
|
|
353
358
|
);
|
|
354
|
-
return
|
|
355
|
-
}, ct = (e, t, s, c,
|
|
356
|
-
const
|
|
357
|
-
return
|
|
358
|
-
}, nt = (e, t, s, c,
|
|
359
|
-
|
|
359
|
+
return oe(u, t, s, c, r, l), u;
|
|
360
|
+
}, ct = (e, t, s, c, r) => {
|
|
361
|
+
const n = () => nt(e, t, s, c, r, n);
|
|
362
|
+
return n;
|
|
363
|
+
}, nt = (e, t, s, c, r, n) => {
|
|
364
|
+
Pe(t), De();
|
|
360
365
|
const u = e(c);
|
|
361
|
-
return
|
|
362
|
-
},
|
|
363
|
-
|
|
366
|
+
return oe(u, t, s, c, r, n), u;
|
|
367
|
+
}, oe = (e, t, s, c, r, n) => {
|
|
368
|
+
b(e, {
|
|
364
369
|
compProps: c,
|
|
365
|
-
compChild:
|
|
370
|
+
compChild: r,
|
|
366
371
|
ctor: s,
|
|
367
372
|
tagName: s.name,
|
|
368
373
|
compKey: t,
|
|
369
|
-
reRender:
|
|
374
|
+
reRender: n
|
|
370
375
|
}), me(
|
|
371
376
|
t,
|
|
372
|
-
() => tt(s, c,
|
|
373
|
-
),
|
|
377
|
+
() => tt(s, c, r, e)
|
|
378
|
+
), Z(t, "vd") && (Z(t, "vd").value = e);
|
|
374
379
|
}, rt = (e, t, s) => {
|
|
375
|
-
if (
|
|
376
|
-
return
|
|
377
|
-
if (
|
|
378
|
-
const c =
|
|
379
|
-
return
|
|
380
|
+
if (g(e))
|
|
381
|
+
return J(t, ...s);
|
|
382
|
+
if (T(e)) {
|
|
383
|
+
const c = fe(e, t, s);
|
|
384
|
+
return O.value ? c : c.resolve();
|
|
380
385
|
}
|
|
381
386
|
return {
|
|
382
387
|
type: "element",
|
|
383
|
-
[
|
|
388
|
+
[v]: !0,
|
|
384
389
|
tag: e,
|
|
385
390
|
props: t,
|
|
386
391
|
children: s
|
|
387
392
|
};
|
|
388
|
-
},
|
|
389
|
-
(s) =>
|
|
393
|
+
}, de = (e, t) => t.map(
|
|
394
|
+
(s) => b(ut(s), { getParent: () => e.value })
|
|
390
395
|
), ut = (e) => {
|
|
391
396
|
if (e == null || e === !1)
|
|
392
|
-
return { type: null, [
|
|
397
|
+
return { type: null, [v]: !0 };
|
|
393
398
|
if (Array.isArray(e)) {
|
|
394
|
-
const t = { value: void 0 }, s =
|
|
399
|
+
const t = { value: void 0 }, s = de(t, e), c = {
|
|
395
400
|
type: "loop",
|
|
396
|
-
[
|
|
401
|
+
[v]: !0,
|
|
397
402
|
children: s
|
|
398
403
|
};
|
|
399
404
|
return t.value = c, c;
|
|
400
405
|
} else if (typeof e == "string" || typeof e == "number")
|
|
401
|
-
return { type: "text", [
|
|
406
|
+
return { type: "text", [v]: !0, text: e };
|
|
402
407
|
return e;
|
|
403
408
|
}, it = (e) => ({ value: e }), yt = () => Promise.resolve();
|
|
404
409
|
export {
|
|
405
|
-
|
|
410
|
+
J as Fragment,
|
|
406
411
|
et as h,
|
|
407
412
|
lt as isPropType,
|
|
408
413
|
ht as mount,
|