ddd-react 1.6.0 → 1.6.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.
- package/dist/component.d.ts +1 -1
- package/dist/index.mjs +20 -14
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -135,7 +135,7 @@ function w(e, t) {
|
|
|
135
135
|
}
|
|
136
136
|
let P = !1;
|
|
137
137
|
const O = [];
|
|
138
|
-
function
|
|
138
|
+
function b(e) {
|
|
139
139
|
O.push(e), Y();
|
|
140
140
|
}
|
|
141
141
|
function Y() {
|
|
@@ -182,7 +182,7 @@ function h(e, t, r = null, n = null) {
|
|
|
182
182
|
case c.COMPONENT: {
|
|
183
183
|
tt(e, t, r, n);
|
|
184
184
|
const s = e.component;
|
|
185
|
-
s &&
|
|
185
|
+
s && b(() => s.onMount());
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
188
|
case c.PORTAL: {
|
|
@@ -315,14 +315,14 @@ function it(e, t, r) {
|
|
|
315
315
|
style: u,
|
|
316
316
|
on: l,
|
|
317
317
|
...d
|
|
318
|
-
} = t.props ?? {}, { listeners:
|
|
318
|
+
} = t.props ?? {}, { listeners: E } = e;
|
|
319
319
|
ot(n, f, d), ct(n, s, a), ut(
|
|
320
320
|
n,
|
|
321
321
|
i,
|
|
322
322
|
u
|
|
323
323
|
), t.listeners = ft(
|
|
324
324
|
n,
|
|
325
|
-
|
|
325
|
+
E,
|
|
326
326
|
o ?? {},
|
|
327
327
|
l ?? {},
|
|
328
328
|
r
|
|
@@ -379,8 +379,8 @@ function R(e, t, r) {
|
|
|
379
379
|
for (const a of o)
|
|
380
380
|
switch (a.op) {
|
|
381
381
|
case y.MOVE: {
|
|
382
|
-
const { from: u, index: l } = a, d = n[u].el,
|
|
383
|
-
d && (i.insertBefore(d,
|
|
382
|
+
const { from: u, index: l } = a, d = n[u].el, E = i.childNodes[l + f];
|
|
383
|
+
d && (i.insertBefore(d, E), m(n[u], s[l], i, r));
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
case y.REMOVE: {
|
|
@@ -463,18 +463,24 @@ class k {
|
|
|
463
463
|
pt(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext(), this.vdom = this.render(), h(this.vdom, t, r, this), this.hostEl = t, this.isMounted = !0;
|
|
464
464
|
}
|
|
465
465
|
unmount() {
|
|
466
|
-
this.isMounted && (
|
|
466
|
+
this.isMounted && (b(() => this.onWillUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: t }) => {
|
|
467
467
|
t.subscribedProvider = null;
|
|
468
|
-
}), this.dependencies = [], this.vdom && p(this.vdom),
|
|
468
|
+
}), this.dependencies = [], this.vdom && p(this.vdom), b(() => this.onUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
|
|
469
469
|
}
|
|
470
470
|
patch(t, r) {
|
|
471
471
|
if (!this.isMounted || !this.hostEl || !this.vdom)
|
|
472
472
|
return;
|
|
473
473
|
const n = this.render();
|
|
474
|
-
this.vdom = m(this.vdom, n, this.hostEl, this),
|
|
474
|
+
this.vdom = m(this.vdom, n, this.hostEl, this), b(() => this.onUpdate(t, r));
|
|
475
475
|
}
|
|
476
476
|
updateContext() {
|
|
477
|
-
|
|
477
|
+
const t = Object.getPrototypeOf(this).constructor.contextType;
|
|
478
|
+
if (t !== null) {
|
|
479
|
+
if (this.subscribedProvider)
|
|
480
|
+
return this.context = this.subscribedProvider.props.value, !0;
|
|
481
|
+
this.context = t.defaultValue;
|
|
482
|
+
}
|
|
483
|
+
return !1;
|
|
478
484
|
}
|
|
479
485
|
subscribeToProvider() {
|
|
480
486
|
const t = Object.getPrototypeOf(this).constructor.contextType;
|
|
@@ -529,12 +535,12 @@ function yt(e) {
|
|
|
529
535
|
defaultValue: e
|
|
530
536
|
};
|
|
531
537
|
}
|
|
532
|
-
function
|
|
538
|
+
function bt(e, t) {
|
|
533
539
|
if (!t)
|
|
534
540
|
throw new Error("Container element is not provided for rendering.");
|
|
535
541
|
h(e, t);
|
|
536
542
|
}
|
|
537
|
-
function
|
|
543
|
+
function Et(e = null) {
|
|
538
544
|
return {
|
|
539
545
|
current: e
|
|
540
546
|
};
|
|
@@ -547,9 +553,9 @@ export {
|
|
|
547
553
|
k as Component,
|
|
548
554
|
yt as createContext,
|
|
549
555
|
vt as createPortal,
|
|
550
|
-
|
|
556
|
+
Et as createRef,
|
|
551
557
|
Ot as h,
|
|
552
558
|
U as hFragment,
|
|
553
559
|
mt as hString,
|
|
554
|
-
|
|
560
|
+
bt as render
|
|
555
561
|
};
|