reactronic 0.24.112 → 0.24.114
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.
- package/build/dist/source/Clock.d.ts +1 -1
- package/build/dist/source/Clock.js +1 -1
- package/build/dist/source/Options.d.ts +3 -3
- package/build/dist/source/Pipe.d.ts +1 -1
- package/build/dist/source/Pipe.js +1 -1
- package/build/dist/source/Reaction.d.ts +1 -1
- package/build/dist/source/Reaction.js +1 -1
- package/build/dist/source/Ref.js +1 -1
- package/build/dist/source/RxSystem.js +5 -5
- package/build/dist/source/api.d.ts +10 -10
- package/build/dist/source/api.js +9 -9
- package/build/dist/source/{RxNode.d.ts → tree/RxNode.d.ts} +3 -5
- package/build/dist/source/{RxNode.js → tree/RxNode.js} +1 -1
- package/build/dist/source/{RxTree.d.ts → tree/RxTree.d.ts} +1 -1
- package/build/dist/source/{RxTree.js → tree/RxTree.js} +21 -25
- package/package.json +1 -1
- /package/build/dist/source/{impl → core}/Changeset.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Changeset.js +0 -0
- /package/build/dist/source/{impl → core}/Data.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Data.js +0 -0
- /package/build/dist/source/{impl → core}/Journal.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Journal.js +0 -0
- /package/build/dist/source/{impl → core}/Meta.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Meta.js +0 -0
- /package/build/dist/source/{impl → core}/Monitor.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Monitor.js +0 -0
- /package/build/dist/source/{impl → core}/Mvcc.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Mvcc.js +0 -0
- /package/build/dist/source/{impl → core}/MvccArray.d.ts +0 -0
- /package/build/dist/source/{impl → core}/MvccArray.js +0 -0
- /package/build/dist/source/{impl → core}/MvccMap.d.ts +0 -0
- /package/build/dist/source/{impl → core}/MvccMap.js +0 -0
- /package/build/dist/source/{impl → core}/MvccMergeList.d.ts +0 -0
- /package/build/dist/source/{impl → core}/MvccMergeList.js +0 -0
- /package/build/dist/source/{impl → core}/Reaction.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Reaction.js +0 -0
- /package/build/dist/source/{impl → core}/Transaction.d.ts +0 -0
- /package/build/dist/source/{impl → core}/Transaction.js +0 -0
- /package/build/dist/source/{util → tree}/RxNodeUtils.d.ts +0 -0
- /package/build/dist/source/{util → tree}/RxNodeUtils.js +0 -0
|
@@ -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 './
|
|
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 './
|
|
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 './
|
|
6
|
-
import { Monitor } from './
|
|
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;
|
|
@@ -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 './
|
|
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) {
|
package/build/dist/source/Ref.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Log } from './util/Dbg.js';
|
|
2
2
|
import { Kind } from './Options.js';
|
|
3
|
-
import { Meta, ObjectHandle } from './
|
|
4
|
-
import { Changeset } from './
|
|
5
|
-
import { Mvcc } from './
|
|
6
|
-
import { Transaction } from './
|
|
7
|
-
import { ReactionImpl } from './
|
|
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 './
|
|
13
|
-
export { TransactionalArray, ObservableArray } from './
|
|
14
|
-
export { TransactionalMap, ObservableMap } from './
|
|
15
|
-
export { Changeset } from './
|
|
16
|
-
export { Transaction } from './
|
|
17
|
-
export { Monitor } from './
|
|
18
|
-
export { Journal } from './
|
|
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, RxElement, RxNode, RxNodeDecl, RxNodeDriver, RxNodeContext } from './tree/RxNode.js';
|
|
22
|
+
export { RxTree, BaseDriver, RxNodeVariable } from './tree/RxTree.js';
|
|
23
23
|
export { Clock } from './Clock.js';
|
package/build/dist/source/api.js
CHANGED
|
@@ -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 './
|
|
9
|
-
export { TransactionalArray, ObservableArray } from './
|
|
10
|
-
export { TransactionalMap, ObservableMap } from './
|
|
11
|
-
export { Changeset } from './
|
|
12
|
-
export { Transaction } from './
|
|
13
|
-
export { Monitor } from './
|
|
14
|
-
export { Journal } from './
|
|
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,10 +1,10 @@
|
|
|
1
|
-
import { MergeListReader, MergedItem } from '
|
|
2
|
-
import { MemberOptions } from '
|
|
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 {
|
|
6
6
|
Default = 0,
|
|
7
|
-
|
|
7
|
+
IndependentUpdate = 1,
|
|
8
8
|
ManualMount = 2
|
|
9
9
|
}
|
|
10
10
|
export declare const enum Priority {
|
|
@@ -40,8 +40,6 @@ export interface RxNodeDecl<E extends RxElement> {
|
|
|
40
40
|
key?: string;
|
|
41
41
|
mode?: Mode;
|
|
42
42
|
triggers?: unknown;
|
|
43
|
-
specify?: Delegate<E>;
|
|
44
|
-
create?: Delegate<E>;
|
|
45
43
|
initialize?: Delegate<E>;
|
|
46
44
|
update?: Delegate<E>;
|
|
47
45
|
finalize?: Delegate<E>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export var Mode;
|
|
2
2
|
(function (Mode) {
|
|
3
3
|
Mode[Mode["Default"] = 0] = "Default";
|
|
4
|
-
Mode[Mode["
|
|
4
|
+
Mode[Mode["IndependentUpdate"] = 1] = "IndependentUpdate";
|
|
5
5
|
Mode[Mode["ManualMount"] = 2] = "ManualMount";
|
|
6
6
|
})(Mode || (Mode = {}));
|
|
7
7
|
export var Priority;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoggingOptions } from '
|
|
1
|
+
import { LoggingOptions } from '../Logging.js';
|
|
2
2
|
import { Priority, RxNodeDecl, RxNodeDriver, SimpleDelegate, RxNode, RxElement } from './RxNode.js';
|
|
3
3
|
export declare class RxTree {
|
|
4
4
|
static readonly shortFrameDuration = 16;
|
|
@@ -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 '
|
|
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;
|
|
@@ -62,7 +62,7 @@ export class RxTree {
|
|
|
62
62
|
const node = new RxNodeImpl(key || '', driver, declaration, owner);
|
|
63
63
|
node.seat = MergeList.createItem(node);
|
|
64
64
|
result = node.element;
|
|
65
|
-
|
|
65
|
+
triggerSeatUpdate(node.seat);
|
|
66
66
|
}
|
|
67
67
|
return result;
|
|
68
68
|
}
|
|
@@ -71,7 +71,7 @@ export class RxTree {
|
|
|
71
71
|
const declaration = node.declaration;
|
|
72
72
|
if (!triggersAreEqual(triggers, declaration.triggers)) {
|
|
73
73
|
declaration.triggers = triggers;
|
|
74
|
-
|
|
74
|
+
triggerSeatUpdate(node.seat);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
static updateNestedTreesThenDo(action) {
|
|
@@ -220,7 +220,7 @@ class RxNodeImpl {
|
|
|
220
220
|
this.priority = Priority.Realtime;
|
|
221
221
|
this.childrenShuffling = false;
|
|
222
222
|
RxNodeImpl.grandNodeCount++;
|
|
223
|
-
if (this.has(Mode.
|
|
223
|
+
if (this.has(Mode.IndependentUpdate))
|
|
224
224
|
RxNodeImpl.disposableNodeCount++;
|
|
225
225
|
}
|
|
226
226
|
get isInitialUpdate() { return this.stamp === 1; }
|
|
@@ -234,8 +234,8 @@ class RxNodeImpl {
|
|
|
234
234
|
updateNow(this.seat);
|
|
235
235
|
}
|
|
236
236
|
configureReactronic(options) {
|
|
237
|
-
if (this.stamp < Number.MAX_SAFE_INTEGER - 1 || !this.has(Mode.
|
|
238
|
-
throw new Error('reactronic can be configured only for elements with
|
|
237
|
+
if (this.stamp < Number.MAX_SAFE_INTEGER - 1 || !this.has(Mode.IndependentUpdate))
|
|
238
|
+
throw new Error('reactronic can be configured only for elements with independent update mode and only inside initialize');
|
|
239
239
|
return RxSystem.getReaction(this.update).configure(options);
|
|
240
240
|
}
|
|
241
241
|
static get current() {
|
|
@@ -319,20 +319,19 @@ function runUpdateNestedTreesThenDo(error, action) {
|
|
|
319
319
|
for (const child of children.items()) {
|
|
320
320
|
if (Transaction.isCanceled)
|
|
321
321
|
break;
|
|
322
|
-
const
|
|
323
|
-
const
|
|
324
|
-
const isPart = node.driver.isPartitionSeparator;
|
|
322
|
+
const childNode = child.instance;
|
|
323
|
+
const isPart = childNode.driver.isPartitionSeparator;
|
|
325
324
|
const host = isPart ? owner : partition;
|
|
326
|
-
const p = (_a =
|
|
325
|
+
const p = (_a = childNode.priority) !== null && _a !== void 0 ? _a : Priority.Realtime;
|
|
327
326
|
mounting = markToMountIfNecessary(mounting, host, child, children, sequential);
|
|
328
327
|
if (p === Priority.Realtime)
|
|
329
|
-
|
|
328
|
+
triggerSeatUpdate(child);
|
|
330
329
|
else if (p === Priority.Normal)
|
|
331
330
|
p1 = push(child, p1);
|
|
332
331
|
else
|
|
333
332
|
p2 = push(child, p2);
|
|
334
333
|
if (isPart)
|
|
335
|
-
partition =
|
|
334
|
+
partition = childNode;
|
|
336
335
|
}
|
|
337
336
|
if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
|
|
338
337
|
promised = startIncrementalUpdate(curr, children, p1, p2).then(() => action(error), e => action(e));
|
|
@@ -346,8 +345,7 @@ function runUpdateNestedTreesThenDo(error, action) {
|
|
|
346
345
|
}
|
|
347
346
|
function markToMountIfNecessary(mounting, host, seat, children, sequential) {
|
|
348
347
|
const node = seat.instance;
|
|
349
|
-
|
|
350
|
-
if (el.native && !node.has(Mode.ManualMount)) {
|
|
348
|
+
if (node.element.native && !node.has(Mode.ManualMount)) {
|
|
351
349
|
if (mounting || node.host !== host) {
|
|
352
350
|
children.markAsMoved(seat);
|
|
353
351
|
mounting = false;
|
|
@@ -380,7 +378,7 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
380
378
|
const frameDurationLimit = priority === Priority.Background ? RxTree.shortFrameDuration : Infinity;
|
|
381
379
|
let frameDuration = Math.min(frameDurationLimit, Math.max(RxTree.frameDuration / 4, RxTree.shortFrameDuration));
|
|
382
380
|
for (const child of items) {
|
|
383
|
-
|
|
381
|
+
triggerSeatUpdate(child);
|
|
384
382
|
if (Transaction.isFrameOver(1, frameDuration)) {
|
|
385
383
|
RxTree.currentUpdatePriority = outerPriority;
|
|
386
384
|
yield Transaction.requestNextFrame(0);
|
|
@@ -398,10 +396,10 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
398
396
|
}
|
|
399
397
|
});
|
|
400
398
|
}
|
|
401
|
-
function
|
|
399
|
+
function triggerSeatUpdate(seat) {
|
|
402
400
|
const node = seat.instance;
|
|
403
401
|
if (node.stamp >= 0) {
|
|
404
|
-
if (node.has(Mode.
|
|
402
|
+
if (node.has(Mode.IndependentUpdate)) {
|
|
405
403
|
if (node.stamp === Number.MAX_SAFE_INTEGER) {
|
|
406
404
|
Transaction.outside(() => {
|
|
407
405
|
if (RxSystem.isLogging)
|
|
@@ -472,9 +470,7 @@ function triggerFinalization(seat, isLeader, individual) {
|
|
|
472
470
|
console.log(`WARNING: it is recommended to assign explicit key for conditional element in order to avoid unexpected side effects: ${node.key}`);
|
|
473
471
|
node.stamp = ~node.stamp;
|
|
474
472
|
const childrenAreLeaders = unobs(() => driver.finalize(el, isLeader));
|
|
475
|
-
|
|
476
|
-
el.controller = null;
|
|
477
|
-
if (node.has(Mode.PinpointUpdate)) {
|
|
473
|
+
if (node.has(Mode.IndependentUpdate)) {
|
|
478
474
|
seat.aux = undefined;
|
|
479
475
|
const last = gLastToDispose;
|
|
480
476
|
if (last)
|
package/package.json
CHANGED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|