ddd-react 1.7.1 → 1.7.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.
@@ -22,9 +22,9 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
22
22
  }): void;
23
23
  notify(): void;
24
24
  didMount(): void | Promise<void>;
25
- onWillUpdate(nextProps: P, nextState: S): void | Promise<void>;
25
+ willUpdate(nextProps: P, nextState: S): void | Promise<void>;
26
26
  didUpdate(prevProps: P, prevState: S): void | Promise<void>;
27
- onWillUnmount(): void | Promise<void>;
27
+ willUnmount(): void | Promise<void>;
28
28
  didUnmount(): void | Promise<void>;
29
29
  abstract render(): VDOMNode;
30
30
  get elements(): HTMLElement[];
package/dist/index.mjs CHANGED
@@ -70,11 +70,11 @@ function h(t) {
70
70
  break;
71
71
  }
72
72
  case c.ELEMENT: {
73
- W(t);
73
+ _(t);
74
74
  break;
75
75
  }
76
76
  case c.FRAGMENT: {
77
- _(t);
77
+ B(t);
78
78
  break;
79
79
  }
80
80
  case c.COMPONENT: {
@@ -82,7 +82,7 @@ function h(t) {
82
82
  break;
83
83
  }
84
84
  case c.PORTAL: {
85
- B(t);
85
+ X(t);
86
86
  break;
87
87
  }
88
88
  default:
@@ -94,43 +94,43 @@ function G(t) {
94
94
  const { el: e } = t;
95
95
  e && e.remove();
96
96
  }
97
- function W(t) {
97
+ function _(t) {
98
98
  const { el: e, children: r, listeners: n, props: s } = t;
99
99
  s?.ref && typeof s.ref == "object" && "current" in s.ref && (s.ref.current = null), e && e.remove(), r && r.forEach(h), n && e && (q(n, e), delete t.listeners);
100
100
  }
101
- function _(t) {
101
+ function B(t) {
102
102
  const { children: e } = t;
103
103
  e && e.forEach(h);
104
104
  }
105
- function B(t) {
105
+ function X(t) {
106
106
  const { children: e } = t;
107
107
  e && e.forEach(h);
108
108
  }
109
109
  function C(t, e, r) {
110
110
  t.style[e] = r.toString();
111
111
  }
112
- function X(t, e) {
112
+ function J(t, e) {
113
113
  t.style[e] = null;
114
114
  }
115
- function J(t, e) {
115
+ function K(t, e) {
116
116
  const { class: r, style: n, ...s } = e;
117
- r && K(t, r), n && Object.entries(n).forEach(([i, o]) => {
117
+ r && W(t, r), n && Object.entries(n).forEach(([i, o]) => {
118
118
  C(t, i, o);
119
119
  });
120
120
  for (const [i, o] of Object.entries(s))
121
- L(t, i, o);
121
+ w(t, i, o);
122
122
  }
123
- function K(t, e) {
123
+ function W(t, e) {
124
124
  if (t instanceof SVGElement) {
125
125
  t.removeAttribute("class"), typeof e == "string" ? t.setAttribute("class", e) : Array.isArray(e) && t.classList.add(...e);
126
126
  return;
127
127
  }
128
128
  t.className = "", typeof e == "string" ? t.className = e : Array.isArray(e) && t.classList.add(...e);
129
129
  }
130
- function L(t, e, r) {
131
- r == null ? w(t, e) : t.setAttribute(e, String(r));
130
+ function w(t, e, r) {
131
+ r == null ? L(t, e) : t.setAttribute(e, String(r));
132
132
  }
133
- function w(t, e) {
133
+ function L(t, e) {
134
134
  t[e] = null, t.removeAttribute(e);
135
135
  }
136
136
  let P = !1;
@@ -211,7 +211,7 @@ function Z(t, e, r, n) {
211
211
  }
212
212
  function V(t, e, r) {
213
213
  const { props: n, events: s } = A(e);
214
- n.ref && typeof n.ref == "object" && "current" in n.ref && (n.ref.current = t, delete n.ref), e.listeners = $(s, t, r), J(t, n);
214
+ n.ref && typeof n.ref == "object" && "current" in n.ref && (n.ref.current = t, delete n.ref), e.listeners = $(s, t, r), K(t, n);
215
215
  }
216
216
  function ee(t, e, r, n) {
217
217
  const s = t.tag, { props: i } = A(t), o = new s(i, n);
@@ -335,9 +335,9 @@ function ie(t, e = {}, r = {}) {
335
335
  delete i.ref, delete o.ref;
336
336
  const { added: u, removed: l, updated: f } = T(i, o);
337
337
  for (const a of l)
338
- w(t, a);
338
+ L(t, a);
339
339
  for (const a of u.concat(f))
340
- L(t, a, o[a]);
340
+ w(t, a, o[a]);
341
341
  }
342
342
  function ce(t, e, r) {
343
343
  const n = M(e), s = M(r), { added: i, removed: o } = U(n, s);
@@ -349,7 +349,7 @@ function M(t = "") {
349
349
  function fe(t, e = {}, r = {}) {
350
350
  const { added: n, removed: s, updated: i } = T(e, r);
351
351
  for (const o of s)
352
- X(t, o);
352
+ J(t, o);
353
353
  for (const o of n.concat(i))
354
354
  C(t, o, r[o]);
355
355
  }
@@ -439,13 +439,13 @@ class k {
439
439
  didMount() {
440
440
  return Promise.resolve();
441
441
  }
442
- onWillUpdate(e, r) {
442
+ willUpdate(e, r) {
443
443
  return Promise.resolve();
444
444
  }
445
445
  didUpdate(e, r) {
446
446
  return Promise.resolve();
447
447
  }
448
- onWillUnmount() {
448
+ willUnmount() {
449
449
  return Promise.resolve();
450
450
  }
451
451
  didUnmount() {
@@ -479,14 +479,14 @@ class k {
479
479
  he(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext(), this.vdom = this.render(), p(this.vdom, e, r, this), this.hostEl = e, this.isMounted = !0;
480
480
  }
481
481
  unmount() {
482
- this.isMounted && (d(() => this.onWillUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: e }) => {
482
+ this.isMounted && (d(() => this.willUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: e }) => {
483
483
  e.subscribedProvider = null;
484
484
  }), this.dependencies = [], this.vdom && h(this.vdom), d(() => this.didUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
485
485
  }
486
486
  patch(e, r) {
487
487
  if (!this.isMounted || !this.hostEl || !this.vdom)
488
488
  return;
489
- d(() => this.onWillUpdate(this.props, this.state));
489
+ d(() => this.willUpdate(this.props, this.state));
490
490
  const n = this.render();
491
491
  this.vdom = m(this.vdom, n, this.hostEl, this), d(() => this.didUpdate(e, r));
492
492
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-react",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "scripts": {
5
5
  "test": "echo \"Error: no test specified\" && exit 1",
6
6
  "type-check": "tsc --noEmit",