ddd-react 1.7.0 → 1.7.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.
@@ -21,11 +21,11 @@ export declare abstract class Component<P = {}, S = {}, C = null> {
21
21
  consumer: Consumer<C>;
22
22
  }): void;
23
23
  notify(): void;
24
- onMount(): void | Promise<void>;
25
- onUnmount(): void | Promise<void>;
24
+ didMount(): void | Promise<void>;
26
25
  onWillUpdate(nextProps: P, nextState: S): void | Promise<void>;
27
- onUpdate(prevProps: P, prevState: S): void | Promise<void>;
26
+ didUpdate(prevProps: P, prevState: S): void | Promise<void>;
28
27
  onWillUnmount(): void | Promise<void>;
28
+ didUnmount(): void | Promise<void>;
29
29
  abstract render(): VDOMNode;
30
30
  get elements(): HTMLElement[];
31
31
  get firstElement(): HTMLElement | undefined;
package/dist/index.mjs CHANGED
@@ -13,8 +13,8 @@ function g(t, e) {
13
13
  if (Array.isArray(t)) {
14
14
  if (t.length !== e.length)
15
15
  return !1;
16
- for (let r = 0; r < t.length; ++r)
17
- if (!g(t[r], e[r]))
16
+ for (let n = 0; n < t.length; ++n)
17
+ if (!g(t[n], e[n]))
18
18
  return !1;
19
19
  return !0;
20
20
  }
@@ -24,14 +24,14 @@ function g(t, e) {
24
24
  return t.valueOf() === e.valueOf();
25
25
  if (t.toString !== Object.prototype.toString)
26
26
  return t.toString() === e.toString();
27
- const n = Object.keys(t);
28
- if (n.length !== Object.keys(e).length)
27
+ const r = Object.keys(t);
28
+ if (r.length !== Object.keys(e).length)
29
29
  return !1;
30
- for (let r = 0; r < n.length; ++r)
31
- if (!Object.prototype.hasOwnProperty.call(e, n[r]))
30
+ for (let n = 0; n < r.length; ++n)
31
+ if (!Object.prototype.hasOwnProperty.call(e, r[n]))
32
32
  return !1;
33
- for (let r = 0; r < n.length; ++r) {
34
- const s = n[r];
33
+ for (let n = 0; n < r.length; ++n) {
34
+ const s = r[n];
35
35
  if (!(s === "_owner" && t.$$typeof) && !g(t[s], e[s]))
36
36
  return !1;
37
37
  }
@@ -39,27 +39,27 @@ function g(t, e) {
39
39
  }
40
40
  return !1;
41
41
  }
42
- function S(t, e, n, r = null) {
42
+ function S(t, e, r, n = null) {
43
43
  function s(i) {
44
44
  const o = i;
45
- r ? e.call(r, o) : e(o);
45
+ n ? e.call(n, o) : e(o);
46
46
  }
47
- return n.addEventListener(t, s), s;
47
+ return r.addEventListener(t, s), s;
48
48
  }
49
- function $(t = {}, e, n = null) {
50
- const r = {};
49
+ function $(t = {}, e, r = null) {
50
+ const n = {};
51
51
  return Object.entries(t).forEach(([s, i]) => {
52
- r[s] = S(
52
+ n[s] = S(
53
53
  s,
54
54
  i,
55
55
  e,
56
- n
56
+ r
57
57
  );
58
- }), r;
58
+ }), n;
59
59
  }
60
60
  function q(t = {}, e) {
61
- Object.entries(t).forEach(([n, r]) => {
62
- e.removeEventListener(n, r);
61
+ Object.entries(t).forEach(([r, n]) => {
62
+ e.removeEventListener(r, n);
63
63
  });
64
64
  }
65
65
  function h(t) {
@@ -95,8 +95,8 @@ function G(t) {
95
95
  e && e.remove();
96
96
  }
97
97
  function W(t) {
98
- const { el: e, children: n, listeners: r, props: s } = t;
99
- s?.ref && typeof s.ref == "object" && "current" in s.ref && (s.ref.current = null), e && e.remove(), n && n.forEach(h), r && e && (q(r, e), delete t.listeners);
98
+ const { el: e, children: r, listeners: n, props: s } = t;
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
101
  function _(t) {
102
102
  const { children: e } = t;
@@ -106,15 +106,15 @@ function B(t) {
106
106
  const { children: e } = t;
107
107
  e && e.forEach(h);
108
108
  }
109
- function C(t, e, n) {
110
- t.style[e] = n.toString();
109
+ function C(t, e, r) {
110
+ t.style[e] = r.toString();
111
111
  }
112
112
  function X(t, e) {
113
113
  t.style[e] = null;
114
114
  }
115
115
  function J(t, e) {
116
- const { class: n, style: r, ...s } = e;
117
- n && K(t, n), r && Object.entries(r).forEach(([i, o]) => {
116
+ const { class: r, style: n, ...s } = e;
117
+ r && K(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))
@@ -127,8 +127,8 @@ function K(t, e) {
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, n) {
131
- n == null ? w(t, e) : t.setAttribute(e, String(n));
130
+ function L(t, e, r) {
131
+ r == null ? w(t, e) : t.setAttribute(e, String(r));
132
132
  }
133
133
  function w(t, e) {
134
134
  t[e] = null, t.removeAttribute(e);
@@ -147,141 +147,141 @@ function H() {
147
147
  let e;
148
148
  try {
149
149
  e = t();
150
- } catch (n) {
151
- console.error(`[scheduler]: ${n}`);
150
+ } catch (r) {
151
+ console.error(`[scheduler]: ${r}`);
152
152
  continue;
153
153
  }
154
154
  Promise.resolve(e).then(
155
155
  () => {
156
156
  },
157
- (n) => {
158
- console.error(`[scheduler]: ${n}`);
157
+ (r) => {
158
+ console.error(`[scheduler]: ${r}`);
159
159
  }
160
160
  );
161
161
  }
162
162
  P = !1;
163
163
  }
164
164
  function A(t) {
165
- const { on: e = {}, ...n } = t.props;
166
- return delete n.key, { props: n, events: e };
165
+ const { on: e = {}, ...r } = t.props;
166
+ return delete r.key, { props: r, events: e };
167
167
  }
168
- function p(t, e, n = null, r = null) {
168
+ function p(t, e, r = null, n = null) {
169
169
  switch (t.type) {
170
170
  case c.TEXT: {
171
- z(t, e, n);
171
+ z(t, e, r);
172
172
  break;
173
173
  }
174
174
  case c.ELEMENT: {
175
- Z(t, e, n, r);
175
+ Z(t, e, r, n);
176
176
  break;
177
177
  }
178
178
  case c.FRAGMENT: {
179
- Q(t, e, n, r);
179
+ Q(t, e, r, n);
180
180
  break;
181
181
  }
182
182
  case c.COMPONENT: {
183
- ee(t, e, n, r);
183
+ ee(t, e, r, n);
184
184
  const s = t.component;
185
- s && d(() => s.onMount());
185
+ s && d(() => s.didMount());
186
186
  break;
187
187
  }
188
188
  case c.PORTAL: {
189
- te(t, r);
189
+ te(t, n);
190
190
  break;
191
191
  }
192
192
  default:
193
193
  throw new Error(`Can't mount DOM of type: ${t.type}`);
194
194
  }
195
195
  }
196
- function z(t, e, n) {
197
- const { value: r } = t, s = document.createTextNode(r);
198
- t.el = s, j(s, e, n);
196
+ function z(t, e, r) {
197
+ const { value: n } = t, s = document.createTextNode(n);
198
+ t.el = s, j(s, e, r);
199
199
  }
200
- function Q(t, e, n, r) {
200
+ function Q(t, e, r, n) {
201
201
  const { children: s } = t;
202
202
  t.el = e, s?.forEach((i, o) => {
203
- p(i, e, n != null ? n + o : null, r);
203
+ p(i, e, r != null ? r + o : null, n);
204
204
  });
205
205
  }
206
- function Z(t, e, n, r) {
206
+ function Z(t, e, r, n) {
207
207
  const { tag: s, children: i } = t, u = s === "svg" || e instanceof SVGElement ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
208
- V(u, t, r), t.el = u, i?.forEach((l) => {
209
- p(l, u, null, r);
210
- }), j(u, e, n);
208
+ V(u, t, n), t.el = u, i?.forEach((l) => {
209
+ p(l, u, null, n);
210
+ }), j(u, e, r);
211
211
  }
212
- function V(t, e, n) {
213
- const { props: r, events: s } = A(e);
214
- r.ref && typeof r.ref == "object" && "current" in r.ref && (r.ref.current = t, delete r.ref), e.listeners = $(s, t, n), J(t, r);
212
+ function V(t, e, r) {
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);
215
215
  }
216
- function ee(t, e, n, r) {
217
- const s = t.tag, { props: i } = A(t), o = new s(i, r);
218
- o.mount(e, n), t.component = o, t.el = o.firstElement || null;
216
+ function ee(t, e, r, n) {
217
+ const s = t.tag, { props: i } = A(t), o = new s(i, n);
218
+ o.mount(e, r), t.component = o, t.el = o.firstElement || null;
219
219
  }
220
- function j(t, e, n) {
221
- if (n == null) {
220
+ function j(t, e, r) {
221
+ if (r == null) {
222
222
  e.append(t);
223
223
  return;
224
224
  }
225
- if (n < 0)
226
- throw new Error(`Index must be a positive integer, got ${n}`);
227
- const r = e.childNodes;
228
- n >= r.length ? e.append(t) : e.insertBefore(t, r[n]);
225
+ if (r < 0)
226
+ throw new Error(`Index must be a positive integer, got ${r}`);
227
+ const n = e.childNodes;
228
+ r >= n.length ? e.append(t) : e.insertBefore(t, n[r]);
229
229
  }
230
230
  function te(t, e) {
231
- const { children: n, container: r } = t;
232
- n?.forEach((s) => {
233
- p(s, r, null, e);
231
+ const { children: r, container: n } = t;
232
+ r?.forEach((s) => {
233
+ p(s, n, null, e);
234
234
  });
235
235
  }
236
236
  function D(t, e) {
237
237
  if (t.type !== e.type)
238
238
  return !1;
239
239
  if (t.type === c.ELEMENT) {
240
- const n = t, r = e, {
240
+ const r = t, n = e, {
241
241
  tag: s,
242
242
  props: { key: i }
243
- } = n, {
243
+ } = r, {
244
244
  tag: o,
245
245
  props: { key: u }
246
- } = r;
246
+ } = n;
247
247
  return s === o && i === u;
248
248
  }
249
249
  if (t.type === c.COMPONENT) {
250
- const n = t, r = e, { tag: s } = n, { tag: i } = r;
250
+ const r = t, n = e, { tag: s } = r, { tag: i } = n;
251
251
  return s === i;
252
252
  }
253
253
  if (t.type === c.PORTAL) {
254
- const n = t, r = e;
255
- return n.container === r.container;
254
+ const r = t, n = e;
255
+ return r.container === n.container;
256
256
  }
257
257
  return !0;
258
258
  }
259
259
  function T(t, e) {
260
- const n = Object.keys(t), r = Object.keys(e), s = [], i = [];
261
- for (const o of r)
260
+ const r = Object.keys(t), n = Object.keys(e), s = [], i = [];
261
+ for (const o of n)
262
262
  o in t ? t[o] !== e[o] && i.push(o) : s.push(o);
263
263
  return {
264
264
  added: s,
265
- removed: n.filter((o) => !(o in e)),
265
+ removed: r.filter((o) => !(o in e)),
266
266
  updated: i
267
267
  };
268
268
  }
269
- function ne(t) {
269
+ function re(t) {
270
270
  return t !== "";
271
271
  }
272
272
  function N(t) {
273
- return ne(t.trim());
273
+ return re(t.trim());
274
274
  }
275
- function m(t, e, n, r = null) {
275
+ function m(t, e, r, n = null) {
276
276
  if (!D(t, e)) {
277
- const s = re(n, t.el);
278
- return h(t), p(e, n, s, r), e;
277
+ const s = ne(r, t.el);
278
+ return h(t), p(e, r, s, n), e;
279
279
  }
280
280
  switch (e.el = t.el, e.type) {
281
281
  case c.TEXT:
282
282
  return se(t, e), e;
283
283
  case c.ELEMENT: {
284
- oe(t, e, r);
284
+ oe(t, e, n);
285
285
  break;
286
286
  }
287
287
  case c.COMPONENT: {
@@ -289,23 +289,23 @@ function m(t, e, n, r = null) {
289
289
  break;
290
290
  }
291
291
  case c.PORTAL: {
292
- ae(t, e, r);
292
+ ae(t, e, n);
293
293
  break;
294
294
  }
295
295
  }
296
- return R(t, e, r), e;
296
+ return R(t, e, n), e;
297
297
  }
298
- function re(t, e) {
298
+ function ne(t, e) {
299
299
  if (!e) return null;
300
- const n = Array.from(t.childNodes).indexOf(e);
301
- return n < 0 ? null : n;
300
+ const r = Array.from(t.childNodes).indexOf(e);
301
+ return r < 0 ? null : r;
302
302
  }
303
303
  function se(t, e) {
304
- const n = t.el, { value: r } = t, { value: s } = e;
305
- r !== s && n && (n.nodeValue = s);
304
+ const r = t.el, { value: n } = t, { value: s } = e;
305
+ n !== s && r && (r.nodeValue = s);
306
306
  }
307
- function oe(t, e, n) {
308
- const r = t.el, {
307
+ function oe(t, e, r) {
308
+ const n = t.el, {
309
309
  class: s,
310
310
  style: i,
311
311
  on: o,
@@ -316,22 +316,22 @@ function oe(t, e, n) {
316
316
  on: a,
317
317
  ...y
318
318
  } = e.props ?? {}, { listeners: b } = t;
319
- ie(r, u, y), ce(r, s, l), fe(
320
- r,
319
+ ie(n, u, y), ce(n, s, l), fe(
320
+ n,
321
321
  i,
322
322
  f
323
323
  ), e.listeners = ue(
324
- r,
324
+ n,
325
325
  b,
326
326
  o ?? {},
327
327
  a ?? {},
328
- n
328
+ r
329
329
  );
330
330
  }
331
- function ie(t, e = {}, n = {}) {
332
- const r = e.ref, s = n.ref;
333
- r !== s && (r && typeof r == "object" && "current" in r && (r.current = null), s && typeof s == "object" && "current" in s && (s.current = t));
334
- const i = { ...e }, o = { ...n };
331
+ function ie(t, e = {}, r = {}) {
332
+ const n = e.ref, s = r.ref;
333
+ n !== s && (n && typeof n == "object" && "current" in n && (n.current = null), s && typeof s == "object" && "current" in s && (s.current = t));
334
+ const i = { ...e }, o = { ...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)
@@ -339,22 +339,22 @@ function ie(t, e = {}, n = {}) {
339
339
  for (const a of u.concat(f))
340
340
  L(t, a, o[a]);
341
341
  }
342
- function ce(t, e, n) {
343
- const r = M(e), s = M(n), { added: i, removed: o } = U(r, s);
342
+ function ce(t, e, r) {
343
+ const n = M(e), s = M(r), { added: i, removed: o } = U(n, s);
344
344
  o.length > 0 && t.classList.remove(...o), i.length > 0 && t.classList.add(...i);
345
345
  }
346
346
  function M(t = "") {
347
347
  return Array.isArray(t) ? t.filter(N) : String(t).split(/(\s+)/).filter(N);
348
348
  }
349
- function fe(t, e = {}, n = {}) {
350
- const { added: r, removed: s, updated: i } = T(e, n);
349
+ function fe(t, e = {}, r = {}) {
350
+ const { added: n, removed: s, updated: i } = T(e, r);
351
351
  for (const o of s)
352
352
  X(t, o);
353
- for (const o of r.concat(i))
354
- C(t, o, n[o]);
353
+ for (const o of n.concat(i))
354
+ C(t, o, r[o]);
355
355
  }
356
- function ue(t, e = {}, n = {}, r = {}, s = null) {
357
- const { removed: i, added: o, updated: u } = T(n, r);
356
+ function ue(t, e = {}, r = {}, n = {}, s = null) {
357
+ const { removed: i, added: o, updated: u } = T(r, n);
358
358
  for (const f of i.concat(u)) {
359
359
  const a = e?.[f];
360
360
  a && t.removeEventListener(f, a);
@@ -363,24 +363,24 @@ function ue(t, e = {}, n = {}, r = {}, s = null) {
363
363
  for (const f of o.concat(u))
364
364
  l[f] = S(
365
365
  f,
366
- r[f],
366
+ n[f],
367
367
  t,
368
368
  s
369
369
  );
370
370
  return l;
371
371
  }
372
- function R(t, e, n) {
373
- const r = v(t), s = v(e), i = t.el, o = x(r, s, D), u = n?.offset ?? 0;
372
+ function R(t, e, r) {
373
+ const n = v(t), s = v(e), i = t.el, o = x(n, s, D), u = r?.offset ?? 0;
374
374
  for (const l of o)
375
375
  if (l.op === E.NOOP) {
376
376
  const { originalIndex: f, index: a } = l;
377
- m(r[f], s[a], i, n);
377
+ m(n[f], s[a], i, r);
378
378
  }
379
379
  for (const l of o)
380
380
  switch (l.op) {
381
381
  case E.MOVE: {
382
- const { from: f, index: a } = l, y = r[f].el, b = i.childNodes[a + u];
383
- y && (i.insertBefore(y, b), m(r[f], s[a], i, n));
382
+ const { from: f, index: a } = l, y = n[f].el, b = i.childNodes[a + u];
383
+ y && (i.insertBefore(y, b), m(n[f], s[a], i, r));
384
384
  break;
385
385
  }
386
386
  case E.REMOVE: {
@@ -390,21 +390,21 @@ function R(t, e, n) {
390
390
  }
391
391
  case E.ADD: {
392
392
  const { index: f, item: a } = l;
393
- p(a, i, f + u, n);
393
+ p(a, i, f + u, r);
394
394
  break;
395
395
  }
396
396
  }
397
397
  }
398
398
  function le(t, e) {
399
- const { component: n } = t, { props: r } = A(e);
400
- n.updateProps(r), e.component = n, e.el = n.firstElement;
399
+ const { component: r } = t, { props: n } = A(e);
400
+ r.updateProps(n), e.component = r, e.el = r.firstElement;
401
401
  }
402
- function ae(t, e, n) {
402
+ function ae(t, e, r) {
403
403
  if (t.container !== e.container) {
404
- h(t), p(e, document.body, null, n);
404
+ h(t), p(e, document.body, null, r);
405
405
  return;
406
406
  }
407
- R(t, e, n);
407
+ R(t, e, r);
408
408
  }
409
409
  const pe = (t) => t.isProvider, he = (t) => t.isConsumer;
410
410
  class k {
@@ -419,15 +419,15 @@ class k {
419
419
  subscribedProvider = null;
420
420
  isProvider = !1;
421
421
  isConsumer = !1;
422
- constructor(e = {}, n) {
423
- this.props = e, this.parent = n;
422
+ constructor(e = {}, r) {
423
+ this.props = e, this.parent = r;
424
424
  }
425
425
  addDependency({ consumer: e }) {
426
- this.dependencies.some((n) => n.consumer === e) || (this.dependencies.push({ consumer: e }), e.subscribedProvider = this);
426
+ this.dependencies.some((r) => r.consumer === e) || (this.dependencies.push({ consumer: e }), e.subscribedProvider = this);
427
427
  }
428
428
  removeDependency({ consumer: e }) {
429
- const n = this.dependencies.findIndex((r) => r.consumer === e);
430
- n !== -1 && (this.dependencies.splice(n, 1), e.subscribedProvider = null);
429
+ const r = this.dependencies.findIndex((n) => n.consumer === e);
430
+ r !== -1 && (this.dependencies.splice(r, 1), e.subscribedProvider = null);
431
431
  }
432
432
  notify() {
433
433
  d(() => {
@@ -436,19 +436,19 @@ class k {
436
436
  });
437
437
  });
438
438
  }
439
- onMount() {
439
+ didMount() {
440
440
  return Promise.resolve();
441
441
  }
442
- onUnmount() {
442
+ onWillUpdate(e, r) {
443
443
  return Promise.resolve();
444
444
  }
445
- onWillUpdate(e, n) {
445
+ didUpdate(e, r) {
446
446
  return Promise.resolve();
447
447
  }
448
- onUpdate(e, n) {
448
+ onWillUnmount() {
449
449
  return Promise.resolve();
450
450
  }
451
- onWillUnmount() {
451
+ didUnmount() {
452
452
  return Promise.resolve();
453
453
  }
454
454
  get elements() {
@@ -461,45 +461,45 @@ class k {
461
461
  return this.vdom?.type === c.FRAGMENT && this.hostEl && this.firstElement ? Array.from(this.hostEl.children).indexOf(this.firstElement) : 0;
462
462
  }
463
463
  updateProps(e) {
464
- const n = { ...this.props, ...e }, r = this.props;
465
- this.props = n;
464
+ const r = { ...this.props, ...e }, n = this.props;
465
+ this.props = r;
466
466
  const s = this.updateContext();
467
- g(r, n) && !s || (pe(this) && this.notify(), this.patch(r, this.state));
467
+ g(n, r) && !s || (pe(this) && this.notify(), this.patch(n, this.state));
468
468
  }
469
469
  setState(e) {
470
- const n = this.state;
470
+ const r = this.state;
471
471
  typeof e == "function" ? this.state = {
472
472
  ...this.state,
473
473
  ...e(this.state, this.props)
474
- } : this.state = { ...this.state, ...e }, this.patch(this.props, n);
474
+ } : this.state = { ...this.state, ...e }, this.patch(this.props, r);
475
475
  }
476
- mount(e, n = null) {
476
+ mount(e, r = null) {
477
477
  if (this.isMounted)
478
478
  throw new Error("Component is already mounted");
479
- he(this) && !this.subscribedProvider && this.subscribeToProvider(), this.updateContext(), this.vdom = this.render(), p(this.vdom, e, n, this), this.hostEl = e, this.isMounted = !0;
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
482
  this.isMounted && (d(() => this.onWillUnmount()), this.subscribedProvider && this.subscribedProvider.removeDependency({ consumer: this }), this.dependencies.forEach(({ consumer: e }) => {
483
483
  e.subscribedProvider = null;
484
- }), this.dependencies = [], this.vdom && h(this.vdom), d(() => this.onUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
484
+ }), this.dependencies = [], this.vdom && h(this.vdom), d(() => this.didUnmount()), this.vdom = null, this.hostEl = null, this.isMounted = !1);
485
485
  }
486
- patch(e, n) {
486
+ patch(e, r) {
487
487
  if (!this.isMounted || !this.hostEl || !this.vdom)
488
488
  return;
489
489
  d(() => this.onWillUpdate(this.props, this.state));
490
- const r = this.render();
491
- this.vdom = m(this.vdom, r, this.hostEl, this), d(() => this.onUpdate(e, n));
490
+ const n = this.render();
491
+ this.vdom = m(this.vdom, n, this.hostEl, this), d(() => this.didUpdate(e, r));
492
492
  }
493
493
  updateContext() {
494
494
  const e = Object.getPrototypeOf(this).constructor.contextType;
495
- let n = this.parent;
495
+ let r = this.parent;
496
496
  if (e != null) {
497
- for (; n; ) {
498
- if (Object.getPrototypeOf(n).constructor === e.Provider)
499
- return this.context = n.props.value, !0;
500
- n = n.parent;
497
+ for (; r; ) {
498
+ if (Object.getPrototypeOf(r).constructor === e.Provider)
499
+ return this.context = r.props.value, !0;
500
+ r = r.parent;
501
501
  }
502
- n == null && (this.context = e.defaultValue);
502
+ r == null && (this.context = e.defaultValue);
503
503
  }
504
504
  return !1;
505
505
  }
@@ -507,13 +507,13 @@ class k {
507
507
  const e = Object.getPrototypeOf(this).constructor.contextType;
508
508
  if (!e)
509
509
  return;
510
- let n = this.parent;
511
- for (; n; ) {
512
- if (Object.getPrototypeOf(n).constructor === e.Provider) {
513
- n.addDependency({ consumer: this });
510
+ let r = this.parent;
511
+ for (; r; ) {
512
+ if (Object.getPrototypeOf(r).constructor === e.Provider) {
513
+ r.addDependency({ consumer: this });
514
514
  break;
515
515
  }
516
- n = n.parent;
516
+ r = r.parent;
517
517
  }
518
518
  }
519
519
  }
@@ -525,7 +525,7 @@ function ye(t) {
525
525
  return Array.isArray(this.props.children) ? s = this.props.children : this.props.children ? s = [this.props.children] : s = [], F(s);
526
526
  }
527
527
  }
528
- class n extends k {
528
+ class r extends k {
529
529
  static contextType = {
530
530
  Provider: e,
531
531
  defaultValue: t
@@ -547,7 +547,7 @@ function ye(t) {
547
547
  }
548
548
  return {
549
549
  Provider: e,
550
- Consumer: n,
550
+ Consumer: r,
551
551
  defaultValue: t
552
552
  };
553
553
  }
@@ -562,8 +562,8 @@ function be(t = null) {
562
562
  };
563
563
  }
564
564
  function ve(t, e) {
565
- const n = Array.isArray(t) ? t : [t];
566
- return I(n, e);
565
+ const r = Array.isArray(t) ? t : [t];
566
+ return I(r, e);
567
567
  }
568
568
  export {
569
569
  k as Component,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-react",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "scripts": {
5
5
  "test": "echo \"Error: no test specified\" && exit 1",
6
6
  "type-check": "tsc --noEmit",