reactronic 0.24.119 → 0.24.121

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.
@@ -17,6 +17,7 @@ export { Transaction } from './core/Transaction.js';
17
17
  export { Monitor } from './core/Monitor.js';
18
18
  export { Journal } from './core/Journal.js';
19
19
  export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from './RxSystem.js';
20
+ export { Reaction } from './Reaction.js';
20
21
  export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from './core/RxNode.js';
21
22
  export type { Delegate, SimpleDelegate, RxNodeDecl, RxNodeDriver, RxNodeContext } from './core/RxNode.js';
22
23
  export { Clock } from './Clock.js';
@@ -13,5 +13,6 @@ export { Transaction } from './core/Transaction.js';
13
13
  export { Monitor } from './core/Monitor.js';
14
14
  export { Journal } from './core/Journal.js';
15
15
  export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from './RxSystem.js';
16
+ export { Reaction } from './Reaction.js';
16
17
  export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from './core/RxNode.js';
17
18
  export { Clock } from './Clock.js';
@@ -37,7 +37,13 @@ export declare abstract class RxNode<E = unknown> {
37
37
  static frameDuration: number;
38
38
  static acquire<E = void>(driver: RxNodeDriver<E>, declaration?: RxNodeDecl<E>, preset?: RxNodeDecl<E>): RxNode<E>;
39
39
  static get isFirstUpdate(): boolean;
40
- static get nodeStamp(): number;
40
+ static get key(): string;
41
+ static get stamp(): number;
42
+ static get triggers(): unknown;
43
+ static get priority(): Priority;
44
+ static set priority(value: Priority);
45
+ static get childrenShuffling(): boolean;
46
+ static set childrenShuffling(value: boolean);
41
47
  static triggerUpdate(node: RxNode<any>, triggers: unknown): void;
42
48
  static updateNestedNodesThenDo(action: (error: unknown) => void): void;
43
49
  static findMatchingHost<E = unknown, R = unknown>(node: RxNode<E>, match: SimpleDelegate<RxNode<E>, boolean>): RxNode<R> | undefined;
@@ -43,7 +43,7 @@ export class RxNode {
43
43
  else
44
44
  declaration = preset !== null && preset !== void 0 ? preset : {};
45
45
  let key = declaration.key;
46
- const owner = gCurrent === null || gCurrent === void 0 ? void 0 : gCurrent.instance;
46
+ const owner = gOwnSeat === null || gOwnSeat === void 0 ? void 0 : gOwnSeat.instance;
47
47
  if (owner) {
48
48
  let existing = undefined;
49
49
  const children = owner.children;
@@ -75,11 +75,28 @@ export class RxNode {
75
75
  return result;
76
76
  }
77
77
  static get isFirstUpdate() {
78
- return (gCurrent === null || gCurrent === void 0 ? void 0 : gCurrent.instance.stamp) === 1;
78
+ return RxNodeImpl.ownSeat.instance.stamp === 1;
79
79
  }
80
- static get nodeStamp() {
81
- var _a;
82
- return (_a = gCurrent === null || gCurrent === void 0 ? void 0 : gCurrent.instance.stamp) !== null && _a !== void 0 ? _a : -1;
80
+ static get key() {
81
+ return RxNodeImpl.ownSeat.instance.key;
82
+ }
83
+ static get stamp() {
84
+ return RxNodeImpl.ownSeat.instance.stamp;
85
+ }
86
+ static get triggers() {
87
+ return RxNodeImpl.ownSeat.instance.declaration.triggers;
88
+ }
89
+ static get priority() {
90
+ return RxNodeImpl.ownSeat.instance.priority;
91
+ }
92
+ static set priority(value) {
93
+ RxNodeImpl.ownSeat.instance.priority = value;
94
+ }
95
+ static get childrenShuffling() {
96
+ return RxNodeImpl.ownSeat.instance.childrenShuffling;
97
+ }
98
+ static set childrenShuffling(value) {
99
+ RxNodeImpl.ownSeat.instance.childrenShuffling = value;
83
100
  }
84
101
  static triggerUpdate(node, triggers) {
85
102
  const impl = node;
@@ -254,14 +271,14 @@ class RxNodeImpl extends RxNode {
254
271
  throw new Error('reactronic can be configured only for elements with independent update mode and only inside initialize');
255
272
  return RxSystem.getReaction(this.update).configure(options);
256
273
  }
257
- static get current() {
258
- if (!gCurrent)
274
+ static get ownSeat() {
275
+ if (!gOwnSeat)
259
276
  throw new Error('current element is undefined');
260
- return gCurrent;
277
+ return gOwnSeat;
261
278
  }
262
279
  static tryUseNodeVariableValue(variable) {
263
280
  var _a, _b;
264
- let node = RxNodeImpl.current.instance;
281
+ let node = RxNodeImpl.ownSeat.instance;
265
282
  while (((_a = node.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && node.owner !== node)
266
283
  node = node.outer.seat.instance;
267
284
  return (_b = node.context) === null || _b === void 0 ? void 0 : _b.value;
@@ -274,7 +291,7 @@ class RxNodeImpl extends RxNode {
274
291
  return result;
275
292
  }
276
293
  static setNodeVariableValue(variable, value) {
277
- const node = RxNodeImpl.current.instance;
294
+ const node = RxNodeImpl.ownSeat.instance;
278
295
  const owner = node.owner;
279
296
  const hostCtx = unobs(() => { var _a; return (_a = owner.context) === null || _a === void 0 ? void 0 : _a.value; });
280
297
  if (value && value !== hostCtx) {
@@ -317,8 +334,8 @@ function getNodeKey(node) {
317
334
  }
318
335
  function runUpdateNestedNodesThenDo(error, action) {
319
336
  var _a;
320
- const curr = RxNodeImpl.current;
321
- const owner = curr.instance;
337
+ const ownSeat = RxNodeImpl.ownSeat;
338
+ const owner = ownSeat.instance;
322
339
  const children = owner.children;
323
340
  if (children.isMergeInProgress) {
324
341
  let promised = undefined;
@@ -350,7 +367,7 @@ function runUpdateNestedNodesThenDo(error, action) {
350
367
  partition = childNode;
351
368
  }
352
369
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
353
- promised = startIncrementalUpdate(curr, children, p1, p2).then(() => action(error), e => action(e));
370
+ promised = startIncrementalUpdate(ownSeat, children, p1, p2).then(() => action(error), e => action(e));
354
371
  }
355
372
  }
356
373
  finally {
@@ -516,23 +533,23 @@ function runDisposalLoop() {
516
533
  }
517
534
  function wrapToRunInside(func) {
518
535
  let wrappedToRunInside;
519
- const current = gCurrent;
520
- if (current)
536
+ const outer = gOwnSeat;
537
+ if (outer)
521
538
  wrappedToRunInside = (...args) => {
522
- return runInside(current, func, ...args);
539
+ return runInside(outer, func, ...args);
523
540
  };
524
541
  else
525
542
  wrappedToRunInside = func;
526
543
  return wrappedToRunInside;
527
544
  }
528
545
  function runInside(seat, func, ...args) {
529
- const outer = gCurrent;
546
+ const outer = gOwnSeat;
530
547
  try {
531
- gCurrent = seat;
548
+ gOwnSeat = seat;
532
549
  return func(...args);
533
550
  }
534
551
  finally {
535
- gCurrent = outer;
552
+ gOwnSeat = outer;
536
553
  }
537
554
  }
538
555
  function triggersAreEqual(a1, a2) {
@@ -585,6 +602,6 @@ function defaultReject(error) {
585
602
  }
586
603
  Promise.prototype.then = reactronicDomHookedThen;
587
604
  const NOP = (...args) => { };
588
- let gCurrent = undefined;
605
+ let gOwnSeat = undefined;
589
606
  let gFirstToDispose = undefined;
590
607
  let gLastToDispose = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.24.119",
3
+ "version": "0.24.121",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",