reactronic 0.24.400 → 0.24.401

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.
@@ -23,7 +23,7 @@ export declare abstract class ReactiveNode<E = unknown> {
23
23
  abstract element: E;
24
24
  abstract readonly host: ReactiveNode;
25
25
  abstract readonly children: MergeListReader<ReactiveNode>;
26
- abstract readonly seat: MergedItem<ReactiveNode<E>> | undefined;
26
+ abstract readonly slot: MergedItem<ReactiveNode<E>> | undefined;
27
27
  abstract readonly stamp: number;
28
28
  abstract readonly outer: ReactiveNode;
29
29
  abstract readonly context: ReactiveNodeContext | undefined;
@@ -48,7 +48,7 @@ export class ReactiveNode {
48
48
  else
49
49
  declaration = contentOrDeclaration !== null && contentOrDeclaration !== void 0 ? contentOrDeclaration : {};
50
50
  let effectiveKey = declaration.key;
51
- const owner = gOwnSeat === null || gOwnSeat === void 0 ? void 0 : gOwnSeat.instance;
51
+ const owner = gOwnSlot === null || gOwnSlot === void 0 ? void 0 : gOwnSlot.instance;
52
52
  if (owner) {
53
53
  let existing = owner.driver.child(owner, driver, declaration, declaration.basis);
54
54
  const children = owner.children;
@@ -64,13 +64,13 @@ export class ReactiveNode {
64
64
  }
65
65
  else {
66
66
  result = new ReactiveNodeImpl(effectiveKey || generateKey(owner), driver, declaration, owner);
67
- result.seat = children.mergeAsAdded(result);
67
+ result.slot = children.mergeAsAdded(result);
68
68
  }
69
69
  }
70
70
  else {
71
71
  result = new ReactiveNodeImpl(effectiveKey || "", driver, declaration, owner);
72
- result.seat = MergeList.createItem(result);
73
- triggerUpdateViaSeat(result.seat);
72
+ result.slot = MergeList.createItem(result);
73
+ triggerUpdateViaSlot(result.slot);
74
74
  }
75
75
  return result;
76
76
  }
@@ -82,43 +82,43 @@ export class ReactiveNode {
82
82
  return declaration;
83
83
  }
84
84
  static get isFirstUpdate() {
85
- return ReactiveNodeImpl.ownSeat.instance.stamp === 1;
85
+ return ReactiveNodeImpl.ownSlot.instance.stamp === 1;
86
86
  }
87
87
  static get key() {
88
- return ReactiveNodeImpl.ownSeat.instance.key;
88
+ return ReactiveNodeImpl.ownSlot.instance.key;
89
89
  }
90
90
  static get stamp() {
91
- return ReactiveNodeImpl.ownSeat.instance.stamp;
91
+ return ReactiveNodeImpl.ownSlot.instance.stamp;
92
92
  }
93
93
  static get triggers() {
94
- return ReactiveNodeImpl.ownSeat.instance.declaration.triggers;
94
+ return ReactiveNodeImpl.ownSlot.instance.declaration.triggers;
95
95
  }
96
96
  static get priority() {
97
- return ReactiveNodeImpl.ownSeat.instance.priority;
97
+ return ReactiveNodeImpl.ownSlot.instance.priority;
98
98
  }
99
99
  static set priority(value) {
100
- ReactiveNodeImpl.ownSeat.instance.priority = value;
100
+ ReactiveNodeImpl.ownSlot.instance.priority = value;
101
101
  }
102
102
  static get childrenShuffling() {
103
- return ReactiveNodeImpl.ownSeat.instance.childrenShuffling;
103
+ return ReactiveNodeImpl.ownSlot.instance.childrenShuffling;
104
104
  }
105
105
  static set childrenShuffling(value) {
106
- ReactiveNodeImpl.ownSeat.instance.childrenShuffling = value;
106
+ ReactiveNodeImpl.ownSlot.instance.childrenShuffling = value;
107
107
  }
108
108
  static triggerUpdate(node, triggers) {
109
109
  const impl = node;
110
110
  const declaration = impl.declaration;
111
111
  if (!triggersAreEqual(triggers, declaration.triggers)) {
112
112
  declaration.triggers = triggers;
113
- triggerUpdateViaSeat(impl.seat);
113
+ triggerUpdateViaSlot(impl.slot);
114
114
  }
115
115
  }
116
116
  static triggerDeactivation(node) {
117
117
  const impl = node;
118
- triggerDeactivation(impl.seat, true, true);
118
+ triggerDeactivation(impl.slot, true, true);
119
119
  }
120
120
  static updateNestedNodesThenDo(action) {
121
- runUpdateNestedNodesThenDo(ReactiveNodeImpl.ownSeat, undefined, action);
121
+ runUpdateNestedNodesThenDo(ReactiveNodeImpl.ownSlot, undefined, action);
122
122
  }
123
123
  static markAsMounted(node, yes) {
124
124
  const n = node;
@@ -135,7 +135,7 @@ export class ReactiveNode {
135
135
  return p;
136
136
  }
137
137
  static findMatchingPrevSibling(node, match) {
138
- let p = node.seat.prev;
138
+ let p = node.slot.prev;
139
139
  while (p && !match(p.instance))
140
140
  p = p.prev;
141
141
  return p === null || p === void 0 ? void 0 : p.instance;
@@ -286,7 +286,7 @@ class ReactiveNodeImpl extends ReactiveNode {
286
286
  this.element = driver.allocate(this);
287
287
  this.host = thisAsUnknown;
288
288
  this.children = new MergeList(getNodeKey, true);
289
- this.seat = undefined;
289
+ this.slot = undefined;
290
290
  this.stamp = Number.MAX_SAFE_INTEGER;
291
291
  this.context = undefined;
292
292
  this.numerator = 0;
@@ -298,28 +298,28 @@ class ReactiveNodeImpl extends ReactiveNode {
298
298
  }
299
299
  get strictOrder() { return this.children.isStrict; }
300
300
  set strictOrder(value) { this.children.isStrict = value; }
301
- get isMoved() { return this.owner.children.isMoved(this.seat); }
301
+ get isMoved() { return this.owner.children.isMoved(this.slot); }
302
302
  has(mode) {
303
303
  return (getModeUsingBasisChain(this.declaration) & mode) === mode;
304
304
  }
305
305
  update(_triggers) {
306
- updateNow(this.seat);
306
+ updateNow(this.slot);
307
307
  }
308
308
  configureReactronic(options) {
309
309
  if (this.stamp < Number.MAX_SAFE_INTEGER - 1 || !this.has(Mode.autonomous))
310
310
  throw new Error("reactronic can be configured only for elements with autonomous mode and only during activation");
311
311
  return ReactiveSystem.getOperation(this.update).configure(options);
312
312
  }
313
- static get ownSeat() {
314
- if (!gOwnSeat)
313
+ static get ownSlot() {
314
+ if (!gOwnSlot)
315
315
  throw new Error("current element is undefined");
316
- return gOwnSeat;
316
+ return gOwnSlot;
317
317
  }
318
318
  static tryUseNodeVariableValue(variable) {
319
319
  var _a, _b;
320
- let node = ReactiveNodeImpl.ownSeat.instance;
320
+ let node = ReactiveNodeImpl.ownSlot.instance;
321
321
  while (((_a = node.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && node.owner !== node)
322
- node = node.outer.seat.instance;
322
+ node = node.outer.slot.instance;
323
323
  return (_b = node.context) === null || _b === void 0 ? void 0 : _b.value;
324
324
  }
325
325
  static useNodeVariableValue(variable) {
@@ -330,7 +330,7 @@ class ReactiveNodeImpl extends ReactiveNode {
330
330
  return result;
331
331
  }
332
332
  static setNodeVariableValue(variable, value) {
333
- const node = ReactiveNodeImpl.ownSeat.instance;
333
+ const node = ReactiveNodeImpl.ownSlot.instance;
334
334
  const owner = node.owner;
335
335
  const hostCtx = unobs(() => { var _a; return (_a = owner.context) === null || _a === void 0 ? void 0 : _a.value; });
336
336
  if (value && value !== hostCtx) {
@@ -372,10 +372,10 @@ __decorate([
372
372
  function getNodeKey(node) {
373
373
  return node.stamp >= 0 ? node.key : undefined;
374
374
  }
375
- function runUpdateNestedNodesThenDo(ownSeat, error, action) {
376
- runInside(ownSeat, () => {
375
+ function runUpdateNestedNodesThenDo(ownSlot, error, action) {
376
+ runInside(ownSlot, () => {
377
377
  var _a;
378
- const owner = ownSeat.instance;
378
+ const owner = ownSlot.instance;
379
379
  const children = owner.children;
380
380
  if (children.isMergeInProgress) {
381
381
  let promised = undefined;
@@ -398,7 +398,7 @@ function runUpdateNestedNodesThenDo(ownSeat, error, action) {
398
398
  mounting = markToMountIfNecessary(mounting, host, child, children, sequential);
399
399
  const p = (_a = childNode.priority) !== null && _a !== void 0 ? _a : Priority.realtime;
400
400
  if (p === Priority.realtime)
401
- triggerUpdateViaSeat(child);
401
+ triggerUpdateViaSlot(child);
402
402
  else if (p === Priority.normal)
403
403
  p1 = push(child, p1);
404
404
  else
@@ -407,7 +407,7 @@ function runUpdateNestedNodesThenDo(ownSeat, error, action) {
407
407
  partition = childNode;
408
408
  }
409
409
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
410
- promised = startIncrementalUpdate(ownSeat, children, p1, p2).then(() => action(error), e => action(e));
410
+ promised = startIncrementalUpdate(ownSlot, children, p1, p2).then(() => action(error), e => action(e));
411
411
  }
412
412
  }
413
413
  finally {
@@ -417,26 +417,26 @@ function runUpdateNestedNodesThenDo(ownSeat, error, action) {
417
417
  }
418
418
  });
419
419
  }
420
- function markToMountIfNecessary(mounting, host, seat, children, sequential) {
421
- const node = seat.instance;
420
+ function markToMountIfNecessary(mounting, host, slot, children, sequential) {
421
+ const node = slot.instance;
422
422
  if (node.element.native && !node.has(Mode.manualMount)) {
423
423
  if (mounting || node.host !== host) {
424
- children.markAsMoved(seat);
424
+ children.markAsMoved(slot);
425
425
  mounting = false;
426
426
  }
427
427
  }
428
- else if (sequential && children.isMoved(seat))
428
+ else if (sequential && children.isMoved(slot))
429
429
  mounting = true;
430
430
  node.host = host;
431
431
  return mounting;
432
432
  }
433
- function startIncrementalUpdate(ownerSeat, allChildren, priority1, priority2) {
433
+ function startIncrementalUpdate(ownerSlot, allChildren, priority1, priority2) {
434
434
  return __awaiter(this, void 0, void 0, function* () {
435
- const stamp = ownerSeat.instance.stamp;
435
+ const stamp = ownerSlot.instance.stamp;
436
436
  if (priority1)
437
- yield updateIncrementally(ownerSeat, stamp, allChildren, priority1, Priority.normal);
437
+ yield updateIncrementally(ownerSlot, stamp, allChildren, priority1, Priority.normal);
438
438
  if (priority2)
439
- yield updateIncrementally(ownerSeat, stamp, allChildren, priority2, Priority.background);
439
+ yield updateIncrementally(ownerSlot, stamp, allChildren, priority2, Priority.background);
440
440
  });
441
441
  }
442
442
  function updateIncrementally(owner, stamp, allChildren, items, priority) {
@@ -452,7 +452,7 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
452
452
  const frameDurationLimit = priority === Priority.background ? ReactiveNode.shortFrameDuration : Infinity;
453
453
  let frameDuration = Math.min(frameDurationLimit, Math.max(ReactiveNode.frameDuration / 4, ReactiveNode.shortFrameDuration));
454
454
  for (const child of items) {
455
- triggerUpdateViaSeat(child);
455
+ triggerUpdateViaSlot(child);
456
456
  if (Transaction.isFrameOver(1, frameDuration)) {
457
457
  ReactiveNode.currentUpdatePriority = outerPriority;
458
458
  yield Transaction.requestNextFrame(0);
@@ -470,8 +470,8 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
470
470
  }
471
471
  });
472
472
  }
473
- function triggerUpdateViaSeat(seat) {
474
- const node = seat.instance;
473
+ function triggerUpdateViaSlot(slot) {
474
+ const node = slot.instance;
475
475
  if (node.stamp >= 0) {
476
476
  if (node.has(Mode.autonomous)) {
477
477
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
@@ -486,7 +486,7 @@ function triggerUpdateViaSeat(seat) {
486
486
  unobs(node.update, node.declaration.triggers);
487
487
  }
488
488
  else
489
- updateNow(seat);
489
+ updateNow(slot);
490
490
  }
491
491
  }
492
492
  function mountOrRemountIfNecessary(node) {
@@ -505,11 +505,11 @@ function mountOrRemountIfNecessary(node) {
505
505
  else if (node.isMoved && !node.has(Mode.manualMount) && node.host !== node)
506
506
  unobs(() => driver.mount(node));
507
507
  }
508
- function updateNow(seat) {
509
- const node = seat.instance;
508
+ function updateNow(slot) {
509
+ const node = slot.instance;
510
510
  if (node.stamp >= 0) {
511
511
  let result = undefined;
512
- runInside(seat, () => {
512
+ runInside(slot, () => {
513
513
  mountOrRemountIfNecessary(node);
514
514
  if (node.stamp < Number.MAX_SAFE_INTEGER - 1) {
515
515
  try {
@@ -518,10 +518,10 @@ function updateNow(seat) {
518
518
  node.children.beginMerge();
519
519
  const driver = node.driver;
520
520
  result = driver.update(node);
521
- result = proceedSyncOrAsync(result, v => { runUpdateNestedNodesThenDo(seat, undefined, NOP); return v; }, e => { console.log(e); runUpdateNestedNodesThenDo(seat, e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
521
+ result = proceedSyncOrAsync(result, v => { runUpdateNestedNodesThenDo(slot, undefined, NOP); return v; }, e => { console.log(e); runUpdateNestedNodesThenDo(slot, e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
522
522
  }
523
523
  catch (e) {
524
- runUpdateNestedNodesThenDo(seat, e, NOP);
524
+ runUpdateNestedNodesThenDo(slot, e, NOP);
525
525
  console.log(`Update failed: ${node.key}`);
526
526
  console.log(`${e}`);
527
527
  }
@@ -529,8 +529,8 @@ function updateNow(seat) {
529
529
  });
530
530
  }
531
531
  }
532
- function triggerDeactivation(seat, isLeader, individual) {
533
- const node = seat.instance;
532
+ function triggerDeactivation(slot, isLeader, individual) {
533
+ const node = slot.instance;
534
534
  if (node.stamp >= 0) {
535
535
  const driver = node.driver;
536
536
  if (individual && node.key !== node.declaration.key && !driver.isPartition)
@@ -538,14 +538,14 @@ function triggerDeactivation(seat, isLeader, individual) {
538
538
  node.stamp = ~node.stamp;
539
539
  const childrenAreLeaders = unobs(() => driver.destroy(node, isLeader));
540
540
  if (node.has(Mode.autonomous)) {
541
- seat.aux = undefined;
541
+ slot.aux = undefined;
542
542
  const last = gLastToDispose;
543
543
  if (last)
544
- gLastToDispose = last.aux = seat;
544
+ gLastToDispose = last.aux = slot;
545
545
  else
546
- gFirstToDispose = gLastToDispose = seat;
547
- if (gFirstToDispose === seat)
548
- Transaction.run({ isolation: Isolation.disjoinForInternalDisposal, hint: `runDisposalLoop(initiator=${seat.instance.key})` }, () => {
546
+ gFirstToDispose = gLastToDispose = slot;
547
+ if (gFirstToDispose === slot)
548
+ Transaction.run({ isolation: Isolation.disjoinForInternalDisposal, hint: `runDisposalLoop(initiator=${slot.instance.key})` }, () => {
549
549
  void runDisposalLoop().then(NOP, error => console.log(error));
550
550
  });
551
551
  }
@@ -557,12 +557,12 @@ function triggerDeactivation(seat, isLeader, individual) {
557
557
  function runDisposalLoop() {
558
558
  return __awaiter(this, void 0, void 0, function* () {
559
559
  yield Transaction.requestNextFrame();
560
- let seat = gFirstToDispose;
561
- while (seat !== undefined) {
560
+ let slot = gFirstToDispose;
561
+ while (slot !== undefined) {
562
562
  if (Transaction.isFrameOver(500, 5))
563
563
  yield Transaction.requestNextFrame();
564
- ReactiveSystem.dispose(seat.instance);
565
- seat = seat.aux;
564
+ ReactiveSystem.dispose(slot.instance);
565
+ slot = slot.aux;
566
566
  ReactiveNodeImpl.disposableNodeCount--;
567
567
  }
568
568
  gFirstToDispose = gLastToDispose = undefined;
@@ -570,7 +570,7 @@ function runDisposalLoop() {
570
570
  }
571
571
  function wrapToRunInside(func) {
572
572
  let wrappedToRunInside;
573
- const outer = gOwnSeat;
573
+ const outer = gOwnSlot;
574
574
  if (outer)
575
575
  wrappedToRunInside = (...args) => {
576
576
  return runInside(outer, func, ...args);
@@ -579,14 +579,14 @@ function wrapToRunInside(func) {
579
579
  wrappedToRunInside = func;
580
580
  return wrappedToRunInside;
581
581
  }
582
- function runInside(seat, func, ...args) {
583
- const outer = gOwnSeat;
582
+ function runInside(slot, func, ...args) {
583
+ const outer = gOwnSlot;
584
584
  try {
585
- gOwnSeat = seat;
585
+ gOwnSlot = slot;
586
586
  return func(...args);
587
587
  }
588
588
  finally {
589
- gOwnSeat = outer;
589
+ gOwnSlot = outer;
590
590
  }
591
591
  }
592
592
  function triggersAreEqual(a1, a2) {
@@ -640,6 +640,6 @@ function defaultReject(error) {
640
640
  Promise.prototype.then = reactronicDomHookedThen;
641
641
  const NOP = (...args) => { };
642
642
  const NOP_ASYNC = (...args) => __awaiter(void 0, void 0, void 0, function* () { });
643
- let gOwnSeat = undefined;
643
+ let gOwnSlot = undefined;
644
644
  let gFirstToDispose = undefined;
645
645
  let gLastToDispose = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.24.400",
3
+ "version": "0.24.401",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",