ddd-react 1.10.2 → 1.10.4
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 +91 -84
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as c, e as
|
|
1
|
+
import { D as c, e as m, a as F, A as g, b as x, h as U, c as B } from "./h-BbaMkkC7.mjs";
|
|
2
2
|
import { d as Pt, f as Ot } from "./h-BbaMkkC7.mjs";
|
|
3
|
-
function
|
|
3
|
+
function b(e, t) {
|
|
4
4
|
if (e === null || t === null || e === void 0 || t === void 0)
|
|
5
5
|
return e === t;
|
|
6
6
|
if (typeof e != typeof t)
|
|
@@ -14,7 +14,7 @@ function m(e, t) {
|
|
|
14
14
|
if (e.length !== t.length)
|
|
15
15
|
return !1;
|
|
16
16
|
for (let n = 0; n < e.length; ++n)
|
|
17
|
-
if (!
|
|
17
|
+
if (!b(e[n], t[n]))
|
|
18
18
|
return !1;
|
|
19
19
|
return !0;
|
|
20
20
|
}
|
|
@@ -32,7 +32,7 @@ function m(e, t) {
|
|
|
32
32
|
return !1;
|
|
33
33
|
for (let n = 0; n < r.length; ++n) {
|
|
34
34
|
const s = r[n];
|
|
35
|
-
if (!(s === "_owner" && e.$$typeof) && !
|
|
35
|
+
if (!(s === "_owner" && e.$$typeof) && !b(e[s], t[s]))
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
38
|
return !0;
|
|
@@ -204,10 +204,10 @@ function Q(e, t, r, n) {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
function Z(e, t, r, n) {
|
|
207
|
-
const { tag: s, children: i } = e,
|
|
208
|
-
V(
|
|
209
|
-
h(
|
|
210
|
-
}), L(
|
|
207
|
+
const { tag: s, children: i } = e, l = s === "svg" || t instanceof SVGElement ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
|
|
208
|
+
V(l, e, n), e.el = l, i?.forEach((a) => {
|
|
209
|
+
h(a, l, null, n);
|
|
210
|
+
}), L(l, t, r);
|
|
211
211
|
}
|
|
212
212
|
function V(e, t, r) {
|
|
213
213
|
const { props: n, events: s } = A(t);
|
|
@@ -242,9 +242,9 @@ function j(e, t) {
|
|
|
242
242
|
props: { key: i }
|
|
243
243
|
} = r, {
|
|
244
244
|
tag: o,
|
|
245
|
-
props: { key:
|
|
245
|
+
props: { key: l }
|
|
246
246
|
} = n;
|
|
247
|
-
return s === o && i ===
|
|
247
|
+
return s === o && i === l;
|
|
248
248
|
}
|
|
249
249
|
if (e.type === c.COMPONENT) {
|
|
250
250
|
const r = e, n = t, { tag: s } = r, { tag: i } = n;
|
|
@@ -269,7 +269,7 @@ function S(e, t) {
|
|
|
269
269
|
function rt(e) {
|
|
270
270
|
return e !== "";
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function C(e) {
|
|
273
273
|
return rt(e.trim());
|
|
274
274
|
}
|
|
275
275
|
function y(e, t, r, n = null) {
|
|
@@ -285,11 +285,11 @@ function y(e, t, r, n = null) {
|
|
|
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
|
}
|
|
@@ -309,22 +309,22 @@ function ot(e, t, r) {
|
|
|
309
309
|
class: s,
|
|
310
310
|
style: i,
|
|
311
311
|
on: o,
|
|
312
|
-
...
|
|
312
|
+
...l
|
|
313
313
|
} = e.props ?? {}, {
|
|
314
|
-
class:
|
|
314
|
+
class: a,
|
|
315
315
|
style: u,
|
|
316
|
-
on:
|
|
316
|
+
on: f,
|
|
317
317
|
...E
|
|
318
|
-
} = t.props ?? {}, { listeners:
|
|
319
|
-
it(n,
|
|
318
|
+
} = t.props ?? {}, { listeners: v } = e;
|
|
319
|
+
it(n, l, E), ct(n, s, a), ut(
|
|
320
320
|
n,
|
|
321
321
|
i,
|
|
322
322
|
u
|
|
323
|
-
), t.listeners =
|
|
323
|
+
), t.listeners = lt(
|
|
324
324
|
n,
|
|
325
|
-
|
|
325
|
+
v,
|
|
326
326
|
o ?? {},
|
|
327
|
-
|
|
327
|
+
f ?? {},
|
|
328
328
|
r
|
|
329
329
|
);
|
|
330
330
|
}
|
|
@@ -333,18 +333,18 @@ function it(e, t = {}, r = {}) {
|
|
|
333
333
|
n !== s && (n && typeof n == "object" && "current" in n && (n.current = null), s && typeof s == "object" && "current" in s && (s.current = e));
|
|
334
334
|
const i = { ...t }, o = { ...r };
|
|
335
335
|
delete i.ref, delete o.ref;
|
|
336
|
-
const { added:
|
|
337
|
-
for (const
|
|
338
|
-
D(e,
|
|
339
|
-
for (const
|
|
340
|
-
w(e,
|
|
336
|
+
const { added: l, removed: a, updated: u } = S(i, o);
|
|
337
|
+
for (const f of a)
|
|
338
|
+
D(e, f);
|
|
339
|
+
for (const f of l.concat(u))
|
|
340
|
+
w(e, f, o[f]);
|
|
341
341
|
}
|
|
342
342
|
function ct(e, t, r) {
|
|
343
|
-
const n =
|
|
343
|
+
const n = T(t), s = T(r), { added: i, removed: o } = x(n, s);
|
|
344
344
|
o.length > 0 && e.classList.remove(...o), i.length > 0 && e.classList.add(...i);
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
return Array.isArray(e) ? e.filter(
|
|
346
|
+
function T(e = "") {
|
|
347
|
+
return Array.isArray(e) ? e.filter(C) : String(e).split(/(\s+)/).filter(C);
|
|
348
348
|
}
|
|
349
349
|
function ut(e, t = {}, r = {}) {
|
|
350
350
|
const { added: n, removed: s, updated: i } = S(t, r);
|
|
@@ -353,53 +353,53 @@ function ut(e, t = {}, r = {}) {
|
|
|
353
353
|
for (const o of n.concat(i))
|
|
354
354
|
M(e, o, r[o]);
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
const { removed: i, added: o, updated:
|
|
358
|
-
for (const u of i.concat(
|
|
359
|
-
const
|
|
360
|
-
|
|
356
|
+
function lt(e, t = {}, r = {}, n = {}, s = null) {
|
|
357
|
+
const { removed: i, added: o, updated: l } = S(r, n);
|
|
358
|
+
for (const u of i.concat(l)) {
|
|
359
|
+
const f = t?.[u];
|
|
360
|
+
f && e.removeEventListener(u, f);
|
|
361
361
|
}
|
|
362
|
-
const
|
|
363
|
-
for (const u of o.concat(
|
|
364
|
-
|
|
362
|
+
const a = {};
|
|
363
|
+
for (const u of o.concat(l))
|
|
364
|
+
a[u] = N(
|
|
365
365
|
u,
|
|
366
366
|
n[u],
|
|
367
367
|
e,
|
|
368
368
|
s
|
|
369
369
|
);
|
|
370
|
-
return
|
|
370
|
+
return a;
|
|
371
371
|
}
|
|
372
372
|
function R(e, t, r) {
|
|
373
|
-
const n =
|
|
374
|
-
for (const
|
|
375
|
-
if (
|
|
376
|
-
const { originalIndex: u, index:
|
|
377
|
-
y(n[u], s[
|
|
373
|
+
const n = m(e), s = m(t), i = e.el, o = F(n, s, j), l = r?.offset ?? 0;
|
|
374
|
+
for (const a of o)
|
|
375
|
+
if (a.op === g.NOOP) {
|
|
376
|
+
const { originalIndex: u, index: f } = a;
|
|
377
|
+
y(n[u], s[f], i, r);
|
|
378
378
|
}
|
|
379
|
-
for (const
|
|
380
|
-
switch (
|
|
381
|
-
case
|
|
382
|
-
const { from: u, index:
|
|
383
|
-
E && (i.insertBefore(E,
|
|
379
|
+
for (const a of o)
|
|
380
|
+
switch (a.op) {
|
|
381
|
+
case g.MOVE: {
|
|
382
|
+
const { from: u, index: f } = a, E = n[u].el, v = i.childNodes[f + l];
|
|
383
|
+
E && (i.insertBefore(E, v), y(n[u], s[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
|
-
h(
|
|
391
|
+
case g.ADD: {
|
|
392
|
+
const { index: u, item: f } = a;
|
|
393
|
+
h(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
404
|
p(e), h(t, document.body, null, r);
|
|
405
405
|
return;
|
|
@@ -407,7 +407,7 @@ function lt(e, t, r) {
|
|
|
407
407
|
R(e, t, r);
|
|
408
408
|
}
|
|
409
409
|
const ht = (e) => e.isProvider, dt = (e) => e.isConsumer;
|
|
410
|
-
class
|
|
410
|
+
class k {
|
|
411
411
|
isMounted = !1;
|
|
412
412
|
vdom = null;
|
|
413
413
|
hostEl = null;
|
|
@@ -458,10 +458,10 @@ class C {
|
|
|
458
458
|
return console.error("Uncaught error:", t, r), this.error = t, Promise.resolve();
|
|
459
459
|
}
|
|
460
460
|
shouldComponentUpdate(t, r) {
|
|
461
|
-
return
|
|
461
|
+
return b(t, r);
|
|
462
462
|
}
|
|
463
463
|
get elements() {
|
|
464
|
-
return this.vdom == null ? [] : this.vdom.type === c.FRAGMENT ?
|
|
464
|
+
return this.vdom == null ? [] : this.vdom.type === c.FRAGMENT ? m(this.vdom).flatMap((t) => t.type === c.COMPONENT && t.component ? t.component.elements : t.el ? [t.el] : []) : this.vdom.el ? [this.vdom.el] : [];
|
|
465
465
|
}
|
|
466
466
|
get firstElement() {
|
|
467
467
|
return this.elements[0];
|
|
@@ -536,28 +536,35 @@ class C {
|
|
|
536
536
|
return this.constructor.defaultProps || {};
|
|
537
537
|
}
|
|
538
538
|
handleError(t, r) {
|
|
539
|
+
console.log("handleError");
|
|
539
540
|
const n = this.findClosestErrorBoundary();
|
|
540
|
-
if (n
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
541
|
+
if (console.log("errorBoundary", n), console.log(1), n) {
|
|
542
|
+
if (console.log(2), n.isMounted) {
|
|
543
|
+
console.log(3);
|
|
544
|
+
const i = n.constructor;
|
|
545
|
+
if (i.getDerivedStateFromError) {
|
|
546
|
+
console.log(4);
|
|
547
|
+
const o = i.getDerivedStateFromError(t);
|
|
548
|
+
n.state = { ...n.state, ...o };
|
|
549
|
+
}
|
|
550
|
+
if (n.didCatch(t, {
|
|
551
|
+
phase: r,
|
|
552
|
+
failedComponent: this.constructor.name,
|
|
553
|
+
componentStack: this.getComponentStack()
|
|
554
|
+
}), n.hostEl && n.vdom) {
|
|
555
|
+
console.log(5);
|
|
556
|
+
try {
|
|
557
|
+
console.log(6);
|
|
558
|
+
const o = n.render();
|
|
559
|
+
o && (console.log(7), y(n.vdom, o, n.hostEl, n));
|
|
560
|
+
} catch (o) {
|
|
561
|
+
console.log(8), console.error("Error during ErrorBoundary recovery:", o);
|
|
556
562
|
}
|
|
557
|
-
} catch (o) {
|
|
558
|
-
console.error("Error during ErrorBoundary recovery:", o);
|
|
559
563
|
}
|
|
564
|
+
}
|
|
565
|
+
return;
|
|
560
566
|
}
|
|
567
|
+
console.log(9);
|
|
561
568
|
const s = this.constructor;
|
|
562
569
|
if (s.getDerivedStateFromError) {
|
|
563
570
|
const i = s.getDerivedStateFromError(t);
|
|
@@ -593,18 +600,18 @@ class C {
|
|
|
593
600
|
return null;
|
|
594
601
|
}
|
|
595
602
|
isErrorBoundary() {
|
|
596
|
-
return this.constructor.getDerivedStateFromError !== void 0;
|
|
603
|
+
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;
|
|
597
604
|
}
|
|
598
605
|
}
|
|
599
606
|
function yt(e) {
|
|
600
|
-
class t extends
|
|
607
|
+
class t extends k {
|
|
601
608
|
isProvider = !0;
|
|
602
609
|
render() {
|
|
603
610
|
let s = [];
|
|
604
611
|
return Array.isArray(this.props.children) ? s = this.props.children : this.props.children ? s = [this.props.children] : s = [], U(s);
|
|
605
612
|
}
|
|
606
613
|
}
|
|
607
|
-
class r extends
|
|
614
|
+
class r extends k {
|
|
608
615
|
static contextType = {
|
|
609
616
|
Provider: t,
|
|
610
617
|
defaultValue: e
|
|
@@ -635,20 +642,20 @@ function Et(e, t) {
|
|
|
635
642
|
throw new Error("Container element is not provided for rendering.");
|
|
636
643
|
h(e, t);
|
|
637
644
|
}
|
|
638
|
-
function
|
|
645
|
+
function gt(e = null) {
|
|
639
646
|
return {
|
|
640
647
|
current: e
|
|
641
648
|
};
|
|
642
649
|
}
|
|
643
|
-
function
|
|
650
|
+
function vt(e, t) {
|
|
644
651
|
const r = Array.isArray(e) ? e : [e];
|
|
645
652
|
return B(r, t);
|
|
646
653
|
}
|
|
647
654
|
export {
|
|
648
|
-
|
|
655
|
+
k as Component,
|
|
649
656
|
yt as createContext,
|
|
650
|
-
|
|
651
|
-
|
|
657
|
+
vt as createPortal,
|
|
658
|
+
gt as createRef,
|
|
652
659
|
Pt as h,
|
|
653
660
|
U as hFragment,
|
|
654
661
|
Ot as hString,
|