reactronic 0.22.202 → 0.22.205

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 CHANGED
@@ -310,7 +310,7 @@ function sensitive<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
310
310
  export interface SnapshotOptions {
311
311
  readonly hint?: string
312
312
  readonly standalone?: StandaloneMode
313
- readonly journal?: TransactionJournal
313
+ readonly journal?: EditJournal
314
314
  readonly logging?: Partial<LoggingOptions>
315
315
  readonly token?: any
316
316
  }
@@ -323,7 +323,7 @@ interface MemberOptions {
323
323
  readonly triggeringArgs: boolean
324
324
  readonly throttling: number // milliseconds, -1 is immediately, Number.MAX_SAFE_INTEGER is never
325
325
  readonly reentrance: Reentrance
326
- readonly journal: TransactionJournal | undefined
326
+ readonly journal: EditJournal | undefined
327
327
  readonly monitor: Monitor | null
328
328
  readonly logging?: Partial<LoggingOptions>
329
329
  }
@@ -1,12 +1,12 @@
1
1
  import { LoggingOptions } from './Logging';
2
2
  import { StandaloneMode } from './impl/Data';
3
3
  export { LoggingOptions, ProfilingOptions, LoggingLevel } from './Logging';
4
- import { TransactionJournal } from './impl/TransactionJournal';
4
+ import { EditJournal } from './impl/EditJournal';
5
5
  import { Monitor } from './impl/Monitor';
6
6
  export interface SnapshotOptions {
7
7
  readonly hint?: string;
8
8
  readonly standalone?: StandaloneMode;
9
- readonly journal?: TransactionJournal;
9
+ readonly journal?: EditJournal;
10
10
  readonly logging?: Partial<LoggingOptions>;
11
11
  readonly token?: any;
12
12
  }
@@ -18,7 +18,7 @@ export interface MemberOptions {
18
18
  readonly triggeringArgs: boolean;
19
19
  readonly throttling: number;
20
20
  readonly reentrance: Reentrance;
21
- readonly journal: TransactionJournal | undefined;
21
+ readonly journal: EditJournal | undefined;
22
22
  readonly monitor: Monitor | null;
23
23
  readonly logging?: Partial<LoggingOptions>;
24
24
  }
@@ -10,5 +10,5 @@ export { ObservableObject } from './impl/Hooks';
10
10
  export { Snapshot } from './impl/Snapshot';
11
11
  export { Transaction } from './impl/Transaction';
12
12
  export { Monitor } from './impl/Monitor';
13
- export { TransactionJournal } from './impl/TransactionJournal';
13
+ export { EditJournal } from './impl/EditJournal';
14
14
  export { Rx, nonreactive, sensitive, unobservable, transaction, reaction, cached, options } from './Rx';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.nonreactive = exports.Rx = exports.TransactionJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = exports.ToggleRef = exports.Ref = exports.Controller = exports.LoggingLevel = exports.Reentrance = exports.Kind = exports.SealedSet = exports.SealedMap = exports.SealedArray = exports.pause = exports.all = void 0;
3
+ exports.options = exports.cached = exports.reaction = exports.transaction = exports.unobservable = exports.sensitive = exports.nonreactive = exports.Rx = exports.EditJournal = exports.Monitor = exports.Transaction = exports.Snapshot = exports.ObservableObject = 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
4
  var Utils_1 = require("./util/Utils");
5
5
  Object.defineProperty(exports, "all", { enumerable: true, get: function () { return Utils_1.all; } });
6
6
  Object.defineProperty(exports, "pause", { enumerable: true, get: function () { return Utils_1.pause; } });
@@ -27,8 +27,8 @@ var Transaction_1 = require("./impl/Transaction");
27
27
  Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return Transaction_1.Transaction; } });
28
28
  var Monitor_1 = require("./impl/Monitor");
29
29
  Object.defineProperty(exports, "Monitor", { enumerable: true, get: function () { return Monitor_1.Monitor; } });
30
- var TransactionJournal_1 = require("./impl/TransactionJournal");
31
- Object.defineProperty(exports, "TransactionJournal", { enumerable: true, get: function () { return TransactionJournal_1.TransactionJournal; } });
30
+ var EditJournal_1 = require("./impl/EditJournal");
31
+ Object.defineProperty(exports, "EditJournal", { enumerable: true, get: function () { return EditJournal_1.EditJournal; } });
32
32
  var Rx_1 = require("./Rx");
33
33
  Object.defineProperty(exports, "Rx", { enumerable: true, get: function () { return Rx_1.Rx; } });
34
34
  Object.defineProperty(exports, "nonreactive", { enumerable: true, get: function () { return Rx_1.nonreactive; } });
@@ -0,0 +1,37 @@
1
+ import { ObservableObject } from './Hooks';
2
+ import { ObjectHolder, ObjectRevision, Patch } from './Data';
3
+ export declare abstract class EditJournal extends ObservableObject {
4
+ abstract capacity: number;
5
+ abstract readonly isSaving: boolean;
6
+ abstract readonly edits: ReadonlyArray<Patch>;
7
+ abstract readonly canUndo: boolean;
8
+ abstract readonly canRedo: boolean;
9
+ abstract undo(count?: number): void;
10
+ abstract redo(count?: number): void;
11
+ abstract getUnsaved(): Patch | undefined;
12
+ abstract beginSave(): void;
13
+ abstract endSave(success: boolean): void;
14
+ abstract register(patch: Patch): void;
15
+ static create(): EditJournal;
16
+ }
17
+ export declare class EditJournalImpl extends EditJournal {
18
+ private _capacity;
19
+ private _isSaving;
20
+ private _edits;
21
+ private _position;
22
+ private _saved;
23
+ get capacity(): number;
24
+ set capacity(value: number);
25
+ get isSaving(): boolean;
26
+ get edits(): ReadonlyArray<Patch>;
27
+ get canUndo(): boolean;
28
+ get canRedo(): boolean;
29
+ undo(count?: number): void;
30
+ redo(count?: number): void;
31
+ getUnsaved(): Patch | undefined;
32
+ beginSave(): void;
33
+ endSave(success: boolean): void;
34
+ register(p: Patch): void;
35
+ static buildPatch(hint: string, changeset: Map<ObjectHolder, ObjectRevision>): Patch;
36
+ static applyPatch(patch: Patch, undo: boolean): void;
37
+ }
@@ -1,62 +1,89 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransactionJournalImpl = exports.TransactionJournal = void 0;
3
+ exports.EditJournalImpl = exports.EditJournal = void 0;
4
4
  const Hooks_1 = require("./Hooks");
5
5
  const Data_1 = require("./Data");
6
6
  const Snapshot_1 = require("./Snapshot");
7
7
  const Transaction_1 = require("./Transaction");
8
8
  const Sealant_1 = require("../util/Sealant");
9
- class TransactionJournal extends Hooks_1.ObservableObject {
10
- static create() { return new TransactionJournalImpl(); }
9
+ class EditJournal extends Hooks_1.ObservableObject {
10
+ static create() { return new EditJournalImpl(); }
11
11
  }
12
- exports.TransactionJournal = TransactionJournal;
13
- class TransactionJournalImpl extends TransactionJournal {
12
+ exports.EditJournal = EditJournal;
13
+ class EditJournalImpl extends EditJournal {
14
14
  constructor() {
15
15
  super(...arguments);
16
16
  this._capacity = 5;
17
- this._items = [];
17
+ this._isSaving = false;
18
+ this._edits = [];
18
19
  this._position = 0;
20
+ this._saved = 0;
19
21
  }
20
22
  get capacity() { return this._capacity; }
21
- set capacity(value) { this._capacity = value; if (value < this._items.length)
22
- this._items.splice(0, this._items.length - value); }
23
- get items() { return this._items; }
24
- get canUndo() { return this._items.length > 0 && this._position > 0; }
25
- get canRedo() { return this._position < this._items.length; }
26
- remember(p) {
27
- Transaction_1.Transaction.run({ hint: 'TransactionJournal.remember', standalone: 'isolated' }, () => {
28
- const items = this._items = this._items.toMutable();
29
- if (items.length >= this._capacity)
30
- items.shift();
31
- else
32
- items.splice(this._position);
33
- items.push(p);
34
- this._position = items.length;
35
- });
36
- }
23
+ set capacity(value) { this._capacity = value; if (value < this._edits.length)
24
+ this._edits.splice(0, this._edits.length - value); }
25
+ get isSaving() { return this._isSaving; }
26
+ get edits() { return this._edits; }
27
+ get canUndo() { return this._edits.length > 0 && this._position > 0; }
28
+ get canRedo() { return this._position < this._edits.length; }
37
29
  undo(count = 1) {
38
- Transaction_1.Transaction.run({ hint: 'TransactionJournal.undo', standalone: 'isolated' }, () => {
30
+ Transaction_1.Transaction.run({ hint: 'EditJournal.undo', standalone: 'isolated' }, () => {
39
31
  let i = this._position - 1;
40
32
  while (i >= 0 && count > 0) {
41
- const patch = this._items[i];
42
- TransactionJournalImpl.applyPatch(patch, true);
33
+ const patch = this._edits[i];
34
+ EditJournalImpl.applyPatch(patch, true);
43
35
  i--, count--;
44
36
  }
45
37
  this._position = i + 1;
46
38
  });
47
39
  }
48
40
  redo(count = 1) {
49
- Transaction_1.Transaction.run({ hint: 'TransactionJournal.redo', standalone: 'isolated' }, () => {
41
+ Transaction_1.Transaction.run({ hint: 'EditJournal.redo', standalone: 'isolated' }, () => {
50
42
  let i = this._position;
51
- while (i < this._items.length && count > 0) {
52
- const patch = this._items[i];
53
- TransactionJournalImpl.applyPatch(patch, false);
43
+ while (i < this._edits.length && count > 0) {
44
+ const patch = this._edits[i];
45
+ EditJournalImpl.applyPatch(patch, false);
54
46
  i++, count--;
55
47
  }
56
48
  this._position = i;
57
49
  });
58
50
  }
59
- static createPatch(hint, changeset) {
51
+ getUnsaved() {
52
+ let result = undefined;
53
+ const length = Math.abs(this._position - this._saved);
54
+ if (length !== 0) {
55
+ result = { hint: 'unsaved changes', objects: new Map() };
56
+ const direction = Math.sign(this._position - this._saved);
57
+ let i = 0;
58
+ while (i < length) {
59
+ const patch = this._edits[this._position + direction * (i + 1)];
60
+ patch.objects.forEach((p, obj) => {
61
+ });
62
+ i++;
63
+ }
64
+ }
65
+ return result;
66
+ }
67
+ beginSave() {
68
+ this._isSaving = true;
69
+ }
70
+ endSave(success) {
71
+ if (success)
72
+ this._saved = this._position;
73
+ this._isSaving = false;
74
+ }
75
+ register(p) {
76
+ Transaction_1.Transaction.run({ hint: 'EditJournal.remember', standalone: 'isolated' }, () => {
77
+ const items = this._edits = this._edits.toMutable();
78
+ if (items.length >= this._capacity)
79
+ items.shift();
80
+ else
81
+ items.splice(this._position);
82
+ items.push(p);
83
+ this._position = items.length;
84
+ });
85
+ }
86
+ static buildPatch(hint, changeset) {
60
87
  const patch = { hint, objects: new Map() };
61
88
  changeset.forEach((r, h) => {
62
89
  const p = { current: {}, former: {} };
@@ -95,7 +122,7 @@ class TransactionJournalImpl extends TransactionJournal {
95
122
  });
96
123
  }
97
124
  }
98
- exports.TransactionJournalImpl = TransactionJournalImpl;
125
+ exports.EditJournalImpl = EditJournalImpl;
99
126
  function unseal(observable) {
100
127
  const result = observable.value;
101
128
  const createCopy = result === null || result === void 0 ? void 0 : result[Sealant_1.Sealant.CreateCopy];
@@ -2,7 +2,7 @@ import { F } from '../util/Utils';
2
2
  import { MemberOptions, Kind, Reentrance } from '../Options';
3
3
  import { LoggingOptions, ProfilingOptions } from '../Logging';
4
4
  import { MemberName, ObjectHolder, StandaloneMode } from './Data';
5
- import { TransactionJournal } from './TransactionJournal';
5
+ import { EditJournal } from './EditJournal';
6
6
  import { Monitor } from './Monitor';
7
7
  export declare abstract class ObservableObject {
8
8
  constructor();
@@ -18,7 +18,7 @@ export declare class OptionsImpl implements MemberOptions {
18
18
  readonly triggeringArgs: boolean;
19
19
  readonly throttling: number;
20
20
  readonly reentrance: Reentrance;
21
- readonly journal: TransactionJournal | undefined;
21
+ readonly journal: EditJournal | undefined;
22
22
  readonly monitor: Monitor | null;
23
23
  readonly logging?: Partial<LoggingOptions>;
24
24
  static readonly INITIAL: Readonly<OptionsImpl>;
@@ -5,6 +5,7 @@ export declare abstract class Meta {
5
5
  static readonly Initial: unique symbol;
6
6
  static readonly Reactions: unique symbol;
7
7
  static readonly Unobservable: unique symbol;
8
+ static readonly Undefined: unique symbol;
8
9
  static get<T>(obj: any, sym: symbol): T;
9
10
  static set(obj: any, sym: symbol, value: any): any;
10
11
  static acquire(proto: any, sym: symbol): any;
@@ -30,3 +30,4 @@ Meta.Disposed = Symbol('rxDisposed');
30
30
  Meta.Initial = Symbol('rxInitial');
31
31
  Meta.Reactions = Symbol('rxReactions');
32
32
  Meta.Unobservable = Symbol('rxUnobservable');
33
+ Meta.Undefined = Symbol('rxUndefined');
@@ -4,24 +4,29 @@ export declare abstract class Monitor extends ObservableObject {
4
4
  abstract readonly isActive: boolean;
5
5
  abstract readonly counter: number;
6
6
  abstract readonly workers: ReadonlySet<Worker>;
7
- static create(hint: string, activationDelay: number, deactivationDelay: number): Monitor;
7
+ abstract readonly duration: number;
8
+ static create(hint: string, activationDelay: number, deactivationDelay: number, durationResolution: number): Monitor;
8
9
  }
9
10
  export declare class MonitorImpl extends Monitor {
10
11
  isActive: boolean;
11
12
  counter: number;
12
13
  workers: Set<Worker>;
14
+ duration: number;
13
15
  internals: {
16
+ started: number;
14
17
  activationDelay: number;
15
18
  activationTimeout: undefined;
16
19
  deactivationDelay: number;
17
20
  deactivationTimeout: undefined;
21
+ durationResolution: number;
18
22
  };
19
23
  enter(worker: Worker): void;
20
24
  leave(worker: Worker): void;
21
- static create(hint: string, activationDelay: number, deactivationDelay: number): MonitorImpl;
25
+ static create(hint: string, activationDelay: number, deactivationDelay: number, durationResolution: number): MonitorImpl;
22
26
  static enter(mon: MonitorImpl, worker: Worker): void;
23
27
  static leave(mon: MonitorImpl, worker: Worker): void;
24
28
  private static doCreate;
25
29
  private static activate;
26
30
  private static deactivate;
31
+ private static tick;
27
32
  }
@@ -4,8 +4,8 @@ exports.MonitorImpl = exports.Monitor = void 0;
4
4
  const Hooks_1 = require("./Hooks");
5
5
  const Transaction_1 = require("./Transaction");
6
6
  class Monitor extends Hooks_1.ObservableObject {
7
- static create(hint, activationDelay, deactivationDelay) {
8
- return MonitorImpl.create(hint, activationDelay, deactivationDelay);
7
+ static create(hint, activationDelay, deactivationDelay, durationResolution) {
8
+ return MonitorImpl.create(hint, activationDelay, deactivationDelay, durationResolution);
9
9
  }
10
10
  }
11
11
  exports.Monitor = Monitor;
@@ -15,11 +15,14 @@ class MonitorImpl extends Monitor {
15
15
  this.isActive = false;
16
16
  this.counter = 0;
17
17
  this.workers = new Set();
18
+ this.duration = 0;
18
19
  this.internals = {
20
+ started: 0,
19
21
  activationDelay: -1,
20
22
  activationTimeout: undefined,
21
23
  deactivationDelay: -1,
22
24
  deactivationTimeout: undefined,
25
+ durationResolution: 1,
23
26
  };
24
27
  }
25
28
  enter(worker) {
@@ -34,8 +37,8 @@ class MonitorImpl extends Monitor {
34
37
  workers.delete(worker);
35
38
  MonitorImpl.deactivate(this, this.internals.deactivationDelay);
36
39
  }
37
- static create(hint, activationDelay, deactivationDelay) {
38
- return Transaction_1.Transaction.run({ hint: 'Monitor.create' }, MonitorImpl.doCreate, hint, activationDelay, deactivationDelay);
40
+ static create(hint, activationDelay, deactivationDelay, durationResolution) {
41
+ return Transaction_1.Transaction.run({ hint: 'Monitor.create' }, MonitorImpl.doCreate, hint, activationDelay, deactivationDelay, durationResolution);
39
42
  }
40
43
  static enter(mon, worker) {
41
44
  mon.enter(worker);
@@ -43,14 +46,20 @@ class MonitorImpl extends Monitor {
43
46
  static leave(mon, worker) {
44
47
  mon.leave(worker);
45
48
  }
46
- static doCreate(hint, activationDelay, deactivationDelay) {
49
+ static doCreate(hint, activationDelay, deactivationDelay, durationResolution) {
47
50
  const m = new MonitorImpl();
48
51
  Hooks_1.Hooks.setHint(m, hint);
49
52
  m.internals.activationDelay = activationDelay;
50
53
  m.internals.deactivationDelay = deactivationDelay;
54
+ m.internals.durationResolution = durationResolution;
51
55
  return m;
52
56
  }
53
57
  static activate(mon, delay) {
58
+ if (mon.internals.started === 0) {
59
+ mon.duration = 0;
60
+ mon.internals.started = performance.now();
61
+ MonitorImpl.tick(mon);
62
+ }
54
63
  if (delay >= 0) {
55
64
  if (mon.internals.activationTimeout === undefined)
56
65
  mon.internals.activationTimeout = setTimeout(() => Transaction_1.Transaction.run({ hint: 'Monitor.activate', standalone: 'isolated' }, MonitorImpl.activate, mon, -1), delay);
@@ -67,6 +76,22 @@ class MonitorImpl extends Monitor {
67
76
  mon.isActive = false;
68
77
  mon.internals.activationTimeout = undefined;
69
78
  }
79
+ if (mon.counter === 0 && mon.internals.started !== 0) {
80
+ const resolution = mon.internals.durationResolution;
81
+ mon.duration = Math.round(resolution * (performance.now() - mon.internals.started)) / resolution;
82
+ mon.internals.started = 0;
83
+ }
84
+ }
85
+ static tick(mon) {
86
+ if (mon.internals.started !== 0) {
87
+ Transaction_1.Transaction.run(null, () => {
88
+ const resolution = mon.internals.durationResolution;
89
+ mon.duration = Math.round(resolution * (performance.now() - mon.internals.started)) / resolution;
90
+ });
91
+ const t = globalThis !== null && globalThis !== void 0 ? globalThis : global;
92
+ if (t.requestAnimationFrame)
93
+ requestAnimationFrame(() => MonitorImpl.tick(mon));
94
+ }
70
95
  }
71
96
  }
72
97
  exports.MonitorImpl = MonitorImpl;
@@ -9,7 +9,7 @@ const Snapshot_1 = require("./Snapshot");
9
9
  const Transaction_1 = require("./Transaction");
10
10
  const Monitor_1 = require("./Monitor");
11
11
  const Hooks_1 = require("./Hooks");
12
- const TransactionJournal_1 = require("./TransactionJournal");
12
+ const EditJournal_1 = require("./EditJournal");
13
13
  const BOOT_ARGS = [];
14
14
  const BOOT_CAUSE = '<boot>';
15
15
  const ROOT_HOLDER = new Data_1.ObjectHolder(undefined, undefined, Hooks_1.Hooks.proxy, Snapshot_1.ROOT_REV, '<root>');
@@ -280,7 +280,7 @@ class Operation extends Data_1.Observable {
280
280
  const skip = !observable.isOperation &&
281
281
  snapshot === this.snapshot;
282
282
  if (!skip) {
283
- const why = `${Snapshot_1.Dump.rev2(holder, snapshot, memberName)} << ${outer}`;
283
+ const why = `${Snapshot_1.Dump.rev2(holder, snapshot, memberName, observable)} << ${outer}`;
284
284
  this.unsubscribeFromAllObservables();
285
285
  this.obsoleteDueTo = why;
286
286
  this.obsoleteSince = since;
@@ -490,7 +490,7 @@ class Operation extends Data_1.Observable {
490
490
  Operation.propagateMemberChangeThroughSubscriptions(true, since, r, m, h, reactions);
491
491
  });
492
492
  reactions.sort(compareReactionsByOrder);
493
- (_a = snapshot.options.journal) === null || _a === void 0 ? void 0 : _a.remember(TransactionJournal_1.TransactionJournalImpl.createPatch(snapshot.hint, snapshot.changeset));
493
+ (_a = snapshot.options.journal) === null || _a === void 0 ? void 0 : _a.register(EditJournal_1.EditJournalImpl.buildPatch(snapshot.hint, snapshot.changeset));
494
494
  }
495
495
  static revokeAllSubscriptions(snapshot) {
496
496
  snapshot.changeset.forEach((r, h) => r.changes.forEach((o, m) => Operation.propagateMemberChangeThroughSubscriptions(true, snapshot.timestamp, r, m, h, undefined)));
@@ -628,6 +628,7 @@ class Operation extends Data_1.Observable {
628
628
  static init() {
629
629
  Object.freeze(BOOT_ARGS);
630
630
  Dbg_1.Log.getMergedLoggingOptions = getMergedLoggingOptions;
631
+ Snapshot_1.Dump.valueHint = valueHint;
631
632
  Snapshot_1.Snapshot.markUsed = Operation.markUsed;
632
633
  Snapshot_1.Snapshot.markEdited = Operation.markEdited;
633
634
  Snapshot_1.Snapshot.isConflicting = Operation.isConflicting;
@@ -674,10 +675,14 @@ function valueHint(value, m) {
674
675
  result = `${Snapshot_1.Dump.rev2(value.controller.ownHolder, value.snapshot, m)}`;
675
676
  else if (value === Data_1.Meta.Disposed)
676
677
  result = '<disposed>';
678
+ else if (value === Data_1.Meta.Undefined)
679
+ result = '◌';
680
+ else if (typeof (value) === 'string')
681
+ result = `"${value.toString().slice(0, 20)}"`;
677
682
  else if (value !== undefined && value !== null)
678
683
  result = value.toString().slice(0, 20);
679
684
  else
680
- result = '';
685
+ result = '';
681
686
  return result;
682
687
  }
683
688
  function getMergedLoggingOptions(local) {
@@ -49,8 +49,9 @@ export declare class Snapshot implements AbstractSnapshot {
49
49
  static _init(): void;
50
50
  }
51
51
  export declare class Dump {
52
- static obj(h: ObjectHolder | undefined, m?: MemberName | undefined, stamp?: number, snapshotId?: number, originSnapshotId?: number, typeless?: boolean): string;
53
- static rev2(h: ObjectHolder, s: AbstractSnapshot, m?: MemberName, value?: Observable): string;
52
+ static valueHint: (value: any, m?: PropertyKey | undefined) => string;
53
+ static obj(h: ObjectHolder | undefined, m?: MemberName | undefined, stamp?: number, snapshotId?: number, originSnapshotId?: number, value?: any): string;
54
+ static rev2(h: ObjectHolder, s: AbstractSnapshot, m?: MemberName, o?: Observable): string;
54
55
  static rev(r: ObjectRevision, m?: MemberName): string;
55
56
  static conflicts(conflicts: ObjectRevision[]): string;
56
57
  static conflictingMemberHint(m: MemberName, ours: ObjectRevision, theirs: ObjectRevision): string;
@@ -311,14 +311,17 @@ Snapshot.propagateAllChangesThroughSubscriptions = (snapshot) => { };
311
311
  Snapshot.revokeAllSubscriptions = (snapshot) => { };
312
312
  Snapshot.enqueueReactionsToRun = (reactions) => { };
313
313
  class Dump {
314
- static obj(h, m, stamp, snapshotId, originSnapshotId, typeless) {
314
+ static obj(h, m, stamp, snapshotId, originSnapshotId, value) {
315
315
  const member = m !== undefined ? `.${m.toString()}` : '';
316
316
  return h === undefined
317
317
  ? `boot${member}`
318
- : stamp === undefined ? `${h.hint}${member} #${h.id}` : `${h.hint}${member} #${h.id}t${snapshotId}v${stamp}${originSnapshotId !== undefined && originSnapshotId !== 0 ? `t${originSnapshotId}` : ''}`;
318
+ : stamp === undefined
319
+ ? `${h.hint}${member}${value !== undefined ? `[=${Dump.valueHint(value)}]` : ''} #${h.id}`
320
+ : `${h.hint}${member}${value !== undefined ? `[=${Dump.valueHint(value)}]` : ''} #${h.id}t${snapshotId}v${stamp}${originSnapshotId !== undefined && originSnapshotId !== 0 ? `t${originSnapshotId}` : ''}`;
319
321
  }
320
- static rev2(h, s, m, value) {
321
- return Dump.obj(h, m, s.timestamp, s.id, value === null || value === void 0 ? void 0 : value.originSnapshotId);
322
+ static rev2(h, s, m, o) {
323
+ var _a;
324
+ return Dump.obj(h, m, s.timestamp, s.id, o === null || o === void 0 ? void 0 : o.originSnapshotId, (_a = o === null || o === void 0 ? void 0 : o.value) !== null && _a !== void 0 ? _a : Data_1.Meta.Undefined);
322
325
  }
323
326
  static rev(r, m) {
324
327
  const h = Data_1.Meta.get(r.data, Data_1.Meta.Holder);
@@ -339,6 +342,7 @@ class Dump {
339
342
  }
340
343
  }
341
344
  exports.Dump = Dump;
345
+ Dump.valueHint = (value, m) => '???';
342
346
  exports.ROOT_REV = new Data_1.ObjectRevision(new Snapshot({ hint: '<root>' }), undefined, {});
343
347
  exports.DefaultSnapshotOptions = Object.freeze({
344
348
  hint: 'noname',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.22.202",
3
+ "version": "0.22.205",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "main": "build/dist/source/api.js",
6
6
  "types": "build/dist/source/api.d.ts",
@@ -1,27 +0,0 @@
1
- import { ObservableObject } from './Hooks';
2
- import { ObjectHolder, ObjectRevision, Patch } from './Data';
3
- export declare abstract class TransactionJournal extends ObservableObject {
4
- abstract capacity: number;
5
- abstract readonly items: ReadonlyArray<Patch>;
6
- abstract readonly canUndo: boolean;
7
- abstract readonly canRedo: boolean;
8
- abstract undo(count?: number): void;
9
- abstract redo(count?: number): void;
10
- abstract remember(patch: Patch): void;
11
- static create(): TransactionJournal;
12
- }
13
- export declare class TransactionJournalImpl extends TransactionJournal {
14
- private _capacity;
15
- private _items;
16
- private _position;
17
- get capacity(): number;
18
- set capacity(value: number);
19
- get items(): ReadonlyArray<Patch>;
20
- get canUndo(): boolean;
21
- get canRedo(): boolean;
22
- remember(p: Patch): void;
23
- undo(count?: number): void;
24
- redo(count?: number): void;
25
- static createPatch(hint: string, changeset: Map<ObjectHolder, ObjectRevision>): Patch;
26
- static applyPatch(patch: Patch, undo: boolean): void;
27
- }