reactronic 0.24.113 → 0.24.115

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.
Files changed (41) hide show
  1. package/build/dist/source/Clock.d.ts +1 -1
  2. package/build/dist/source/Clock.js +1 -1
  3. package/build/dist/source/Options.d.ts +3 -3
  4. package/build/dist/source/Pipe.d.ts +1 -1
  5. package/build/dist/source/Pipe.js +1 -1
  6. package/build/dist/source/Reaction.d.ts +1 -1
  7. package/build/dist/source/Reaction.js +1 -1
  8. package/build/dist/source/Ref.js +1 -1
  9. package/build/dist/source/RxSystem.js +5 -5
  10. package/build/dist/source/api.d.ts +10 -10
  11. package/build/dist/source/api.js +9 -9
  12. package/build/dist/source/{RxNode.d.ts → tree/RxNode.d.ts} +9 -15
  13. package/build/dist/source/tree/RxTree.d.ts +36 -0
  14. package/build/dist/source/{RxTree.js → tree/RxTree.js} +53 -55
  15. package/package.json +1 -1
  16. package/build/dist/source/RxTree.d.ts +0 -34
  17. /package/build/dist/source/{impl → core}/Changeset.d.ts +0 -0
  18. /package/build/dist/source/{impl → core}/Changeset.js +0 -0
  19. /package/build/dist/source/{impl → core}/Data.d.ts +0 -0
  20. /package/build/dist/source/{impl → core}/Data.js +0 -0
  21. /package/build/dist/source/{impl → core}/Journal.d.ts +0 -0
  22. /package/build/dist/source/{impl → core}/Journal.js +0 -0
  23. /package/build/dist/source/{impl → core}/Meta.d.ts +0 -0
  24. /package/build/dist/source/{impl → core}/Meta.js +0 -0
  25. /package/build/dist/source/{impl → core}/Monitor.d.ts +0 -0
  26. /package/build/dist/source/{impl → core}/Monitor.js +0 -0
  27. /package/build/dist/source/{impl → core}/Mvcc.d.ts +0 -0
  28. /package/build/dist/source/{impl → core}/Mvcc.js +0 -0
  29. /package/build/dist/source/{impl → core}/MvccArray.d.ts +0 -0
  30. /package/build/dist/source/{impl → core}/MvccArray.js +0 -0
  31. /package/build/dist/source/{impl → core}/MvccMap.d.ts +0 -0
  32. /package/build/dist/source/{impl → core}/MvccMap.js +0 -0
  33. /package/build/dist/source/{impl → core}/MvccMergeList.d.ts +0 -0
  34. /package/build/dist/source/{impl → core}/MvccMergeList.js +0 -0
  35. /package/build/dist/source/{impl → core}/Reaction.d.ts +0 -0
  36. /package/build/dist/source/{impl → core}/Reaction.js +0 -0
  37. /package/build/dist/source/{impl → core}/Transaction.d.ts +0 -0
  38. /package/build/dist/source/{impl → core}/Transaction.js +0 -0
  39. /package/build/dist/source/{RxNode.js → tree/RxNode.js} +0 -0
  40. /package/build/dist/source/{util → tree}/RxNodeUtils.d.ts +0 -0
  41. /package/build/dist/source/{util → tree}/RxNodeUtils.js +0 -0
@@ -1,4 +1,4 @@
1
- import { ObservableObject } from './impl/Mvcc.js';
1
+ import { ObservableObject } from './core/Mvcc.js';
2
2
  export declare class Clock extends ObservableObject {
3
3
  hour: number;
4
4
  minute: number;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { ObservableObject } from './impl/Mvcc.js';
10
+ import { ObservableObject } from './core/Mvcc.js';
11
11
  import { transactional } from './RxSystem.js';
12
12
  export class Clock extends ObservableObject {
13
13
  constructor(interval = 1000) {
@@ -1,9 +1,9 @@
1
1
  import { LoggingOptions } from './Logging.js';
2
- import { SeparationMode } from './impl/Data.js';
2
+ import { SeparationMode } from './core/Data.js';
3
3
  export { LoggingLevel } from './Logging.js';
4
4
  export type { LoggingOptions, ProfilingOptions } from './Logging.js';
5
- import { Journal } from './impl/Journal.js';
6
- import { Monitor } from './impl/Monitor.js';
5
+ import { Journal } from './core/Journal.js';
6
+ import { Monitor } from './core/Monitor.js';
7
7
  export interface SnapshotOptions {
8
8
  readonly hint?: string;
9
9
  readonly separation?: SeparationMode;
@@ -1,4 +1,4 @@
1
- import { ObservableObject } from './impl/Mvcc.js';
1
+ import { ObservableObject } from './core/Mvcc.js';
2
2
  export declare abstract class Pipe<T> extends ObservableObject {
3
3
  abstract readonly capacity: number;
4
4
  abstract readonly count: number;
@@ -1,4 +1,4 @@
1
- import { ObservableObject } from './impl/Mvcc.js';
1
+ import { ObservableObject } from './core/Mvcc.js';
2
2
  export class Pipe extends ObservableObject {
3
3
  static create(hint, capacity) { throw new Error('not implemented'); }
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import { F } from './util/Utils.js';
2
- import { ObservableObject } from './impl/Mvcc.js';
2
+ import { ObservableObject } from './core/Mvcc.js';
3
3
  export declare class Reaction<T> extends ObservableObject {
4
4
  protected action: F<T>;
5
5
  constructor(action: F<T>);
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { ObservableObject } from './impl/Mvcc.js';
10
+ import { ObservableObject } from './core/Mvcc.js';
11
11
  import { reactive } from './RxSystem.js';
12
12
  export class Reaction extends ObservableObject {
13
13
  constructor(action) {
@@ -1,4 +1,4 @@
1
- import { Transaction } from './impl/Transaction.js';
1
+ import { Transaction } from './core/Transaction.js';
2
2
  import { unobs } from './RxSystem.js';
3
3
  export function refs(owner) {
4
4
  return new Proxy(owner, RefGettingProxy);
@@ -1,10 +1,10 @@
1
1
  import { Log } from './util/Dbg.js';
2
2
  import { Kind } from './Options.js';
3
- import { Meta, ObjectHandle } from './impl/Data.js';
4
- import { Changeset } from './impl/Changeset.js';
5
- import { Mvcc } from './impl/Mvcc.js';
6
- import { Transaction } from './impl/Transaction.js';
7
- import { ReactionImpl } from './impl/Reaction.js';
3
+ import { Meta, ObjectHandle } from './core/Data.js';
4
+ import { Changeset } from './core/Changeset.js';
5
+ import { Mvcc } from './core/Mvcc.js';
6
+ import { Transaction } from './core/Transaction.js';
7
+ import { ReactionImpl } from './core/Reaction.js';
8
8
  export class RxSystem {
9
9
  static why(brief = false) { return brief ? ReactionImpl.briefWhy() : ReactionImpl.why(); }
10
10
  static getReaction(method) { return ReactionImpl.getControllerOf(method); }
@@ -9,15 +9,15 @@ export type { AbstractReaction, MemberOptions, SnapshotOptions, LoggingOptions,
9
9
  export type { Worker } from './Worker.js';
10
10
  export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from './Ref.js';
11
11
  export type { BoolOnly, GivenTypeOnly } from './Ref.js';
12
- export { TransactionalObject, ObservableObject } from './impl/Mvcc.js';
13
- export { TransactionalArray, ObservableArray } from './impl/MvccArray.js';
14
- export { TransactionalMap, ObservableMap } from './impl/MvccMap.js';
15
- export { Changeset } from './impl/Changeset.js';
16
- export { Transaction } from './impl/Transaction.js';
17
- export { Monitor } from './impl/Monitor.js';
18
- export { Journal } from './impl/Journal.js';
12
+ export { TransactionalObject, ObservableObject } from './core/Mvcc.js';
13
+ export { TransactionalArray, ObservableArray } from './core/MvccArray.js';
14
+ export { TransactionalMap, ObservableMap } from './core/MvccMap.js';
15
+ export { Changeset } from './core/Changeset.js';
16
+ export { Transaction } from './core/Transaction.js';
17
+ export { Monitor } from './core/Monitor.js';
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 { Mode, Priority } from './RxNode.js';
21
- export type { Delegate, SimpleDelegate, RxElement, RxNode, RxNodeDecl, RxNodeDriver, RxNodeContext } from './RxNode.js';
22
- export { RxTree, BaseDriver, RxNodeVariable } from './RxTree.js';
20
+ export { Mode, Priority } from './tree/RxNode.js';
21
+ export type { Delegate, SimpleDelegate, RxNode, RxNodeDecl, RxNodeDriver, RxNodeContext } from './tree/RxNode.js';
22
+ export { RxTree, BaseDriver, RxNodeVariable } from './tree/RxTree.js';
23
23
  export { Clock } from './Clock.js';
@@ -5,14 +5,14 @@ export { SealedMap } from './util/SealedMap.js';
5
5
  export { SealedSet } from './util/SealedSet.js';
6
6
  export { Kind, Reentrance, LoggingLevel } from './Options.js';
7
7
  export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from './Ref.js';
8
- export { TransactionalObject, ObservableObject } from './impl/Mvcc.js';
9
- export { TransactionalArray, ObservableArray } from './impl/MvccArray.js';
10
- export { TransactionalMap, ObservableMap } from './impl/MvccMap.js';
11
- export { Changeset } from './impl/Changeset.js';
12
- export { Transaction } from './impl/Transaction.js';
13
- export { Monitor } from './impl/Monitor.js';
14
- export { Journal } from './impl/Journal.js';
8
+ export { TransactionalObject, ObservableObject } from './core/Mvcc.js';
9
+ export { TransactionalArray, ObservableArray } from './core/MvccArray.js';
10
+ export { TransactionalMap, ObservableMap } from './core/MvccMap.js';
11
+ export { Changeset } from './core/Changeset.js';
12
+ export { Transaction } from './core/Transaction.js';
13
+ export { Monitor } from './core/Monitor.js';
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 { Mode, Priority } from './RxNode.js';
17
- export { RxTree, BaseDriver, RxNodeVariable } from './RxTree.js';
16
+ export { Mode, Priority } from './tree/RxNode.js';
17
+ export { RxTree, BaseDriver, RxNodeVariable } from './tree/RxTree.js';
18
18
  export { Clock } from './Clock.js';
@@ -1,5 +1,5 @@
1
- import { MergeListReader, MergedItem } from './util/MergeList.js';
2
- import { MemberOptions } from './Options.js';
1
+ import { MergeListReader, MergedItem } from '../util/MergeList.js';
2
+ import { MemberOptions } from '../Options.js';
3
3
  export type Delegate<T> = (element: T, base: () => void) => void;
4
4
  export type SimpleDelegate<T = unknown, R = void> = (element: T) => R;
5
5
  export declare enum Mode {
@@ -12,10 +12,7 @@ export declare const enum Priority {
12
12
  Normal = 1,
13
13
  Background = 2
14
14
  }
15
- export interface RxElement {
16
- node: RxNode<any>;
17
- }
18
- export interface RxNode<E extends RxElement = any> {
15
+ export interface RxNode<E = unknown> {
19
16
  readonly key: string;
20
17
  readonly driver: RxNodeDriver<E>;
21
18
  readonly declaration: Readonly<RxNodeDecl<E>>;
@@ -28,33 +25,30 @@ export interface RxNode<E extends RxElement = any> {
28
25
  readonly stamp: number;
29
26
  readonly outer: RxNode;
30
27
  readonly context: RxNodeContext | undefined;
31
- readonly isInitialUpdate: boolean;
32
28
  priority?: Priority;
33
29
  childrenShuffling: boolean;
34
30
  strictOrder: boolean;
35
31
  has(mode: Mode): boolean;
36
32
  configureReactronic(options: Partial<MemberOptions>): MemberOptions;
37
33
  }
38
- export interface RxNodeDecl<E extends RxElement> {
34
+ export interface RxNodeDecl<E = unknown> {
39
35
  preset?: RxNodeDecl<E>;
40
36
  key?: string;
41
37
  mode?: Mode;
42
38
  triggers?: unknown;
43
- specify?: Delegate<E>;
44
- create?: Delegate<E>;
45
39
  initialize?: Delegate<E>;
46
40
  update?: Delegate<E>;
47
41
  finalize?: Delegate<E>;
48
42
  }
49
- export interface RxNodeDriver<E extends RxElement> {
43
+ export interface RxNodeDriver<E = unknown> {
50
44
  readonly name: string;
51
45
  readonly isPartitionSeparator: boolean;
52
46
  readonly predefine?: SimpleDelegate<E>;
53
47
  allocate(node: RxNode<E>): E;
54
- initialize(element: E): void;
55
- mount(element: E): void;
56
- update(element: E): void | Promise<void>;
57
- finalize(element: E, isLeader: boolean): boolean;
48
+ initialize(node: RxNode<E>): void;
49
+ mount(node: RxNode<E>): void;
50
+ update(node: RxNode<E>): void | Promise<void>;
51
+ finalize(node: RxNode<E>, isLeader: boolean): boolean;
58
52
  }
59
53
  export interface RxNodeContext<T extends Object = Object> {
60
54
  value: T;
@@ -0,0 +1,36 @@
1
+ import { LoggingOptions } from '../Logging.js';
2
+ import { Priority, RxNodeDecl, RxNodeDriver, SimpleDelegate, RxNode } from './RxNode.js';
3
+ export declare class RxTree {
4
+ static readonly shortFrameDuration = 16;
5
+ static readonly longFrameDuration = 300;
6
+ static currentUpdatePriority: Priority;
7
+ static frameDuration: number;
8
+ static declare<E = void>(driver: RxNodeDriver<E>, declaration?: RxNodeDecl<E>, preset?: RxNodeDecl<E>): RxNode<E>;
9
+ static get isFirstUpdate(): boolean;
10
+ static get nodeStamp(): number;
11
+ static triggerUpdate(node: RxNode<any>, triggers: unknown): void;
12
+ static updateNestedTreesThenDo(action: (error: unknown) => void): void;
13
+ static findMatchingHost<E = unknown, R = unknown>(node: RxNode<E>, match: SimpleDelegate<RxNode<E>, boolean>): RxNode<R> | undefined;
14
+ static findMatchingPrevSibling<E = unknown, R = unknown>(node: RxNode<E>, match: SimpleDelegate<RxNode<E>, boolean>): RxNode<R> | undefined;
15
+ static forEachChildRecursively<E = unknown>(node: RxNode<E>, action: SimpleDelegate<RxNode<E>>): void;
16
+ static getDefaultLoggingOptions(): LoggingOptions | undefined;
17
+ static setDefaultLoggingOptions(logging?: LoggingOptions): void;
18
+ }
19
+ export declare abstract class BaseDriver<E = unknown> implements RxNodeDriver<E> {
20
+ readonly name: string;
21
+ readonly isPartitionSeparator: boolean;
22
+ readonly predefine?: SimpleDelegate<E> | undefined;
23
+ constructor(name: string, isPartitionSeparator: boolean, predefine?: SimpleDelegate<E> | undefined);
24
+ abstract allocate(node: RxNode<E>): E;
25
+ initialize(node: RxNode<E>): void;
26
+ mount(node: RxNode<E>): void;
27
+ update(node: RxNode<E>): void | Promise<void>;
28
+ finalize(node: RxNode<E>, isLeader: boolean): boolean;
29
+ }
30
+ export declare class RxNodeVariable<T extends Object = Object> {
31
+ readonly defaultValue: T | undefined;
32
+ constructor(defaultValue?: T);
33
+ set value(value: T);
34
+ get value(): T;
35
+ get valueOrUndefined(): T | undefined;
36
+ }
@@ -16,13 +16,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
16
16
  step((generator = generator.apply(thisArg, _arguments || [])).next());
17
17
  });
18
18
  };
19
- import { MergeList } from './util/MergeList.js';
19
+ import { MergeList } from '../util/MergeList.js';
20
+ import { emitLetters, getCallerInfo } from './RxNodeUtils.js';
21
+ import { Reentrance } from '../Options.js';
22
+ import { ObservableObject } from '../core/Mvcc.js';
23
+ import { Transaction } from '../core/Transaction.js';
24
+ import { RxSystem, options, raw, reactive, unobs } from '../RxSystem.js';
20
25
  import { Priority, Mode } from './RxNode.js';
21
- import { emitLetters, getCallerInfo } from './util/RxNodeUtils.js';
22
- import { Reentrance } from './Options.js';
23
- import { ObservableObject } from './impl/Mvcc.js';
24
- import { Transaction } from './impl/Transaction.js';
25
- import { RxSystem, options, raw, reactive, unobs } from './RxSystem.js';
26
26
  export class RxTree {
27
27
  static declare(driver, declaration, preset) {
28
28
  var _a;
@@ -43,35 +43,39 @@ export class RxTree {
43
43
  }
44
44
  existing !== null && existing !== void 0 ? existing : (existing = children.tryMergeAsExisting(key = key || generateKey(owner), undefined, 'nested elements can be declared inside update function only'));
45
45
  if (existing) {
46
- const node = existing.instance;
47
- result = node.element;
48
- if (node.driver !== driver && driver !== undefined)
49
- throw new Error(`changing element driver is not yet supported: "${node.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
50
- const exTriggers = node.declaration.triggers;
46
+ result = existing.instance;
47
+ if (result.driver !== driver && driver !== undefined)
48
+ throw new Error(`changing element driver is not yet supported: "${result.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
49
+ const exTriggers = result.declaration.triggers;
51
50
  if (triggersAreEqual(declaration.triggers, exTriggers))
52
51
  declaration.triggers = exTriggers;
53
- node.declaration = declaration;
52
+ result.declaration = declaration;
54
53
  }
55
54
  else {
56
- const node = new RxNodeImpl(key || generateKey(owner), driver, declaration, owner);
57
- node.seat = children.mergeAsAdded(node);
58
- result = node.element;
55
+ result = new RxNodeImpl(key || generateKey(owner), driver, declaration, owner);
56
+ result.seat = children.mergeAsAdded(result);
59
57
  }
60
58
  }
61
59
  else {
62
- const node = new RxNodeImpl(key || '', driver, declaration, owner);
63
- node.seat = MergeList.createItem(node);
64
- result = node.element;
65
- triggerUpdateGivenSeat(node.seat);
60
+ result = new RxNodeImpl(key || '', driver, declaration, owner);
61
+ result.seat = MergeList.createItem(result);
62
+ triggerUpdateViaSeat(result.seat);
66
63
  }
67
64
  return result;
68
65
  }
69
- static triggerUpdate(element, triggers) {
70
- const node = element.node;
71
- const declaration = node.declaration;
66
+ static get isFirstUpdate() {
67
+ return (gCurrent === null || gCurrent === void 0 ? void 0 : gCurrent.instance.stamp) === 1;
68
+ }
69
+ static get nodeStamp() {
70
+ var _a;
71
+ return (_a = gCurrent === null || gCurrent === void 0 ? void 0 : gCurrent.instance.stamp) !== null && _a !== void 0 ? _a : -1;
72
+ }
73
+ static triggerUpdate(node, triggers) {
74
+ const impl = node;
75
+ const declaration = impl.declaration;
72
76
  if (!triggersAreEqual(triggers, declaration.triggers)) {
73
77
  declaration.triggers = triggers;
74
- triggerUpdateGivenSeat(node.seat);
78
+ triggerUpdateViaSeat(impl.seat);
75
79
  }
76
80
  }
77
81
  static updateNestedTreesThenDo(action) {
@@ -111,18 +115,18 @@ export class BaseDriver {
111
115
  this.isPartitionSeparator = isPartitionSeparator;
112
116
  this.predefine = predefine;
113
117
  }
114
- initialize(element) {
118
+ initialize(node) {
115
119
  var _a;
116
- (_a = this.predefine) === null || _a === void 0 ? void 0 : _a.call(this, element);
117
- initializeViaPresetChain(element, element.node.declaration);
120
+ (_a = this.predefine) === null || _a === void 0 ? void 0 : _a.call(this, node.element);
121
+ initializeViaPresetChain(node.element, node.declaration);
118
122
  }
119
- mount(element) {
123
+ mount(node) {
120
124
  }
121
- update(element) {
122
- updateViaPresetChain(element, element.node.declaration);
125
+ update(node) {
126
+ updateViaPresetChain(node.element, node.declaration);
123
127
  }
124
- finalize(element, isLeader) {
125
- finalizeViaPresetChain(element, element.node.declaration);
128
+ finalize(node, isLeader) {
129
+ finalizeViaPresetChain(node.element, node.declaration);
126
130
  return isLeader;
127
131
  }
128
132
  }
@@ -196,6 +200,7 @@ __decorate([
196
200
  ], RxNodeContextImpl.prototype, "variable", void 0);
197
201
  class RxNodeImpl {
198
202
  constructor(key, driver, declaration, owner) {
203
+ const thisAsUnknown = this;
199
204
  this.key = key;
200
205
  this.driver = driver;
201
206
  this.declaration = declaration;
@@ -207,11 +212,11 @@ class RxNodeImpl {
207
212
  }
208
213
  else {
209
214
  this.level = 1;
210
- this.owner = owner = this;
211
- this.outer = this;
215
+ this.owner = owner = thisAsUnknown;
216
+ this.outer = thisAsUnknown;
212
217
  }
213
218
  this.element = driver.allocate(this);
214
- this.host = this;
219
+ this.host = thisAsUnknown;
215
220
  this.children = new MergeList(getNodeKey, true);
216
221
  this.seat = undefined;
217
222
  this.stamp = Number.MAX_SAFE_INTEGER;
@@ -223,7 +228,6 @@ class RxNodeImpl {
223
228
  if (this.has(Mode.IndependentUpdate))
224
229
  RxNodeImpl.disposableNodeCount++;
225
230
  }
226
- get isInitialUpdate() { return this.stamp === 1; }
227
231
  get strictOrder() { return this.children.isStrict; }
228
232
  set strictOrder(value) { this.children.isStrict = value; }
229
233
  get isMoved() { return this.owner.children.isMoved(this.seat); }
@@ -319,20 +323,19 @@ function runUpdateNestedTreesThenDo(error, action) {
319
323
  for (const child of children.items()) {
320
324
  if (Transaction.isCanceled)
321
325
  break;
322
- const node = child.instance;
323
- const el = node.element;
324
- const isPart = node.driver.isPartitionSeparator;
326
+ const childNode = child.instance;
327
+ const isPart = childNode.driver.isPartitionSeparator;
325
328
  const host = isPart ? owner : partition;
326
- const p = (_a = el.node.priority) !== null && _a !== void 0 ? _a : Priority.Realtime;
329
+ const p = (_a = childNode.priority) !== null && _a !== void 0 ? _a : Priority.Realtime;
327
330
  mounting = markToMountIfNecessary(mounting, host, child, children, sequential);
328
331
  if (p === Priority.Realtime)
329
- triggerUpdateGivenSeat(child);
332
+ triggerUpdateViaSeat(child);
330
333
  else if (p === Priority.Normal)
331
334
  p1 = push(child, p1);
332
335
  else
333
336
  p2 = push(child, p2);
334
337
  if (isPart)
335
- partition = node;
338
+ partition = childNode;
336
339
  }
337
340
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
338
341
  promised = startIncrementalUpdate(curr, children, p1, p2).then(() => action(error), e => action(e));
@@ -346,8 +349,7 @@ function runUpdateNestedTreesThenDo(error, action) {
346
349
  }
347
350
  function markToMountIfNecessary(mounting, host, seat, children, sequential) {
348
351
  const node = seat.instance;
349
- const el = node.element;
350
- if (el.native && !node.has(Mode.ManualMount)) {
352
+ if (node.element.native && !node.has(Mode.ManualMount)) {
351
353
  if (mounting || node.host !== host) {
352
354
  children.markAsMoved(seat);
353
355
  mounting = false;
@@ -380,7 +382,7 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
380
382
  const frameDurationLimit = priority === Priority.Background ? RxTree.shortFrameDuration : Infinity;
381
383
  let frameDuration = Math.min(frameDurationLimit, Math.max(RxTree.frameDuration / 4, RxTree.shortFrameDuration));
382
384
  for (const child of items) {
383
- triggerUpdateGivenSeat(child);
385
+ triggerUpdateViaSeat(child);
384
386
  if (Transaction.isFrameOver(1, frameDuration)) {
385
387
  RxTree.currentUpdatePriority = outerPriority;
386
388
  yield Transaction.requestNextFrame(0);
@@ -398,7 +400,7 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
398
400
  }
399
401
  });
400
402
  }
401
- function triggerUpdateGivenSeat(seat) {
403
+ function triggerUpdateViaSeat(seat) {
402
404
  const node = seat.instance;
403
405
  if (node.stamp >= 0) {
404
406
  if (node.has(Mode.IndependentUpdate)) {
@@ -418,22 +420,21 @@ function triggerUpdateGivenSeat(seat) {
418
420
  }
419
421
  }
420
422
  function mountOrRemountIfNecessary(node) {
421
- const element = node.element;
422
423
  const driver = node.driver;
423
424
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
424
425
  node.stamp = Number.MAX_SAFE_INTEGER - 1;
425
426
  unobs(() => {
426
- driver.initialize(element);
427
+ driver.initialize(node);
427
428
  if (!node.has(Mode.ManualMount)) {
428
429
  node.stamp = 0;
429
- if (element.node.host !== element.node)
430
- driver.mount(element);
430
+ if (node.host !== node)
431
+ driver.mount(node);
431
432
  }
432
433
  node.stamp = 0;
433
434
  });
434
435
  }
435
- else if (node.isMoved && !node.has(Mode.ManualMount) && element.node.host !== element.node)
436
- unobs(() => driver.mount(element));
436
+ else if (node.isMoved && !node.has(Mode.ManualMount) && node.host !== node)
437
+ unobs(() => driver.mount(node));
437
438
  }
438
439
  function updateNow(seat) {
439
440
  const node = seat.instance;
@@ -465,15 +466,12 @@ function updateNow(seat) {
465
466
  }
466
467
  function triggerFinalization(seat, isLeader, individual) {
467
468
  const node = seat.instance;
468
- const el = node.element;
469
469
  if (node.stamp >= 0) {
470
470
  const driver = node.driver;
471
471
  if (individual && node.key !== node.declaration.key && !driver.isPartitionSeparator)
472
472
  console.log(`WARNING: it is recommended to assign explicit key for conditional element in order to avoid unexpected side effects: ${node.key}`);
473
473
  node.stamp = ~node.stamp;
474
- const childrenAreLeaders = unobs(() => driver.finalize(el, isLeader));
475
- el.native = null;
476
- el.controller = null;
474
+ const childrenAreLeaders = unobs(() => driver.finalize(node, isLeader));
477
475
  if (node.has(Mode.IndependentUpdate)) {
478
476
  seat.aux = undefined;
479
477
  const last = gLastToDispose;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.24.113",
3
+ "version": "0.24.115",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",
@@ -1,34 +0,0 @@
1
- import { LoggingOptions } from './Logging.js';
2
- import { Priority, RxNodeDecl, RxNodeDriver, SimpleDelegate, RxNode, RxElement } from './RxNode.js';
3
- export declare class RxTree {
4
- static readonly shortFrameDuration = 16;
5
- static readonly longFrameDuration = 300;
6
- static currentUpdatePriority: Priority;
7
- static frameDuration: number;
8
- static declare<E extends RxElement>(driver: RxNodeDriver<E>, declaration?: RxNodeDecl<E>, preset?: RxNodeDecl<E>): E;
9
- static triggerUpdate(element: RxElement, triggers: unknown): void;
10
- static updateNestedTreesThenDo(action: (error: unknown) => void): void;
11
- static findMatchingHost<E extends RxElement, R extends RxElement>(node: RxNode<E>, match: SimpleDelegate<RxNode<E>, boolean>): RxNode<R> | undefined;
12
- static findMatchingPrevSibling<E extends RxElement, R extends RxElement>(node: RxNode<E>, match: SimpleDelegate<RxNode<E>, boolean>): RxNode<R> | undefined;
13
- static forEachChildRecursively<E extends RxElement>(node: RxNode<E>, action: SimpleDelegate<RxNode<E>>): void;
14
- static getDefaultLoggingOptions(): LoggingOptions | undefined;
15
- static setDefaultLoggingOptions(logging?: LoggingOptions): void;
16
- }
17
- export declare abstract class BaseDriver<E extends RxElement> implements RxNodeDriver<E> {
18
- readonly name: string;
19
- readonly isPartitionSeparator: boolean;
20
- readonly predefine?: SimpleDelegate<E> | undefined;
21
- constructor(name: string, isPartitionSeparator: boolean, predefine?: SimpleDelegate<E> | undefined);
22
- abstract allocate(node: RxNode<E>): E;
23
- initialize(element: E): void;
24
- mount(element: E): void;
25
- update(element: E): void | Promise<void>;
26
- finalize(element: E, isLeader: boolean): boolean;
27
- }
28
- export declare class RxNodeVariable<T extends Object = Object> {
29
- readonly defaultValue: T | undefined;
30
- constructor(defaultValue?: T);
31
- set value(value: T);
32
- get value(): T;
33
- get valueOrUndefined(): T | undefined;
34
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes