ddd-react 1.9.1 → 1.10.1

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.
@@ -4,7 +4,9 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
4
4
  vdom: VDOMNode | null;
5
5
  private hostEl;
6
6
  parent: Component | null;
7
+ private error;
7
8
  static defaultProps: any;
9
+ static getDerivedStateFromError?(error: Error): any;
8
10
  props: P & WithChildrenProps;
9
11
  state: S;
10
12
  context: C;
@@ -27,6 +29,7 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
27
29
  didUpdate(prevProps: P, prevState: S): void | Promise<void>;
28
30
  willUnmount(): void | Promise<void>;
29
31
  didUnmount(): void | Promise<void>;
32
+ didCatch(error: Error, errorInfo: any): void | Promise<void>;
30
33
  shouldComponentUpdate(prevProps: P, nextProps: P): boolean;
31
34
  abstract render(): VDOMNode;
32
35
  get elements(): HTMLElement[];
@@ -40,4 +43,8 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
40
43
  private updateContext;
41
44
  private subscribeToProvider;
42
45
  getDefaultProps(): P;
46
+ private handleError;
47
+ private getComponentStack;
48
+ private findClosestErrorBoundary;
49
+ isErrorBoundary(): boolean;
43
50
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { D as c, e as v, a as x, A as E, b as U, h as F, c as I } from "./h-BbaMkkC7.mjs";
2
- import { d as Ot, f as mt } from "./h-BbaMkkC7.mjs";
3
- function g(e, t) {
1
+ import { D as c, e as b, a as x, A as E, b as F, h as U, c as B } from "./h-BbaMkkC7.mjs";
2
+ import { d as Pt, f as Ot } from "./h-BbaMkkC7.mjs";
3
+ function m(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 g(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 (!g(e[n], t[n]))
17
+ if (!m(e[n], t[n]))
18
18
  return !1;
19
19
  return !0;
20
20
  }
@@ -32,49 +32,49 @@ function g(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) && !g(e[s], t[s]))
35
+ if (!(s === "_owner" && e.$$typeof) && !m(e[s], t[s]))
36
36
  return !1;
37
37
  }
38
38
  return !0;
39
39
  }
40
40
  return !1;
41
41
  }
42
- function S(e, t, r, n = null) {
43
- function s(i) {
44
- const o = i;
45
- n ? t.call(n, o) : t(o);
42
+ function N(e, t, r, n = null) {
43
+ function s(o) {
44
+ const i = o;
45
+ n ? t.call(n, i) : t(i);
46
46
  }
47
47
  return r.addEventListener(e, s), s;
48
48
  }
49
- function $(e = {}, t, r = null) {
49
+ function I(e = {}, t, r = null) {
50
50
  const n = {};
51
- return Object.entries(e).forEach(([s, i]) => {
52
- n[s] = S(
51
+ return Object.entries(e).forEach(([s, o]) => {
52
+ n[s] = N(
53
53
  s,
54
- i,
54
+ o,
55
55
  t,
56
56
  r
57
57
  );
58
58
  }), n;
59
59
  }
60
- function q(e = {}, t) {
60
+ function $(e = {}, t) {
61
61
  Object.entries(e).forEach(([r, n]) => {
62
62
  t.removeEventListener(r, n);
63
63
  });
64
64
  }
65
- function h(e) {
65
+ function p(e) {
66
66
  const { type: t } = e;
67
67
  switch (t) {
68
68
  case c.TEXT: {
69
- G(e);
69
+ q(e);
70
70
  break;
71
71
  }
72
72
  case c.ELEMENT: {
73
- _(e);
73
+ G(e);
74
74
  break;
75
75
  }
76
76
  case c.FRAGMENT: {
77
- B(e);
77
+ _(e);
78
78
  break;
79
79
  }
80
80
  case c.COMPONENT: {
@@ -90,23 +90,23 @@ function h(e) {
90
90
  }
91
91
  delete e.el;
92
92
  }
93
- function G(e) {
93
+ function q(e) {
94
94
  const { el: t } = e;
95
95
  t && t.remove();
96
96
  }
97
- function _(e) {
97
+ function G(e) {
98
98
  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(h), n && t && (q(n, t), delete e.listeners);
99
+ s?.ref && typeof s.ref == "object" && "current" in s.ref && (s.ref.current = null), t && t.remove(), r && r.forEach(p), n && t && ($(n, t), delete e.listeners);
100
100
  }
101
- function B(e) {
101
+ function _(e) {
102
102
  const { children: t } = e;
103
- t && t.forEach(h);
103
+ t && t.forEach(p);
104
104
  }
105
105
  function X(e) {
106
106
  const { children: t } = e;
107
- t && t.forEach(h);
107
+ t && t.forEach(p);
108
108
  }
109
- function C(e, t, r) {
109
+ function M(e, t, r) {
110
110
  e.style[t] = r.toString();
111
111
  }
112
112
  function J(e, t) {
@@ -114,11 +114,11 @@ function J(e, t) {
114
114
  }
115
115
  function K(e, t) {
116
116
  const { class: r, style: n, ...s } = t;
117
- r && W(e, r), n && Object.entries(n).forEach(([i, o]) => {
118
- C(e, i, o);
117
+ r && W(e, r), n && Object.entries(n).forEach(([o, i]) => {
118
+ M(e, o, i);
119
119
  });
120
- for (const [i, o] of Object.entries(s))
121
- w(e, i, o);
120
+ for (const [o, i] of Object.entries(s))
121
+ w(e, o, i);
122
122
  }
123
123
  function W(e, t) {
124
124
  if (e instanceof SVGElement) {
@@ -128,9 +128,9 @@ function W(e, t) {
128
128
  e.className = "", typeof t == "string" ? e.className = t : Array.isArray(t) && e.classList.add(...t);
129
129
  }
130
130
  function w(e, t, r) {
131
- r == null ? L(e, t) : e.setAttribute(t, String(r));
131
+ r == null ? D(e, t) : e.setAttribute(t, String(r));
132
132
  }
133
- function L(e, t) {
133
+ function D(e, t) {
134
134
  e[t] = null, e.removeAttribute(t);
135
135
  }
136
136
  let P = !1;
@@ -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 p(e, t, r = null, n = null) {
168
+ function h(e, t, r = null, n = null) {
169
169
  switch (e.type) {
170
170
  case c.TEXT: {
171
171
  z(e, t, r);
@@ -195,29 +195,29 @@ function p(e, t, r = null, n = null) {
195
195
  }
196
196
  function z(e, t, r) {
197
197
  const { value: n } = e, s = document.createTextNode(n);
198
- e.el = s, j(s, t, r);
198
+ e.el = s, L(s, t, r);
199
199
  }
200
200
  function Q(e, t, r, n) {
201
201
  const { children: s } = e;
202
- e.el = t, s?.forEach((i, o) => {
203
- p(i, t, r != null ? r + o : null, n);
202
+ e.el = t, s?.forEach((o, i) => {
203
+ h(o, t, r != null ? r + i : null, n);
204
204
  });
205
205
  }
206
206
  function Z(e, t, r, n) {
207
- const { tag: s, children: i } = e, f = s === "svg" || t instanceof SVGElement ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
208
- V(f, e, n), e.el = f, i?.forEach((l) => {
209
- p(l, f, null, n);
210
- }), j(f, t, r);
207
+ const { tag: s, children: o } = e, a = s === "svg" || t instanceof SVGElement ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
208
+ V(a, e, n), e.el = a, o?.forEach((f) => {
209
+ h(f, a, null, n);
210
+ }), L(a, t, r);
211
211
  }
212
212
  function V(e, t, r) {
213
213
  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 = $(s, e, r), K(e, n);
214
+ n.ref && typeof n.ref == "object" && "current" in n.ref && (n.ref.current = e, delete n.ref), t.listeners = I(s, e, r), K(e, n);
215
215
  }
216
216
  function tt(e, t, r, n) {
217
- const s = e.tag, { props: i } = A(e), o = new s(i, n);
218
- o.mount(t, r), e.component = o, e.el = o.firstElement || null;
217
+ const s = e.tag, { props: o } = A(e), i = new s(o, n);
218
+ i.mount(t, r), e.component = i, e.el = i.firstElement || null;
219
219
  }
220
- function j(e, t, r) {
220
+ function L(e, t, r) {
221
221
  if (r == null) {
222
222
  t.append(e);
223
223
  return;
@@ -230,25 +230,25 @@ function j(e, t, r) {
230
230
  function et(e, t) {
231
231
  const { children: r, container: n } = e;
232
232
  r?.forEach((s) => {
233
- p(s, n, null, t);
233
+ h(s, n, null, t);
234
234
  });
235
235
  }
236
- function D(e, t) {
236
+ function j(e, t) {
237
237
  if (e.type !== t.type)
238
238
  return !1;
239
239
  if (e.type === c.ELEMENT) {
240
240
  const r = e, n = t, {
241
241
  tag: s,
242
- props: { key: i }
242
+ props: { key: o }
243
243
  } = r, {
244
- tag: o,
245
- props: { key: f }
244
+ tag: i,
245
+ props: { key: a }
246
246
  } = n;
247
- return s === o && i === f;
247
+ return s === i && o === a;
248
248
  }
249
249
  if (e.type === c.COMPONENT) {
250
- const r = e, n = t, { tag: s } = r, { tag: i } = n;
251
- return s === i;
250
+ const r = e, n = t, { tag: s } = r, { tag: o } = n;
251
+ return s === o;
252
252
  }
253
253
  if (e.type === c.PORTAL) {
254
254
  const r = e, n = t;
@@ -256,26 +256,26 @@ function D(e, t) {
256
256
  }
257
257
  return !0;
258
258
  }
259
- function T(e, t) {
260
- const r = Object.keys(e), n = Object.keys(t), s = [], i = [];
261
- for (const o of n)
262
- o in e ? e[o] !== t[o] && i.push(o) : s.push(o);
259
+ function S(e, t) {
260
+ const r = Object.keys(e), n = Object.keys(t), s = [], o = [];
261
+ for (const i of n)
262
+ i in e ? e[i] !== t[i] && o.push(i) : s.push(i);
263
263
  return {
264
264
  added: s,
265
- removed: r.filter((o) => !(o in t)),
266
- updated: i
265
+ removed: r.filter((i) => !(i in t)),
266
+ updated: o
267
267
  };
268
268
  }
269
269
  function rt(e) {
270
270
  return e !== "";
271
271
  }
272
- function N(e) {
272
+ function T(e) {
273
273
  return rt(e.trim());
274
274
  }
275
- function m(e, t, r, n = null) {
276
- if (!D(e, t)) {
275
+ function v(e, t, r, n = null) {
276
+ if (!j(e, t)) {
277
277
  const s = nt(r, e.el);
278
- return h(e), p(t, r, s, n), t;
278
+ return p(e), h(t, r, s, n), t;
279
279
  }
280
280
  switch (t.el = e.el, t.type) {
281
281
  case c.TEXT:
@@ -285,11 +285,11 @@ function m(e, t, r, n = null) {
285
285
  break;
286
286
  }
287
287
  case c.COMPONENT: {
288
- lt(e, t);
288
+ ft(e, t);
289
289
  break;
290
290
  }
291
291
  case c.PORTAL: {
292
- at(e, t, n);
292
+ lt(e, t, n);
293
293
  break;
294
294
  }
295
295
  }
@@ -307,111 +307,112 @@ function st(e, t) {
307
307
  function ot(e, t, r) {
308
308
  const n = e.el, {
309
309
  class: s,
310
- style: i,
311
- on: o,
312
- ...f
310
+ style: o,
311
+ on: i,
312
+ ...a
313
313
  } = e.props ?? {}, {
314
- class: l,
314
+ class: f,
315
315
  style: u,
316
- on: a,
316
+ on: l,
317
317
  ...y
318
- } = t.props ?? {}, { listeners: b } = e;
319
- it(n, f, y), ct(n, s, l), ut(
318
+ } = t.props ?? {}, { listeners: g } = e;
319
+ it(n, a, y), ct(n, s, f), ut(
320
320
  n,
321
- i,
321
+ o,
322
322
  u
323
- ), t.listeners = ft(
323
+ ), t.listeners = at(
324
324
  n,
325
- b,
326
- o ?? {},
327
- a ?? {},
325
+ g,
326
+ i ?? {},
327
+ l ?? {},
328
328
  r
329
329
  );
330
330
  }
331
331
  function it(e, t = {}, r = {}) {
332
332
  const n = t.ref, s = r.ref;
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
- const i = { ...t }, o = { ...r };
335
- delete i.ref, delete o.ref;
336
- const { added: f, removed: l, updated: u } = T(i, o);
337
- for (const a of l)
338
- L(e, a);
339
- for (const a of f.concat(u))
340
- w(e, a, o[a]);
334
+ const o = { ...t }, i = { ...r };
335
+ delete o.ref, delete i.ref;
336
+ const { added: a, removed: f, updated: u } = S(o, i);
337
+ for (const l of f)
338
+ D(e, l);
339
+ for (const l of a.concat(u))
340
+ w(e, l, i[l]);
341
341
  }
342
342
  function ct(e, t, r) {
343
- const n = M(t), s = M(r), { added: i, removed: o } = U(n, s);
344
- o.length > 0 && e.classList.remove(...o), i.length > 0 && e.classList.add(...i);
343
+ const n = k(t), s = k(r), { added: o, removed: i } = F(n, s);
344
+ i.length > 0 && e.classList.remove(...i), o.length > 0 && e.classList.add(...o);
345
345
  }
346
- function M(e = "") {
347
- return Array.isArray(e) ? e.filter(N) : String(e).split(/(\s+)/).filter(N);
346
+ function k(e = "") {
347
+ return Array.isArray(e) ? e.filter(T) : String(e).split(/(\s+)/).filter(T);
348
348
  }
349
349
  function ut(e, t = {}, r = {}) {
350
- const { added: n, removed: s, updated: i } = T(t, r);
351
- for (const o of s)
352
- J(e, o);
353
- for (const o of n.concat(i))
354
- C(e, o, r[o]);
355
- }
356
- function ft(e, t = {}, r = {}, n = {}, s = null) {
357
- const { removed: i, added: o, updated: f } = T(r, n);
358
- for (const u of i.concat(f)) {
359
- const a = t?.[u];
360
- a && e.removeEventListener(u, a);
361
- }
362
- const l = {};
363
- for (const u of o.concat(f))
364
- l[u] = S(
350
+ const { added: n, removed: s, updated: o } = S(t, r);
351
+ for (const i of s)
352
+ J(e, i);
353
+ for (const i of n.concat(o))
354
+ M(e, i, r[i]);
355
+ }
356
+ function at(e, t = {}, r = {}, n = {}, s = null) {
357
+ const { removed: o, added: i, updated: a } = S(r, n);
358
+ for (const u of o.concat(a)) {
359
+ const l = t?.[u];
360
+ l && e.removeEventListener(u, l);
361
+ }
362
+ const f = {};
363
+ for (const u of i.concat(a))
364
+ f[u] = N(
365
365
  u,
366
366
  n[u],
367
367
  e,
368
368
  s
369
369
  );
370
- return l;
370
+ return f;
371
371
  }
372
372
  function R(e, t, r) {
373
- const n = v(e), s = v(t), i = e.el, o = x(n, s, D), f = r?.offset ?? 0;
374
- for (const l of o)
375
- if (l.op === E.NOOP) {
376
- const { originalIndex: u, index: a } = l;
377
- m(n[u], s[a], i, r);
373
+ const n = b(e), s = b(t), o = e.el, i = x(n, s, j), a = r?.offset ?? 0;
374
+ for (const f of i)
375
+ if (f.op === E.NOOP) {
376
+ const { originalIndex: u, index: l } = f;
377
+ v(n[u], s[l], o, r);
378
378
  }
379
- for (const l of o)
380
- switch (l.op) {
379
+ for (const f of i)
380
+ switch (f.op) {
381
381
  case E.MOVE: {
382
- const { from: u, index: a } = l, y = n[u].el, b = i.childNodes[a + f];
383
- y && (i.insertBefore(y, b), m(n[u], s[a], i, r));
382
+ const { from: u, index: l } = f, y = n[u].el, g = o.childNodes[l + a];
383
+ y && (o.insertBefore(y, g), v(n[u], s[l], o, r));
384
384
  break;
385
385
  }
386
386
  case E.REMOVE: {
387
- const { item: u } = l;
388
- h(u);
387
+ const { item: u } = f;
388
+ p(u);
389
389
  break;
390
390
  }
391
391
  case E.ADD: {
392
- const { index: u, item: a } = l;
393
- p(a, i, u + f, r);
392
+ const { index: u, item: l } = f;
393
+ h(l, o, u + a, r);
394
394
  break;
395
395
  }
396
396
  }
397
397
  }
398
- function lt(e, t) {
398
+ function ft(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 at(e, t, r) {
402
+ function lt(e, t, r) {
403
403
  if (e.container !== t.container) {
404
- h(e), p(t, document.body, null, r);
404
+ p(e), h(t, document.body, null, r);
405
405
  return;
406
406
  }
407
407
  R(e, t, r);
408
408
  }
409
- const pt = (e) => e.isProvider, ht = (e) => e.isConsumer;
410
- class k {
409
+ const ht = (e) => e.isProvider, dt = (e) => e.isConsumer;
410
+ class C {
411
411
  isMounted = !1;
412
412
  vdom = null;
413
413
  hostEl = null;
414
414
  parent = null;
415
+ error = null;
415
416
  static defaultProps = {};
416
417
  props;
417
418
  state = {};
@@ -453,11 +454,14 @@ class k {
453
454
  didUnmount() {
454
455
  return Promise.resolve();
455
456
  }
457
+ didCatch(t, r) {
458
+ return console.error("Uncaught error:", t, r), this.error = t, Promise.resolve();
459
+ }
456
460
  shouldComponentUpdate(t, r) {
457
- return g(t, r);
461
+ return m(t, r);
458
462
  }
459
463
  get elements() {
460
- return this.vdom == null ? [] : this.vdom.type === c.FRAGMENT ? v(this.vdom).flatMap((t) => t.type === c.COMPONENT && t.component ? t.component.elements : t.el ? [t.el] : []) : this.vdom.el ? [this.vdom.el] : [];
464
+ return this.vdom == null ? [] : this.vdom.type === c.FRAGMENT ? b(this.vdom).flatMap((t) => t.type === c.COMPONENT && t.component ? t.component.elements : t.el ? [t.el] : []) : this.vdom.el ? [this.vdom.el] : [];
461
465
  }
462
466
  get firstElement() {
463
467
  return this.elements[0];
@@ -467,7 +471,7 @@ class k {
467
471
  }
468
472
  updateProps(t) {
469
473
  const n = { ...this.getDefaultProps(), ...this.props, ...t }, s = this.props;
470
- this.props = n, !this.shouldComponentUpdate(s, n) && (pt(this) && this.notify(), this.patch(s, this.state));
474
+ this.props = n, !this.shouldComponentUpdate(s, n) && (ht(this) && this.notify(), this.patch(s, this.state));
471
475
  }
472
476
  setState(t) {
473
477
  const r = this.state;
@@ -479,19 +483,28 @@ class k {
479
483
  mount(t, r = null) {
480
484
  if (this.isMounted)
481
485
  throw new Error("Component is already mounted");
482
- ht(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext(), this.vdom = this.render(), p(this.vdom, t, r, this), this.hostEl = t, this.isMounted = !0;
486
+ dt(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext();
487
+ try {
488
+ this.vdom = this.render(), h(this.vdom, t, r, this), this.hostEl = t, this.isMounted = !0;
489
+ } catch (n) {
490
+ this.handleError(n, "mount");
491
+ }
483
492
  }
484
493
  unmount() {
485
494
  this.isMounted && (d(() => this.willUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: t }) => {
486
495
  t.subscribedProvider = null;
487
- }), this.dependencies = [], this.vdom && h(this.vdom), d(() => this.didUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
496
+ }), this.dependencies = [], this.vdom && p(this.vdom), d(() => this.didUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1, this.error = null);
488
497
  }
489
498
  patch(t, r) {
490
- if (!this.isMounted || !this.hostEl || !this.vdom)
491
- return;
492
- d(() => this.willUpdate(this.props, this.state));
493
- const n = this.render();
494
- this.vdom = m(this.vdom, n, this.hostEl, this), d(() => this.didUpdate(t, r));
499
+ if (!(!this.isMounted || !this.hostEl || !this.vdom) && !this.error) {
500
+ d(() => this.willUpdate(this.props, this.state));
501
+ try {
502
+ const n = this.render();
503
+ this.vdom = v(this.vdom, n, this.hostEl, this), d(() => this.didUpdate(t, r));
504
+ } catch (n) {
505
+ this.handleError(n, "patch");
506
+ }
507
+ }
495
508
  }
496
509
  updateContext() {
497
510
  const t = Object.getPrototypeOf(this).constructor.contextType;
@@ -522,16 +535,73 @@ class k {
522
535
  getDefaultProps() {
523
536
  return this.constructor.defaultProps || {};
524
537
  }
538
+ handleError(t, r) {
539
+ const n = this.findClosestErrorBoundary();
540
+ if (n && n.isMounted) {
541
+ const o = n.constructor;
542
+ if (o.getDerivedStateFromError) {
543
+ const i = o.getDerivedStateFromError(t);
544
+ n.state = { ...n.state, ...i };
545
+ }
546
+ if (n.didCatch(t, {
547
+ phase: r,
548
+ failedComponent: this.constructor.name,
549
+ componentStack: this.getComponentStack()
550
+ }), n.hostEl && n.vdom)
551
+ try {
552
+ if (n.render())
553
+ return;
554
+ } catch (i) {
555
+ console.error("Error during ErrorBoundary recovery:", i);
556
+ }
557
+ }
558
+ const s = this.constructor;
559
+ if (s.getDerivedStateFromError) {
560
+ const o = s.getDerivedStateFromError(t);
561
+ this.state = { ...this.state, ...o };
562
+ }
563
+ d(() => {
564
+ if (this.didCatch(t, {
565
+ phase: r,
566
+ componentStack: this.getComponentStack()
567
+ }), this.hostEl && this.isMounted)
568
+ try {
569
+ const o = this.render();
570
+ o && v(this.vdom, o, this.hostEl, this);
571
+ } catch (o) {
572
+ console.error("Error during error recovery render:", o);
573
+ }
574
+ });
575
+ }
576
+ getComponentStack() {
577
+ const t = [this.constructor.name];
578
+ let r = this.parent;
579
+ for (; r; )
580
+ t.push(r.constructor.name), r = r.parent;
581
+ return t.reverse();
582
+ }
583
+ findClosestErrorBoundary() {
584
+ let t = this.parent;
585
+ for (; t; ) {
586
+ if (t.isErrorBoundary())
587
+ return t;
588
+ t = t.parent;
589
+ }
590
+ return null;
591
+ }
592
+ isErrorBoundary() {
593
+ return this.constructor.getDerivedStateFromError !== void 0;
594
+ }
525
595
  }
526
596
  function yt(e) {
527
- class t extends k {
597
+ class t extends C {
528
598
  isProvider = !0;
529
599
  render() {
530
600
  let s = [];
531
- return Array.isArray(this.props.children) ? s = this.props.children : this.props.children ? s = [this.props.children] : s = [], F(s);
601
+ return Array.isArray(this.props.children) ? s = this.props.children : this.props.children ? s = [this.props.children] : s = [], U(s);
532
602
  }
533
603
  }
534
- class r extends k {
604
+ class r extends C {
535
605
  static contextType = {
536
606
  Provider: t,
537
607
  defaultValue: e
@@ -560,24 +630,24 @@ function yt(e) {
560
630
  function Et(e, t) {
561
631
  if (!t)
562
632
  throw new Error("Container element is not provided for rendering.");
563
- p(e, t);
633
+ h(e, t);
564
634
  }
565
- function bt(e = null) {
635
+ function vt(e = null) {
566
636
  return {
567
637
  current: e
568
638
  };
569
639
  }
570
- function vt(e, t) {
640
+ function gt(e, t) {
571
641
  const r = Array.isArray(e) ? e : [e];
572
- return I(r, t);
642
+ return B(r, t);
573
643
  }
574
644
  export {
575
- k as Component,
645
+ C as Component,
576
646
  yt as createContext,
577
- vt as createPortal,
578
- bt as createRef,
579
- Ot as h,
580
- F as hFragment,
581
- mt as hString,
647
+ gt as createPortal,
648
+ vt as createRef,
649
+ Pt as h,
650
+ U as hFragment,
651
+ Ot as hString,
582
652
  Et as render
583
653
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-react",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
4
4
  "scripts": {
5
5
  "test": "echo \"Error: no test specified\" && exit 1",
6
6
  "type-check": "tsc --noEmit",