reactronic 0.22.302 → 0.22.306
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/package.json +1 -1
- package/build/dist/source/Buffer.d.ts +0 -8
- package/build/dist/source/Buffer.js +0 -8
- package/build/dist/source/Controller.d.ts +0 -12
- package/build/dist/source/Controller.js +0 -6
- package/build/dist/source/Logging.d.ts +0 -38
- package/build/dist/source/Logging.js +0 -113
- package/build/dist/source/Options.d.ts +0 -38
- package/build/dist/source/Options.js +0 -21
- package/build/dist/source/Ref.d.ts +0 -34
- package/build/dist/source/Ref.js +0 -90
- package/build/dist/source/Rx.d.ts +0 -26
- package/build/dist/source/Rx.js +0 -57
- package/build/dist/source/Worker.d.ts +0 -8
- package/build/dist/source/Worker.js +0 -2
- package/build/dist/source/api.d.ts +0 -14
- package/build/dist/source/api.js +0 -40
- package/build/dist/source/impl/Data.d.ts +0 -58
- package/build/dist/source/impl/Data.js +0 -42
- package/build/dist/source/impl/Hooks.d.ts +0 -50
- package/build/dist/source/impl/Hooks.js +0 -241
- package/build/dist/source/impl/Journal.d.ts +0 -34
- package/build/dist/source/impl/Journal.js +0 -138
- package/build/dist/source/impl/Meta.d.ts +0 -13
- package/build/dist/source/impl/Meta.js +0 -33
- package/build/dist/source/impl/Monitor.d.ts +0 -32
- package/build/dist/source/impl/Monitor.js +0 -97
- package/build/dist/source/impl/Operation.d.ts +0 -93
- package/build/dist/source/impl/Operation.js +0 -721
- package/build/dist/source/impl/Snapshot.d.ts +0 -60
- package/build/dist/source/impl/Snapshot.js +0 -353
- package/build/dist/source/impl/Transaction.d.ts +0 -30
- package/build/dist/source/impl/Transaction.js +0 -313
- package/build/dist/source/util/Dbg.d.ts +0 -15
- package/build/dist/source/util/Dbg.js +0 -96
- package/build/dist/source/util/Sealant.d.ts +0 -14
- package/build/dist/source/util/Sealant.js +0 -30
- package/build/dist/source/util/SealedArray.d.ts +0 -16
- package/build/dist/source/util/SealedArray.js +0 -28
- package/build/dist/source/util/SealedMap.d.ts +0 -13
- package/build/dist/source/util/SealedMap.js +0 -21
- package/build/dist/source/util/SealedSet.d.ts +0 -13
- package/build/dist/source/util/SealedSet.js +0 -21
- package/build/dist/source/util/Utils.d.ts +0 -9
- package/build/dist/source/util/Utils.js +0 -62
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ReactiveObject } from './impl/Hooks';
|
|
2
|
-
export declare abstract class Buffer<T> extends ReactiveObject {
|
|
3
|
-
abstract readonly capacity: number;
|
|
4
|
-
abstract readonly count: number;
|
|
5
|
-
abstract put(...items: T[]): void;
|
|
6
|
-
abstract take(count: number): T[];
|
|
7
|
-
static create<T>(hint?: string, capacity?: number): Buffer<T>;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Buffer = void 0;
|
|
4
|
-
const Hooks_1 = require("./impl/Hooks");
|
|
5
|
-
class Buffer extends Hooks_1.ReactiveObject {
|
|
6
|
-
static create(hint, capacity) { throw new Error('not implemented'); }
|
|
7
|
-
}
|
|
8
|
-
exports.Buffer = Buffer;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MemberOptions } from './Options';
|
|
2
|
-
export declare abstract class Controller<T> {
|
|
3
|
-
abstract readonly options: MemberOptions;
|
|
4
|
-
abstract readonly args: ReadonlyArray<any>;
|
|
5
|
-
abstract readonly result: T;
|
|
6
|
-
abstract readonly error: any;
|
|
7
|
-
abstract readonly stamp: number;
|
|
8
|
-
abstract readonly isUpToDate: boolean;
|
|
9
|
-
abstract configure(options: Partial<MemberOptions>): MemberOptions;
|
|
10
|
-
abstract markObsolete(): void;
|
|
11
|
-
abstract pullLastResult(args?: any[]): T | undefined;
|
|
12
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export interface LoggingOptions {
|
|
2
|
-
readonly enabled: boolean;
|
|
3
|
-
readonly transaction: boolean;
|
|
4
|
-
readonly operation: boolean;
|
|
5
|
-
readonly step: boolean;
|
|
6
|
-
readonly monitor: boolean;
|
|
7
|
-
readonly read: boolean;
|
|
8
|
-
readonly write: boolean;
|
|
9
|
-
readonly change: boolean;
|
|
10
|
-
readonly obsolete: boolean;
|
|
11
|
-
readonly error: boolean;
|
|
12
|
-
readonly warning: boolean;
|
|
13
|
-
readonly gc: boolean;
|
|
14
|
-
readonly color: number;
|
|
15
|
-
readonly prefix: string;
|
|
16
|
-
readonly margin1: number;
|
|
17
|
-
readonly margin2: number;
|
|
18
|
-
}
|
|
19
|
-
export interface ProfilingOptions {
|
|
20
|
-
repetitiveUsageWarningThreshold: number;
|
|
21
|
-
mainThreadBlockingWarningThreshold: number;
|
|
22
|
-
asyncActionDurationWarningThreshold: number;
|
|
23
|
-
garbageCollectionSummaryInterval: number;
|
|
24
|
-
}
|
|
25
|
-
export declare const LoggingLevel: {
|
|
26
|
-
Off: LoggingOptions;
|
|
27
|
-
ErrorsOnly: LoggingOptions;
|
|
28
|
-
Reactions: LoggingOptions;
|
|
29
|
-
Transactions: LoggingOptions;
|
|
30
|
-
Operations: LoggingOptions;
|
|
31
|
-
Debug: LoggingOptions;
|
|
32
|
-
};
|
|
33
|
-
declare global {
|
|
34
|
-
interface Window {
|
|
35
|
-
rWhy: string;
|
|
36
|
-
rBriefWhy: string;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoggingLevel = void 0;
|
|
4
|
-
exports.LoggingLevel = {
|
|
5
|
-
Off: {
|
|
6
|
-
enabled: false,
|
|
7
|
-
transaction: false,
|
|
8
|
-
operation: false,
|
|
9
|
-
step: false,
|
|
10
|
-
monitor: false,
|
|
11
|
-
read: false,
|
|
12
|
-
write: false,
|
|
13
|
-
change: false,
|
|
14
|
-
obsolete: false,
|
|
15
|
-
error: true,
|
|
16
|
-
warning: true,
|
|
17
|
-
gc: false,
|
|
18
|
-
color: 37,
|
|
19
|
-
prefix: '',
|
|
20
|
-
margin1: 0,
|
|
21
|
-
margin2: 0,
|
|
22
|
-
},
|
|
23
|
-
ErrorsOnly: {
|
|
24
|
-
enabled: true,
|
|
25
|
-
transaction: false,
|
|
26
|
-
operation: false,
|
|
27
|
-
step: false,
|
|
28
|
-
monitor: false,
|
|
29
|
-
read: false,
|
|
30
|
-
write: false,
|
|
31
|
-
change: false,
|
|
32
|
-
obsolete: false,
|
|
33
|
-
error: true,
|
|
34
|
-
warning: true,
|
|
35
|
-
gc: false,
|
|
36
|
-
color: 37,
|
|
37
|
-
prefix: '',
|
|
38
|
-
margin1: 0,
|
|
39
|
-
margin2: 0,
|
|
40
|
-
},
|
|
41
|
-
Reactions: {
|
|
42
|
-
enabled: true,
|
|
43
|
-
transaction: false,
|
|
44
|
-
operation: false,
|
|
45
|
-
step: false,
|
|
46
|
-
monitor: false,
|
|
47
|
-
read: false,
|
|
48
|
-
write: false,
|
|
49
|
-
change: false,
|
|
50
|
-
obsolete: true,
|
|
51
|
-
error: true,
|
|
52
|
-
warning: true,
|
|
53
|
-
gc: false,
|
|
54
|
-
color: 37,
|
|
55
|
-
prefix: '',
|
|
56
|
-
margin1: 0,
|
|
57
|
-
margin2: 0,
|
|
58
|
-
},
|
|
59
|
-
Transactions: {
|
|
60
|
-
enabled: true,
|
|
61
|
-
transaction: true,
|
|
62
|
-
operation: false,
|
|
63
|
-
step: false,
|
|
64
|
-
monitor: false,
|
|
65
|
-
read: false,
|
|
66
|
-
write: false,
|
|
67
|
-
change: false,
|
|
68
|
-
obsolete: true,
|
|
69
|
-
error: true,
|
|
70
|
-
warning: true,
|
|
71
|
-
gc: false,
|
|
72
|
-
color: 37,
|
|
73
|
-
prefix: '',
|
|
74
|
-
margin1: 0,
|
|
75
|
-
margin2: 0,
|
|
76
|
-
},
|
|
77
|
-
Operations: {
|
|
78
|
-
enabled: true,
|
|
79
|
-
transaction: true,
|
|
80
|
-
operation: true,
|
|
81
|
-
step: false,
|
|
82
|
-
monitor: true,
|
|
83
|
-
read: false,
|
|
84
|
-
write: false,
|
|
85
|
-
change: true,
|
|
86
|
-
obsolete: true,
|
|
87
|
-
error: true,
|
|
88
|
-
warning: true,
|
|
89
|
-
gc: false,
|
|
90
|
-
color: 37,
|
|
91
|
-
prefix: '',
|
|
92
|
-
margin1: 0,
|
|
93
|
-
margin2: 0,
|
|
94
|
-
},
|
|
95
|
-
Debug: {
|
|
96
|
-
enabled: true,
|
|
97
|
-
transaction: true,
|
|
98
|
-
operation: true,
|
|
99
|
-
step: true,
|
|
100
|
-
monitor: true,
|
|
101
|
-
read: true,
|
|
102
|
-
write: true,
|
|
103
|
-
change: true,
|
|
104
|
-
obsolete: true,
|
|
105
|
-
error: true,
|
|
106
|
-
warning: true,
|
|
107
|
-
gc: false,
|
|
108
|
-
color: 37,
|
|
109
|
-
prefix: '',
|
|
110
|
-
margin1: 0,
|
|
111
|
-
margin2: 0,
|
|
112
|
-
},
|
|
113
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { LoggingOptions } from './Logging';
|
|
2
|
-
import { StandaloneMode } from './impl/Data';
|
|
3
|
-
export { LoggingOptions, ProfilingOptions, LoggingLevel } from './Logging';
|
|
4
|
-
import { Journal } from './impl/Journal';
|
|
5
|
-
import { Monitor } from './impl/Monitor';
|
|
6
|
-
export interface SnapshotOptions {
|
|
7
|
-
readonly hint?: string;
|
|
8
|
-
readonly standalone?: StandaloneMode;
|
|
9
|
-
readonly journal?: Journal;
|
|
10
|
-
readonly logging?: Partial<LoggingOptions>;
|
|
11
|
-
readonly token?: any;
|
|
12
|
-
}
|
|
13
|
-
export interface MemberOptions {
|
|
14
|
-
readonly kind: Kind;
|
|
15
|
-
readonly standalone: StandaloneMode;
|
|
16
|
-
readonly order: number;
|
|
17
|
-
readonly noSideEffects: boolean;
|
|
18
|
-
readonly triggeringArgs: boolean;
|
|
19
|
-
readonly throttling: number;
|
|
20
|
-
readonly reentrance: Reentrance;
|
|
21
|
-
readonly journal: Journal | undefined;
|
|
22
|
-
readonly monitor: Monitor | null;
|
|
23
|
-
readonly logging?: Partial<LoggingOptions>;
|
|
24
|
-
}
|
|
25
|
-
export declare enum Kind {
|
|
26
|
-
Plain = 0,
|
|
27
|
-
Transaction = 1,
|
|
28
|
-
Reaction = 2,
|
|
29
|
-
Cache = 3
|
|
30
|
-
}
|
|
31
|
-
export declare enum Reentrance {
|
|
32
|
-
PreventWithError = 1,
|
|
33
|
-
WaitAndRestart = 0,
|
|
34
|
-
CancelPrevious = -1,
|
|
35
|
-
CancelAndWaitPrevious = -2,
|
|
36
|
-
OverwritePrevious = -3,
|
|
37
|
-
RunSideBySide = -4
|
|
38
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Reentrance = exports.Kind = exports.LoggingLevel = void 0;
|
|
4
|
-
var Logging_1 = require("./Logging");
|
|
5
|
-
Object.defineProperty(exports, "LoggingLevel", { enumerable: true, get: function () { return Logging_1.LoggingLevel; } });
|
|
6
|
-
var Kind;
|
|
7
|
-
(function (Kind) {
|
|
8
|
-
Kind[Kind["Plain"] = 0] = "Plain";
|
|
9
|
-
Kind[Kind["Transaction"] = 1] = "Transaction";
|
|
10
|
-
Kind[Kind["Reaction"] = 2] = "Reaction";
|
|
11
|
-
Kind[Kind["Cache"] = 3] = "Cache";
|
|
12
|
-
})(Kind = exports.Kind || (exports.Kind = {}));
|
|
13
|
-
var Reentrance;
|
|
14
|
-
(function (Reentrance) {
|
|
15
|
-
Reentrance[Reentrance["PreventWithError"] = 1] = "PreventWithError";
|
|
16
|
-
Reentrance[Reentrance["WaitAndRestart"] = 0] = "WaitAndRestart";
|
|
17
|
-
Reentrance[Reentrance["CancelPrevious"] = -1] = "CancelPrevious";
|
|
18
|
-
Reentrance[Reentrance["CancelAndWaitPrevious"] = -2] = "CancelAndWaitPrevious";
|
|
19
|
-
Reentrance[Reentrance["OverwritePrevious"] = -3] = "OverwritePrevious";
|
|
20
|
-
Reentrance[Reentrance["RunSideBySide"] = -4] = "RunSideBySide";
|
|
21
|
-
})(Reentrance = exports.Reentrance || (exports.Reentrance = {}));
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare type BoolOnly<T> = Pick<T, {
|
|
2
|
-
[P in keyof T]: T[P] extends boolean ? P : never;
|
|
3
|
-
}[keyof T]>;
|
|
4
|
-
export declare type GivenTypeOnly<T, V> = Pick<T, {
|
|
5
|
-
[P in keyof T]: T[P] extends V ? P : never;
|
|
6
|
-
}[keyof T]>;
|
|
7
|
-
export declare class Ref<T = any> {
|
|
8
|
-
readonly owner: any;
|
|
9
|
-
readonly name: string;
|
|
10
|
-
readonly index: number;
|
|
11
|
-
constructor(owner: any, name: string, index?: number);
|
|
12
|
-
get value(): T;
|
|
13
|
-
set value(value: T);
|
|
14
|
-
nonreactive(): T;
|
|
15
|
-
observe(): T;
|
|
16
|
-
unobserve(): T;
|
|
17
|
-
static to<O extends object = object>(owner: O): {
|
|
18
|
-
readonly [P in keyof O]-?: Ref<O[P]>;
|
|
19
|
-
};
|
|
20
|
-
static toToggle<O extends object = object>(owner: O): {
|
|
21
|
-
readonly [P in keyof BoolOnly<O>]: ToggleRef<O[P]>;
|
|
22
|
-
};
|
|
23
|
-
static toCustomToggle<T, O extends object = any>(owner: O, value1: T, value2: T): {
|
|
24
|
-
readonly [P in keyof GivenTypeOnly<O, T | any>]: ToggleRef<O[P]>;
|
|
25
|
-
};
|
|
26
|
-
static sameRefs(v1: Ref, v2: Ref): boolean;
|
|
27
|
-
static similarRefs(v1: Ref, v2: Ref): boolean;
|
|
28
|
-
}
|
|
29
|
-
export declare class ToggleRef<T = boolean> extends Ref<T> {
|
|
30
|
-
readonly valueOn: T;
|
|
31
|
-
readonly valueOff: T;
|
|
32
|
-
constructor(owner: any, name: string, valueOn: T, valueOff: T);
|
|
33
|
-
toggle(): void;
|
|
34
|
-
}
|
package/build/dist/source/Ref.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToggleRef = exports.Ref = void 0;
|
|
4
|
-
const Transaction_1 = require("./impl/Transaction");
|
|
5
|
-
const Rx_1 = require("./Rx");
|
|
6
|
-
class Ref {
|
|
7
|
-
constructor(owner, name, index = -1) {
|
|
8
|
-
this.owner = owner;
|
|
9
|
-
this.name = name;
|
|
10
|
-
this.index = index;
|
|
11
|
-
}
|
|
12
|
-
get value() {
|
|
13
|
-
if (this.index < 0)
|
|
14
|
-
return this.owner[this.name];
|
|
15
|
-
else
|
|
16
|
-
return this.owner[this.name][this.index];
|
|
17
|
-
}
|
|
18
|
-
set value(value) {
|
|
19
|
-
if (this.index < 0)
|
|
20
|
-
this.owner[this.name] = value;
|
|
21
|
-
else
|
|
22
|
-
this.owner[this.name][this.index] = value;
|
|
23
|
-
}
|
|
24
|
-
nonreactive() {
|
|
25
|
-
return (0, Rx_1.nonreactive)(() => this.value);
|
|
26
|
-
}
|
|
27
|
-
observe() {
|
|
28
|
-
return this.value;
|
|
29
|
-
}
|
|
30
|
-
unobserve() {
|
|
31
|
-
throw new Error('not implemented');
|
|
32
|
-
}
|
|
33
|
-
static to(owner) {
|
|
34
|
-
return new Proxy(owner, RefGettingProxy);
|
|
35
|
-
}
|
|
36
|
-
static toToggle(owner) {
|
|
37
|
-
return new Proxy(owner, BoolRefGettingProxy);
|
|
38
|
-
}
|
|
39
|
-
static toCustomToggle(owner, value1, value2) {
|
|
40
|
-
const handler = new CustomToggleRefGettingProxy(value1, value2);
|
|
41
|
-
return new Proxy(owner, handler);
|
|
42
|
-
}
|
|
43
|
-
static sameRefs(v1, v2) {
|
|
44
|
-
return v1.owner === v2.owner && v1.name === v2.name && v1.index === v2.index;
|
|
45
|
-
}
|
|
46
|
-
static similarRefs(v1, v2) {
|
|
47
|
-
return v1.owner.constructor === v2.owner.constructor && v1.name === v2.name && v1.index === v2.index;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.Ref = Ref;
|
|
51
|
-
class ToggleRef extends Ref {
|
|
52
|
-
constructor(owner, name, valueOn, valueOff) {
|
|
53
|
-
super(owner, name);
|
|
54
|
-
this.valueOn = valueOn;
|
|
55
|
-
this.valueOff = valueOff;
|
|
56
|
-
}
|
|
57
|
-
toggle() {
|
|
58
|
-
const o = this.owner;
|
|
59
|
-
const p = this.name;
|
|
60
|
-
Transaction_1.Transaction.run({ hint: `toggle ${o.constructor.name}.${p}` }, () => {
|
|
61
|
-
const v = o[p];
|
|
62
|
-
const isOn = v === this.valueOn || (v instanceof Ref && this.valueOn instanceof Ref &&
|
|
63
|
-
Ref.sameRefs(v, this.valueOn));
|
|
64
|
-
if (!isOn)
|
|
65
|
-
o[p] = this.valueOn;
|
|
66
|
-
else
|
|
67
|
-
o[p] = this.valueOff;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.ToggleRef = ToggleRef;
|
|
72
|
-
const RefGettingProxy = {
|
|
73
|
-
get: (obj, prop) => {
|
|
74
|
-
return new Ref(obj, prop);
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
const BoolRefGettingProxy = {
|
|
78
|
-
get: (obj, prop) => {
|
|
79
|
-
return new ToggleRef(obj, prop, true, false);
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
class CustomToggleRefGettingProxy {
|
|
83
|
-
constructor(value1, value2) {
|
|
84
|
-
this.value1 = value1;
|
|
85
|
-
this.value2 = value2;
|
|
86
|
-
}
|
|
87
|
-
get(obj, prop) {
|
|
88
|
-
return new ToggleRef(obj, prop, this.value1, this.value2);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { F } from './util/Utils';
|
|
2
|
-
import { Controller } from './Controller';
|
|
3
|
-
import { MemberOptions, LoggingOptions, ProfilingOptions } from './Options';
|
|
4
|
-
export declare class Rx {
|
|
5
|
-
static why(brief?: boolean): string;
|
|
6
|
-
static getController<T>(method: F<T>): Controller<T>;
|
|
7
|
-
static pullLastResult<T>(method: F<Promise<T>>, args?: any[]): T | undefined;
|
|
8
|
-
static configureCurrentOperation(options: Partial<MemberOptions>): MemberOptions;
|
|
9
|
-
static takeSnapshot<T>(obj: T): T;
|
|
10
|
-
static dispose(obj: any): void;
|
|
11
|
-
static get reactionsAutoStartDisabled(): boolean;
|
|
12
|
-
static set reactionsAutoStartDisabled(value: boolean);
|
|
13
|
-
static get isLogging(): boolean;
|
|
14
|
-
static get loggingOptions(): LoggingOptions;
|
|
15
|
-
static setLoggingMode(isOn: boolean, options?: LoggingOptions): void;
|
|
16
|
-
static setLoggingHint<T extends object>(obj: T, name: string | undefined): void;
|
|
17
|
-
static getLoggingHint<T extends object>(obj: T, full?: boolean): string | undefined;
|
|
18
|
-
static setProfilingMode(isOn: boolean, options?: Partial<ProfilingOptions>): void;
|
|
19
|
-
}
|
|
20
|
-
export declare function nonreactive<T>(func: F<T>, ...args: any[]): T;
|
|
21
|
-
export declare function sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
|
|
22
|
-
export declare function isnonreactive(proto: object, prop: PropertyKey): any;
|
|
23
|
-
export declare function transaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
|
|
24
|
-
export declare function reaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
|
|
25
|
-
export declare function cached(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
|
|
26
|
-
export declare function options(value: Partial<MemberOptions>): F<any>;
|
package/build/dist/source/Rx.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.options = exports.cached = exports.reaction = exports.transaction = exports.isnonreactive = exports.sensitive = exports.nonreactive = exports.Rx = void 0;
|
|
4
|
-
const Dbg_1 = require("./util/Dbg");
|
|
5
|
-
const Options_1 = require("./Options");
|
|
6
|
-
const Data_1 = require("./impl/Data");
|
|
7
|
-
const Snapshot_1 = require("./impl/Snapshot");
|
|
8
|
-
const Hooks_1 = require("./impl/Hooks");
|
|
9
|
-
const Operation_1 = require("./impl/Operation");
|
|
10
|
-
class Rx {
|
|
11
|
-
static why(brief = false) { return brief ? Operation_1.OperationController.briefWhy() : Operation_1.OperationController.why(); }
|
|
12
|
-
static getController(method) { return Operation_1.OperationController.of(method); }
|
|
13
|
-
static pullLastResult(method, args) { return Rx.getController(method).pullLastResult(args); }
|
|
14
|
-
static configureCurrentOperation(options) { return Operation_1.OperationController.configureImpl(undefined, options); }
|
|
15
|
-
static takeSnapshot(obj) { return Snapshot_1.Snapshot.takeSnapshot(obj); }
|
|
16
|
-
static dispose(obj) { Snapshot_1.Snapshot.dispose(obj); }
|
|
17
|
-
static get reactionsAutoStartDisabled() { return Hooks_1.Hooks.reactionsAutoStartDisabled; }
|
|
18
|
-
static set reactionsAutoStartDisabled(value) { Hooks_1.Hooks.reactionsAutoStartDisabled = value; }
|
|
19
|
-
static get isLogging() { return Dbg_1.Log.isOn; }
|
|
20
|
-
static get loggingOptions() { return Dbg_1.Log.opt; }
|
|
21
|
-
static setLoggingMode(isOn, options) { Dbg_1.Log.setMode(isOn, options); }
|
|
22
|
-
static setLoggingHint(obj, name) { Hooks_1.Hooks.setHint(obj, name); }
|
|
23
|
-
static getLoggingHint(obj, full = false) { return Data_1.DataHolder.getHint(obj, full); }
|
|
24
|
-
static setProfilingMode(isOn, options) { Hooks_1.Hooks.setProfilingMode(isOn, options); }
|
|
25
|
-
}
|
|
26
|
-
exports.Rx = Rx;
|
|
27
|
-
function nonreactive(func, ...args) {
|
|
28
|
-
return Operation_1.OperationController.runWithin(undefined, func, ...args);
|
|
29
|
-
}
|
|
30
|
-
exports.nonreactive = nonreactive;
|
|
31
|
-
function sensitive(sensitivity, func, ...args) {
|
|
32
|
-
return Hooks_1.Hooks.sensitive(sensitivity, func, ...args);
|
|
33
|
-
}
|
|
34
|
-
exports.sensitive = sensitive;
|
|
35
|
-
function isnonreactive(proto, prop) {
|
|
36
|
-
return Hooks_1.Hooks.decorateData(false, proto, prop);
|
|
37
|
-
}
|
|
38
|
-
exports.isnonreactive = isnonreactive;
|
|
39
|
-
function transaction(proto, prop, pd) {
|
|
40
|
-
const opts = { kind: Options_1.Kind.Transaction };
|
|
41
|
-
return Hooks_1.Hooks.decorateOperation(true, transaction, opts, proto, prop, pd);
|
|
42
|
-
}
|
|
43
|
-
exports.transaction = transaction;
|
|
44
|
-
function reaction(proto, prop, pd) {
|
|
45
|
-
const opts = { kind: Options_1.Kind.Reaction, throttling: -1 };
|
|
46
|
-
return Hooks_1.Hooks.decorateOperation(true, reaction, opts, proto, prop, pd);
|
|
47
|
-
}
|
|
48
|
-
exports.reaction = reaction;
|
|
49
|
-
function cached(proto, prop, pd) {
|
|
50
|
-
const opts = { kind: Options_1.Kind.Cache, noSideEffects: true };
|
|
51
|
-
return Hooks_1.Hooks.decorateOperation(true, cached, opts, proto, prop, pd);
|
|
52
|
-
}
|
|
53
|
-
exports.cached = cached;
|
|
54
|
-
function options(value) {
|
|
55
|
-
return Hooks_1.Hooks.decorateOperationParametrized(options, value);
|
|
56
|
-
}
|
|
57
|
-
exports.options = options;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { all, pause } from './util/Utils';
|
|
2
|
-
export { SealedArray } from './util/SealedArray';
|
|
3
|
-
export { SealedMap } from './util/SealedMap';
|
|
4
|
-
export { SealedSet } from './util/SealedSet';
|
|
5
|
-
export { MemberOptions, SnapshotOptions, Kind, Reentrance, LoggingOptions, ProfilingOptions, LoggingLevel } from './Options';
|
|
6
|
-
export { Worker } from './Worker';
|
|
7
|
-
export { Controller } from './Controller';
|
|
8
|
-
export { Ref, ToggleRef, BoolOnly, GivenTypeOnly } from './Ref';
|
|
9
|
-
export { ReactiveObject } from './impl/Hooks';
|
|
10
|
-
export { Snapshot } from './impl/Snapshot';
|
|
11
|
-
export { Transaction } from './impl/Transaction';
|
|
12
|
-
export { Monitor } from './impl/Monitor';
|
|
13
|
-
export { Journal } from './impl/Journal';
|
|
14
|
-
export { Rx, nonreactive, sensitive, isnonreactive, transaction, reaction, cached, options } from './Rx';
|
package/build/dist/source/api.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.options = exports.cached = exports.reaction = exports.transaction = exports.isnonreactive = exports.sensitive = exports.nonreactive = exports.Rx = exports.Journal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ReactiveObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.LoggingLevel = exports.Reentrance = exports.Kind = exports.SealedSet = exports.SealedMap = exports.SealedArray = exports.pause = exports.all = void 0;
|
|
4
|
-
var Utils_1 = require("./util/Utils");
|
|
5
|
-
Object.defineProperty(exports, "all", { enumerable: true, get: function () { return Utils_1.all; } });
|
|
6
|
-
Object.defineProperty(exports, "pause", { enumerable: true, get: function () { return Utils_1.pause; } });
|
|
7
|
-
var SealedArray_1 = require("./util/SealedArray");
|
|
8
|
-
Object.defineProperty(exports, "SealedArray", { enumerable: true, get: function () { return SealedArray_1.SealedArray; } });
|
|
9
|
-
var SealedMap_1 = require("./util/SealedMap");
|
|
10
|
-
Object.defineProperty(exports, "SealedMap", { enumerable: true, get: function () { return SealedMap_1.SealedMap; } });
|
|
11
|
-
var SealedSet_1 = require("./util/SealedSet");
|
|
12
|
-
Object.defineProperty(exports, "SealedSet", { enumerable: true, get: function () { return SealedSet_1.SealedSet; } });
|
|
13
|
-
var Options_1 = require("./Options");
|
|
14
|
-
Object.defineProperty(exports, "Kind", { enumerable: true, get: function () { return Options_1.Kind; } });
|
|
15
|
-
Object.defineProperty(exports, "Reentrance", { enumerable: true, get: function () { return Options_1.Reentrance; } });
|
|
16
|
-
Object.defineProperty(exports, "LoggingLevel", { enumerable: true, get: function () { return Options_1.LoggingLevel; } });
|
|
17
|
-
var Controller_1 = require("./Controller");
|
|
18
|
-
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return Controller_1.Controller; } });
|
|
19
|
-
var Ref_1 = require("./Ref");
|
|
20
|
-
Object.defineProperty(exports, "Ref", { enumerable: true, get: function () { return Ref_1.Ref; } });
|
|
21
|
-
Object.defineProperty(exports, "ToggleRef", { enumerable: true, get: function () { return Ref_1.ToggleRef; } });
|
|
22
|
-
var Hooks_1 = require("./impl/Hooks");
|
|
23
|
-
Object.defineProperty(exports, "ReactiveObject", { enumerable: true, get: function () { return Hooks_1.ReactiveObject; } });
|
|
24
|
-
var Snapshot_1 = require("./impl/Snapshot");
|
|
25
|
-
Object.defineProperty(exports, "Snapshot", { enumerable: true, get: function () { return Snapshot_1.Snapshot; } });
|
|
26
|
-
var Transaction_1 = require("./impl/Transaction");
|
|
27
|
-
Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return Transaction_1.Transaction; } });
|
|
28
|
-
var Monitor_1 = require("./impl/Monitor");
|
|
29
|
-
Object.defineProperty(exports, "Monitor", { enumerable: true, get: function () { return Monitor_1.Monitor; } });
|
|
30
|
-
var Journal_1 = require("./impl/Journal");
|
|
31
|
-
Object.defineProperty(exports, "Journal", { enumerable: true, get: function () { return Journal_1.Journal; } });
|
|
32
|
-
var Rx_1 = require("./Rx");
|
|
33
|
-
Object.defineProperty(exports, "Rx", { enumerable: true, get: function () { return Rx_1.Rx; } });
|
|
34
|
-
Object.defineProperty(exports, "nonreactive", { enumerable: true, get: function () { return Rx_1.nonreactive; } });
|
|
35
|
-
Object.defineProperty(exports, "sensitive", { enumerable: true, get: function () { return Rx_1.sensitive; } });
|
|
36
|
-
Object.defineProperty(exports, "isnonreactive", { enumerable: true, get: function () { return Rx_1.isnonreactive; } });
|
|
37
|
-
Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return Rx_1.transaction; } });
|
|
38
|
-
Object.defineProperty(exports, "reaction", { enumerable: true, get: function () { return Rx_1.reaction; } });
|
|
39
|
-
Object.defineProperty(exports, "cached", { enumerable: true, get: function () { return Rx_1.cached; } });
|
|
40
|
-
Object.defineProperty(exports, "options", { enumerable: true, get: function () { return Rx_1.options; } });
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export { Meta } from './Meta';
|
|
2
|
-
export interface AbstractSnapshot {
|
|
3
|
-
readonly id: number;
|
|
4
|
-
readonly hint: string;
|
|
5
|
-
readonly timestamp: number;
|
|
6
|
-
readonly sealed: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class Subscription {
|
|
9
|
-
content: any;
|
|
10
|
-
subscribers?: Set<Subscriber>;
|
|
11
|
-
get isOperation(): boolean;
|
|
12
|
-
get originSnapshotId(): number | undefined;
|
|
13
|
-
constructor(content: any);
|
|
14
|
-
}
|
|
15
|
-
export declare type StandaloneMode = boolean | 'isolated' | 'disposal';
|
|
16
|
-
export interface Subscriber {
|
|
17
|
-
readonly order: number;
|
|
18
|
-
readonly subscriptions: Map<Subscription, SubscriptionInfo> | undefined;
|
|
19
|
-
readonly obsoleteSince: number;
|
|
20
|
-
hint(nop?: boolean): string;
|
|
21
|
-
markObsoleteDueTo(subscription: Subscription, memberName: MemberName, snapshot: AbstractSnapshot, holder: DataHolder, outer: string, since: number, reactions: Array<Subscriber>): void;
|
|
22
|
-
runIfNotUpToDate(now: boolean, nothrow: boolean): void;
|
|
23
|
-
}
|
|
24
|
-
export declare type MemberName = PropertyKey;
|
|
25
|
-
export interface SubscriptionInfo {
|
|
26
|
-
readonly memberHint: string;
|
|
27
|
-
readonly usageCount: number;
|
|
28
|
-
}
|
|
29
|
-
export declare class DataRevision {
|
|
30
|
-
readonly snapshot: AbstractSnapshot;
|
|
31
|
-
readonly former: {
|
|
32
|
-
revision: DataRevision;
|
|
33
|
-
};
|
|
34
|
-
readonly data: any;
|
|
35
|
-
readonly changes: Set<MemberName>;
|
|
36
|
-
readonly conflicts: Map<MemberName, DataRevision>;
|
|
37
|
-
constructor(snapshot: AbstractSnapshot, former: DataRevision | undefined, data: object);
|
|
38
|
-
}
|
|
39
|
-
export declare class DataHolder {
|
|
40
|
-
private static generator;
|
|
41
|
-
readonly id: number;
|
|
42
|
-
readonly data: any;
|
|
43
|
-
readonly proxy: any;
|
|
44
|
-
head: DataRevision;
|
|
45
|
-
editing?: DataRevision;
|
|
46
|
-
editors: number;
|
|
47
|
-
hint: string;
|
|
48
|
-
constructor(data: any, proxy: any, handler: ProxyHandler<DataHolder>, head: DataRevision, hint: string);
|
|
49
|
-
static getHint(obj: object, full: boolean): string | undefined;
|
|
50
|
-
}
|
|
51
|
-
export interface PatchSet {
|
|
52
|
-
hint: string;
|
|
53
|
-
objects: Map<object, DataPatch>;
|
|
54
|
-
}
|
|
55
|
-
export interface DataPatch {
|
|
56
|
-
data: any;
|
|
57
|
-
former: any;
|
|
58
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataHolder = exports.DataRevision = exports.Subscription = exports.Meta = void 0;
|
|
4
|
-
const Dbg_1 = require("../util/Dbg");
|
|
5
|
-
const Meta_1 = require("./Meta");
|
|
6
|
-
var Meta_2 = require("./Meta");
|
|
7
|
-
Object.defineProperty(exports, "Meta", { enumerable: true, get: function () { return Meta_2.Meta; } });
|
|
8
|
-
class Subscription {
|
|
9
|
-
constructor(content) { this.content = content; }
|
|
10
|
-
get isOperation() { return false; }
|
|
11
|
-
get originSnapshotId() { return 0; }
|
|
12
|
-
}
|
|
13
|
-
exports.Subscription = Subscription;
|
|
14
|
-
class DataRevision {
|
|
15
|
-
constructor(snapshot, former, data) {
|
|
16
|
-
this.snapshot = snapshot;
|
|
17
|
-
this.former = { revision: former || this };
|
|
18
|
-
this.data = data;
|
|
19
|
-
this.changes = new Set();
|
|
20
|
-
this.conflicts = new Map();
|
|
21
|
-
if (Dbg_1.Log.isOn)
|
|
22
|
-
Object.freeze(this);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.DataRevision = DataRevision;
|
|
26
|
-
class DataHolder {
|
|
27
|
-
constructor(data, proxy, handler, head, hint) {
|
|
28
|
-
this.id = ++DataHolder.generator;
|
|
29
|
-
this.data = data;
|
|
30
|
-
this.proxy = proxy || new Proxy(this, handler);
|
|
31
|
-
this.head = head;
|
|
32
|
-
this.editing = undefined;
|
|
33
|
-
this.editors = 0;
|
|
34
|
-
this.hint = hint;
|
|
35
|
-
}
|
|
36
|
-
static getHint(obj, full) {
|
|
37
|
-
const h = Meta_1.Meta.get(obj, Meta_1.Meta.Holder);
|
|
38
|
-
return h !== undefined ? (full ? `${h.hint}#${h.id}` : h.hint) : undefined;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.DataHolder = DataHolder;
|
|
42
|
-
DataHolder.generator = 19;
|