reactronic 0.22.308 → 0.22.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.
Files changed (45) hide show
  1. package/build/dist/source/Buffer.d.ts +8 -0
  2. package/build/dist/source/Buffer.js +8 -0
  3. package/build/dist/source/Controller.d.ts +12 -0
  4. package/build/dist/source/Controller.js +6 -0
  5. package/build/dist/source/Logging.d.ts +38 -0
  6. package/build/dist/source/Logging.js +113 -0
  7. package/build/dist/source/Options.d.ts +38 -0
  8. package/build/dist/source/Options.js +21 -0
  9. package/build/dist/source/Ref.d.ts +34 -0
  10. package/build/dist/source/Ref.js +90 -0
  11. package/build/dist/source/Rx.d.ts +27 -0
  12. package/build/dist/source/Rx.js +58 -0
  13. package/build/dist/source/Worker.d.ts +8 -0
  14. package/build/dist/source/Worker.js +2 -0
  15. package/build/dist/source/api.d.ts +14 -0
  16. package/build/dist/source/api.js +42 -0
  17. package/build/dist/source/impl/Changeset.d.ts +60 -0
  18. package/build/dist/source/impl/Changeset.js +361 -0
  19. package/build/dist/source/impl/Data.d.ts +60 -0
  20. package/build/dist/source/impl/Data.js +51 -0
  21. package/build/dist/source/impl/Hooks.d.ts +96 -0
  22. package/build/dist/source/impl/Hooks.js +310 -0
  23. package/build/dist/source/impl/Journal.d.ts +34 -0
  24. package/build/dist/source/impl/Journal.js +149 -0
  25. package/build/dist/source/impl/Meta.d.ts +13 -0
  26. package/build/dist/source/impl/Meta.js +33 -0
  27. package/build/dist/source/impl/Monitor.d.ts +32 -0
  28. package/build/dist/source/impl/Monitor.js +97 -0
  29. package/build/dist/source/impl/Operation.d.ts +93 -0
  30. package/build/dist/source/impl/Operation.js +722 -0
  31. package/build/dist/source/impl/Transaction.d.ts +30 -0
  32. package/build/dist/source/impl/Transaction.js +313 -0
  33. package/build/dist/source/util/Dbg.d.ts +15 -0
  34. package/build/dist/source/util/Dbg.js +96 -0
  35. package/build/dist/source/util/Sealant.d.ts +14 -0
  36. package/build/dist/source/util/Sealant.js +30 -0
  37. package/build/dist/source/util/SealedArray.d.ts +16 -0
  38. package/build/dist/source/util/SealedArray.js +28 -0
  39. package/build/dist/source/util/SealedMap.d.ts +13 -0
  40. package/build/dist/source/util/SealedMap.js +21 -0
  41. package/build/dist/source/util/SealedSet.d.ts +13 -0
  42. package/build/dist/source/util/SealedSet.js +21 -0
  43. package/build/dist/source/util/Utils.d.ts +9 -0
  44. package/build/dist/source/util/Utils.js +62 -0
  45. package/package.json +1 -1
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Controller = void 0;
4
+ class Controller {
5
+ }
6
+ exports.Controller = Controller;
@@ -0,0 +1,38 @@
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
+ readonly Off: LoggingOptions;
27
+ readonly ErrorsOnly: LoggingOptions;
28
+ readonly Reactions: LoggingOptions;
29
+ readonly Transactions: LoggingOptions;
30
+ readonly Operations: LoggingOptions;
31
+ readonly Debug: LoggingOptions;
32
+ };
33
+ declare global {
34
+ interface Window {
35
+ rWhy: string;
36
+ rBriefWhy: string;
37
+ }
38
+ }
@@ -0,0 +1,113 @@
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
+ };
@@ -0,0 +1,38 @@
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
+ }
@@ -0,0 +1,21 @@
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 = {}));
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,90 @@
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
+ }
@@ -0,0 +1,27 @@
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 getRevisionOf(obj: any): number;
6
+ static why(brief?: boolean): string;
7
+ static getController<T>(method: F<T>): Controller<T>;
8
+ static pullLastResult<T>(method: F<Promise<T>>, args?: any[]): T | undefined;
9
+ static configureCurrentOperation(options: Partial<MemberOptions>): MemberOptions;
10
+ static takeSnapshot<T>(obj: T): T;
11
+ static dispose(obj: any): void;
12
+ static get reactionsAutoStartDisabled(): boolean;
13
+ static set reactionsAutoStartDisabled(value: boolean);
14
+ static get isLogging(): boolean;
15
+ static get loggingOptions(): LoggingOptions;
16
+ static setLoggingMode(isOn: boolean, options?: LoggingOptions): void;
17
+ static setLoggingHint<T extends object>(obj: T, name: string | undefined): void;
18
+ static getLoggingHint<T extends object>(obj: T, full?: boolean): string | undefined;
19
+ static setProfilingMode(isOn: boolean, options?: Partial<ProfilingOptions>): void;
20
+ }
21
+ export declare function nonreactive<T>(func: F<T>, ...args: any[]): T;
22
+ export declare function sensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
23
+ export declare function isnonreactive(proto: object, prop: PropertyKey): any;
24
+ export declare function transaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
25
+ export declare function reaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
26
+ export declare function cached(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
27
+ export declare function options(value: Partial<MemberOptions>): F<any>;
@@ -0,0 +1,58 @@
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 Changeset_1 = require("./impl/Changeset");
8
+ const Hooks_1 = require("./impl/Hooks");
9
+ const Operation_1 = require("./impl/Operation");
10
+ class Rx {
11
+ static getRevisionOf(obj) { return obj[Data_1.Meta.Revision]; }
12
+ static why(brief = false) { return brief ? Operation_1.OperationController.briefWhy() : Operation_1.OperationController.why(); }
13
+ static getController(method) { return Operation_1.OperationController.of(method); }
14
+ static pullLastResult(method, args) { return Rx.getController(method).pullLastResult(args); }
15
+ static configureCurrentOperation(options) { return Operation_1.OperationController.configureImpl(undefined, options); }
16
+ static takeSnapshot(obj) { return Changeset_1.Changeset.takeSnapshot(obj); }
17
+ static dispose(obj) { Changeset_1.Changeset.dispose(obj); }
18
+ static get reactionsAutoStartDisabled() { return Hooks_1.Hooks.reactionsAutoStartDisabled; }
19
+ static set reactionsAutoStartDisabled(value) { Hooks_1.Hooks.reactionsAutoStartDisabled = value; }
20
+ static get isLogging() { return Dbg_1.Log.isOn; }
21
+ static get loggingOptions() { return Dbg_1.Log.opt; }
22
+ static setLoggingMode(isOn, options) { Dbg_1.Log.setMode(isOn, options); }
23
+ static setLoggingHint(obj, name) { Hooks_1.Hooks.setHint(obj, name); }
24
+ static getLoggingHint(obj, full = false) { return Data_1.ObjectHandle.getHint(obj, full); }
25
+ static setProfilingMode(isOn, options) { Hooks_1.Hooks.setProfilingMode(isOn, options); }
26
+ }
27
+ exports.Rx = Rx;
28
+ function nonreactive(func, ...args) {
29
+ return Operation_1.OperationController.runWithin(undefined, func, ...args);
30
+ }
31
+ exports.nonreactive = nonreactive;
32
+ function sensitive(sensitivity, func, ...args) {
33
+ return Hooks_1.Hooks.sensitive(sensitivity, func, ...args);
34
+ }
35
+ exports.sensitive = sensitive;
36
+ function isnonreactive(proto, prop) {
37
+ return Hooks_1.Hooks.decorateData(false, proto, prop);
38
+ }
39
+ exports.isnonreactive = isnonreactive;
40
+ function transaction(proto, prop, pd) {
41
+ const opts = { kind: Options_1.Kind.Transaction };
42
+ return Hooks_1.Hooks.decorateOperation(true, transaction, opts, proto, prop, pd);
43
+ }
44
+ exports.transaction = transaction;
45
+ function reaction(proto, prop, pd) {
46
+ const opts = { kind: Options_1.Kind.Reaction, throttling: -1 };
47
+ return Hooks_1.Hooks.decorateOperation(true, reaction, opts, proto, prop, pd);
48
+ }
49
+ exports.reaction = reaction;
50
+ function cached(proto, prop, pd) {
51
+ const opts = { kind: Options_1.Kind.Cache, noSideEffects: true };
52
+ return Hooks_1.Hooks.decorateOperation(true, cached, opts, proto, prop, pd);
53
+ }
54
+ exports.cached = cached;
55
+ function options(value) {
56
+ return Hooks_1.Hooks.decorateOperationParametrized(options, value);
57
+ }
58
+ exports.options = options;
@@ -0,0 +1,8 @@
1
+ export interface Worker {
2
+ readonly id: number;
3
+ readonly hint: string;
4
+ readonly isCanceled: boolean;
5
+ readonly isFinished: boolean;
6
+ cancel(error: Error, restartAfter?: Worker | null): this;
7
+ whenFinished(): Promise<void>;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
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, ReactiveArray, ReactiveMap } from './impl/Hooks';
10
+ export { Changeset } from './impl/Changeset';
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';
@@ -0,0 +1,42 @@
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.Changeset = exports.ReactiveMap = exports.ReactiveArray = 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
+ Object.defineProperty(exports, "ReactiveArray", { enumerable: true, get: function () { return Hooks_1.ReactiveArray; } });
25
+ Object.defineProperty(exports, "ReactiveMap", { enumerable: true, get: function () { return Hooks_1.ReactiveMap; } });
26
+ var Changeset_1 = require("./impl/Changeset");
27
+ Object.defineProperty(exports, "Changeset", { enumerable: true, get: function () { return Changeset_1.Changeset; } });
28
+ var Transaction_1 = require("./impl/Transaction");
29
+ Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return Transaction_1.Transaction; } });
30
+ var Monitor_1 = require("./impl/Monitor");
31
+ Object.defineProperty(exports, "Monitor", { enumerable: true, get: function () { return Monitor_1.Monitor; } });
32
+ var Journal_1 = require("./impl/Journal");
33
+ Object.defineProperty(exports, "Journal", { enumerable: true, get: function () { return Journal_1.Journal; } });
34
+ var Rx_1 = require("./Rx");
35
+ Object.defineProperty(exports, "Rx", { enumerable: true, get: function () { return Rx_1.Rx; } });
36
+ Object.defineProperty(exports, "nonreactive", { enumerable: true, get: function () { return Rx_1.nonreactive; } });
37
+ Object.defineProperty(exports, "sensitive", { enumerable: true, get: function () { return Rx_1.sensitive; } });
38
+ Object.defineProperty(exports, "isnonreactive", { enumerable: true, get: function () { return Rx_1.isnonreactive; } });
39
+ Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return Rx_1.transaction; } });
40
+ Object.defineProperty(exports, "reaction", { enumerable: true, get: function () { return Rx_1.reaction; } });
41
+ Object.defineProperty(exports, "cached", { enumerable: true, get: function () { return Rx_1.cached; } });
42
+ Object.defineProperty(exports, "options", { enumerable: true, get: function () { return Rx_1.options; } });
@@ -0,0 +1,60 @@
1
+ import { Kind, SnapshotOptions } from '../Options';
2
+ import { AbstractChangeset, ObjectSnapshot, MemberName, ObjectHandle, Subscription, Subscriber } from './Data';
3
+ export declare const MAX_REVISION: number;
4
+ export declare const UNDEFINED_REVISION: number;
5
+ export declare class Changeset implements AbstractChangeset {
6
+ static idGen: number;
7
+ private static stampGen;
8
+ private static pending;
9
+ private static oldest;
10
+ static garbageCollectionSummaryInterval: number;
11
+ static lastGarbageCollectionSummaryTimestamp: number;
12
+ static totalObjectHandleCount: number;
13
+ static totalObjectSnapshotCount: number;
14
+ readonly id: number;
15
+ readonly options: SnapshotOptions;
16
+ get hint(): string;
17
+ get timestamp(): number;
18
+ private revision;
19
+ private bumper;
20
+ items: Map<ObjectHandle, ObjectSnapshot>;
21
+ reactions: Subscriber[];
22
+ sealed: boolean;
23
+ constructor(options: SnapshotOptions | null);
24
+ static current: () => Changeset;
25
+ static edit: () => Changeset;
26
+ static markUsed: (subscription: Subscription, os: ObjectSnapshot, m: MemberName, h: ObjectHandle, kind: Kind, weak: boolean) => void;
27
+ static markEdited: (oldValue: any, newValue: any, edited: boolean, os: ObjectSnapshot, m: MemberName, h: ObjectHandle) => void;
28
+ static isConflicting: (oldValue: any, newValue: any) => boolean;
29
+ static propagateAllChangesThroughSubscriptions: (changeset: Changeset) => void;
30
+ static revokeAllSubscriptions: (changeset: Changeset) => void;
31
+ static enqueueReactionsToRun: (reactions: Array<Subscriber>) => void;
32
+ seekSnapshot(h: ObjectHandle, m: MemberName): ObjectSnapshot;
33
+ getRelevantSnapshot(h: ObjectHandle, m: MemberName): ObjectSnapshot;
34
+ getEditableSnapshot(h: ObjectHandle, m: MemberName, value: any, token?: any): ObjectSnapshot;
35
+ static takeSnapshot<T>(obj: T): T;
36
+ static dispose(obj: any): void;
37
+ static doDispose(ctx: Changeset, h: ObjectHandle): ObjectSnapshot;
38
+ private isNewSnapshotRequired;
39
+ acquire(outer: Changeset): void;
40
+ bumpBy(timestamp: number): void;
41
+ rebase(): ObjectSnapshot[] | undefined;
42
+ private merge;
43
+ applyOrDiscard(error?: any): Array<Subscriber>;
44
+ static sealObjectSnapshot(h: ObjectHandle, os: ObjectSnapshot): void;
45
+ static sealSubscription(subscription: Subscription | symbol, m: MemberName, typeName: string): void;
46
+ static freezeObjectSnapshot(os: ObjectSnapshot): ObjectSnapshot;
47
+ triggerGarbageCollection(): void;
48
+ private unlinkHistory;
49
+ static _init(): void;
50
+ }
51
+ export declare class Dump {
52
+ static valueHint: (value: any, m?: PropertyKey | undefined) => string;
53
+ static obj(h: ObjectHandle | undefined, m?: MemberName | undefined, stamp?: number, snapshotId?: number, originSnapshotId?: number, value?: any): string;
54
+ static snapshot2(h: ObjectHandle, s: AbstractChangeset, m?: MemberName, o?: Subscription): string;
55
+ static snapshot(os: ObjectSnapshot, m?: MemberName): string;
56
+ static conflicts(conflicts: ObjectSnapshot[]): string;
57
+ static conflictingMemberHint(m: MemberName, ours: ObjectSnapshot, theirs: ObjectSnapshot): string;
58
+ }
59
+ export declare const EMPTY_SNAPSHOT: ObjectSnapshot;
60
+ export declare const DefaultSnapshotOptions: SnapshotOptions;