reactronic 0.24.308 → 0.24.309

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.
@@ -8,7 +8,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
10
  import { ObservableObject } from "./core/Mvcc.js";
11
- import { transactional } from "./RxSystem.js";
11
+ import { transactional } from "./ReactiveSystem.js";
12
12
  export class Clock extends ObservableObject {
13
13
  constructor(interval = 1000) {
14
14
  super();
@@ -8,7 +8,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
10
  import { ObservableObject } from "./core/Mvcc.js";
11
- import { reactive } from "./RxSystem.js";
11
+ import { reactive } from "./ReactiveSystem.js";
12
12
  export class Reaction extends ObservableObject {
13
13
  constructor(action) {
14
14
  super();
@@ -1,6 +1,6 @@
1
1
  import { F } from "./util/Utils.js";
2
2
  import { Operation, MemberOptions, LoggingOptions, ProfilingOptions } from "./Options.js";
3
- export declare class RxSystem {
3
+ export declare class ReactiveSystem {
4
4
  static why(brief?: boolean): string;
5
5
  static getOperation<T>(method: F<T>): Operation<T>;
6
6
  static pullLastResult<T>(method: F<Promise<T>>, args?: any[]): T | undefined;
@@ -5,10 +5,10 @@ import { Changeset } from "./core/Changeset.js";
5
5
  import { Mvcc } from "./core/Mvcc.js";
6
6
  import { Transaction } from "./core/Transaction.js";
7
7
  import { OperationImpl } from "./core/Operation.js";
8
- export class RxSystem {
8
+ export class ReactiveSystem {
9
9
  static why(brief = false) { return brief ? OperationImpl.briefWhy() : OperationImpl.why(); }
10
10
  static getOperation(method) { return OperationImpl.getControllerOf(method); }
11
- static pullLastResult(method, args) { return RxSystem.getOperation(method).pullLastResult(args); }
11
+ static pullLastResult(method, args) { return ReactiveSystem.getOperation(method).pullLastResult(args); }
12
12
  static configureCurrentOperation(options) { return OperationImpl.configureImpl(undefined, options); }
13
13
  static getRevisionOf(obj) { return obj[Meta.Revision]; }
14
14
  static takeSnapshot(obj) { return Changeset.takeSnapshot(obj); }
@@ -1,5 +1,5 @@
1
1
  import { Transaction } from "./core/Transaction.js";
2
- import { unobs } from "./RxSystem.js";
2
+ import { unobs } from "./ReactiveSystem.js";
3
3
  export function refs(owner) {
4
4
  return new Proxy(owner, RefGettingProxy);
5
5
  }
@@ -16,8 +16,8 @@ export { Changeset } from "./core/Changeset.js";
16
16
  export { Transaction } from "./core/Transaction.js";
17
17
  export { Indicator } from "./core/Indicator.js";
18
18
  export { Journal } from "./core/Journal.js";
19
- export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from "./RxSystem.js";
19
+ export { ReactiveSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from "./ReactiveSystem.js";
20
20
  export { Reaction } from "./Reaction.js";
21
- export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from "./core/RxNode.js";
22
- export type { Script, ScriptAsync, Handler, RxNodeDecl, RxNodeDriver, RxNodeContext } from "./core/RxNode.js";
21
+ export { ReactiveNode, Mode, Priority, BaseDriver, ReactiveNodeVariable } from "./core/ReactiveNode.js";
22
+ export type { Script, ScriptAsync, Handler, ReactiveNodeDecl, ReactiveNodeDriver, ReactiveNodeContext } from "./core/ReactiveNode.js";
23
23
  export { Clock } from "./Clock.js";
@@ -12,7 +12,7 @@ export { Changeset } from "./core/Changeset.js";
12
12
  export { Transaction } from "./core/Transaction.js";
13
13
  export { Indicator } from "./core/Indicator.js";
14
14
  export { Journal } from "./core/Journal.js";
15
- export { RxSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from "./RxSystem.js";
15
+ export { ReactiveSystem, raw, obs, transactional, reactive, cached, transaction, unobs, sensitive, options } from "./ReactiveSystem.js";
16
16
  export { Reaction } from "./Reaction.js";
17
- export { RxNode, Mode, Priority, BaseDriver, RxNodeVariable } from "./core/RxNode.js";
17
+ export { ReactiveNode, Mode, Priority, BaseDriver, ReactiveNodeVariable } from "./core/ReactiveNode.js";
18
18
  export { Clock } from "./Clock.js";
@@ -0,0 +1,106 @@
1
+ import { LoggingOptions } from "../Logging.js";
2
+ import { MergeListReader, MergedItem } from "../util/MergeList.js";
3
+ import { MemberOptions } from "../Options.js";
4
+ export type Script<E> = (e: E, basis: () => void) => void;
5
+ export type ScriptAsync<E> = (e: E, basis: () => Promise<void>) => Promise<void>;
6
+ export type Handler<E = unknown, R = void> = (e: E) => R;
7
+ export declare enum Mode {
8
+ default = 0,
9
+ independentUpdate = 1,
10
+ manualMount = 2
11
+ }
12
+ export declare enum Priority {
13
+ realtime = 0,
14
+ normal = 1,
15
+ background = 2
16
+ }
17
+ export declare abstract class ReactiveNode<E = unknown> {
18
+ abstract readonly key: string;
19
+ abstract readonly driver: ReactiveNodeDriver<E>;
20
+ abstract readonly declaration: Readonly<ReactiveNodeDecl<E>>;
21
+ abstract readonly level: number;
22
+ abstract readonly owner: ReactiveNode;
23
+ abstract element: E;
24
+ abstract readonly host: ReactiveNode;
25
+ abstract readonly children: MergeListReader<ReactiveNode>;
26
+ abstract readonly seat: MergedItem<ReactiveNode<E>> | undefined;
27
+ abstract readonly stamp: number;
28
+ abstract readonly outer: ReactiveNode;
29
+ abstract readonly context: ReactiveNodeContext | undefined;
30
+ abstract priority?: Priority;
31
+ abstract childrenShuffling: boolean;
32
+ abstract strictOrder: boolean;
33
+ abstract has(mode: Mode): boolean;
34
+ abstract configureReactronic(options: Partial<MemberOptions>): MemberOptions;
35
+ static readonly shortFrameDuration = 16;
36
+ static readonly longFrameDuration = 300;
37
+ static currentUpdatePriority: Priority;
38
+ static frameDuration: number;
39
+ static declare<E = void>(driver: ReactiveNodeDriver<E>, script?: Script<E>, scriptAsync?: ScriptAsync<E>, key?: string, mode?: Mode, creation?: Script<E>, creationAsync?: ScriptAsync<E>, destruction?: Script<E>, triggers?: unknown, basis?: ReactiveNodeDecl<E>): ReactiveNode<E>;
40
+ static declare<E = void>(driver: ReactiveNodeDriver<E>, declaration?: ReactiveNodeDecl<E>): ReactiveNode<E>;
41
+ static declare<E = void>(driver: ReactiveNodeDriver<E>, scriptOrDeclaration?: Script<E> | ReactiveNodeDecl<E>, scriptAsync?: ScriptAsync<E>, key?: string, mode?: Mode, creation?: Script<E>, creationAsync?: ScriptAsync<E>, destruction?: Script<E>, triggers?: unknown, basis?: ReactiveNodeDecl<E>): ReactiveNode<E>;
42
+ static withBasis<E = void>(declaration?: ReactiveNodeDecl<E>, basis?: ReactiveNodeDecl<E>): ReactiveNodeDecl<E>;
43
+ static get isFirstUpdate(): boolean;
44
+ static get key(): string;
45
+ static get stamp(): number;
46
+ static get triggers(): unknown;
47
+ static get priority(): Priority;
48
+ static set priority(value: Priority);
49
+ static get childrenShuffling(): boolean;
50
+ static set childrenShuffling(value: boolean);
51
+ static triggerUpdate(node: ReactiveNode<any>, triggers: unknown): void;
52
+ static triggerDeactivation(node: ReactiveNode<any>): void;
53
+ static updateNestedNodesThenDo(action: (error: unknown) => void): void;
54
+ static markAsMounted(node: ReactiveNode<any>, yes: boolean): void;
55
+ static findMatchingHost<E = unknown, R = unknown>(node: ReactiveNode<E>, match: Handler<ReactiveNode<E>, boolean>): ReactiveNode<R> | undefined;
56
+ static findMatchingPrevSibling<E = unknown, R = unknown>(node: ReactiveNode<E>, match: Handler<ReactiveNode<E>, boolean>): ReactiveNode<R> | undefined;
57
+ static forEachChildRecursively<E = unknown>(node: ReactiveNode<E>, action: Handler<ReactiveNode<E>>): void;
58
+ static getDefaultLoggingOptions(): LoggingOptions | undefined;
59
+ static setDefaultLoggingOptions(logging?: LoggingOptions): void;
60
+ }
61
+ export type ReactiveNodeDecl<E = unknown> = {
62
+ script?: Script<E>;
63
+ scriptAsync?: ScriptAsync<E>;
64
+ key?: string;
65
+ mode?: Mode;
66
+ creation?: Script<E>;
67
+ creationAsync?: ScriptAsync<E>;
68
+ destruction?: Script<E>;
69
+ triggers?: unknown;
70
+ basis?: ReactiveNodeDecl<E>;
71
+ };
72
+ export type ReactiveNodeDriver<E = unknown> = {
73
+ readonly name: string;
74
+ readonly isPartition: boolean;
75
+ readonly initialize?: Handler<E>;
76
+ allocate(node: ReactiveNode<E>): E;
77
+ create(node: ReactiveNode<E>): void;
78
+ destroy(node: ReactiveNode<E>, isLeader: boolean): boolean;
79
+ mount(node: ReactiveNode<E>): void;
80
+ update(node: ReactiveNode<E>): void | Promise<void>;
81
+ child(ownerNode: ReactiveNode<E>, childDriver: ReactiveNodeDriver<any>, childDeclaration?: ReactiveNodeDecl<any>, childBasis?: ReactiveNodeDecl<any>): MergedItem<ReactiveNode> | undefined;
82
+ getHost(node: ReactiveNode<E>): ReactiveNode<E>;
83
+ };
84
+ export type ReactiveNodeContext<T extends Object = Object> = {
85
+ value: T;
86
+ };
87
+ export declare abstract class BaseDriver<E = unknown> implements ReactiveNodeDriver<E> {
88
+ readonly name: string;
89
+ readonly isPartition: boolean;
90
+ readonly initialize?: Handler<E> | undefined;
91
+ constructor(name: string, isPartition: boolean, initialize?: Handler<E> | undefined);
92
+ abstract allocate(node: ReactiveNode<E>): E;
93
+ create(node: ReactiveNode<E>): void | Promise<void>;
94
+ destroy(node: ReactiveNode<E>, isLeader: boolean): boolean;
95
+ mount(node: ReactiveNode<E>): void;
96
+ update(node: ReactiveNode<E>): void | Promise<void>;
97
+ child(ownerNode: ReactiveNode<E>, childDriver: ReactiveNodeDriver<any>, childDeclaration?: ReactiveNodeDecl<any>, childBasis?: ReactiveNodeDecl<any>): MergedItem<ReactiveNode> | undefined;
98
+ getHost(node: ReactiveNode<E>): ReactiveNode<E>;
99
+ }
100
+ export declare class ReactiveNodeVariable<T extends Object = Object> {
101
+ readonly defaultValue: T | undefined;
102
+ constructor(defaultValue?: T);
103
+ set value(value: T);
104
+ get value(): T;
105
+ get valueOrUndefined(): T | undefined;
106
+ }
@@ -22,7 +22,7 @@ import { emitLetters, getCallerInfo, proceedSyncOrAsync } from "../util/Utils.js
22
22
  import { Isolation, Reentrance } from "../Options.js";
23
23
  import { ObservableObject } from "../core/Mvcc.js";
24
24
  import { Transaction } from "../core/Transaction.js";
25
- import { RxSystem, options, raw, reactive, unobs } from "../RxSystem.js";
25
+ import { ReactiveSystem, options, raw, reactive, unobs } from "../ReactiveSystem.js";
26
26
  export var Mode;
27
27
  (function (Mode) {
28
28
  Mode[Mode["default"] = 0] = "default";
@@ -35,7 +35,7 @@ export var Priority;
35
35
  Priority[Priority["normal"] = 1] = "normal";
36
36
  Priority[Priority["background"] = 2] = "background";
37
37
  })(Priority || (Priority = {}));
38
- export class RxNode {
38
+ export class ReactiveNode {
39
39
  static declare(driver, scriptOrDeclaration, scriptAsync, key, mode, creation, creationAsync, destruction, triggers, basis) {
40
40
  let result;
41
41
  let declaration;
@@ -63,18 +63,18 @@ export class RxNode {
63
63
  result.declaration = declaration;
64
64
  }
65
65
  else {
66
- result = new RxNodeImpl(effectiveKey || generateKey(owner), driver, declaration, owner);
66
+ result = new ReactiveNodeImpl(effectiveKey || generateKey(owner), driver, declaration, owner);
67
67
  result.seat = children.mergeAsAdded(result);
68
68
  }
69
69
  }
70
70
  else {
71
- result = new RxNodeImpl(effectiveKey || "", driver, declaration, owner);
71
+ result = new ReactiveNodeImpl(effectiveKey || "", driver, declaration, owner);
72
72
  result.seat = MergeList.createItem(result);
73
73
  triggerUpdateViaSeat(result.seat);
74
74
  }
75
75
  return result;
76
76
  }
77
- static rebased(declaration, basis) {
77
+ static withBasis(declaration, basis) {
78
78
  if (declaration)
79
79
  declaration.basis = basis;
80
80
  else
@@ -82,28 +82,28 @@ export class RxNode {
82
82
  return declaration;
83
83
  }
84
84
  static get isFirstUpdate() {
85
- return RxNodeImpl.ownSeat.instance.stamp === 1;
85
+ return ReactiveNodeImpl.ownSeat.instance.stamp === 1;
86
86
  }
87
87
  static get key() {
88
- return RxNodeImpl.ownSeat.instance.key;
88
+ return ReactiveNodeImpl.ownSeat.instance.key;
89
89
  }
90
90
  static get stamp() {
91
- return RxNodeImpl.ownSeat.instance.stamp;
91
+ return ReactiveNodeImpl.ownSeat.instance.stamp;
92
92
  }
93
93
  static get triggers() {
94
- return RxNodeImpl.ownSeat.instance.declaration.triggers;
94
+ return ReactiveNodeImpl.ownSeat.instance.declaration.triggers;
95
95
  }
96
96
  static get priority() {
97
- return RxNodeImpl.ownSeat.instance.priority;
97
+ return ReactiveNodeImpl.ownSeat.instance.priority;
98
98
  }
99
99
  static set priority(value) {
100
- RxNodeImpl.ownSeat.instance.priority = value;
100
+ ReactiveNodeImpl.ownSeat.instance.priority = value;
101
101
  }
102
102
  static get childrenShuffling() {
103
- return RxNodeImpl.ownSeat.instance.childrenShuffling;
103
+ return ReactiveNodeImpl.ownSeat.instance.childrenShuffling;
104
104
  }
105
105
  static set childrenShuffling(value) {
106
- RxNodeImpl.ownSeat.instance.childrenShuffling = value;
106
+ ReactiveNodeImpl.ownSeat.instance.childrenShuffling = value;
107
107
  }
108
108
  static triggerUpdate(node, triggers) {
109
109
  const impl = node;
@@ -118,7 +118,7 @@ export class RxNode {
118
118
  triggerDeactivation(impl.seat, true, true);
119
119
  }
120
120
  static updateNestedNodesThenDo(action) {
121
- runUpdateNestedNodesThenDo(RxNodeImpl.ownSeat, undefined, action);
121
+ runUpdateNestedNodesThenDo(ReactiveNodeImpl.ownSeat, undefined, action);
122
122
  }
123
123
  static markAsMounted(node, yes) {
124
124
  const n = node;
@@ -143,19 +143,19 @@ export class RxNode {
143
143
  static forEachChildRecursively(node, action) {
144
144
  action(node);
145
145
  for (const child of node.children.items())
146
- RxNode.forEachChildRecursively(child.instance, action);
146
+ ReactiveNode.forEachChildRecursively(child.instance, action);
147
147
  }
148
148
  static getDefaultLoggingOptions() {
149
- return RxNodeImpl.logging;
149
+ return ReactiveNodeImpl.logging;
150
150
  }
151
151
  static setDefaultLoggingOptions(logging) {
152
- RxNodeImpl.logging = logging;
152
+ ReactiveNodeImpl.logging = logging;
153
153
  }
154
154
  }
155
- RxNode.shortFrameDuration = 16;
156
- RxNode.longFrameDuration = 300;
157
- RxNode.currentUpdatePriority = Priority.realtime;
158
- RxNode.frameDuration = RxNode.longFrameDuration;
155
+ ReactiveNode.shortFrameDuration = 16;
156
+ ReactiveNode.longFrameDuration = 300;
157
+ ReactiveNode.currentUpdatePriority = Priority.realtime;
158
+ ReactiveNode.frameDuration = ReactiveNode.longFrameDuration;
159
159
  export class BaseDriver {
160
160
  constructor(name, isPartition, initialize) {
161
161
  this.name = name;
@@ -183,25 +183,25 @@ export class BaseDriver {
183
183
  return node;
184
184
  }
185
185
  }
186
- export class RxNodeVariable {
186
+ export class ReactiveNodeVariable {
187
187
  constructor(defaultValue) {
188
188
  this.defaultValue = defaultValue;
189
189
  }
190
190
  set value(value) {
191
- RxNodeImpl.setNodeVariableValue(this, value);
191
+ ReactiveNodeImpl.setNodeVariableValue(this, value);
192
192
  }
193
193
  get value() {
194
- return RxNodeImpl.useNodeVariableValue(this);
194
+ return ReactiveNodeImpl.useNodeVariableValue(this);
195
195
  }
196
196
  get valueOrUndefined() {
197
- return RxNodeImpl.tryUseNodeVariableValue(this);
197
+ return ReactiveNodeImpl.tryUseNodeVariableValue(this);
198
198
  }
199
199
  }
200
200
  function generateKey(owner) {
201
201
  const n = owner.numerator++;
202
202
  const lettered = emitLetters(n);
203
203
  let result;
204
- if (RxSystem.isLogging)
204
+ if (ReactiveSystem.isLogging)
205
205
  result = `·${getCallerInfo(lettered)}`;
206
206
  else
207
207
  result = `·${lettered}`;
@@ -255,7 +255,7 @@ function invokeDestructionUsingBasisChain(element, declaration) {
255
255
  else if (basis)
256
256
  invokeDestructionUsingBasisChain(element, basis);
257
257
  }
258
- class RxNodeContextImpl extends ObservableObject {
258
+ class ReactiveNodeContextImpl extends ObservableObject {
259
259
  constructor(variable, value) {
260
260
  super();
261
261
  this.next = undefined;
@@ -266,12 +266,12 @@ class RxNodeContextImpl extends ObservableObject {
266
266
  __decorate([
267
267
  raw,
268
268
  __metadata("design:type", Object)
269
- ], RxNodeContextImpl.prototype, "next", void 0);
269
+ ], ReactiveNodeContextImpl.prototype, "next", void 0);
270
270
  __decorate([
271
271
  raw,
272
- __metadata("design:type", RxNodeVariable)
273
- ], RxNodeContextImpl.prototype, "variable", void 0);
274
- class RxNodeImpl extends RxNode {
272
+ __metadata("design:type", ReactiveNodeVariable)
273
+ ], ReactiveNodeContextImpl.prototype, "variable", void 0);
274
+ class ReactiveNodeImpl extends ReactiveNode {
275
275
  constructor(key, driver, declaration, owner) {
276
276
  super();
277
277
  const thisAsUnknown = this;
@@ -298,9 +298,9 @@ class RxNodeImpl extends RxNode {
298
298
  this.numerator = 0;
299
299
  this.priority = Priority.realtime;
300
300
  this.childrenShuffling = false;
301
- RxNodeImpl.grandNodeCount++;
301
+ ReactiveNodeImpl.grandNodeCount++;
302
302
  if (this.has(Mode.independentUpdate))
303
- RxNodeImpl.disposableNodeCount++;
303
+ ReactiveNodeImpl.disposableNodeCount++;
304
304
  }
305
305
  get strictOrder() { return this.children.isStrict; }
306
306
  set strictOrder(value) { this.children.isStrict = value; }
@@ -314,7 +314,7 @@ class RxNodeImpl extends RxNode {
314
314
  configureReactronic(options) {
315
315
  if (this.stamp < Number.MAX_SAFE_INTEGER - 1 || !this.has(Mode.independentUpdate))
316
316
  throw new Error("reactronic can be configured only for elements with independent update mode and only during activation");
317
- return RxSystem.getOperation(this.update).configure(options);
317
+ return ReactiveSystem.getOperation(this.update).configure(options);
318
318
  }
319
319
  static get ownSeat() {
320
320
  if (!gOwnSeat)
@@ -323,20 +323,20 @@ class RxNodeImpl extends RxNode {
323
323
  }
324
324
  static tryUseNodeVariableValue(variable) {
325
325
  var _a, _b;
326
- let node = RxNodeImpl.ownSeat.instance;
326
+ let node = ReactiveNodeImpl.ownSeat.instance;
327
327
  while (((_a = node.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && node.owner !== node)
328
328
  node = node.outer.seat.instance;
329
329
  return (_b = node.context) === null || _b === void 0 ? void 0 : _b.value;
330
330
  }
331
331
  static useNodeVariableValue(variable) {
332
332
  var _a;
333
- const result = (_a = RxNodeImpl.tryUseNodeVariableValue(variable)) !== null && _a !== void 0 ? _a : variable.defaultValue;
333
+ const result = (_a = ReactiveNodeImpl.tryUseNodeVariableValue(variable)) !== null && _a !== void 0 ? _a : variable.defaultValue;
334
334
  if (!result)
335
335
  throw new Error("unknown node variable");
336
336
  return result;
337
337
  }
338
338
  static setNodeVariableValue(variable, value) {
339
- const node = RxNodeImpl.ownSeat.instance;
339
+ const node = ReactiveNodeImpl.ownSeat.instance;
340
340
  const owner = node.owner;
341
341
  const hostCtx = unobs(() => { var _a; return (_a = owner.context) === null || _a === void 0 ? void 0 : _a.value; });
342
342
  if (value && value !== hostCtx) {
@@ -351,7 +351,7 @@ class RxNodeImpl extends RxNode {
351
351
  ctx.value = value;
352
352
  }
353
353
  else
354
- node.context = new RxNodeContextImpl(variable, value);
354
+ node.context = new ReactiveNodeContextImpl(variable, value);
355
355
  });
356
356
  }
357
357
  else if (hostCtx)
@@ -360,9 +360,9 @@ class RxNodeImpl extends RxNode {
360
360
  node.outer = owner.outer;
361
361
  }
362
362
  }
363
- RxNodeImpl.logging = undefined;
364
- RxNodeImpl.grandNodeCount = 0;
365
- RxNodeImpl.disposableNodeCount = 0;
363
+ ReactiveNodeImpl.logging = undefined;
364
+ ReactiveNodeImpl.grandNodeCount = 0;
365
+ ReactiveNodeImpl.disposableNodeCount = 0;
366
366
  __decorate([
367
367
  reactive,
368
368
  options({
@@ -374,7 +374,7 @@ __decorate([
374
374
  __metadata("design:type", Function),
375
375
  __metadata("design:paramtypes", [Object]),
376
376
  __metadata("design:returntype", void 0)
377
- ], RxNodeImpl.prototype, "update", null);
377
+ ], ReactiveNodeImpl.prototype, "update", null);
378
378
  function getNodeKey(node) {
379
379
  return node.stamp >= 0 ? node.key : undefined;
380
380
  }
@@ -449,29 +449,29 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
449
449
  return __awaiter(this, void 0, void 0, function* () {
450
450
  yield Transaction.requestNextFrame();
451
451
  const node = owner.instance;
452
- if (!Transaction.isCanceled || !Transaction.isFrameOver(1, RxNode.shortFrameDuration / 3)) {
453
- let outerPriority = RxNode.currentUpdatePriority;
454
- RxNode.currentUpdatePriority = priority;
452
+ if (!Transaction.isCanceled || !Transaction.isFrameOver(1, ReactiveNode.shortFrameDuration / 3)) {
453
+ let outerPriority = ReactiveNode.currentUpdatePriority;
454
+ ReactiveNode.currentUpdatePriority = priority;
455
455
  try {
456
456
  if (node.childrenShuffling)
457
457
  shuffle(items);
458
- const frameDurationLimit = priority === Priority.background ? RxNode.shortFrameDuration : Infinity;
459
- let frameDuration = Math.min(frameDurationLimit, Math.max(RxNode.frameDuration / 4, RxNode.shortFrameDuration));
458
+ const frameDurationLimit = priority === Priority.background ? ReactiveNode.shortFrameDuration : Infinity;
459
+ let frameDuration = Math.min(frameDurationLimit, Math.max(ReactiveNode.frameDuration / 4, ReactiveNode.shortFrameDuration));
460
460
  for (const child of items) {
461
461
  triggerUpdateViaSeat(child);
462
462
  if (Transaction.isFrameOver(1, frameDuration)) {
463
- RxNode.currentUpdatePriority = outerPriority;
463
+ ReactiveNode.currentUpdatePriority = outerPriority;
464
464
  yield Transaction.requestNextFrame(0);
465
- outerPriority = RxNode.currentUpdatePriority;
466
- RxNode.currentUpdatePriority = priority;
467
- frameDuration = Math.min(4 * frameDuration, Math.min(frameDurationLimit, RxNode.frameDuration));
465
+ outerPriority = ReactiveNode.currentUpdatePriority;
466
+ ReactiveNode.currentUpdatePriority = priority;
467
+ frameDuration = Math.min(4 * frameDuration, Math.min(frameDurationLimit, ReactiveNode.frameDuration));
468
468
  }
469
- if (Transaction.isCanceled && Transaction.isFrameOver(1, RxNode.shortFrameDuration / 3))
469
+ if (Transaction.isCanceled && Transaction.isFrameOver(1, ReactiveNode.shortFrameDuration / 3))
470
470
  break;
471
471
  }
472
472
  }
473
473
  finally {
474
- RxNode.currentUpdatePriority = outerPriority;
474
+ ReactiveNode.currentUpdatePriority = outerPriority;
475
475
  }
476
476
  }
477
477
  });
@@ -482,9 +482,9 @@ function triggerUpdateViaSeat(seat) {
482
482
  if (node.has(Mode.independentUpdate)) {
483
483
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
484
484
  Transaction.outside(() => {
485
- if (RxSystem.isLogging)
486
- RxSystem.setLoggingHint(node.element, node.key);
487
- RxSystem.getOperation(node.update).configure({
485
+ if (ReactiveSystem.isLogging)
486
+ ReactiveSystem.setLoggingHint(node.element, node.key);
487
+ ReactiveSystem.getOperation(node.update).configure({
488
488
  order: node.level,
489
489
  });
490
490
  });
@@ -557,7 +557,7 @@ function triggerDeactivation(seat, isLeader, individual) {
557
557
  }
558
558
  for (const child of node.children.items())
559
559
  triggerDeactivation(child, childrenAreLeaders, false);
560
- RxNodeImpl.grandNodeCount--;
560
+ ReactiveNodeImpl.grandNodeCount--;
561
561
  }
562
562
  }
563
563
  function runDisposalLoop() {
@@ -567,9 +567,9 @@ function runDisposalLoop() {
567
567
  while (seat !== undefined) {
568
568
  if (Transaction.isFrameOver(500, 5))
569
569
  yield Transaction.requestNextFrame();
570
- RxSystem.dispose(seat.instance);
570
+ ReactiveSystem.dispose(seat.instance);
571
571
  seat = seat.aux;
572
- RxNodeImpl.disposableNodeCount--;
572
+ ReactiveNodeImpl.disposableNodeCount--;
573
573
  }
574
574
  gFirstToDispose = gLastToDispose = undefined;
575
575
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.24.308",
3
+ "version": "0.24.309",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",
@@ -1,106 +0,0 @@
1
- import { LoggingOptions } from "../Logging.js";
2
- import { MergeListReader, MergedItem } from "../util/MergeList.js";
3
- import { MemberOptions } from "../Options.js";
4
- export type Script<E> = (el: E, basis: () => void) => void;
5
- export type ScriptAsync<E> = (el: E, basis: () => Promise<void>) => Promise<void>;
6
- export type Handler<E = unknown, R = void> = (el: E) => R;
7
- export declare enum Mode {
8
- default = 0,
9
- independentUpdate = 1,
10
- manualMount = 2
11
- }
12
- export declare enum Priority {
13
- realtime = 0,
14
- normal = 1,
15
- background = 2
16
- }
17
- export declare abstract class RxNode<E = unknown> {
18
- abstract readonly key: string;
19
- abstract readonly driver: RxNodeDriver<E>;
20
- abstract readonly declaration: Readonly<RxNodeDecl<E>>;
21
- abstract readonly level: number;
22
- abstract readonly owner: RxNode;
23
- abstract element: E;
24
- abstract readonly host: RxNode;
25
- abstract readonly children: MergeListReader<RxNode>;
26
- abstract readonly seat: MergedItem<RxNode<E>> | undefined;
27
- abstract readonly stamp: number;
28
- abstract readonly outer: RxNode;
29
- abstract readonly context: RxNodeContext | undefined;
30
- abstract priority?: Priority;
31
- abstract childrenShuffling: boolean;
32
- abstract strictOrder: boolean;
33
- abstract has(mode: Mode): boolean;
34
- abstract configureReactronic(options: Partial<MemberOptions>): MemberOptions;
35
- static readonly shortFrameDuration = 16;
36
- static readonly longFrameDuration = 300;
37
- static currentUpdatePriority: Priority;
38
- static frameDuration: number;
39
- static declare<E = void>(driver: RxNodeDriver<E>, script?: Script<E>, scriptAsync?: ScriptAsync<E>, key?: string, mode?: Mode, creation?: Script<E>, creationAsync?: ScriptAsync<E>, destruction?: Script<E>, triggers?: unknown, basis?: RxNodeDecl<E>): RxNode<E>;
40
- static declare<E = void>(driver: RxNodeDriver<E>, declaration?: RxNodeDecl<E>): RxNode<E>;
41
- static declare<E = void>(driver: RxNodeDriver<E>, scriptOrDeclaration?: Script<E> | RxNodeDecl<E>, scriptAsync?: ScriptAsync<E>, key?: string, mode?: Mode, creation?: Script<E>, creationAsync?: ScriptAsync<E>, destruction?: Script<E>, triggers?: unknown, basis?: RxNodeDecl<E>): RxNode<E>;
42
- static rebased<E = void>(declaration?: RxNodeDecl<E>, basis?: RxNodeDecl<E>): RxNodeDecl<E>;
43
- static get isFirstUpdate(): boolean;
44
- static get key(): string;
45
- static get stamp(): number;
46
- static get triggers(): unknown;
47
- static get priority(): Priority;
48
- static set priority(value: Priority);
49
- static get childrenShuffling(): boolean;
50
- static set childrenShuffling(value: boolean);
51
- static triggerUpdate(node: RxNode<any>, triggers: unknown): void;
52
- static triggerDeactivation(node: RxNode<any>): void;
53
- static updateNestedNodesThenDo(action: (error: unknown) => void): void;
54
- static markAsMounted(node: RxNode<any>, yes: boolean): void;
55
- static findMatchingHost<E = unknown, R = unknown>(node: RxNode<E>, match: Handler<RxNode<E>, boolean>): RxNode<R> | undefined;
56
- static findMatchingPrevSibling<E = unknown, R = unknown>(node: RxNode<E>, match: Handler<RxNode<E>, boolean>): RxNode<R> | undefined;
57
- static forEachChildRecursively<E = unknown>(node: RxNode<E>, action: Handler<RxNode<E>>): void;
58
- static getDefaultLoggingOptions(): LoggingOptions | undefined;
59
- static setDefaultLoggingOptions(logging?: LoggingOptions): void;
60
- }
61
- export type RxNodeDecl<E = unknown> = {
62
- script?: Script<E>;
63
- scriptAsync?: ScriptAsync<E>;
64
- key?: string;
65
- mode?: Mode;
66
- creation?: Script<E>;
67
- creationAsync?: ScriptAsync<E>;
68
- destruction?: Script<E>;
69
- triggers?: unknown;
70
- basis?: RxNodeDecl<E>;
71
- };
72
- export type RxNodeDriver<E = unknown> = {
73
- readonly name: string;
74
- readonly isPartition: boolean;
75
- readonly initialize?: Handler<E>;
76
- allocate(node: RxNode<E>): E;
77
- create(node: RxNode<E>): void;
78
- destroy(node: RxNode<E>, isLeader: boolean): boolean;
79
- mount(node: RxNode<E>): void;
80
- update(node: RxNode<E>): void | Promise<void>;
81
- child(ownerNode: RxNode<E>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any>, childBasis?: RxNodeDecl<any>): MergedItem<RxNode> | undefined;
82
- getHost(node: RxNode<E>): RxNode<E>;
83
- };
84
- export type RxNodeContext<T extends Object = Object> = {
85
- value: T;
86
- };
87
- export declare abstract class BaseDriver<E = unknown> implements RxNodeDriver<E> {
88
- readonly name: string;
89
- readonly isPartition: boolean;
90
- readonly initialize?: Handler<E> | undefined;
91
- constructor(name: string, isPartition: boolean, initialize?: Handler<E> | undefined);
92
- abstract allocate(node: RxNode<E>): E;
93
- create(node: RxNode<E>): void | Promise<void>;
94
- destroy(node: RxNode<E>, isLeader: boolean): boolean;
95
- mount(node: RxNode<E>): void;
96
- update(node: RxNode<E>): void | Promise<void>;
97
- child(ownerNode: RxNode<E>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any>, childBasis?: RxNodeDecl<any>): MergedItem<RxNode> | undefined;
98
- getHost(node: RxNode<E>): RxNode<E>;
99
- }
100
- export declare class RxNodeVariable<T extends Object = Object> {
101
- readonly defaultValue: T | undefined;
102
- constructor(defaultValue?: T);
103
- set value(value: T);
104
- get value(): T;
105
- get valueOrUndefined(): T | undefined;
106
- }