ddd-react 1.3.7 → 1.3.8
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 +25 -25
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as c, e as v, a as F, A as
|
|
2
|
-
import { d as
|
|
1
|
+
import { D as c, e as v, a as F, A as g, b as U, h as q, c as I } from "./h-BbaMkkC7.mjs";
|
|
2
|
+
import { d as me, f as Oe } from "./h-BbaMkkC7.mjs";
|
|
3
3
|
function E(t, e) {
|
|
4
4
|
if (t === null || e === null || t === void 0 || e === void 0)
|
|
5
5
|
return t === e;
|
|
@@ -134,16 +134,16 @@ function j(t, e) {
|
|
|
134
134
|
t[e] = null, t.removeAttribute(e);
|
|
135
135
|
}
|
|
136
136
|
let P = !1;
|
|
137
|
-
const
|
|
138
|
-
function
|
|
139
|
-
|
|
137
|
+
const m = [];
|
|
138
|
+
function y(t) {
|
|
139
|
+
m.push(t), H();
|
|
140
140
|
}
|
|
141
141
|
function H() {
|
|
142
142
|
P || (P = !0, queueMicrotask(z));
|
|
143
143
|
}
|
|
144
144
|
function z() {
|
|
145
|
-
for (;
|
|
146
|
-
const t =
|
|
145
|
+
for (; m.length > 0; ) {
|
|
146
|
+
const t = m.shift();
|
|
147
147
|
let e;
|
|
148
148
|
try {
|
|
149
149
|
e = t();
|
|
@@ -182,7 +182,7 @@ function h(t, e, n = null, r = null) {
|
|
|
182
182
|
case c.COMPONENT: {
|
|
183
183
|
te(t, e, n, r);
|
|
184
184
|
const s = t.component;
|
|
185
|
-
s &&
|
|
185
|
+
s && y(() => s.onMount());
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
188
|
case c.PORTAL: {
|
|
@@ -272,7 +272,7 @@ function re(t) {
|
|
|
272
272
|
function N(t) {
|
|
273
273
|
return re(t.trim());
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function O(t, e, n, r = null) {
|
|
276
276
|
if (!D(t, e)) {
|
|
277
277
|
const s = se(n, t.el);
|
|
278
278
|
return p(t), h(e, n, s, r), e;
|
|
@@ -372,23 +372,23 @@ function fe(t, e = {}, n = {}, r = {}, s = null) {
|
|
|
372
372
|
function R(t, e, n) {
|
|
373
373
|
const r = v(t), s = v(e), o = t.el, i = F(r, s, D), u = n?.offset ?? 0;
|
|
374
374
|
for (const f of i)
|
|
375
|
-
if (f.op ===
|
|
375
|
+
if (f.op === g.NOOP) {
|
|
376
376
|
const { originalIndex: l, index: a } = f;
|
|
377
|
-
|
|
377
|
+
O(r[l], s[a], o, n);
|
|
378
378
|
}
|
|
379
379
|
for (const f of i)
|
|
380
380
|
switch (f.op) {
|
|
381
|
-
case
|
|
381
|
+
case g.MOVE: {
|
|
382
382
|
const { from: l, index: a } = f, d = r[l].el, b = o.childNodes[a + u];
|
|
383
|
-
d && (o.insertBefore(d, b),
|
|
383
|
+
d && (o.insertBefore(d, b), O(r[l], s[a], o, n));
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
|
-
case
|
|
386
|
+
case g.REMOVE: {
|
|
387
387
|
const { item: l } = f;
|
|
388
388
|
p(l);
|
|
389
389
|
break;
|
|
390
390
|
}
|
|
391
|
-
case
|
|
391
|
+
case g.ADD: {
|
|
392
392
|
const { index: l, item: a } = f;
|
|
393
393
|
h(a, o, l + u, n);
|
|
394
394
|
break;
|
|
@@ -406,7 +406,7 @@ function he(t, e, n) {
|
|
|
406
406
|
}
|
|
407
407
|
R(t, e, n);
|
|
408
408
|
}
|
|
409
|
-
const k = (t) => t.constructor.name.includes("Provider"), pe = (t) => t.constructor.name.includes("Consumer");
|
|
409
|
+
const k = (t) => (console.log("isProvider"), console.log("component.constructor.name", t.constructor.name), t.constructor.name.includes("Provider")), pe = (t) => (console.log("isConsumer"), console.log("component.constructor.name", t.constructor.name), t.constructor.name.includes("Consumer"));
|
|
410
410
|
class C {
|
|
411
411
|
constructor(e = {}, n) {
|
|
412
412
|
this.isMounted = !1, this.vdom = null, this.hostEl = null, this.parent = null, this.state = {}, this.context = null, this.dependencies = [], this.subscribedProvider = null, this.props = e, this.parent = n;
|
|
@@ -470,15 +470,15 @@ class C {
|
|
|
470
470
|
pe(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext(), this.vdom = this.render(), h(this.vdom, e, n, this), this.hostEl = e, this.isMounted = !0;
|
|
471
471
|
}
|
|
472
472
|
unmount() {
|
|
473
|
-
this.isMounted && (
|
|
473
|
+
this.isMounted && (y(() => this.onWillUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: e }) => {
|
|
474
474
|
e.subscribedProvider = null;
|
|
475
|
-
}), this.dependencies = [], this.vdom && p(this.vdom),
|
|
475
|
+
}), this.dependencies = [], this.vdom && p(this.vdom), y(() => this.onUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
|
|
476
476
|
}
|
|
477
477
|
patch() {
|
|
478
478
|
if (!this.isMounted || !this.hostEl || !this.vdom)
|
|
479
479
|
return;
|
|
480
480
|
const e = this.render();
|
|
481
|
-
this.vdom =
|
|
481
|
+
this.vdom = O(this.vdom, e, this.hostEl, this), y(() => this.onUpdate());
|
|
482
482
|
}
|
|
483
483
|
updateContext() {
|
|
484
484
|
console.log("updateContext");
|
|
@@ -509,7 +509,7 @@ class C {
|
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function ge(t) {
|
|
513
513
|
class e extends C {
|
|
514
514
|
render() {
|
|
515
515
|
let o = [];
|
|
@@ -542,7 +542,7 @@ function ye(t) {
|
|
|
542
542
|
defaultValue: t
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ye(t, e) {
|
|
546
546
|
if (!e)
|
|
547
547
|
throw new Error("Container element is not provided for rendering.");
|
|
548
548
|
h(t, e);
|
|
@@ -558,11 +558,11 @@ function be(t, e) {
|
|
|
558
558
|
}
|
|
559
559
|
export {
|
|
560
560
|
C as Component,
|
|
561
|
-
|
|
561
|
+
ge as createContext,
|
|
562
562
|
be as createPortal,
|
|
563
563
|
Ee as createRef,
|
|
564
|
-
|
|
564
|
+
me as h,
|
|
565
565
|
q as hFragment,
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
Oe as hString,
|
|
567
|
+
ye as render
|
|
568
568
|
};
|