ddd-react 1.10.1 → 1.10.2

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.
Files changed (2) hide show
  1. package/dist/index.mjs +75 -72
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
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";
1
+ import { D as c, e as b, a as x, A as v, b as F, h as U, c as B } from "./h-BbaMkkC7.mjs";
2
2
  import { d as Pt, f as Ot } from "./h-BbaMkkC7.mjs";
3
3
  function m(e, t) {
4
4
  if (e === null || t === null || e === void 0 || t === void 0)
@@ -40,18 +40,18 @@ function m(e, t) {
40
40
  return !1;
41
41
  }
42
42
  function N(e, t, r, n = null) {
43
- function s(o) {
44
- const i = o;
45
- n ? t.call(n, i) : t(i);
43
+ function s(i) {
44
+ const o = i;
45
+ n ? t.call(n, o) : t(o);
46
46
  }
47
47
  return r.addEventListener(e, s), s;
48
48
  }
49
49
  function I(e = {}, t, r = null) {
50
50
  const n = {};
51
- return Object.entries(e).forEach(([s, o]) => {
51
+ return Object.entries(e).forEach(([s, i]) => {
52
52
  n[s] = N(
53
53
  s,
54
- o,
54
+ i,
55
55
  t,
56
56
  r
57
57
  );
@@ -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(([o, i]) => {
118
- M(e, o, i);
117
+ r && W(e, r), n && Object.entries(n).forEach(([i, o]) => {
118
+ M(e, i, o);
119
119
  });
120
- for (const [o, i] of Object.entries(s))
121
- w(e, o, i);
120
+ for (const [i, o] of Object.entries(s))
121
+ w(e, i, o);
122
122
  }
123
123
  function W(e, t) {
124
124
  if (e instanceof SVGElement) {
@@ -199,13 +199,13 @@ function z(e, t, r) {
199
199
  }
200
200
  function Q(e, t, r, n) {
201
201
  const { children: s } = e;
202
- e.el = t, s?.forEach((o, i) => {
203
- h(o, t, r != null ? r + i : null, n);
202
+ e.el = t, s?.forEach((i, o) => {
203
+ h(i, t, r != null ? r + o : null, n);
204
204
  });
205
205
  }
206
206
  function Z(e, t, r, n) {
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) => {
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
209
  h(f, a, null, n);
210
210
  }), L(a, t, r);
211
211
  }
@@ -214,8 +214,8 @@ function V(e, t, r) {
214
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: o } = A(e), i = new s(o, n);
218
- i.mount(t, r), e.component = i, e.el = i.firstElement || null;
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;
219
219
  }
220
220
  function L(e, t, r) {
221
221
  if (r == null) {
@@ -239,16 +239,16 @@ function j(e, t) {
239
239
  if (e.type === c.ELEMENT) {
240
240
  const r = e, n = t, {
241
241
  tag: s,
242
- props: { key: o }
242
+ props: { key: i }
243
243
  } = r, {
244
- tag: i,
244
+ tag: o,
245
245
  props: { key: a }
246
246
  } = n;
247
- return s === i && o === a;
247
+ return s === o && i === a;
248
248
  }
249
249
  if (e.type === c.COMPONENT) {
250
- const r = e, n = t, { tag: s } = r, { tag: o } = n;
251
- return s === o;
250
+ const r = e, n = t, { tag: s } = r, { tag: i } = n;
251
+ return s === i;
252
252
  }
253
253
  if (e.type === c.PORTAL) {
254
254
  const r = e, n = t;
@@ -257,13 +257,13 @@ function j(e, t) {
257
257
  return !0;
258
258
  }
259
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);
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);
263
263
  return {
264
264
  added: s,
265
- removed: r.filter((i) => !(i in t)),
266
- updated: o
265
+ removed: r.filter((o) => !(o in t)),
266
+ updated: i
267
267
  };
268
268
  }
269
269
  function rt(e) {
@@ -272,7 +272,7 @@ function rt(e) {
272
272
  function T(e) {
273
273
  return rt(e.trim());
274
274
  }
275
- function v(e, t, r, n = null) {
275
+ function y(e, t, r, n = null) {
276
276
  if (!j(e, t)) {
277
277
  const s = nt(r, e.el);
278
278
  return p(e), h(t, r, s, n), t;
@@ -307,23 +307,23 @@ function st(e, t) {
307
307
  function ot(e, t, r) {
308
308
  const n = e.el, {
309
309
  class: s,
310
- style: o,
311
- on: i,
310
+ style: i,
311
+ on: o,
312
312
  ...a
313
313
  } = e.props ?? {}, {
314
314
  class: f,
315
315
  style: u,
316
316
  on: l,
317
- ...y
317
+ ...E
318
318
  } = t.props ?? {}, { listeners: g } = e;
319
- it(n, a, y), ct(n, s, f), ut(
319
+ it(n, a, E), ct(n, s, f), ut(
320
320
  n,
321
- o,
321
+ i,
322
322
  u
323
323
  ), t.listeners = at(
324
324
  n,
325
325
  g,
326
- i ?? {},
326
+ o ?? {},
327
327
  l ?? {},
328
328
  r
329
329
  );
@@ -331,36 +331,36 @@ function ot(e, t, r) {
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 o = { ...t }, i = { ...r };
335
- delete o.ref, delete i.ref;
336
- const { added: a, removed: f, updated: u } = S(o, i);
334
+ const i = { ...t }, o = { ...r };
335
+ delete i.ref, delete o.ref;
336
+ const { added: a, removed: f, updated: u } = S(i, o);
337
337
  for (const l of f)
338
338
  D(e, l);
339
339
  for (const l of a.concat(u))
340
- w(e, l, i[l]);
340
+ w(e, l, o[l]);
341
341
  }
342
342
  function ct(e, t, r) {
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);
343
+ const n = k(t), s = k(r), { added: i, removed: o } = F(n, s);
344
+ o.length > 0 && e.classList.remove(...o), i.length > 0 && e.classList.add(...i);
345
345
  }
346
346
  function k(e = "") {
347
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: 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]);
350
+ const { added: n, removed: s, updated: i } = S(t, r);
351
+ for (const o of s)
352
+ J(e, o);
353
+ for (const o of n.concat(i))
354
+ M(e, o, r[o]);
355
355
  }
356
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)) {
357
+ const { removed: i, added: o, updated: a } = S(r, n);
358
+ for (const u of i.concat(a)) {
359
359
  const l = t?.[u];
360
360
  l && e.removeEventListener(u, l);
361
361
  }
362
362
  const f = {};
363
- for (const u of i.concat(a))
363
+ for (const u of o.concat(a))
364
364
  f[u] = N(
365
365
  u,
366
366
  n[u],
@@ -370,27 +370,27 @@ function at(e, t = {}, r = {}, n = {}, s = null) {
370
370
  return f;
371
371
  }
372
372
  function R(e, t, 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) {
373
+ const n = b(e), s = b(t), i = e.el, o = x(n, s, j), a = r?.offset ?? 0;
374
+ for (const f of o)
375
+ if (f.op === v.NOOP) {
376
376
  const { originalIndex: u, index: l } = f;
377
- v(n[u], s[l], o, r);
377
+ y(n[u], s[l], i, r);
378
378
  }
379
- for (const f of i)
379
+ for (const f of o)
380
380
  switch (f.op) {
381
- case E.MOVE: {
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));
381
+ case v.MOVE: {
382
+ const { from: u, index: l } = f, E = n[u].el, g = i.childNodes[l + a];
383
+ E && (i.insertBefore(E, g), y(n[u], s[l], i, r));
384
384
  break;
385
385
  }
386
- case E.REMOVE: {
386
+ case v.REMOVE: {
387
387
  const { item: u } = f;
388
388
  p(u);
389
389
  break;
390
390
  }
391
- case E.ADD: {
391
+ case v.ADD: {
392
392
  const { index: u, item: l } = f;
393
- h(l, o, u + a, r);
393
+ h(l, i, u + a, r);
394
394
  break;
395
395
  }
396
396
  }
@@ -500,7 +500,7 @@ class C {
500
500
  d(() => this.willUpdate(this.props, this.state));
501
501
  try {
502
502
  const n = this.render();
503
- this.vdom = v(this.vdom, n, this.hostEl, this), d(() => this.didUpdate(t, r));
503
+ this.vdom = y(this.vdom, n, this.hostEl, this), d(() => this.didUpdate(t, r));
504
504
  } catch (n) {
505
505
  this.handleError(n, "patch");
506
506
  }
@@ -538,10 +538,10 @@ class C {
538
538
  handleError(t, r) {
539
539
  const n = this.findClosestErrorBoundary();
540
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 };
541
+ const i = n.constructor;
542
+ if (i.getDerivedStateFromError) {
543
+ const o = i.getDerivedStateFromError(t);
544
+ n.state = { ...n.state, ...o };
545
545
  }
546
546
  if (n.didCatch(t, {
547
547
  phase: r,
@@ -549,16 +549,19 @@ class C {
549
549
  componentStack: this.getComponentStack()
550
550
  }), n.hostEl && n.vdom)
551
551
  try {
552
- if (n.render())
552
+ const o = n.render();
553
+ if (o) {
554
+ y(n.vdom, o, n.hostEl, n);
553
555
  return;
554
- } catch (i) {
555
- console.error("Error during ErrorBoundary recovery:", i);
556
+ }
557
+ } catch (o) {
558
+ console.error("Error during ErrorBoundary recovery:", o);
556
559
  }
557
560
  }
558
561
  const s = this.constructor;
559
562
  if (s.getDerivedStateFromError) {
560
- const o = s.getDerivedStateFromError(t);
561
- this.state = { ...this.state, ...o };
563
+ const i = s.getDerivedStateFromError(t);
564
+ this.state = { ...this.state, ...i };
562
565
  }
563
566
  d(() => {
564
567
  if (this.didCatch(t, {
@@ -566,10 +569,10 @@ class C {
566
569
  componentStack: this.getComponentStack()
567
570
  }), this.hostEl && this.isMounted)
568
571
  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);
572
+ const i = this.render();
573
+ i && y(this.vdom, i, this.hostEl, this);
574
+ } catch (i) {
575
+ console.error("Error during error recovery render:", i);
573
576
  }
574
577
  });
575
578
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-react",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "scripts": {
5
5
  "test": "echo \"Error: no test specified\" && exit 1",
6
6
  "type-check": "tsc --noEmit",