ddd-react 1.10.16 → 1.12.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/component.d.ts +4 -3
- package/dist/{h-BbaMkkC7.mjs → h-DE267foy.mjs} +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +193 -137
- package/dist/jsx-runtime.mjs +17 -13
- package/dist/types/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
|
@@ -24,13 +24,13 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
|
|
|
24
24
|
}): void;
|
|
25
25
|
notify(): void;
|
|
26
26
|
didMount(): void | Promise<void>;
|
|
27
|
-
willUpdate(
|
|
28
|
-
didUpdate(
|
|
27
|
+
willUpdate(_nextProps: P, _nextState: S): void | Promise<void>;
|
|
28
|
+
didUpdate(_prevProps: P, _prevState: S): void | Promise<void>;
|
|
29
29
|
willUnmount(): void | Promise<void>;
|
|
30
30
|
didUnmount(): void | Promise<void>;
|
|
31
31
|
didCatch(error: Error, errorInfo: any): void | Promise<void>;
|
|
32
32
|
shouldComponentUpdate(prevProps: P, nextProps: P): boolean;
|
|
33
|
-
abstract render(): VDOMNode;
|
|
33
|
+
abstract render(): VDOMNode | VDOMNode[] | Function | string | null | undefined;
|
|
34
34
|
get elements(): HTMLElement[];
|
|
35
35
|
get firstElement(): HTMLElement | undefined;
|
|
36
36
|
get offset(): number;
|
|
@@ -46,4 +46,5 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
|
|
|
46
46
|
private getComponentStack;
|
|
47
47
|
private findClosestErrorBoundary;
|
|
48
48
|
isErrorBoundary(): boolean;
|
|
49
|
+
private normalizeRenderResult;
|
|
49
50
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { h, hFragment, hString } from './h';
|
|
|
4
4
|
import { render } from './render';
|
|
5
5
|
import { createRef } from './ref';
|
|
6
6
|
import type { Ref } from './ref';
|
|
7
|
-
import type { ComponentType } from './types
|
|
7
|
+
import type { ComponentType } from './types';
|
|
8
8
|
import { createPortal } from './portal';
|
|
9
9
|
export type { ComponentType, Ref };
|
|
10
10
|
export { Component, createContext, createRef, h, hFragment, hString, render, createPortal };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { D as u, e as
|
|
2
|
-
|
|
3
|
-
function m(e, t) {
|
|
1
|
+
import { D as u, e as m, a as x, A as v, b as U, h as N, c as B, d as I, f as _ } from "./h-DE267foy.mjs";
|
|
2
|
+
function b(e, t) {
|
|
4
3
|
if (e === null || t === null || e === void 0 || t === void 0)
|
|
5
4
|
return e === t;
|
|
6
5
|
if (typeof e != typeof t)
|
|
@@ -14,7 +13,7 @@ function m(e, t) {
|
|
|
14
13
|
if (e.length !== t.length)
|
|
15
14
|
return !1;
|
|
16
15
|
for (let n = 0; n < e.length; ++n)
|
|
17
|
-
if (!
|
|
16
|
+
if (!b(e[n], t[n]))
|
|
18
17
|
return !1;
|
|
19
18
|
return !0;
|
|
20
19
|
}
|
|
@@ -32,24 +31,24 @@ function m(e, t) {
|
|
|
32
31
|
return !1;
|
|
33
32
|
for (let n = 0; n < r.length; ++n) {
|
|
34
33
|
const s = r[n];
|
|
35
|
-
if (!(s === "_owner" && e.$$typeof) && !
|
|
34
|
+
if (!(s === "_owner" && e.$$typeof) && !b(e[s], t[s]))
|
|
36
35
|
return !1;
|
|
37
36
|
}
|
|
38
37
|
return !0;
|
|
39
38
|
}
|
|
40
39
|
return !1;
|
|
41
40
|
}
|
|
42
|
-
function
|
|
41
|
+
function M(e, t, r, n = null) {
|
|
43
42
|
function s(i) {
|
|
44
43
|
const o = i;
|
|
45
44
|
n ? t.call(n, o) : t(o);
|
|
46
45
|
}
|
|
47
46
|
return r.addEventListener(e, s), s;
|
|
48
47
|
}
|
|
49
|
-
function
|
|
48
|
+
function $(e = {}, t, r = null) {
|
|
50
49
|
const n = {};
|
|
51
50
|
return Object.entries(e).forEach(([s, i]) => {
|
|
52
|
-
n[s] =
|
|
51
|
+
n[s] = M(
|
|
53
52
|
s,
|
|
54
53
|
i,
|
|
55
54
|
t,
|
|
@@ -57,7 +56,7 @@ function I(e = {}, t, r = null) {
|
|
|
57
56
|
);
|
|
58
57
|
}), n;
|
|
59
58
|
}
|
|
60
|
-
function
|
|
59
|
+
function q(e = {}, t) {
|
|
61
60
|
Object.entries(e).forEach(([r, n]) => {
|
|
62
61
|
t.removeEventListener(r, n);
|
|
63
62
|
});
|
|
@@ -66,15 +65,15 @@ function p(e) {
|
|
|
66
65
|
const { type: t } = e;
|
|
67
66
|
switch (t) {
|
|
68
67
|
case u.TEXT: {
|
|
69
|
-
|
|
68
|
+
G(e);
|
|
70
69
|
break;
|
|
71
70
|
}
|
|
72
71
|
case u.ELEMENT: {
|
|
73
|
-
|
|
72
|
+
z(e);
|
|
74
73
|
break;
|
|
75
74
|
}
|
|
76
75
|
case u.FRAGMENT: {
|
|
77
|
-
|
|
76
|
+
X(e);
|
|
78
77
|
break;
|
|
79
78
|
}
|
|
80
79
|
case u.COMPONENT: {
|
|
@@ -82,7 +81,7 @@ function p(e) {
|
|
|
82
81
|
break;
|
|
83
82
|
}
|
|
84
83
|
case u.PORTAL: {
|
|
85
|
-
|
|
84
|
+
J(e);
|
|
86
85
|
break;
|
|
87
86
|
}
|
|
88
87
|
default:
|
|
@@ -90,58 +89,58 @@ function p(e) {
|
|
|
90
89
|
}
|
|
91
90
|
delete e.el;
|
|
92
91
|
}
|
|
93
|
-
function
|
|
92
|
+
function G(e) {
|
|
94
93
|
const { el: t } = e;
|
|
95
94
|
t && t.remove();
|
|
96
95
|
}
|
|
97
|
-
function
|
|
96
|
+
function z(e) {
|
|
98
97
|
const { el: t, children: r, listeners: n, props: s } = e;
|
|
99
|
-
s?.ref && typeof s.ref == "object" && "current" in s.ref && (s.ref.current = null), t && t.remove(), r && r.forEach(p), n && t && (
|
|
98
|
+
s?.ref && typeof s.ref == "object" && "current" in s.ref && (s.ref.current = null), t && t.remove(), r && r.forEach(p), n && t && (q(n, t), delete e.listeners);
|
|
100
99
|
}
|
|
101
|
-
function
|
|
100
|
+
function X(e) {
|
|
102
101
|
const { children: t } = e;
|
|
103
102
|
t && t.forEach(p);
|
|
104
103
|
}
|
|
105
|
-
function
|
|
104
|
+
function J(e) {
|
|
106
105
|
const { children: t } = e;
|
|
107
106
|
t && t.forEach(p);
|
|
108
107
|
}
|
|
109
|
-
function
|
|
108
|
+
function w(e, t, r) {
|
|
110
109
|
e.style[t] = r.toString();
|
|
111
110
|
}
|
|
112
|
-
function
|
|
111
|
+
function K(e, t) {
|
|
113
112
|
e.style[t] = null;
|
|
114
113
|
}
|
|
115
|
-
function
|
|
114
|
+
function W(e, t) {
|
|
116
115
|
const { class: r, style: n, ...s } = t;
|
|
117
|
-
r &&
|
|
118
|
-
|
|
116
|
+
r && Y(e, r), n && Object.entries(n).forEach(([i, o]) => {
|
|
117
|
+
w(e, i, o);
|
|
119
118
|
});
|
|
120
119
|
for (const [i, o] of Object.entries(s))
|
|
121
|
-
|
|
120
|
+
D(e, i, o);
|
|
122
121
|
}
|
|
123
|
-
function
|
|
122
|
+
function Y(e, t) {
|
|
124
123
|
if (e instanceof SVGElement) {
|
|
125
124
|
e.removeAttribute("class"), typeof t == "string" ? e.setAttribute("class", t) : Array.isArray(t) && e.classList.add(...t);
|
|
126
125
|
return;
|
|
127
126
|
}
|
|
128
127
|
e.className = "", typeof t == "string" ? e.className = t : Array.isArray(t) && e.classList.add(...t);
|
|
129
128
|
}
|
|
130
|
-
function
|
|
131
|
-
r == null ?
|
|
129
|
+
function D(e, t, r) {
|
|
130
|
+
r == null ? j(e, t) : e.setAttribute(t, String(r));
|
|
132
131
|
}
|
|
133
|
-
function
|
|
132
|
+
function j(e, t) {
|
|
134
133
|
e[t] = null, e.removeAttribute(t);
|
|
135
134
|
}
|
|
136
135
|
let P = !1;
|
|
137
136
|
const O = [];
|
|
138
|
-
function
|
|
139
|
-
O.push(e),
|
|
140
|
-
}
|
|
141
|
-
function Y() {
|
|
142
|
-
P || (P = !0, queueMicrotask(H));
|
|
137
|
+
function d(e) {
|
|
138
|
+
O.push(e), H();
|
|
143
139
|
}
|
|
144
140
|
function H() {
|
|
141
|
+
P || (P = !0, queueMicrotask(Q));
|
|
142
|
+
}
|
|
143
|
+
function Q() {
|
|
145
144
|
for (; O.length > 0; ) {
|
|
146
145
|
const e = O.shift();
|
|
147
146
|
let t;
|
|
@@ -165,59 +164,74 @@ function A(e) {
|
|
|
165
164
|
const { on: t = {}, ...r } = e.props;
|
|
166
165
|
return delete r.key, { props: r, events: t };
|
|
167
166
|
}
|
|
168
|
-
function
|
|
167
|
+
function h(e, t, r = null, n = null) {
|
|
169
168
|
switch (e.type) {
|
|
170
169
|
case u.TEXT: {
|
|
171
|
-
|
|
170
|
+
Z(e, t, r);
|
|
172
171
|
break;
|
|
173
172
|
}
|
|
174
173
|
case u.ELEMENT: {
|
|
175
|
-
|
|
174
|
+
tt(
|
|
175
|
+
e,
|
|
176
|
+
t,
|
|
177
|
+
r,
|
|
178
|
+
n
|
|
179
|
+
);
|
|
176
180
|
break;
|
|
177
181
|
}
|
|
178
182
|
case u.FRAGMENT: {
|
|
179
|
-
|
|
183
|
+
V(
|
|
184
|
+
e,
|
|
185
|
+
t,
|
|
186
|
+
r,
|
|
187
|
+
n
|
|
188
|
+
);
|
|
180
189
|
break;
|
|
181
190
|
}
|
|
182
191
|
case u.COMPONENT: {
|
|
183
|
-
|
|
192
|
+
rt(
|
|
193
|
+
e,
|
|
194
|
+
t,
|
|
195
|
+
r,
|
|
196
|
+
n
|
|
197
|
+
);
|
|
184
198
|
const s = e.component;
|
|
185
|
-
s &&
|
|
199
|
+
s && d(() => s.didMount());
|
|
186
200
|
break;
|
|
187
201
|
}
|
|
188
202
|
case u.PORTAL: {
|
|
189
|
-
|
|
203
|
+
nt(e, n);
|
|
190
204
|
break;
|
|
191
205
|
}
|
|
192
206
|
default:
|
|
193
207
|
throw new Error(`Can't mount DOM of type: ${e.type}`);
|
|
194
208
|
}
|
|
195
209
|
}
|
|
196
|
-
function
|
|
210
|
+
function Z(e, t, r) {
|
|
197
211
|
const { value: n } = e, s = document.createTextNode(n);
|
|
198
|
-
e.el = s,
|
|
212
|
+
e.el = s, L(s, t, r);
|
|
199
213
|
}
|
|
200
|
-
function
|
|
214
|
+
function V(e, t, r, n) {
|
|
201
215
|
const { children: s } = e;
|
|
202
216
|
e.el = t, s?.forEach((i, o) => {
|
|
203
|
-
|
|
217
|
+
h(i, t, r != null ? r + o : null, n);
|
|
204
218
|
});
|
|
205
219
|
}
|
|
206
|
-
function
|
|
207
|
-
const { tag: s, children: i } = e,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}),
|
|
220
|
+
function tt(e, t, r, n) {
|
|
221
|
+
const { tag: s, children: i } = e, l = s === "svg" || t instanceof SVGElement ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
|
|
222
|
+
et(l, e, n), e.el = l, i?.forEach((f) => {
|
|
223
|
+
h(f, l, null, n);
|
|
224
|
+
}), L(l, t, r);
|
|
211
225
|
}
|
|
212
|
-
function
|
|
226
|
+
function et(e, t, r) {
|
|
213
227
|
const { props: n, events: s } = A(t);
|
|
214
|
-
n.ref && typeof n.ref == "object" && "current" in n.ref && (n.ref.current = e, delete n.ref), t.listeners =
|
|
228
|
+
n.ref && typeof n.ref == "object" && "current" in n.ref && (n.ref.current = e, delete n.ref), t.listeners = $(s, e, r), W(e, n);
|
|
215
229
|
}
|
|
216
|
-
function
|
|
230
|
+
function rt(e, t, r, n) {
|
|
217
231
|
const s = e.tag, { props: i } = A(e), o = new s(i, n);
|
|
218
232
|
o.mount(t, r), e.component = o, e.el = o.firstElement || null;
|
|
219
233
|
}
|
|
220
|
-
function
|
|
234
|
+
function L(e, t, r) {
|
|
221
235
|
if (r == null) {
|
|
222
236
|
t.append(e);
|
|
223
237
|
return;
|
|
@@ -227,13 +241,13 @@ function j(e, t, r) {
|
|
|
227
241
|
const n = t.childNodes;
|
|
228
242
|
r >= n.length ? t.append(e) : t.insertBefore(e, n[r]);
|
|
229
243
|
}
|
|
230
|
-
function
|
|
244
|
+
function nt(e, t) {
|
|
231
245
|
const { children: r, container: n } = e;
|
|
232
246
|
r?.forEach((s) => {
|
|
233
|
-
|
|
247
|
+
h(s, n, null, t);
|
|
234
248
|
});
|
|
235
249
|
}
|
|
236
|
-
function
|
|
250
|
+
function R(e, t) {
|
|
237
251
|
if (e.type !== t.type)
|
|
238
252
|
return !1;
|
|
239
253
|
if (e.type === u.ELEMENT) {
|
|
@@ -242,9 +256,9 @@ function L(e, t) {
|
|
|
242
256
|
props: { key: i }
|
|
243
257
|
} = r, {
|
|
244
258
|
tag: o,
|
|
245
|
-
props: { key:
|
|
259
|
+
props: { key: l }
|
|
246
260
|
} = n;
|
|
247
|
-
return s === o && i ===
|
|
261
|
+
return s === o && i === l;
|
|
248
262
|
}
|
|
249
263
|
if (e.type === u.COMPONENT) {
|
|
250
264
|
const r = e, n = t, { tag: s } = r, { tag: i } = n;
|
|
@@ -266,57 +280,68 @@ function S(e, t) {
|
|
|
266
280
|
updated: i
|
|
267
281
|
};
|
|
268
282
|
}
|
|
269
|
-
function
|
|
283
|
+
function st(e) {
|
|
270
284
|
return e !== "";
|
|
271
285
|
}
|
|
272
286
|
function T(e) {
|
|
273
|
-
return
|
|
287
|
+
return st(e.trim());
|
|
274
288
|
}
|
|
275
289
|
function y(e, t, r, n = null) {
|
|
276
|
-
if (!
|
|
277
|
-
const s =
|
|
278
|
-
return p(e),
|
|
290
|
+
if (!R(e, t)) {
|
|
291
|
+
const s = ot(r, e.el);
|
|
292
|
+
return p(e), h(t, r, s, n), t;
|
|
279
293
|
}
|
|
280
294
|
switch (t.el = e.el, t.type) {
|
|
281
295
|
case u.TEXT:
|
|
282
|
-
return
|
|
296
|
+
return it(e, t), t;
|
|
283
297
|
case u.ELEMENT: {
|
|
284
|
-
|
|
298
|
+
ct(
|
|
299
|
+
e,
|
|
300
|
+
t,
|
|
301
|
+
n
|
|
302
|
+
);
|
|
285
303
|
break;
|
|
286
304
|
}
|
|
287
305
|
case u.COMPONENT: {
|
|
288
|
-
|
|
306
|
+
ht(
|
|
307
|
+
e,
|
|
308
|
+
t
|
|
309
|
+
);
|
|
289
310
|
break;
|
|
290
311
|
}
|
|
291
312
|
case u.PORTAL: {
|
|
292
|
-
|
|
313
|
+
dt(
|
|
314
|
+
e,
|
|
315
|
+
t,
|
|
316
|
+
n
|
|
317
|
+
);
|
|
293
318
|
break;
|
|
294
319
|
}
|
|
295
320
|
}
|
|
296
|
-
return
|
|
321
|
+
return F(e, t, n), t;
|
|
297
322
|
}
|
|
298
|
-
function
|
|
323
|
+
function ot(e, t) {
|
|
299
324
|
if (!t) return null;
|
|
300
325
|
const r = Array.from(e.childNodes).indexOf(t);
|
|
301
326
|
return r < 0 ? null : r;
|
|
302
327
|
}
|
|
303
|
-
function
|
|
328
|
+
function it(e, t) {
|
|
304
329
|
const r = e.el, { value: n } = e, { value: s } = t;
|
|
305
330
|
n !== s && r && (r.nodeValue = s);
|
|
306
331
|
}
|
|
307
|
-
function
|
|
332
|
+
function ct(e, t, r) {
|
|
308
333
|
const n = e.el, {
|
|
309
334
|
class: s,
|
|
310
335
|
style: i,
|
|
311
336
|
on: o,
|
|
312
|
-
...
|
|
337
|
+
...l
|
|
313
338
|
} = e.props ?? {}, {
|
|
314
339
|
class: f,
|
|
315
340
|
style: c,
|
|
316
|
-
on:
|
|
341
|
+
on: a,
|
|
317
342
|
...E
|
|
318
343
|
} = t.props ?? {}, { listeners: g } = e;
|
|
319
|
-
|
|
344
|
+
ut(n, l, E), lt(n, s, f), ft(
|
|
320
345
|
n,
|
|
321
346
|
i,
|
|
322
347
|
c
|
|
@@ -324,43 +349,46 @@ function ot(e, t, r) {
|
|
|
324
349
|
n,
|
|
325
350
|
g,
|
|
326
351
|
o ?? {},
|
|
327
|
-
|
|
352
|
+
a ?? {},
|
|
328
353
|
r
|
|
329
354
|
);
|
|
330
355
|
}
|
|
331
|
-
function
|
|
356
|
+
function ut(e, t = {}, r = {}) {
|
|
332
357
|
const n = t.ref, s = r.ref;
|
|
333
358
|
n !== s && (n && typeof n == "object" && "current" in n && (n.current = null), s && typeof s == "object" && "current" in s && (s.current = e));
|
|
334
359
|
const i = { ...t }, o = { ...r };
|
|
335
360
|
delete i.ref, delete o.ref;
|
|
336
|
-
const { added:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
361
|
+
const { added: l, removed: f, updated: c } = S(
|
|
362
|
+
i,
|
|
363
|
+
o
|
|
364
|
+
);
|
|
365
|
+
for (const a of f)
|
|
366
|
+
j(e, a);
|
|
367
|
+
for (const a of l.concat(c))
|
|
368
|
+
D(e, a, o[a]);
|
|
341
369
|
}
|
|
342
|
-
function
|
|
343
|
-
const n = k(t), s = k(r), { added: i, removed: o } =
|
|
370
|
+
function lt(e, t, r) {
|
|
371
|
+
const n = k(t), s = k(r), { added: i, removed: o } = U(n, s);
|
|
344
372
|
o.length > 0 && e.classList.remove(...o), i.length > 0 && e.classList.add(...i);
|
|
345
373
|
}
|
|
346
374
|
function k(e = "") {
|
|
347
375
|
return Array.isArray(e) ? e.filter(T) : String(e).split(/(\s+)/).filter(T);
|
|
348
376
|
}
|
|
349
|
-
function
|
|
377
|
+
function ft(e, t = {}, r = {}) {
|
|
350
378
|
const { added: n, removed: s, updated: i } = S(t, r);
|
|
351
379
|
for (const o of s)
|
|
352
|
-
|
|
380
|
+
K(e, o);
|
|
353
381
|
for (const o of n.concat(i))
|
|
354
|
-
|
|
382
|
+
w(e, o, r[o]);
|
|
355
383
|
}
|
|
356
384
|
function at(e, t = {}, r = {}, n = {}, s = null) {
|
|
357
|
-
const { removed: i, added: o, updated:
|
|
358
|
-
for (const c of i.concat(
|
|
359
|
-
const
|
|
360
|
-
|
|
385
|
+
const { removed: i, added: o, updated: l } = S(r, n), f = { ...t };
|
|
386
|
+
for (const c of i.concat(l)) {
|
|
387
|
+
const a = t?.[c];
|
|
388
|
+
a && (e.removeEventListener(c, a), delete f[c]);
|
|
361
389
|
}
|
|
362
|
-
for (const c of o.concat(
|
|
363
|
-
f[c] =
|
|
390
|
+
for (const c of o.concat(l))
|
|
391
|
+
f[c] = M(
|
|
364
392
|
c,
|
|
365
393
|
n[c],
|
|
366
394
|
e,
|
|
@@ -368,18 +396,32 @@ function at(e, t = {}, r = {}, n = {}, s = null) {
|
|
|
368
396
|
);
|
|
369
397
|
return f;
|
|
370
398
|
}
|
|
371
|
-
function
|
|
372
|
-
const n =
|
|
399
|
+
function F(e, t, r) {
|
|
400
|
+
const n = m(e), s = m(t), i = e.el, o = x(
|
|
401
|
+
n,
|
|
402
|
+
s,
|
|
403
|
+
R
|
|
404
|
+
), l = r?.offset ?? 0;
|
|
373
405
|
for (const f of o)
|
|
374
406
|
if (f.op === v.NOOP) {
|
|
375
|
-
const { originalIndex: c, index:
|
|
376
|
-
y(
|
|
407
|
+
const { originalIndex: c, index: a } = f;
|
|
408
|
+
y(
|
|
409
|
+
n[c],
|
|
410
|
+
s[a],
|
|
411
|
+
i,
|
|
412
|
+
r
|
|
413
|
+
);
|
|
377
414
|
}
|
|
378
415
|
for (const f of o)
|
|
379
416
|
switch (f.op) {
|
|
380
417
|
case v.MOVE: {
|
|
381
|
-
const { from: c, index:
|
|
382
|
-
E && (i.insertBefore(E, g), y(
|
|
418
|
+
const { from: c, index: a } = f, E = n[c].el, g = i.childNodes[a + l];
|
|
419
|
+
E && (i.insertBefore(E, g), y(
|
|
420
|
+
n[c],
|
|
421
|
+
s[a],
|
|
422
|
+
i,
|
|
423
|
+
r
|
|
424
|
+
));
|
|
383
425
|
break;
|
|
384
426
|
}
|
|
385
427
|
case v.REMOVE: {
|
|
@@ -388,24 +430,24 @@ function R(e, t, r) {
|
|
|
388
430
|
break;
|
|
389
431
|
}
|
|
390
432
|
case v.ADD: {
|
|
391
|
-
const { index: c, item:
|
|
392
|
-
|
|
433
|
+
const { index: c, item: a } = f;
|
|
434
|
+
h(a, i, c + l, r);
|
|
393
435
|
break;
|
|
394
436
|
}
|
|
395
437
|
}
|
|
396
438
|
}
|
|
397
|
-
function
|
|
439
|
+
function ht(e, t) {
|
|
398
440
|
const { component: r } = e, { props: n } = A(t);
|
|
399
441
|
r.updateProps(n), t.component = r, t.el = r.firstElement;
|
|
400
442
|
}
|
|
401
|
-
function
|
|
443
|
+
function dt(e, t, r) {
|
|
402
444
|
if (e.container !== t.container) {
|
|
403
|
-
p(e),
|
|
445
|
+
p(e), h(t, document.body, null, r);
|
|
404
446
|
return;
|
|
405
447
|
}
|
|
406
|
-
|
|
448
|
+
F(e, t, r);
|
|
407
449
|
}
|
|
408
|
-
const
|
|
450
|
+
const pt = (e) => e.isProvider, yt = (e) => e.isConsumer;
|
|
409
451
|
class C {
|
|
410
452
|
isMounted = !1;
|
|
411
453
|
vdom = null;
|
|
@@ -427,11 +469,13 @@ class C {
|
|
|
427
469
|
this.dependencies.some((r) => r.consumer === t) || (this.dependencies.push({ consumer: t }), t.subscribedProvider = this);
|
|
428
470
|
}
|
|
429
471
|
removeDependency({ consumer: t }) {
|
|
430
|
-
const r = this.dependencies.findIndex(
|
|
472
|
+
const r = this.dependencies.findIndex(
|
|
473
|
+
(n) => n.consumer === t
|
|
474
|
+
);
|
|
431
475
|
r !== -1 && (this.dependencies.splice(r, 1), t.subscribedProvider = null);
|
|
432
476
|
}
|
|
433
477
|
notify() {
|
|
434
|
-
|
|
478
|
+
d(() => {
|
|
435
479
|
this.dependencies.forEach(({ consumer: t }) => {
|
|
436
480
|
t.isMounted && t.updateContext() && t.patch(t.props, t.state);
|
|
437
481
|
});
|
|
@@ -456,10 +500,10 @@ class C {
|
|
|
456
500
|
return console.error("Uncaught error:", t, r), Promise.resolve();
|
|
457
501
|
}
|
|
458
502
|
shouldComponentUpdate(t, r) {
|
|
459
|
-
return
|
|
503
|
+
return b(t, r);
|
|
460
504
|
}
|
|
461
505
|
get elements() {
|
|
462
|
-
return this.vdom == null ? [] : this.vdom.type === u.FRAGMENT ?
|
|
506
|
+
return this.vdom == null ? [] : this.vdom.type === u.FRAGMENT ? m(this.vdom).flatMap((t) => t.type === u.COMPONENT && t.component ? t.component.elements : t.el ? [t.el] : []) : this.vdom.el ? [this.vdom.el] : [];
|
|
463
507
|
}
|
|
464
508
|
get firstElement() {
|
|
465
509
|
return this.elements[0];
|
|
@@ -469,36 +513,40 @@ class C {
|
|
|
469
513
|
}
|
|
470
514
|
updateProps(t) {
|
|
471
515
|
const n = { ...this.getDefaultProps(), ...this.props, ...t }, s = this.props;
|
|
472
|
-
this.props = n, !this.shouldComponentUpdate(s, n) && (
|
|
516
|
+
this.props = n, !this.shouldComponentUpdate(s, n) && (pt(this) && this.notify(), this.patch(s, this.state));
|
|
473
517
|
}
|
|
474
518
|
setState(t) {
|
|
475
519
|
const r = this.state;
|
|
476
520
|
typeof t == "function" ? this.state = {
|
|
477
521
|
...this.state,
|
|
478
|
-
...t(
|
|
522
|
+
...t(
|
|
523
|
+
this.state,
|
|
524
|
+
this.props
|
|
525
|
+
)
|
|
479
526
|
} : this.state = { ...this.state, ...t }, this.patch(this.props, r);
|
|
480
527
|
}
|
|
481
528
|
mount(t, r = null) {
|
|
482
529
|
if (this.isMounted)
|
|
483
530
|
throw new Error("Component is already mounted");
|
|
484
|
-
|
|
531
|
+
yt(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext();
|
|
485
532
|
try {
|
|
486
|
-
|
|
533
|
+
const n = this.render(), s = this.normalizeRenderResult(n);
|
|
534
|
+
this.hostEl = t, this.isMounted = !0, s !== null ? (h(s, t, r, this), this.vdom = s) : this.vdom = null;
|
|
487
535
|
} catch (n) {
|
|
488
536
|
this.handleError(n, "mount");
|
|
489
537
|
}
|
|
490
538
|
}
|
|
491
539
|
unmount() {
|
|
492
|
-
this.isMounted && (
|
|
540
|
+
this.isMounted && (d(() => this.willUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: t }) => {
|
|
493
541
|
t.subscribedProvider = null;
|
|
494
|
-
}), this.dependencies = [], this.vdom && p(this.vdom),
|
|
542
|
+
}), this.dependencies = [], this.vdom && p(this.vdom), d(() => this.didUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
|
|
495
543
|
}
|
|
496
544
|
patch(t, r) {
|
|
497
|
-
if (!(!this.isMounted || !this.hostEl
|
|
498
|
-
|
|
545
|
+
if (!(!this.isMounted || !this.hostEl)) {
|
|
546
|
+
d(() => this.willUpdate(this.props, this.state));
|
|
499
547
|
try {
|
|
500
|
-
const n = this.render();
|
|
501
|
-
this.vdom = y(this.vdom,
|
|
548
|
+
const n = this.render(), s = this.normalizeRenderResult(n);
|
|
549
|
+
this.vdom === null && s !== null ? (h(s, this.hostEl, null, this), this.vdom = s) : this.vdom !== null && s === null ? (p(this.vdom), this.vdom = null) : this.vdom !== null && s !== null && (this.vdom = y(this.vdom, s, this.hostEl, this)), d(() => this.didUpdate(t, r));
|
|
502
550
|
} catch (n) {
|
|
503
551
|
this.handleError(n, "patch");
|
|
504
552
|
}
|
|
@@ -544,13 +592,18 @@ class C {
|
|
|
544
592
|
if (n.hostEl && n.isMounted)
|
|
545
593
|
try {
|
|
546
594
|
const o = n.render();
|
|
547
|
-
o && (n.vdom = y(
|
|
548
|
-
|
|
595
|
+
o && (n.vdom = y(
|
|
596
|
+
n.vdom,
|
|
597
|
+
o,
|
|
598
|
+
n.hostEl,
|
|
599
|
+
n
|
|
600
|
+
), d(() => {
|
|
601
|
+
const l = {
|
|
549
602
|
phase: r,
|
|
550
603
|
failedComponent: this.constructor.name,
|
|
551
604
|
componentStack: this.getComponentStack()
|
|
552
605
|
};
|
|
553
|
-
console.error("error", t,
|
|
606
|
+
console.error("error", t, l), n.didCatch(t, l);
|
|
554
607
|
}));
|
|
555
608
|
} catch (o) {
|
|
556
609
|
n.parent && n.parent.handleError(o, r);
|
|
@@ -562,7 +615,7 @@ class C {
|
|
|
562
615
|
const i = s.getDerivedStateFromError(t);
|
|
563
616
|
this.state = { ...this.state, ...i };
|
|
564
617
|
}
|
|
565
|
-
|
|
618
|
+
d(() => {
|
|
566
619
|
if (this.didCatch(t, {
|
|
567
620
|
phase: r,
|
|
568
621
|
componentStack: this.getComponentStack()
|
|
@@ -594,13 +647,16 @@ class C {
|
|
|
594
647
|
isErrorBoundary() {
|
|
595
648
|
return this.constructor.getDerivedStateFromError !== void 0;
|
|
596
649
|
}
|
|
650
|
+
normalizeRenderResult(t) {
|
|
651
|
+
return t == null ? null : Array.isArray(t) ? t.length > 0 ? N(t) : null : typeof t == "function" ? B(t, {}) : typeof t == "string" ? I(t) : t;
|
|
652
|
+
}
|
|
597
653
|
}
|
|
598
|
-
function
|
|
654
|
+
function vt(e) {
|
|
599
655
|
class t extends C {
|
|
600
656
|
isProvider = !0;
|
|
601
657
|
render() {
|
|
602
658
|
let s = [];
|
|
603
|
-
return Array.isArray(this.props.children) ? s = this.props.children : this.props.children ? s = [this.props.children] : s = [],
|
|
659
|
+
return Array.isArray(this.props.children) ? s = this.props.children : this.props.children ? s = [this.props.children] : s = [], N(s);
|
|
604
660
|
}
|
|
605
661
|
}
|
|
606
662
|
class r extends C {
|
|
@@ -629,27 +685,27 @@ function yt(e) {
|
|
|
629
685
|
defaultValue: e
|
|
630
686
|
};
|
|
631
687
|
}
|
|
632
|
-
function
|
|
688
|
+
function gt(e, t) {
|
|
633
689
|
if (!t)
|
|
634
690
|
throw new Error("Container element is not provided for rendering.");
|
|
635
|
-
|
|
691
|
+
h(e, t);
|
|
636
692
|
}
|
|
637
|
-
function
|
|
693
|
+
function mt(e = null) {
|
|
638
694
|
return {
|
|
639
695
|
current: e
|
|
640
696
|
};
|
|
641
697
|
}
|
|
642
|
-
function
|
|
698
|
+
function bt(e, t) {
|
|
643
699
|
const r = Array.isArray(e) ? e : [e];
|
|
644
|
-
return
|
|
700
|
+
return _(r, t);
|
|
645
701
|
}
|
|
646
702
|
export {
|
|
647
703
|
C as Component,
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
704
|
+
vt as createContext,
|
|
705
|
+
bt as createPortal,
|
|
706
|
+
mt as createRef,
|
|
707
|
+
B as h,
|
|
708
|
+
N as hFragment,
|
|
709
|
+
I as hString,
|
|
710
|
+
gt as render
|
|
655
711
|
};
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { h as p,
|
|
2
|
-
const
|
|
1
|
+
import { h as p, c, d as a } from "./h-DE267foy.mjs";
|
|
2
|
+
const h = /* @__PURE__ */ Symbol("Fragment");
|
|
3
3
|
function l(n) {
|
|
4
4
|
return n == null || n === !1 ? null : typeof n == "string" || typeof n == "number" || typeof n == "boolean" ? a(String(n)) : n;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
if (n ===
|
|
8
|
-
const t =
|
|
6
|
+
function d(n, o, ...s) {
|
|
7
|
+
if (n === h) {
|
|
8
|
+
const t = s.flat().map(l).filter((e) => e != null);
|
|
9
9
|
return p(t);
|
|
10
10
|
}
|
|
11
11
|
let f = {}, i = {};
|
|
12
12
|
if (o && Object.entries(o).forEach(([t, e]) => {
|
|
13
13
|
if (t.startsWith("on") && typeof e == "function") {
|
|
14
|
-
const
|
|
15
|
-
f[
|
|
14
|
+
const r = t.slice(2).toLowerCase();
|
|
15
|
+
f[r] = e;
|
|
16
16
|
} else t === "ref" ? i.ref = e : t === "className" ? i.class = e : t === "style" && typeof e == "object" ? i.style = e : t === "colorInterpolationFilters" ? i["color-interpolation-filters"] = e : t === "viewbox" ? i.viewBox = e : t !== "children" && t !== "key" && (i[t] = e);
|
|
17
17
|
}), typeof n == "function")
|
|
18
18
|
try {
|
|
@@ -21,18 +21,22 @@ function j(n, o, ...r) {
|
|
|
21
21
|
}
|
|
22
22
|
if (typeof n == "function" || typeof n == "object" && n != null && "render" in n) {
|
|
23
23
|
const t = { ...o ?? {} };
|
|
24
|
-
|
|
24
|
+
if (s.length > 0) {
|
|
25
|
+
const e = s.flat().map(l).filter((r) => r != null);
|
|
26
|
+
e.length === 1 ? t.children = e[0] : t.children = e;
|
|
27
|
+
}
|
|
28
|
+
return c(n, t);
|
|
25
29
|
}
|
|
26
30
|
f = {}, i = {}, o && Object.entries(o).forEach(([t, e]) => {
|
|
27
31
|
if (t.startsWith("on") && typeof e == "function") {
|
|
28
|
-
const
|
|
29
|
-
f[
|
|
32
|
+
const r = t.slice(2).toLowerCase();
|
|
33
|
+
f[r] = e;
|
|
30
34
|
} else t === "ref" ? i.ref = e : t === "className" ? i.class = e : t === "style" && typeof e == "object" ? i.style = e : t === "colorInterpolationFilters" ? i["color-interpolation-filters"] = e : t === "filterUnits" ? i.filterUnits = e : t === "clipPath" ? i["clip-path"] = e : t === "floodOpacity" ? i["flood-opacity"] = e : t === "stdDeviation" ? i.stdDeviation = e : t === "viewbox" ? i.viewBox = e : t !== "children" && t !== "key" && (i[t] = e);
|
|
31
35
|
});
|
|
32
|
-
const m =
|
|
36
|
+
const m = s.flat().map(l).filter((t) => t != null);
|
|
33
37
|
return c(n, { ...i, on: f }, m);
|
|
34
38
|
}
|
|
35
39
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
h as Fragment,
|
|
41
|
+
d as jsx
|
|
38
42
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface Context<T> {
|
|
|
40
40
|
defaultValue: T;
|
|
41
41
|
}
|
|
42
42
|
export interface WithChildrenProps {
|
|
43
|
-
children?: VDOMNode[] | VDOMNode |
|
|
43
|
+
children?: VDOMNode[] | VDOMNode | Function;
|
|
44
44
|
}
|
|
45
45
|
export type ComponentType<Props = any, ComponentState = any, Context = any> = new (props: Props, parentComponent: Component<{}, any, null> | null) => Component<Props, ComponentState, Context>;
|
|
46
46
|
export type Consumer<T> = Component<{}, {}, T>;
|