reactronic 0.24.123 → 0.24.125
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/README.md +5 -5
- package/build/dist/source/Clock.d.ts +1 -1
- package/build/dist/source/Clock.js +2 -2
- package/build/dist/source/Logging.d.ts +4 -4
- package/build/dist/source/Logging.js +6 -6
- package/build/dist/source/Options.d.ts +12 -12
- package/build/dist/source/Options.js +1 -1
- package/build/dist/source/Pipe.d.ts +1 -1
- package/build/dist/source/Pipe.js +2 -2
- package/build/dist/source/Reaction.d.ts +2 -2
- package/build/dist/source/Reaction.js +2 -2
- package/build/dist/source/Ref.js +4 -4
- package/build/dist/source/RxSystem.d.ts +2 -2
- package/build/dist/source/RxSystem.js +7 -7
- package/build/dist/source/Worker.d.ts +3 -3
- package/build/dist/source/api.d.ts +23 -23
- package/build/dist/source/api.js +18 -18
- package/build/dist/source/core/Changeset.d.ts +2 -2
- package/build/dist/source/core/Changeset.js +33 -33
- package/build/dist/source/core/Data.d.ts +11 -11
- package/build/dist/source/core/Data.js +3 -3
- package/build/dist/source/core/Journal.d.ts +2 -2
- package/build/dist/source/core/Journal.js +12 -12
- package/build/dist/source/core/Meta.js +7 -7
- package/build/dist/source/core/Monitor.d.ts +2 -2
- package/build/dist/source/core/Monitor.js +6 -6
- package/build/dist/source/core/Mvcc.d.ts +6 -6
- package/build/dist/source/core/Mvcc.js +8 -8
- package/build/dist/source/core/MvccArray.d.ts +1 -1
- package/build/dist/source/core/MvccArray.js +2 -2
- package/build/dist/source/core/MvccMap.d.ts +1 -1
- package/build/dist/source/core/MvccMap.js +2 -2
- package/build/dist/source/core/MvccMergeList.d.ts +2 -2
- package/build/dist/source/core/MvccMergeList.js +1 -1
- package/build/dist/source/core/Reaction.d.ts +6 -6
- package/build/dist/source/core/Reaction.js +59 -59
- package/build/dist/source/core/RxNode.d.ts +9 -9
- package/build/dist/source/core/RxNode.js +15 -15
- package/build/dist/source/core/Transaction.d.ts +4 -4
- package/build/dist/source/core/Transaction.js +13 -13
- package/build/dist/source/util/Dbg.d.ts +1 -1
- package/build/dist/source/util/Dbg.js +11 -11
- package/build/dist/source/util/MergeList.d.ts +4 -4
- package/build/dist/source/util/MergeList.js +5 -5
- package/build/dist/source/util/Sealant.d.ts +4 -4
- package/build/dist/source/util/Sealant.js +5 -5
- package/build/dist/source/util/SealedArray.d.ts +1 -1
- package/build/dist/source/util/SealedArray.js +2 -2
- package/build/dist/source/util/SealedMap.d.ts +1 -1
- package/build/dist/source/util/SealedMap.js +2 -2
- package/build/dist/source/util/SealedSet.d.ts +1 -1
- package/build/dist/source/util/SealedSet.js +2 -2
- package/build/dist/source/util/Utils.js +14 -14
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { Meta } from
|
|
2
|
-
export
|
|
1
|
+
export { Meta } from "./Meta.js";
|
|
2
|
+
export type AbstractChangeset = {
|
|
3
3
|
readonly id: number;
|
|
4
4
|
readonly hint: string;
|
|
5
5
|
readonly timestamp: number;
|
|
6
6
|
readonly sealed: boolean;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class ValueSnapshot<T = any> {
|
|
9
9
|
content: T;
|
|
10
10
|
observers?: Set<Observer>;
|
|
@@ -12,20 +12,20 @@ export declare class ValueSnapshot<T = any> {
|
|
|
12
12
|
get originSnapshotId(): number | undefined;
|
|
13
13
|
constructor(content: T);
|
|
14
14
|
}
|
|
15
|
-
export type SeparationMode = boolean |
|
|
16
|
-
export
|
|
15
|
+
export type SeparationMode = boolean | "isolated" | "disposal";
|
|
16
|
+
export type Observer = {
|
|
17
17
|
readonly order: number;
|
|
18
18
|
readonly observables: Map<ValueSnapshot, Subscription> | undefined;
|
|
19
19
|
readonly obsoleteSince: number;
|
|
20
20
|
hint(nop?: boolean): string;
|
|
21
21
|
markObsoleteDueTo(observable: ValueSnapshot, m: MemberName, changeset: AbstractChangeset, h: ObjectHandle, outer: string, since: number, reactive: Array<Observer>): void;
|
|
22
22
|
relaunchIfNotUpToDate(now: boolean, nothrow: boolean): void;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
export type MemberName = PropertyKey;
|
|
25
|
-
export
|
|
25
|
+
export type Subscription = {
|
|
26
26
|
readonly memberHint: string;
|
|
27
27
|
readonly usageCount: number;
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
export declare class ObjectSnapshot {
|
|
30
30
|
readonly changeset: AbstractChangeset;
|
|
31
31
|
readonly former: {
|
|
@@ -52,9 +52,9 @@ export declare class ObjectHandle {
|
|
|
52
52
|
static getHint(obj: object, full: boolean): string | undefined;
|
|
53
53
|
}
|
|
54
54
|
export type PatchSet = Map<object, Map<MemberName, ValuePatch>>;
|
|
55
|
-
export
|
|
55
|
+
export type ValuePatch = {
|
|
56
56
|
memberName: MemberName;
|
|
57
|
-
patchKind:
|
|
57
|
+
patchKind: "update" | "add" | "remove";
|
|
58
58
|
freshValue: any;
|
|
59
59
|
formerValue: any;
|
|
60
|
-
}
|
|
60
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Log } from
|
|
2
|
-
import { Meta } from
|
|
3
|
-
export { Meta } from
|
|
1
|
+
import { Log } from "../util/Dbg.js";
|
|
2
|
+
import { Meta } from "./Meta.js";
|
|
3
|
+
export { Meta } from "./Meta.js";
|
|
4
4
|
export class ValueSnapshot {
|
|
5
5
|
get isOperation() { return false; }
|
|
6
6
|
get originSnapshotId() { return 0; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ObservableObject } from
|
|
2
|
-
import { ObjectHandle, ObjectSnapshot, PatchSet } from
|
|
1
|
+
import { ObservableObject } from "./Mvcc.js";
|
|
2
|
+
import { ObjectHandle, ObjectSnapshot, PatchSet } from "./Data.js";
|
|
3
3
|
export type Saver = (patch: PatchSet) => Promise<void>;
|
|
4
4
|
export declare abstract class Journal extends ObservableObject {
|
|
5
5
|
abstract capacity: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ObservableObject } from
|
|
2
|
-
import { Meta, ValueSnapshot } from
|
|
3
|
-
import { Changeset, EMPTY_SNAPSHOT } from
|
|
4
|
-
import { Transaction } from
|
|
5
|
-
import { Sealant } from
|
|
1
|
+
import { ObservableObject } from "./Mvcc.js";
|
|
2
|
+
import { Meta, ValueSnapshot } from "./Data.js";
|
|
3
|
+
import { Changeset, EMPTY_SNAPSHOT } from "./Changeset.js";
|
|
4
|
+
import { Transaction } from "./Transaction.js";
|
|
5
|
+
import { Sealant } from "../util/Sealant.js";
|
|
6
6
|
export class Journal extends ObservableObject {
|
|
7
7
|
static create() { return new JournalImpl(); }
|
|
8
8
|
}
|
|
@@ -22,7 +22,7 @@ export class JournalImpl extends Journal {
|
|
|
22
22
|
get canUndo() { return this._edits.length > 0 && this._position > 0; }
|
|
23
23
|
get canRedo() { return this._position < this._edits.length; }
|
|
24
24
|
edited(p) {
|
|
25
|
-
Transaction.run({ hint:
|
|
25
|
+
Transaction.run({ hint: "EditJournal.edited", separation: "isolated" }, () => {
|
|
26
26
|
const items = this._edits = this._edits.toMutable();
|
|
27
27
|
if (items.length >= this._capacity)
|
|
28
28
|
items.shift();
|
|
@@ -37,10 +37,10 @@ export class JournalImpl extends Journal {
|
|
|
37
37
|
if (this._unsaved === patch)
|
|
38
38
|
this._unsaved = new Map();
|
|
39
39
|
else
|
|
40
|
-
throw new Error(
|
|
40
|
+
throw new Error("not implemented");
|
|
41
41
|
}
|
|
42
42
|
undo(count = 1) {
|
|
43
|
-
Transaction.run({ hint:
|
|
43
|
+
Transaction.run({ hint: "Journal.undo", separation: "isolated" }, () => {
|
|
44
44
|
let i = this._position - 1;
|
|
45
45
|
while (i >= 0 && count > 0) {
|
|
46
46
|
const patch = this._edits[i];
|
|
@@ -52,7 +52,7 @@ export class JournalImpl extends Journal {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
redo(count = 1) {
|
|
55
|
-
Transaction.run({ hint:
|
|
55
|
+
Transaction.run({ hint: "Journal.redo", separation: "isolated" }, () => {
|
|
56
56
|
let i = this._position;
|
|
57
57
|
while (i < this._edits.length && count > 0) {
|
|
58
58
|
const patch = this._edits[i];
|
|
@@ -70,7 +70,7 @@ export class JournalImpl extends Journal {
|
|
|
70
70
|
const former = os.former.snapshot !== EMPTY_SNAPSHOT ? os.former.snapshot.data : undefined;
|
|
71
71
|
os.changes.forEach(m => {
|
|
72
72
|
const vp = {
|
|
73
|
-
memberName: m, patchKind:
|
|
73
|
+
memberName: m, patchKind: "update",
|
|
74
74
|
freshValue: unseal(os.data[m]), formerValue: undefined,
|
|
75
75
|
};
|
|
76
76
|
if (former)
|
|
@@ -79,7 +79,7 @@ export class JournalImpl extends Journal {
|
|
|
79
79
|
});
|
|
80
80
|
if (!former) {
|
|
81
81
|
const vp = {
|
|
82
|
-
memberName: Meta.Revision, patchKind:
|
|
82
|
+
memberName: Meta.Revision, patchKind: "remove",
|
|
83
83
|
freshValue: Meta.Undefined, formerValue: undefined,
|
|
84
84
|
};
|
|
85
85
|
op.set(Meta.Revision, vp);
|
|
@@ -119,7 +119,7 @@ export class JournalImpl extends Journal {
|
|
|
119
119
|
let merged = result.get(m);
|
|
120
120
|
if (!merged)
|
|
121
121
|
result.set(m, merged = {
|
|
122
|
-
memberName: m, patchKind:
|
|
122
|
+
memberName: m, patchKind: "update",
|
|
123
123
|
freshValue: undefined, formerValue: undefined,
|
|
124
124
|
});
|
|
125
125
|
const value = undoing ? vp.formerValue : vp.freshValue;
|
|
@@ -20,10 +20,10 @@ export class Meta {
|
|
|
20
20
|
return (_a = proto[sym]) !== null && _a !== void 0 ? _a : EMPTY_META;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
Meta.Handle = Symbol(
|
|
24
|
-
Meta.Revision = Symbol(
|
|
25
|
-
Meta.Controller = Symbol(
|
|
26
|
-
Meta.Initial = Symbol(
|
|
27
|
-
Meta.Reactive = Symbol(
|
|
28
|
-
Meta.Raw = Symbol(
|
|
29
|
-
Meta.Undefined = Symbol(
|
|
23
|
+
Meta.Handle = Symbol("rx-handle");
|
|
24
|
+
Meta.Revision = Symbol("rx-revision");
|
|
25
|
+
Meta.Controller = Symbol("rx-controller");
|
|
26
|
+
Meta.Initial = Symbol("rx-initial");
|
|
27
|
+
Meta.Reactive = Symbol("rx-reactive");
|
|
28
|
+
Meta.Raw = Symbol("rx-raw");
|
|
29
|
+
Meta.Undefined = Symbol("rx-undefined");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Worker } from
|
|
2
|
-
import { ObservableObject } from
|
|
1
|
+
import { Worker } from "../Worker.js";
|
|
2
|
+
import { ObservableObject } from "./Mvcc.js";
|
|
3
3
|
export declare abstract class Monitor extends ObservableObject {
|
|
4
4
|
abstract readonly isActive: boolean;
|
|
5
5
|
abstract readonly counter: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ObservableObject, Mvcc } from
|
|
2
|
-
import { Transaction } from
|
|
1
|
+
import { ObservableObject, Mvcc } from "./Mvcc.js";
|
|
2
|
+
import { Transaction } from "./Transaction.js";
|
|
3
3
|
export class Monitor extends ObservableObject {
|
|
4
4
|
static create(hint, activationDelay, deactivationDelay, durationResolution) {
|
|
5
5
|
return MonitorImpl.create(hint, activationDelay, deactivationDelay, durationResolution);
|
|
@@ -34,7 +34,7 @@ export class MonitorImpl extends Monitor {
|
|
|
34
34
|
MonitorImpl.deactivate(this, this.internals.deactivationDelay);
|
|
35
35
|
}
|
|
36
36
|
static create(hint, activationDelay, deactivationDelay, durationResolution) {
|
|
37
|
-
return Transaction.run({ hint:
|
|
37
|
+
return Transaction.run({ hint: "Monitor.create" }, MonitorImpl.doCreate, hint, activationDelay, deactivationDelay, durationResolution);
|
|
38
38
|
}
|
|
39
39
|
static enter(mon, worker) {
|
|
40
40
|
mon.enter(worker);
|
|
@@ -59,7 +59,7 @@ export class MonitorImpl extends Monitor {
|
|
|
59
59
|
}
|
|
60
60
|
if (delay >= 0) {
|
|
61
61
|
if (mon.internals.activationTimeout === undefined)
|
|
62
|
-
mon.internals.activationTimeout = setTimeout(() => Transaction.run({ hint:
|
|
62
|
+
mon.internals.activationTimeout = setTimeout(() => Transaction.run({ hint: "Monitor.activate", separation: "isolated" }, MonitorImpl.activate, mon, -1), delay);
|
|
63
63
|
}
|
|
64
64
|
else if (active)
|
|
65
65
|
mon.isActive = true;
|
|
@@ -67,7 +67,7 @@ export class MonitorImpl extends Monitor {
|
|
|
67
67
|
static deactivate(mon, delay) {
|
|
68
68
|
if (delay >= 0) {
|
|
69
69
|
clearTimeout(mon.internals.deactivationTimeout);
|
|
70
|
-
mon.internals.deactivationTimeout = setTimeout(() => Transaction.run({ hint:
|
|
70
|
+
mon.internals.deactivationTimeout = setTimeout(() => Transaction.run({ hint: "Monitor.deactivate", separation: "isolated" }, MonitorImpl.deactivate, mon, -1), delay);
|
|
71
71
|
}
|
|
72
72
|
else if (mon.counter <= 0) {
|
|
73
73
|
mon.isActive = false;
|
|
@@ -92,5 +92,5 @@ export class MonitorImpl extends Monitor {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
const MONITOR_TICK_OPTIONS = Object.freeze({
|
|
95
|
-
hint:
|
|
95
|
+
hint: "Monitor.tick",
|
|
96
96
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F } from
|
|
2
|
-
import { MemberOptions, Kind, Reentrance } from
|
|
3
|
-
import { LoggingOptions, ProfilingOptions } from
|
|
4
|
-
import { MemberName, ObjectHandle, SeparationMode } from
|
|
5
|
-
import { Journal } from
|
|
6
|
-
import { Monitor } from
|
|
1
|
+
import { F } from "../util/Utils.js";
|
|
2
|
+
import { MemberOptions, Kind, Reentrance } from "../Options.js";
|
|
3
|
+
import { LoggingOptions, ProfilingOptions } from "../Logging.js";
|
|
4
|
+
import { MemberName, ObjectHandle, SeparationMode } from "./Data.js";
|
|
5
|
+
import { Journal } from "./Journal.js";
|
|
6
|
+
import { Monitor } from "./Monitor.js";
|
|
7
7
|
export declare abstract class MvccObject {
|
|
8
8
|
protected constructor(observable: boolean);
|
|
9
9
|
[Symbol.toStringTag](): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { UNDEF } from
|
|
2
|
-
import { Log, misuse } from
|
|
3
|
-
import { Kind, Reentrance } from
|
|
4
|
-
import { ObjectSnapshot, ObjectHandle, ValueSnapshot, Meta } from
|
|
5
|
-
import { Changeset, Dump, EMPTY_SNAPSHOT } from
|
|
1
|
+
import { UNDEF } from "../util/Utils.js";
|
|
2
|
+
import { Log, misuse } from "../util/Dbg.js";
|
|
3
|
+
import { Kind, Reentrance } from "../Options.js";
|
|
4
|
+
import { ObjectSnapshot, ObjectHandle, ValueSnapshot, Meta } from "./Data.js";
|
|
5
|
+
import { Changeset, Dump, EMPTY_SNAPSHOT } from "./Changeset.js";
|
|
6
6
|
export class MvccObject {
|
|
7
7
|
constructor(observable) {
|
|
8
8
|
const proto = new.target.prototype;
|
|
@@ -190,7 +190,7 @@ export class Mvcc {
|
|
|
190
190
|
let h = obj[Meta.Handle];
|
|
191
191
|
if (!h) {
|
|
192
192
|
if (obj !== Object(obj) || Array.isArray(obj))
|
|
193
|
-
throw misuse(
|
|
193
|
+
throw misuse("only objects can be observable");
|
|
194
194
|
const initial = Meta.getFrom(Object.getPrototypeOf(obj), Meta.Initial);
|
|
195
195
|
const os = new ObjectSnapshot(EMPTY_SNAPSHOT.changeset, EMPTY_SNAPSHOT, Object.assign({}, initial));
|
|
196
196
|
h = new ObjectHandle(obj, obj, Mvcc.observable, os, obj.constructor.name);
|
|
@@ -254,10 +254,10 @@ Mvcc.sensitivity = false;
|
|
|
254
254
|
Mvcc.transactional = new Mvcc(false);
|
|
255
255
|
Mvcc.observable = new Mvcc(true);
|
|
256
256
|
Mvcc.createOperation = function (h, m, options) {
|
|
257
|
-
throw misuse(
|
|
257
|
+
throw misuse("this implementation of createOperation should never be called");
|
|
258
258
|
};
|
|
259
259
|
Mvcc.rememberOperationOptions = function (proto, m, getter, setter, enumerable, configurable, options, implicit) {
|
|
260
|
-
throw misuse(
|
|
260
|
+
throw misuse("this implementation of rememberOperationOptions should never be called");
|
|
261
261
|
};
|
|
262
262
|
const EMPTY_PROP_DESCRIPTOR = {
|
|
263
263
|
configurable: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Sealant } from
|
|
2
|
-
import { MvccObject } from
|
|
1
|
+
import { Sealant } from "../util/Sealant.js";
|
|
2
|
+
import { MvccObject } from "./Mvcc.js";
|
|
3
3
|
export class MvccArray extends MvccObject {
|
|
4
4
|
constructor(isObservable, array) {
|
|
5
5
|
super(isObservable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Sealant } from
|
|
2
|
-
import { MvccObject } from
|
|
1
|
+
import { Sealant } from "../util/Sealant.js";
|
|
2
|
+
import { MvccObject } from "./Mvcc.js";
|
|
3
3
|
export class MvccMap extends MvccObject {
|
|
4
4
|
constructor(isObservable, map) {
|
|
5
5
|
super(isObservable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MergeList, MergedItem, MergeListReader } from
|
|
2
|
-
import { ObservableObject } from
|
|
1
|
+
import { MergeList, MergedItem, MergeListReader } from "../util/MergeList.js";
|
|
2
|
+
import { ObservableObject } from "./Mvcc.js";
|
|
3
3
|
export declare abstract class ObservableMergeList<T> extends ObservableObject implements MergeListReader<T> {
|
|
4
4
|
protected abstract impl: MergeList<T>;
|
|
5
5
|
get isStrict(): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { F } from
|
|
2
|
-
import { AbstractReaction, MemberOptions } from
|
|
3
|
-
import { MemberName, ObjectHandle, ValueSnapshot, Observer, Subscription, AbstractChangeset } from
|
|
4
|
-
import { Transaction } from
|
|
5
|
-
import { OptionsImpl } from
|
|
1
|
+
import { F } from "../util/Utils.js";
|
|
2
|
+
import { AbstractReaction, MemberOptions } from "../Options.js";
|
|
3
|
+
import { MemberName, ObjectHandle, ValueSnapshot, Observer, Subscription, AbstractChangeset } from "./Data.js";
|
|
4
|
+
import { Transaction } from "./Transaction.js";
|
|
5
|
+
import { OptionsImpl } from "./Mvcc.js";
|
|
6
6
|
export declare class ReactionImpl implements AbstractReaction<any> {
|
|
7
7
|
readonly objectHandle: ObjectHandle;
|
|
8
8
|
readonly memberName: MemberName;
|
|
@@ -54,7 +54,7 @@ declare class Launch extends ValueSnapshot implements Observer {
|
|
|
54
54
|
get originSnapshotId(): number;
|
|
55
55
|
hint(): string;
|
|
56
56
|
get order(): number;
|
|
57
|
-
get [
|
|
57
|
+
get ["#this#"](): string;
|
|
58
58
|
why(): string;
|
|
59
59
|
briefWhy(): string;
|
|
60
60
|
dependencies(): string[];
|