ddd-react 1.10.3 → 1.10.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/dist/index.mjs +186 -174
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as c, e as m, a as
|
|
1
|
+
import { D as c, e as m, a as R, A as g, b as x, h as B, c as U } from "./h-BbaMkkC7.mjs";
|
|
2
2
|
import { d as Pt, f as Ot } from "./h-BbaMkkC7.mjs";
|
|
3
3
|
function b(e, t) {
|
|
4
4
|
if (e === null || t === null || e === void 0 || t === void 0)
|
|
@@ -31,8 +31,8 @@ function b(e, t) {
|
|
|
31
31
|
if (!Object.prototype.hasOwnProperty.call(t, r[n]))
|
|
32
32
|
return !1;
|
|
33
33
|
for (let n = 0; n < r.length; ++n) {
|
|
34
|
-
const
|
|
35
|
-
if (!(
|
|
34
|
+
const o = r[n];
|
|
35
|
+
if (!(o === "_owner" && e.$$typeof) && !b(e[o], t[o]))
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
38
|
return !0;
|
|
@@ -40,17 +40,17 @@ function b(e, t) {
|
|
|
40
40
|
return !1;
|
|
41
41
|
}
|
|
42
42
|
function N(e, t, r, n = null) {
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
n ? t.call(n,
|
|
43
|
+
function o(i) {
|
|
44
|
+
const s = i;
|
|
45
|
+
n ? t.call(n, s) : t(s);
|
|
46
46
|
}
|
|
47
|
-
return r.addEventListener(e,
|
|
47
|
+
return r.addEventListener(e, o), o;
|
|
48
48
|
}
|
|
49
49
|
function I(e = {}, t, r = null) {
|
|
50
50
|
const n = {};
|
|
51
|
-
return Object.entries(e).forEach(([
|
|
52
|
-
n[
|
|
53
|
-
|
|
51
|
+
return Object.entries(e).forEach(([o, i]) => {
|
|
52
|
+
n[o] = N(
|
|
53
|
+
o,
|
|
54
54
|
i,
|
|
55
55
|
t,
|
|
56
56
|
r
|
|
@@ -95,8 +95,8 @@ function q(e) {
|
|
|
95
95
|
t && t.remove();
|
|
96
96
|
}
|
|
97
97
|
function G(e) {
|
|
98
|
-
const { el: t, children: r, listeners: n, props:
|
|
99
|
-
|
|
98
|
+
const { el: t, children: r, listeners: n, props: o } = e;
|
|
99
|
+
o?.ref && typeof o.ref == "object" && "current" in o.ref && (o.ref.current = null), t && t.remove(), r && r.forEach(p), n && t && ($(n, t), delete e.listeners);
|
|
100
100
|
}
|
|
101
101
|
function _(e) {
|
|
102
102
|
const { children: t } = e;
|
|
@@ -113,12 +113,12 @@ function J(e, t) {
|
|
|
113
113
|
e.style[t] = null;
|
|
114
114
|
}
|
|
115
115
|
function K(e, t) {
|
|
116
|
-
const { class: r, style: n, ...
|
|
117
|
-
r && W(e, r), n && Object.entries(n).forEach(([i,
|
|
118
|
-
M(e, i,
|
|
116
|
+
const { class: r, style: n, ...o } = t;
|
|
117
|
+
r && W(e, r), n && Object.entries(n).forEach(([i, s]) => {
|
|
118
|
+
M(e, i, s);
|
|
119
119
|
});
|
|
120
|
-
for (const [i,
|
|
121
|
-
w(e, i,
|
|
120
|
+
for (const [i, s] of Object.entries(o))
|
|
121
|
+
w(e, i, s);
|
|
122
122
|
}
|
|
123
123
|
function W(e, t) {
|
|
124
124
|
if (e instanceof SVGElement) {
|
|
@@ -135,7 +135,7 @@ function D(e, t) {
|
|
|
135
135
|
}
|
|
136
136
|
let P = !1;
|
|
137
137
|
const O = [];
|
|
138
|
-
function
|
|
138
|
+
function h(e) {
|
|
139
139
|
O.push(e), Y();
|
|
140
140
|
}
|
|
141
141
|
function Y() {
|
|
@@ -165,7 +165,7 @@ function A(e) {
|
|
|
165
165
|
const { on: t = {}, ...r } = e.props;
|
|
166
166
|
return delete r.key, { props: r, events: t };
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function d(e, t, r = null, n = null) {
|
|
169
169
|
switch (e.type) {
|
|
170
170
|
case c.TEXT: {
|
|
171
171
|
z(e, t, r);
|
|
@@ -181,8 +181,8 @@ function h(e, t, r = null, n = null) {
|
|
|
181
181
|
}
|
|
182
182
|
case c.COMPONENT: {
|
|
183
183
|
tt(e, t, r, n);
|
|
184
|
-
const
|
|
185
|
-
|
|
184
|
+
const o = e.component;
|
|
185
|
+
o && h(() => o.didMount());
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
188
|
case c.PORTAL: {
|
|
@@ -194,28 +194,28 @@ function h(e, t, r = null, n = null) {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
function z(e, t, r) {
|
|
197
|
-
const { value: n } = e,
|
|
198
|
-
e.el =
|
|
197
|
+
const { value: n } = e, o = document.createTextNode(n);
|
|
198
|
+
e.el = o, L(o, t, r);
|
|
199
199
|
}
|
|
200
200
|
function Q(e, t, r, n) {
|
|
201
|
-
const { children:
|
|
202
|
-
e.el = t,
|
|
203
|
-
|
|
201
|
+
const { children: o } = e;
|
|
202
|
+
e.el = t, o?.forEach((i, s) => {
|
|
203
|
+
d(i, t, r != null ? r + s : null, n);
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
function Z(e, t, r, n) {
|
|
207
|
-
const { tag:
|
|
208
|
-
V(
|
|
209
|
-
|
|
210
|
-
}), L(
|
|
207
|
+
const { tag: o, children: i } = e, l = o === "svg" || t instanceof SVGElement ? document.createElementNS("http://www.w3.org/2000/svg", o) : document.createElement(o);
|
|
208
|
+
V(l, e, n), e.el = l, i?.forEach((a) => {
|
|
209
|
+
d(a, l, null, n);
|
|
210
|
+
}), L(l, t, r);
|
|
211
211
|
}
|
|
212
212
|
function V(e, t, r) {
|
|
213
|
-
const { props: n, events:
|
|
214
|
-
n.ref && typeof n.ref == "object" && "current" in n.ref && (n.ref.current = e, delete n.ref), t.listeners = I(
|
|
213
|
+
const { props: n, events: o } = A(t);
|
|
214
|
+
n.ref && typeof n.ref == "object" && "current" in n.ref && (n.ref.current = e, delete n.ref), t.listeners = I(o, e, r), K(e, n);
|
|
215
215
|
}
|
|
216
216
|
function tt(e, t, r, n) {
|
|
217
|
-
const
|
|
218
|
-
|
|
217
|
+
const o = e.tag, { props: i } = A(e), s = new o(i, n);
|
|
218
|
+
s.mount(t, r), e.component = s, e.el = s.firstElement || null;
|
|
219
219
|
}
|
|
220
220
|
function L(e, t, r) {
|
|
221
221
|
if (r == null) {
|
|
@@ -229,8 +229,8 @@ function L(e, t, r) {
|
|
|
229
229
|
}
|
|
230
230
|
function et(e, t) {
|
|
231
231
|
const { children: r, container: n } = e;
|
|
232
|
-
r?.forEach((
|
|
233
|
-
|
|
232
|
+
r?.forEach((o) => {
|
|
233
|
+
d(o, n, null, t);
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
function j(e, t) {
|
|
@@ -238,17 +238,17 @@ function j(e, t) {
|
|
|
238
238
|
return !1;
|
|
239
239
|
if (e.type === c.ELEMENT) {
|
|
240
240
|
const r = e, n = t, {
|
|
241
|
-
tag:
|
|
241
|
+
tag: o,
|
|
242
242
|
props: { key: i }
|
|
243
243
|
} = r, {
|
|
244
|
-
tag:
|
|
245
|
-
props: { key:
|
|
244
|
+
tag: s,
|
|
245
|
+
props: { key: l }
|
|
246
246
|
} = n;
|
|
247
|
-
return
|
|
247
|
+
return o === s && i === l;
|
|
248
248
|
}
|
|
249
249
|
if (e.type === c.COMPONENT) {
|
|
250
|
-
const r = e, n = t, { tag:
|
|
251
|
-
return
|
|
250
|
+
const r = e, n = t, { tag: o } = r, { tag: i } = n;
|
|
251
|
+
return o === i;
|
|
252
252
|
}
|
|
253
253
|
if (e.type === c.PORTAL) {
|
|
254
254
|
const r = e, n = t;
|
|
@@ -256,158 +256,158 @@ function j(e, t) {
|
|
|
256
256
|
}
|
|
257
257
|
return !0;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
const r = Object.keys(e), n = Object.keys(t),
|
|
261
|
-
for (const
|
|
262
|
-
|
|
259
|
+
function C(e, t) {
|
|
260
|
+
const r = Object.keys(e), n = Object.keys(t), o = [], i = [];
|
|
261
|
+
for (const s of n)
|
|
262
|
+
s in e ? e[s] !== t[s] && i.push(s) : o.push(s);
|
|
263
263
|
return {
|
|
264
|
-
added:
|
|
265
|
-
removed: r.filter((
|
|
264
|
+
added: o,
|
|
265
|
+
removed: r.filter((s) => !(s in t)),
|
|
266
266
|
updated: i
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
function rt(e) {
|
|
270
270
|
return e !== "";
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function S(e) {
|
|
273
273
|
return rt(e.trim());
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function E(e, t, r, n = null) {
|
|
276
276
|
if (!j(e, t)) {
|
|
277
|
-
const
|
|
278
|
-
return p(e),
|
|
277
|
+
const o = nt(r, e.el);
|
|
278
|
+
return p(e), d(t, r, o, n), t;
|
|
279
279
|
}
|
|
280
280
|
switch (t.el = e.el, t.type) {
|
|
281
281
|
case c.TEXT:
|
|
282
|
-
return
|
|
282
|
+
return ot(e, t), t;
|
|
283
283
|
case c.ELEMENT: {
|
|
284
|
-
|
|
284
|
+
st(e, t, n);
|
|
285
285
|
break;
|
|
286
286
|
}
|
|
287
287
|
case c.COMPONENT: {
|
|
288
|
-
|
|
288
|
+
at(e, t);
|
|
289
289
|
break;
|
|
290
290
|
}
|
|
291
291
|
case c.PORTAL: {
|
|
292
|
-
|
|
292
|
+
ft(e, t, n);
|
|
293
293
|
break;
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
return
|
|
296
|
+
return F(e, t, n), t;
|
|
297
297
|
}
|
|
298
298
|
function nt(e, t) {
|
|
299
299
|
if (!t) return null;
|
|
300
300
|
const r = Array.from(e.childNodes).indexOf(t);
|
|
301
301
|
return r < 0 ? null : r;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
const r = e.el, { value: n } = e, { value:
|
|
305
|
-
n !==
|
|
303
|
+
function ot(e, t) {
|
|
304
|
+
const r = e.el, { value: n } = e, { value: o } = t;
|
|
305
|
+
n !== o && r && (r.nodeValue = o);
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function st(e, t, r) {
|
|
308
308
|
const n = e.el, {
|
|
309
|
-
class:
|
|
309
|
+
class: o,
|
|
310
310
|
style: i,
|
|
311
|
-
on:
|
|
312
|
-
...
|
|
311
|
+
on: s,
|
|
312
|
+
...l
|
|
313
313
|
} = e.props ?? {}, {
|
|
314
|
-
class:
|
|
314
|
+
class: a,
|
|
315
315
|
style: u,
|
|
316
|
-
on:
|
|
317
|
-
...
|
|
318
|
-
} = t.props ?? {}, { listeners:
|
|
319
|
-
it(n,
|
|
316
|
+
on: f,
|
|
317
|
+
...y
|
|
318
|
+
} = t.props ?? {}, { listeners: v } = e;
|
|
319
|
+
it(n, l, y), ct(n, o, a), ut(
|
|
320
320
|
n,
|
|
321
321
|
i,
|
|
322
322
|
u
|
|
323
|
-
), t.listeners =
|
|
323
|
+
), t.listeners = lt(
|
|
324
324
|
n,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
v,
|
|
326
|
+
s ?? {},
|
|
327
|
+
f ?? {},
|
|
328
328
|
r
|
|
329
329
|
);
|
|
330
330
|
}
|
|
331
331
|
function it(e, t = {}, r = {}) {
|
|
332
|
-
const n = t.ref,
|
|
333
|
-
n !==
|
|
334
|
-
const i = { ...t },
|
|
335
|
-
delete i.ref, delete
|
|
336
|
-
const { added:
|
|
337
|
-
for (const
|
|
338
|
-
D(e,
|
|
339
|
-
for (const
|
|
340
|
-
w(e,
|
|
332
|
+
const n = t.ref, o = r.ref;
|
|
333
|
+
n !== o && (n && typeof n == "object" && "current" in n && (n.current = null), o && typeof o == "object" && "current" in o && (o.current = e));
|
|
334
|
+
const i = { ...t }, s = { ...r };
|
|
335
|
+
delete i.ref, delete s.ref;
|
|
336
|
+
const { added: l, removed: a, updated: u } = C(i, s);
|
|
337
|
+
for (const f of a)
|
|
338
|
+
D(e, f);
|
|
339
|
+
for (const f of l.concat(u))
|
|
340
|
+
w(e, f, s[f]);
|
|
341
341
|
}
|
|
342
342
|
function ct(e, t, r) {
|
|
343
|
-
const n =
|
|
344
|
-
|
|
343
|
+
const n = k(t), o = k(r), { added: i, removed: s } = x(n, o);
|
|
344
|
+
s.length > 0 && e.classList.remove(...s), i.length > 0 && e.classList.add(...i);
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
return Array.isArray(e) ? e.filter(
|
|
346
|
+
function k(e = "") {
|
|
347
|
+
return Array.isArray(e) ? e.filter(S) : String(e).split(/(\s+)/).filter(S);
|
|
348
348
|
}
|
|
349
349
|
function ut(e, t = {}, r = {}) {
|
|
350
|
-
const { added: n, removed:
|
|
351
|
-
for (const
|
|
352
|
-
J(e,
|
|
353
|
-
for (const
|
|
354
|
-
M(e,
|
|
355
|
-
}
|
|
356
|
-
function
|
|
357
|
-
const { removed: i, added:
|
|
358
|
-
for (const u of i.concat(
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
const
|
|
363
|
-
for (const u of
|
|
364
|
-
|
|
350
|
+
const { added: n, removed: o, updated: i } = C(t, r);
|
|
351
|
+
for (const s of o)
|
|
352
|
+
J(e, s);
|
|
353
|
+
for (const s of n.concat(i))
|
|
354
|
+
M(e, s, r[s]);
|
|
355
|
+
}
|
|
356
|
+
function lt(e, t = {}, r = {}, n = {}, o = null) {
|
|
357
|
+
const { removed: i, added: s, updated: l } = C(r, n);
|
|
358
|
+
for (const u of i.concat(l)) {
|
|
359
|
+
const f = t?.[u];
|
|
360
|
+
f && e.removeEventListener(u, f);
|
|
361
|
+
}
|
|
362
|
+
const a = {};
|
|
363
|
+
for (const u of s.concat(l))
|
|
364
|
+
a[u] = N(
|
|
365
365
|
u,
|
|
366
366
|
n[u],
|
|
367
367
|
e,
|
|
368
|
-
|
|
368
|
+
o
|
|
369
369
|
);
|
|
370
|
-
return
|
|
371
|
-
}
|
|
372
|
-
function
|
|
373
|
-
const n = m(e),
|
|
374
|
-
for (const
|
|
375
|
-
if (
|
|
376
|
-
const { originalIndex: u, index:
|
|
377
|
-
|
|
370
|
+
return a;
|
|
371
|
+
}
|
|
372
|
+
function F(e, t, r) {
|
|
373
|
+
const n = m(e), o = m(t), i = e.el, s = R(n, o, j), l = r?.offset ?? 0;
|
|
374
|
+
for (const a of s)
|
|
375
|
+
if (a.op === g.NOOP) {
|
|
376
|
+
const { originalIndex: u, index: f } = a;
|
|
377
|
+
E(n[u], o[f], i, r);
|
|
378
378
|
}
|
|
379
|
-
for (const
|
|
380
|
-
switch (
|
|
381
|
-
case
|
|
382
|
-
const { from: u, index:
|
|
383
|
-
|
|
379
|
+
for (const a of s)
|
|
380
|
+
switch (a.op) {
|
|
381
|
+
case g.MOVE: {
|
|
382
|
+
const { from: u, index: f } = a, y = n[u].el, v = i.childNodes[f + l];
|
|
383
|
+
y && (i.insertBefore(y, v), E(n[u], o[f], i, r));
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
|
-
case
|
|
387
|
-
const { item: u } =
|
|
386
|
+
case g.REMOVE: {
|
|
387
|
+
const { item: u } = a;
|
|
388
388
|
p(u);
|
|
389
389
|
break;
|
|
390
390
|
}
|
|
391
|
-
case
|
|
392
|
-
const { index: u, item:
|
|
393
|
-
|
|
391
|
+
case g.ADD: {
|
|
392
|
+
const { index: u, item: f } = a;
|
|
393
|
+
d(f, i, u + l, r);
|
|
394
394
|
break;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function at(e, t) {
|
|
399
399
|
const { component: r } = e, { props: n } = A(t);
|
|
400
400
|
r.updateProps(n), t.component = r, t.el = r.firstElement;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function ft(e, t, r) {
|
|
403
403
|
if (e.container !== t.container) {
|
|
404
|
-
p(e),
|
|
404
|
+
p(e), d(t, document.body, null, r);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
|
-
|
|
407
|
+
F(e, t, r);
|
|
408
408
|
}
|
|
409
|
-
const
|
|
410
|
-
class
|
|
409
|
+
const dt = (e) => e.isProvider, ht = (e) => e.isConsumer;
|
|
410
|
+
class T {
|
|
411
411
|
isMounted = !1;
|
|
412
412
|
vdom = null;
|
|
413
413
|
hostEl = null;
|
|
@@ -433,7 +433,7 @@ class k {
|
|
|
433
433
|
r !== -1 && (this.dependencies.splice(r, 1), t.subscribedProvider = null);
|
|
434
434
|
}
|
|
435
435
|
notify() {
|
|
436
|
-
|
|
436
|
+
h(() => {
|
|
437
437
|
this.dependencies.forEach(({ consumer: t }) => {
|
|
438
438
|
t.isMounted && t.updateContext() && t.patch(t.props, t.state);
|
|
439
439
|
});
|
|
@@ -470,8 +470,8 @@ class k {
|
|
|
470
470
|
return this.vdom?.type === c.FRAGMENT && this.hostEl && this.firstElement ? Array.from(this.hostEl.children).indexOf(this.firstElement) : 0;
|
|
471
471
|
}
|
|
472
472
|
updateProps(t) {
|
|
473
|
-
const n = { ...this.getDefaultProps(), ...this.props, ...t },
|
|
474
|
-
this.props = n, !this.shouldComponentUpdate(
|
|
473
|
+
const n = { ...this.getDefaultProps(), ...this.props, ...t }, o = this.props;
|
|
474
|
+
this.props = n, !this.shouldComponentUpdate(o, n) && (dt(this) && this.notify(), this.patch(o, this.state));
|
|
475
475
|
}
|
|
476
476
|
setState(t) {
|
|
477
477
|
const r = this.state;
|
|
@@ -483,24 +483,24 @@ class k {
|
|
|
483
483
|
mount(t, r = null) {
|
|
484
484
|
if (this.isMounted)
|
|
485
485
|
throw new Error("Component is already mounted");
|
|
486
|
-
|
|
486
|
+
ht(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext();
|
|
487
487
|
try {
|
|
488
|
-
this.vdom = this.render(),
|
|
488
|
+
this.vdom = this.render(), this.hostEl = t, d(this.vdom, t, r, this), this.isMounted = !0;
|
|
489
489
|
} catch (n) {
|
|
490
490
|
this.handleError(n, "mount");
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
unmount() {
|
|
494
|
-
this.isMounted && (
|
|
494
|
+
this.isMounted && (h(() => this.willUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: t }) => {
|
|
495
495
|
t.subscribedProvider = null;
|
|
496
|
-
}), this.dependencies = [], this.vdom && p(this.vdom),
|
|
496
|
+
}), this.dependencies = [], this.vdom && p(this.vdom), h(() => this.didUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1, this.error = null);
|
|
497
497
|
}
|
|
498
498
|
patch(t, r) {
|
|
499
499
|
if (!(!this.isMounted || !this.hostEl || !this.vdom) && !this.error) {
|
|
500
|
-
|
|
500
|
+
h(() => this.willUpdate(this.props, this.state));
|
|
501
501
|
try {
|
|
502
502
|
const n = this.render();
|
|
503
|
-
this.vdom =
|
|
503
|
+
this.vdom = E(this.vdom, n, this.hostEl, this), h(() => this.didUpdate(t, r));
|
|
504
504
|
} catch (n) {
|
|
505
505
|
this.handleError(n, "patch");
|
|
506
506
|
}
|
|
@@ -538,40 +538,52 @@ class k {
|
|
|
538
538
|
handleError(t, r) {
|
|
539
539
|
console.log("handleError");
|
|
540
540
|
const n = this.findClosestErrorBoundary();
|
|
541
|
-
if (console.log("errorBoundary", n), n
|
|
541
|
+
if (console.log("errorBoundary", n), n) {
|
|
542
|
+
console.log("Found error boundary");
|
|
542
543
|
const i = n.constructor;
|
|
543
544
|
if (i.getDerivedStateFromError) {
|
|
544
|
-
|
|
545
|
-
|
|
545
|
+
console.log("Calling getDerivedStateFromError");
|
|
546
|
+
const s = i.getDerivedStateFromError(t);
|
|
547
|
+
n.state = { ...n.state, ...s };
|
|
546
548
|
}
|
|
547
|
-
if (n.didCatch(t, {
|
|
549
|
+
if ((r === "patch" || n.isMounted) && (console.log("Calling componentDidCatch"), n.didCatch(t, {
|
|
548
550
|
phase: r,
|
|
549
551
|
failedComponent: this.constructor.name,
|
|
550
552
|
componentStack: this.getComponentStack()
|
|
551
|
-
}), n.hostEl
|
|
553
|
+
})), n.hostEl) {
|
|
554
|
+
console.log("Rendering fallback UI");
|
|
552
555
|
try {
|
|
553
|
-
const
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
556
|
+
const s = n.render();
|
|
557
|
+
if (s)
|
|
558
|
+
if (n.vdom)
|
|
559
|
+
console.log("Patching ErrorBoundary"), E(n.vdom, s, n.hostEl, n);
|
|
560
|
+
else {
|
|
561
|
+
console.log("Mounting ErrorBoundary fallback");
|
|
562
|
+
const l = n.parent?.offset || 0;
|
|
563
|
+
n.hostEl && n.hostEl.children.length > 0 && Array.from(n.hostEl.children).forEach((a) => {
|
|
564
|
+
a.remove();
|
|
565
|
+
}), d(s, n.hostEl, l, n.parent), n.vdom = s, n.isMounted = !0;
|
|
566
|
+
}
|
|
567
|
+
} catch (s) {
|
|
568
|
+
console.error("Error during ErrorBoundary recovery:", s), n.parent && n.parent.handleError(s, r);
|
|
560
569
|
}
|
|
570
|
+
}
|
|
571
|
+
return;
|
|
561
572
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
573
|
+
console.log("No error boundary found, handling locally");
|
|
574
|
+
const o = this.constructor;
|
|
575
|
+
if (o.getDerivedStateFromError) {
|
|
576
|
+
const i = o.getDerivedStateFromError(t);
|
|
565
577
|
this.state = { ...this.state, ...i };
|
|
566
578
|
}
|
|
567
|
-
|
|
579
|
+
h(() => {
|
|
568
580
|
if (this.didCatch(t, {
|
|
569
581
|
phase: r,
|
|
570
582
|
componentStack: this.getComponentStack()
|
|
571
583
|
}), this.hostEl && this.isMounted)
|
|
572
584
|
try {
|
|
573
585
|
const i = this.render();
|
|
574
|
-
i &&
|
|
586
|
+
i && E(this.vdom, i, this.hostEl, this);
|
|
575
587
|
} catch (i) {
|
|
576
588
|
console.error("Error during error recovery render:", i);
|
|
577
589
|
}
|
|
@@ -597,32 +609,32 @@ class k {
|
|
|
597
609
|
return console.log("isErrorBoundary"), console.log("this.constructor as typeof Component", this.constructor), console.log("(this.constructor as typeof Component).getDerivedStateFromError", this.constructor.getDerivedStateFromError), this.constructor.getDerivedStateFromError !== void 0;
|
|
598
610
|
}
|
|
599
611
|
}
|
|
600
|
-
function
|
|
601
|
-
class t extends
|
|
612
|
+
function Et(e) {
|
|
613
|
+
class t extends T {
|
|
602
614
|
isProvider = !0;
|
|
603
615
|
render() {
|
|
604
|
-
let
|
|
605
|
-
return Array.isArray(this.props.children) ?
|
|
616
|
+
let o = [];
|
|
617
|
+
return Array.isArray(this.props.children) ? o = this.props.children : this.props.children ? o = [this.props.children] : o = [], B(o);
|
|
606
618
|
}
|
|
607
619
|
}
|
|
608
|
-
class r extends
|
|
620
|
+
class r extends T {
|
|
609
621
|
static contextType = {
|
|
610
622
|
Provider: t,
|
|
611
623
|
defaultValue: e
|
|
612
624
|
};
|
|
613
625
|
isConsumer = !0;
|
|
614
626
|
render() {
|
|
615
|
-
let
|
|
616
|
-
if (Array.isArray(
|
|
617
|
-
if (
|
|
618
|
-
|
|
627
|
+
let o = this.props.children;
|
|
628
|
+
if (Array.isArray(o))
|
|
629
|
+
if (o.length === 1 && typeof o[0] == "function")
|
|
630
|
+
o = o[0];
|
|
619
631
|
else
|
|
620
632
|
throw new Error(
|
|
621
633
|
"Consumer: expected single function child, got array"
|
|
622
634
|
);
|
|
623
|
-
if (typeof
|
|
635
|
+
if (typeof o != "function")
|
|
624
636
|
throw new Error("Consumer: children is not a function");
|
|
625
|
-
return
|
|
637
|
+
return o(this.context);
|
|
626
638
|
}
|
|
627
639
|
}
|
|
628
640
|
return {
|
|
@@ -631,27 +643,27 @@ function yt(e) {
|
|
|
631
643
|
defaultValue: e
|
|
632
644
|
};
|
|
633
645
|
}
|
|
634
|
-
function
|
|
646
|
+
function yt(e, t) {
|
|
635
647
|
if (!t)
|
|
636
648
|
throw new Error("Container element is not provided for rendering.");
|
|
637
|
-
|
|
649
|
+
d(e, t);
|
|
638
650
|
}
|
|
639
|
-
function
|
|
651
|
+
function gt(e = null) {
|
|
640
652
|
return {
|
|
641
653
|
current: e
|
|
642
654
|
};
|
|
643
655
|
}
|
|
644
|
-
function
|
|
656
|
+
function vt(e, t) {
|
|
645
657
|
const r = Array.isArray(e) ? e : [e];
|
|
646
|
-
return
|
|
658
|
+
return U(r, t);
|
|
647
659
|
}
|
|
648
660
|
export {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
661
|
+
T as Component,
|
|
662
|
+
Et as createContext,
|
|
663
|
+
vt as createPortal,
|
|
664
|
+
gt as createRef,
|
|
653
665
|
Pt as h,
|
|
654
|
-
|
|
666
|
+
B as hFragment,
|
|
655
667
|
Ot as hString,
|
|
656
|
-
|
|
668
|
+
yt as render
|
|
657
669
|
};
|