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