reactronic 0.94.25036 → 0.95.25040

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 (42) hide show
  1. package/README.md +67 -66
  2. package/build/dist/source/Enums.d.ts +3 -3
  3. package/build/dist/source/Enums.js +3 -3
  4. package/build/dist/source/OperationEx.d.ts +2 -2
  5. package/build/dist/source/OperationEx.js +5 -5
  6. package/build/dist/source/Options.d.ts +2 -2
  7. package/build/dist/source/Pipe.d.ts +2 -2
  8. package/build/dist/source/Pipe.js +2 -2
  9. package/build/dist/source/Ref.d.ts +2 -2
  10. package/build/dist/source/Ref.js +5 -5
  11. package/build/dist/source/System.d.ts +14 -14
  12. package/build/dist/source/System.js +22 -22
  13. package/build/dist/source/api.d.ts +9 -9
  14. package/build/dist/source/api.js +7 -7
  15. package/build/dist/source/core/Changeset.js +1 -1
  16. package/build/dist/source/core/Data.d.ts +1 -1
  17. package/build/dist/source/core/Indicator.d.ts +2 -2
  18. package/build/dist/source/core/Indicator.js +2 -2
  19. package/build/dist/source/core/Journal.d.ts +2 -2
  20. package/build/dist/source/core/Journal.js +2 -2
  21. package/build/dist/source/core/Mvcc.d.ts +10 -10
  22. package/build/dist/source/core/Mvcc.js +19 -19
  23. package/build/dist/source/core/MvccArray.d.ts +3 -3
  24. package/build/dist/source/core/MvccArray.js +4 -4
  25. package/build/dist/source/core/MvccMap.d.ts +3 -3
  26. package/build/dist/source/core/MvccMap.js +4 -4
  27. package/build/dist/source/core/MvccReconciliationList.d.ts +28 -0
  28. package/build/dist/source/core/MvccReconciliationList.js +26 -0
  29. package/build/dist/source/core/Operation.d.ts +8 -8
  30. package/build/dist/source/core/Operation.js +41 -41
  31. package/build/dist/source/core/Transaction.js +28 -28
  32. package/build/dist/source/core/TreeNode.d.ts +19 -19
  33. package/build/dist/source/core/TreeNode.js +58 -58
  34. package/build/dist/source/util/LinkedList.d.ts +52 -0
  35. package/build/dist/source/util/LinkedList.js +177 -0
  36. package/build/dist/source/util/LinkedListRenovation.d.ts +20 -0
  37. package/build/dist/source/util/LinkedListRenovation.js +134 -0
  38. package/build/dist/source/util/{ScriptedList.d.ts → ReconciliationList.d.ts} +17 -15
  39. package/build/dist/source/util/{ScriptedList.js → ReconciliationList.js} +91 -90
  40. package/package.json +10 -9
  41. package/build/dist/source/core/MvccMergeList.d.ts +0 -27
  42. package/build/dist/source/core/MvccMergeList.js +0 -25
package/README.md CHANGED
@@ -20,23 +20,23 @@ corresponding visual components for (re)rendering. All
20
20
  that is done in automatic, seamless, and fine-grained
21
21
  way. Reactronic **takes full care of tracking dependencies**
22
22
  between visual components (reactive functions) and
23
- application state (observable objects).
23
+ application state (signalling objects).
24
24
 
25
25
  Transactional reactivity is based on four fundamental
26
26
  concepts:
27
27
 
28
- - **Observable Objects** - a set of objects that store
28
+ - **Signalling Objects** - a set of objects that store
29
29
  data of an application (state) and cause reactions
30
30
  upon their changes;
31
- - **Atomic Block** - a code block that makes changes
32
- in observable objects in atomic way ("all or
33
- nothing");
34
- - **Reaction** - a function that is
31
+ - **Transactional Function** - a function that makes
32
+ changes in signalling objects in atomic way ("all
33
+ or nothing");
34
+ - **Reactive Function** - a function that is
35
35
  (re-)executed in response to changes made in
36
- observable objects by atomic actions;
37
- - **Cache** - a function which result is remembered
38
- and, if becomes obsolete, causes function to
39
- re-execute on-demand.
36
+ signalling objects by transactional functions;
37
+ - **Cache Function** - a function which result is
38
+ remembered and, if becomes obsolete, causes
39
+ function to re-execute on-demand.
40
40
 
41
41
  Demo application built with Reactronic: https://nevod.io/#/playground.
42
42
  Source code of the demo: https://gitlab.com/nezaboodka/nevod.web.public/-/blob/master/README.md.
@@ -48,17 +48,17 @@ Quick introduction and detailed description is below.
48
48
  Here is an example of transactional reactive code:
49
49
 
50
50
  ``` typescript
51
- class Demo extends ObservableObject {
51
+ class Demo extends SignallingObject {
52
52
  name: string = 'Nezaboodka Software'
53
53
  email: string = 'contact@nezaboodka.com'
54
54
 
55
- @atomic
55
+ @transaction
56
56
  saveContact(name: string, email: string): void {
57
57
  this.name = name
58
58
  this.email = email
59
59
  }
60
60
 
61
- @reactive
61
+ @reaction
62
62
  printContact(): void {
63
63
  // depends on `name` and `email` and reacts to their changes
64
64
  if (this.email.indexOf('@') >= 0)
@@ -68,28 +68,28 @@ class Demo extends ObservableObject {
68
68
  }
69
69
  ```
70
70
 
71
- In the example above, `Demo` is an observable object,
71
+ In the example above, `Demo` is a signalling object,
72
72
  meaning that access to its fields are seamlessly tracked
73
73
  to determine dependent reactive and cached functions.
74
74
  Reactive function `printContact` reads `name` and `email`
75
75
  fields, thus depends on them. It is executed automatically
76
- in response to changes of these fields made by the atomic
77
- function `saveContact`.
76
+ in response to changes of these fields made by the
77
+ transactional function `saveContact`.
78
78
 
79
79
  Here is an example of a cached result that is
80
80
  (re-)computed on-demand:
81
81
 
82
82
  ``` typescript
83
- class Demo extends ObservableObject {
83
+ class Demo extends SignallingObject {
84
84
  name: string = 'Nezaboodka Software'
85
85
  email: string = 'contact@nezaboodka.com'
86
86
 
87
- @cached
87
+ @cache
88
88
  get contact(): string {
89
89
  return this.name + ' <' + this.email + '>'
90
90
  }
91
91
 
92
- @reactive
92
+ @reaction
93
93
  printContact(): void {
94
94
  if (this.contact !== '')
95
95
  Console.log(this.contact)
@@ -107,15 +107,15 @@ thus causing execution of depending reactive function
107
107
  `printContact` runs it reads `contact` and causes its
108
108
  re-computation.
109
109
 
110
- ## Observable Objects
110
+ ## Signalling Objects
111
111
 
112
- Observable objects are aimed to store data of
112
+ Signalling objects are aimed to store data of
113
113
  an application. All such objects are transparently hooked
114
114
  to track access to their properties, both on reads and
115
115
  writes.
116
116
 
117
117
  ``` typescript
118
- class MyModel extends ObservableObject {
118
+ class MyModel extends SignallingObject {
119
119
  url: string = "https://github.com/nezaboodka/reactronic"
120
120
  content: string = "transactional reactive state management"
121
121
  timestamp: Date = Date.now()
@@ -123,21 +123,22 @@ class MyModel extends ObservableObject {
123
123
  ```
124
124
 
125
125
  In the example above, the class `MyModel` is based on
126
- Reactronic's `ObservableObject` class and all its
126
+ Reactronic's `SignallingObject` class and all its
127
127
  properties `url`, `content`, and `timestamp` are hooked.
128
128
 
129
- ## Atomic Function
129
+ ## Transactional Function
130
130
 
131
- Atomic function makes changes in observable objects
132
- in atomic (transactional) way, thus provoking execution
133
- of dependent reactive and cached functions. Atomic
134
- function is instrumented with hooks to provide transparent atomicity
135
- (by implicit context switching and isolation).
131
+ Transactional function makes changes in signalling
132
+ objects in atomic way ("all or nothing"), thus provoking
133
+ execution of dependent reactive and cached functions.
134
+ Transactional function is instrumented with hooks to
135
+ provide transparent atomicity (by implicit context
136
+ switching and isolation).
136
137
 
137
138
  ``` typescript
138
- class MyModel extends ObservableObject {
139
+ class MyModel extends SignallingObject {
139
140
  // ...
140
- @atomic
141
+ @transaction
141
142
  async load(url: string): Promise<void> {
142
143
  this.url = url
143
144
  this.content = await fetch(url)
@@ -146,9 +147,9 @@ class MyModel extends ObservableObject {
146
147
  }
147
148
  ```
148
149
 
149
- In the example above, the atomic function `load` makes
150
+ In the example above, the transactional function `load` makes
150
151
  changes to `url`, `content` and `timestamp` properties.
151
- While atomic function is running, the changes are visible
152
+ While transactional function is running, the changes are visible
152
153
  only inside the function itself. The new values become
153
154
  atomically visible outside of the function only upon its
154
155
  completion.
@@ -159,41 +160,41 @@ function until it is fully finished and applied. Multiple
159
160
  objects and their properties can be changed with full
160
161
  respect to the all-or-nothing principle. To do so,
161
162
  separate data snapshot is automatically maintained for
162
- each atomic function. That is a logical snapshot that does
163
- not create a full copy of all the data.
163
+ each transactional function. That is a logical snapshot
164
+ that does not create a full copy of all the data.
164
165
 
165
166
  Compensating rollback operations are not needed in case
166
- of the atomic function failure, because all the changes
167
- made by the atomic function in its logical snapshot are
168
- simply discarded. In case the atomic function is
167
+ of a transactional function failure, because all the changes
168
+ made by transactional function in its logical snapshot are
169
+ simply discarded. In case a transaction function is
169
170
  successfully applied, affected cached results are marked
170
171
  as obsolete and corresponding caching functions are
171
172
  re-executed in a proper order (but only when all the
172
173
  data changes are fully applied).
173
174
 
174
175
  Asynchronous operations (promises) are supported out of
175
- the box during atomic function execution. Atomic function
176
- may consist of a set of asynchronous calls prolonging
177
- the function until completion of all of them. An
178
- asynchronous call may spawn other asynchronous calls,
179
- which prolong atomic atomic execution until the whole
176
+ the box during transactional function execution.
177
+ Transactional function may consist of a set of asynchronous
178
+ calls prolonging the function until completion of all of
179
+ them. An asynchronous call may spawn other asynchronous
180
+ calls, which prolong transactional execution until the whole
180
181
  chain of asynchronous operations is fully completed.
181
182
 
182
183
  ## Reactive & Cached Functions
183
184
 
184
185
  Reactive function is automatically and immediately called
185
- in response to changes in observable objects made by
186
- atomic functions. Cached function is called on-demand to
187
- renew the result if it was marked as obsolete due to
188
- changes made by an atomic functions. Reactive and cached
186
+ in response to changes in signalling objects made by
187
+ transactional functions. Cached function is called on-demand
188
+ to renew the result if it was marked as obsolete due to
189
+ changes made by an transactional functions. Reactive and cached
189
190
  functions are instrumented with hooks to seamlessly
190
- subscribe to those observable objects and other cached
191
+ subscribe to those signalling objects and other cached
191
192
  functions (dependencies), which are used during their
192
193
  execution.
193
194
 
194
195
  ``` tsx
195
196
  class MyView extends Component<{model: MyModel}> {
196
- @cached
197
+ @cache
197
198
  render(): React.JSX.Element {
198
199
  return (
199
200
  <div>
@@ -207,12 +208,12 @@ class MyView extends Component<{model: MyModel}> {
207
208
 
208
209
  ``` tsx
209
210
  class Component<P> extends React.Component<P> {
210
- @cached
211
+ @cache
211
212
  render(): React.JSX.Element {
212
213
  throw new Error('render method is undefined')
213
214
  }
214
215
 
215
- @reactive // called in response to changes
216
+ @reaction // called in response to changes
216
217
  ensureUpToDate(): void {
217
218
  if (this.shouldComponentUpdate()) {
218
219
  // Ask React to re-render
@@ -231,7 +232,7 @@ class Component<P> extends React.Component<P> {
231
232
  }
232
233
 
233
234
  componentWillUnmount(): void {
234
- atomicAction(disposeObservableObject, this)
235
+ runTransactional(disposeSignallingObject, this)
235
236
  }
236
237
  }
237
238
  ```
@@ -250,14 +251,14 @@ cached value.
250
251
 
251
252
  In general case, all reactive and cached functions
252
253
  are automatically and immediately marked as obsolete
253
- when changes are made in those observable objects and
254
+ when changes are made in those signalling objects and
254
255
  other cached results that were used during their
255
256
  execution. And once marked, the functions are
256
257
  automatically executed again, either immediately (for
257
258
  reactive functions) or on-demand (for cached functions).
258
259
 
259
260
  Reactronic takes full care of tracking dependencies
260
- between all the observable objects and reactive/cached
261
+ between all the signalling objects and reactive/cached
261
262
  functions. With Reactronic, you no longer need to create
262
263
  data change events in one set of objects, subscribe to
263
264
  these events in other objects, and manually maintain
@@ -277,11 +278,11 @@ reactive functions:
277
278
  is executed in case of recurring changes:
278
279
 
279
280
  - `(ms)` - minimal delay in milliseconds between executions;
280
- - `-1` - execute immediately once atomic function is applied (synchronously);
281
+ - `-1` - execute immediately once transactional function changes are applied (synchronously);
281
282
  - `0` - execute immediately via event loop (asynchronously with zero timeout);
282
283
  - `>= Number.MAX_SAFE_INTEGER` - never execute (suspended reaction).
283
284
 
284
- **Reentrance** option defines how to handle reentrant calls of atomic
285
+ **Reentrance** option defines how to handle reentrant calls of transactional
285
286
  and reactive functions:
286
287
 
287
288
  - `preventWithError` - fail with error if there is an existing call in progress;
@@ -292,7 +293,7 @@ and reactive functions:
292
293
 
293
294
  **Indicator** is an object that maintains status of running functions,
294
295
  which it is attached to. A single indicator object can be shared between
295
- multiple atomic, reactive, and cached functions, thus maintaining
296
+ multiple transactional, reactive, and cached functions, thus maintaining
296
297
  consolidated status for all of them (busy, workers, etc).
297
298
 
298
299
  ## Notes
@@ -323,20 +324,20 @@ NPM: `npm install reactronic`
323
324
 
324
325
  // Classes
325
326
 
326
- class AtomicObject { }
327
- class ObservableObject { }
327
+ class TransactionalObject { }
328
+ class SignallingObject { }
328
329
 
329
330
  // Decorators & Operators
330
331
 
331
- function observable(boolean) // field only
332
- function observable(proto, prop) // field only
333
- function atomic(proto, prop, pd) // method only
332
+ function signal(boolean) // field only
333
+ function signal(proto, prop) // field only
334
+ function transaction(proto, prop, pd) // method only
334
335
  function reaction(proto, prop, pd) // method only
335
336
  function cache(proto, prop, pd) // method only
336
337
  function options(value: Partial<ReactivityOptions>): F<any>
337
338
 
338
- function runNonReactively<T>(func: F<T>, ...args: any[]): T
339
- function runSensitively<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
339
+ function runNonReactive<T>(func: F<T>, ...args: any[]): T
340
+ function runSensitive<T>(sensitivity: Sensitivity, func: F<T>, ...args: any[]): T
340
341
 
341
342
  // SnapshotOptions, ReactivityOptions, Kind, Reentrance, Indicator, LoggingOptions, ProfilingOptions
342
343
 
@@ -353,7 +354,7 @@ type ReactivityOptions = {
353
354
  readonly isolation: Isolation
354
355
  readonly order: number
355
356
  readonly noSideEffects: boolean
356
- readonly observableArgs: boolean
357
+ readonly signalArgs: boolean
357
358
  readonly throttling: number // milliseconds, -1 is immediately, Number.MAX_SAFE_INTEGER is never
358
359
  readonly reentrance: Reentrance
359
360
  readonly journal: Journal | undefined
@@ -363,7 +364,7 @@ type ReactivityOptions = {
363
364
 
364
365
  enum Kind {
365
366
  plain = 0,
366
- atomic = 1,
367
+ transaction = 1,
367
368
  reaction = 2,
368
369
  cache = 3
369
370
  }
@@ -10,9 +10,9 @@ export declare enum Priority {
10
10
  }
11
11
  export declare enum Kind {
12
12
  plain = 0,
13
- atomic = 1,
14
- reactive = 2,
15
- cached = 3
13
+ transaction = 1,
14
+ reaction = 2,
15
+ cache = 3
16
16
  }
17
17
  export declare enum Reentrance {
18
18
  preventWithError = 1,
@@ -13,9 +13,9 @@ export var Priority;
13
13
  export var Kind;
14
14
  (function (Kind) {
15
15
  Kind[Kind["plain"] = 0] = "plain";
16
- Kind[Kind["atomic"] = 1] = "atomic";
17
- Kind[Kind["reactive"] = 2] = "reactive";
18
- Kind[Kind["cached"] = 3] = "cached";
16
+ Kind[Kind["transaction"] = 1] = "transaction";
17
+ Kind[Kind["reaction"] = 2] = "reaction";
18
+ Kind[Kind["cache"] = 3] = "cache";
19
19
  })(Kind || (Kind = {}));
20
20
  export var Reentrance;
21
21
  (function (Reentrance) {
@@ -1,6 +1,6 @@
1
1
  import { F } from "./util/Utils.js";
2
- import { ObservableObject } from "./core/Mvcc.js";
3
- export declare class ReactiveOperationEx<T> extends ObservableObject {
2
+ import { SxObject } from "./core/Mvcc.js";
3
+ export declare class ReactionEx<T> extends SxObject {
4
4
  protected operation: F<T>;
5
5
  constructor(operation: F<T>);
6
6
  protected launch(): T;
@@ -7,9 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { ObservableObject } from "./core/Mvcc.js";
11
- import { reactive } from "./System.js";
12
- export class ReactiveOperationEx extends ObservableObject {
10
+ import { SxObject } from "./core/Mvcc.js";
11
+ import { reaction } from "./System.js";
12
+ export class ReactionEx extends SxObject {
13
13
  constructor(operation) {
14
14
  super();
15
15
  this.operation = operation;
@@ -19,8 +19,8 @@ export class ReactiveOperationEx extends ObservableObject {
19
19
  }
20
20
  }
21
21
  __decorate([
22
- reactive,
22
+ reaction,
23
23
  __metadata("design:type", Function),
24
24
  __metadata("design:paramtypes", []),
25
25
  __metadata("design:returntype", Object)
26
- ], ReactiveOperationEx.prototype, "launch", null);
26
+ ], ReactionEx.prototype, "launch", null);
@@ -16,7 +16,7 @@ export type ReactivityOptions = {
16
16
  readonly isolation: Isolation;
17
17
  readonly order: number;
18
18
  readonly noSideEffects: boolean;
19
- readonly observableArgs: boolean;
19
+ readonly signalArgs: boolean;
20
20
  readonly throttling: number;
21
21
  readonly reentrance: Reentrance;
22
22
  readonly allowObsoleteToFinish: boolean;
@@ -24,7 +24,7 @@ export type ReactivityOptions = {
24
24
  readonly indicator: Indicator | null;
25
25
  readonly logging?: Partial<LoggingOptions>;
26
26
  };
27
- export type ReactiveOperation<T> = {
27
+ export type Reaction<T> = {
28
28
  readonly options: ReactivityOptions;
29
29
  readonly args: ReadonlyArray<any>;
30
30
  readonly result: T;
@@ -1,5 +1,5 @@
1
- import { ObservableObject } from "./core/Mvcc.js";
2
- export declare abstract class Pipe<T> extends ObservableObject {
1
+ import { SxObject } from "./core/Mvcc.js";
2
+ export declare abstract class Pipe<T> extends SxObject {
3
3
  abstract readonly capacity: number;
4
4
  abstract readonly count: number;
5
5
  abstract put(...items: T[]): void;
@@ -1,5 +1,5 @@
1
1
  import { misuse } from "./util/Dbg.js";
2
- import { ObservableObject } from "./core/Mvcc.js";
3
- export class Pipe extends ObservableObject {
2
+ import { SxObject } from "./core/Mvcc.js";
3
+ export class Pipe extends SxObject {
4
4
  static create(hint, capacity) { throw misuse("not implemented"); }
5
5
  }
@@ -28,8 +28,8 @@ export declare class Ref<T = any> {
28
28
  get variable(): T;
29
29
  set variable(value: T);
30
30
  nonReactively(): T;
31
- observe(): T;
32
- unobserve(): T;
31
+ signalling(): T;
32
+ nonSignalling(): T;
33
33
  static sameRefs(v1: Ref, v2: Ref): boolean;
34
34
  static similarRefs(v1: Ref, v2: Ref): boolean;
35
35
  }
@@ -1,5 +1,5 @@
1
1
  import { misuse } from "./util/Dbg.js";
2
- import { runAtomically, runNonReactively } from "./System.js";
2
+ import { runTransactional, runNonReactive } from "./System.js";
3
3
  export function refs(owner) {
4
4
  return new Proxy(owner, RefGettingProxy);
5
5
  }
@@ -29,12 +29,12 @@ export class Ref {
29
29
  this.owner[this.name][this.index] = value;
30
30
  }
31
31
  nonReactively() {
32
- return runNonReactively(() => this.variable);
32
+ return runNonReactive(() => this.variable);
33
33
  }
34
- observe() {
34
+ signalling() {
35
35
  return this.variable;
36
36
  }
37
- unobserve() {
37
+ nonSignalling() {
38
38
  throw misuse("not implemented");
39
39
  }
40
40
  static sameRefs(v1, v2) {
@@ -53,7 +53,7 @@ export class ToggleRef extends Ref {
53
53
  toggle() {
54
54
  const o = this.owner;
55
55
  const p = this.name;
56
- runAtomically({ hint: `toggle ${o.constructor.name}.${p}` }, () => {
56
+ runTransactional({ hint: `toggle ${o.constructor.name}.${p}` }, () => {
57
57
  const v = o[p];
58
58
  const isOn = v === this.valueOn || (v instanceof Ref && this.valueOn instanceof Ref &&
59
59
  Ref.sameRefs(v, this.valueOn));
@@ -1,5 +1,5 @@
1
1
  import { F } from "./util/Utils.js";
2
- import { ReactiveOperation, ReactivityOptions, LoggingOptions, ProfilingOptions, SnapshotOptions } from "./Options.js";
2
+ import { Reaction, ReactivityOptions, LoggingOptions, ProfilingOptions, SnapshotOptions } from "./Options.js";
3
3
  export declare class ReactiveSystem {
4
4
  static why(brief?: boolean): string;
5
5
  static getRevisionOf(obj: any): number;
@@ -13,17 +13,17 @@ export declare class ReactiveSystem {
13
13
  static getLoggingHint<T extends object>(obj: T, full?: boolean): string | undefined;
14
14
  static setProfilingMode(isOn: boolean, options?: Partial<ProfilingOptions>): void;
15
15
  }
16
- export declare function runAtomically<T>(func: F<T>, ...args: any[]): T;
17
- export declare function runAtomically<T>(options: SnapshotOptions, func: F<T>, ...args: any[]): T;
18
- export declare function runNonReactively<T>(func: F<T>, ...args: any[]): T;
19
- export declare function runSensitively<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
20
- export declare function runContextually<T>(p: Promise<T>): Promise<T>;
21
- export declare function manageReactiveOperation<T>(method: F<T>): ReactiveOperation<T>;
22
- export declare function configureCurrentReactiveOperation(options: Partial<ReactivityOptions>): ReactivityOptions;
23
- export declare function disposeObservableObject(obj: any): void;
24
- export declare function observable(enabled: boolean): (proto: object, prop: PropertyKey) => any;
25
- export declare function observable<T>(proto: object, prop: PropertyKey): any;
26
- export declare function atomic(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
27
- export declare function reactive(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
28
- export declare function cached(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
16
+ export declare function runTransactional<T>(func: F<T>, ...args: any[]): T;
17
+ export declare function runTransactional<T>(options: SnapshotOptions, func: F<T>, ...args: any[]): T;
18
+ export declare function runNonReactive<T>(func: F<T>, ...args: any[]): T;
19
+ export declare function runSensitive<T>(sensitivity: boolean, func: F<T>, ...args: any[]): T;
20
+ export declare function runContextual<T>(p: Promise<T>): Promise<T>;
21
+ export declare function manageReaction<T>(method: F<T>): Reaction<T>;
22
+ export declare function configureCurrentReaction(options: Partial<ReactivityOptions>): ReactivityOptions;
23
+ export declare function disposeSignallingObject(obj: any): void;
24
+ export declare function signal(enabled: boolean): (proto: object, prop: PropertyKey) => any;
25
+ export declare function signal<T>(proto: object, prop: PropertyKey): any;
26
+ export declare function transaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
27
+ export declare function reaction(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
28
+ export declare function cache(proto: object, prop: PropertyKey, pd: PropertyDescriptor): any;
29
29
  export declare function options(value: Partial<ReactivityOptions>): F<any>;
@@ -4,9 +4,9 @@ import { Meta, ObjectHandle } from "./core/Data.js";
4
4
  import { Changeset } from "./core/Changeset.js";
5
5
  import { Mvcc } from "./core/Mvcc.js";
6
6
  import { Transaction } from "./core/Transaction.js";
7
- import { ReactiveOperationImpl } from "./core/Operation.js";
7
+ import { ReactionImpl } from "./core/Operation.js";
8
8
  export class ReactiveSystem {
9
- static why(brief = false) { return brief ? ReactiveOperationImpl.briefWhy() : ReactiveOperationImpl.why(); }
9
+ static why(brief = false) { return brief ? ReactionImpl.briefWhy() : ReactionImpl.why(); }
10
10
  static getRevisionOf(obj) { return obj[Meta.Revision]; }
11
11
  static takeSnapshot(obj) { return Changeset.takeSnapshot(obj); }
12
12
  static get reactivityAutoStartDisabled() { return Mvcc.reactivityAutoStartDisabled; }
@@ -18,7 +18,7 @@ export class ReactiveSystem {
18
18
  static getLoggingHint(obj, full = false) { return ObjectHandle.getHint(obj, full); }
19
19
  static setProfilingMode(isOn, options) { Mvcc.setProfilingMode(isOn, options); }
20
20
  }
21
- export function runAtomically(p1, p2, p3) {
21
+ export function runTransactional(p1, p2, p3) {
22
22
  if (p1 instanceof Function) {
23
23
  if (p2 !== undefined)
24
24
  return Transaction.run(null, p1, ...p2);
@@ -32,25 +32,25 @@ export function runAtomically(p1, p2, p3) {
32
32
  return Transaction.run(p1, p2);
33
33
  }
34
34
  }
35
- export function runNonReactively(func, ...args) {
36
- return ReactiveOperationImpl.proceedWithinGivenLaunch(undefined, func, ...args);
35
+ export function runNonReactive(func, ...args) {
36
+ return ReactionImpl.proceedWithinGivenLaunch(undefined, func, ...args);
37
37
  }
38
- export function runSensitively(sensitivity, func, ...args) {
38
+ export function runSensitive(sensitivity, func, ...args) {
39
39
  return Mvcc.sensitive(sensitivity, func, ...args);
40
40
  }
41
- export function runContextually(p) {
41
+ export function runContextual(p) {
42
42
  throw misuse("not implemented yet");
43
43
  }
44
- export function manageReactiveOperation(method) {
45
- return ReactiveOperationImpl.manageReactiveOperation(method);
44
+ export function manageReaction(method) {
45
+ return ReactionImpl.manageReaction(method);
46
46
  }
47
- export function configureCurrentReactiveOperation(options) {
48
- return ReactiveOperationImpl.configureImpl(undefined, options);
47
+ export function configureCurrentReaction(options) {
48
+ return ReactionImpl.configureImpl(undefined, options);
49
49
  }
50
- export function disposeObservableObject(obj) {
50
+ export function disposeSignallingObject(obj) {
51
51
  Changeset.dispose(obj);
52
52
  }
53
- export function observable(protoOrEnabled, prop) {
53
+ export function signal(protoOrEnabled, prop) {
54
54
  if (typeof (protoOrEnabled) === "boolean") {
55
55
  return (proto, prop) => {
56
56
  return Mvcc.decorateData(protoOrEnabled, proto, prop);
@@ -59,28 +59,28 @@ export function observable(protoOrEnabled, prop) {
59
59
  else
60
60
  return Mvcc.decorateData(true, protoOrEnabled, prop);
61
61
  }
62
- export function atomic(proto, prop, pd) {
62
+ export function transaction(proto, prop, pd) {
63
63
  const opts = {
64
- kind: Kind.atomic,
64
+ kind: Kind.transaction,
65
65
  isolation: Isolation.joinToCurrentTransaction,
66
66
  };
67
- return Mvcc.decorateOperation(true, atomic, opts, proto, prop, pd);
67
+ return Mvcc.decorateOperation(true, transaction, opts, proto, prop, pd);
68
68
  }
69
- export function reactive(proto, prop, pd) {
69
+ export function reaction(proto, prop, pd) {
70
70
  const opts = {
71
- kind: Kind.reactive,
71
+ kind: Kind.reaction,
72
72
  isolation: Isolation.joinAsNestedTransaction,
73
73
  throttling: -1,
74
74
  };
75
- return Mvcc.decorateOperation(true, reactive, opts, proto, prop, pd);
75
+ return Mvcc.decorateOperation(true, reaction, opts, proto, prop, pd);
76
76
  }
77
- export function cached(proto, prop, pd) {
77
+ export function cache(proto, prop, pd) {
78
78
  const opts = {
79
- kind: Kind.cached,
79
+ kind: Kind.cache,
80
80
  isolation: Isolation.joinToCurrentTransaction,
81
81
  noSideEffects: true,
82
82
  };
83
- return Mvcc.decorateOperation(true, cached, opts, proto, prop, pd);
83
+ return Mvcc.decorateOperation(true, cache, opts, proto, prop, pd);
84
84
  }
85
85
  export function options(value) {
86
86
  return Mvcc.decorateOperationParametrized(options, value);
@@ -1,25 +1,25 @@
1
1
  export { all, pause, proceedSyncOrAsync } from "./util/Utils.js";
2
2
  export { Uri } from "./util/Uri.js";
3
- export { ScriptedList } from "./util/ScriptedList.js";
4
- export type { LinkedItem, ScriptedListReader } from "./util/ScriptedList.js";
3
+ export { ReconciliationList } from "./util/ReconciliationList.js";
4
+ export type { LinkedItem, ReconciliationListReader } from "./util/ReconciliationList.js";
5
5
  export { SealedArray } from "./util/SealedArray.js";
6
6
  export { SealedMap } from "./util/SealedMap.js";
7
7
  export { SealedSet } from "./util/SealedSet.js";
8
8
  export { LoggingLevel } from "./Options.js";
9
9
  export { Mode, Priority, Kind, Reentrance, Isolation } from "./Enums.js";
10
- export type { ReactiveOperation, ReactivityOptions, SnapshotOptions, LoggingOptions, ProfilingOptions } from "./Options.js";
10
+ export type { Reaction, ReactivityOptions, SnapshotOptions, LoggingOptions, ProfilingOptions } from "./Options.js";
11
11
  export type { Worker } from "./Worker.js";
12
12
  export { Ref, ToggleRef, refs, toggleRefs, customToggleRefs } from "./Ref.js";
13
13
  export type { BoolOnly, GivenTypeOnly } from "./Ref.js";
14
- export { AtomicObject, ObservableObject } from "./core/Mvcc.js";
15
- export { AtomicArray, ObservableArray } from "./core/MvccArray.js";
16
- export { AtomicMap, ObservableMap } from "./core/MvccMap.js";
14
+ export { TxObject, SxObject } from "./core/Mvcc.js";
15
+ export { TxArray, SxArray } from "./core/MvccArray.js";
16
+ export { TxMap, SxMap } from "./core/MvccMap.js";
17
17
  export { Changeset } from "./core/Changeset.js";
18
18
  export { Transaction } from "./core/Transaction.js";
19
19
  export { Indicator } from "./core/Indicator.js";
20
20
  export { Journal } from "./core/Journal.js";
21
- export { runAtomically, runNonReactively, runSensitively, runContextually, manageReactiveOperation, configureCurrentReactiveOperation, disposeObservableObject } from "./System.js";
22
- export { ReactiveSystem, observable, atomic, reactive, cached, options } from "./System.js";
23
- export { ReactiveOperationEx } from "./OperationEx.js";
21
+ export { runTransactional, runNonReactive, runSensitive, runContextual, manageReaction, configureCurrentReaction, disposeSignallingObject } from "./System.js";
22
+ export { ReactiveSystem, signal, transaction, reaction, cache, options } from "./System.js";
23
+ export { ReactionEx } from "./OperationEx.js";
24
24
  export { declare, derivative, launch, ReactiveTreeNode, BaseDriver, ReactiveTreeVariable } from "./core/TreeNode.js";
25
25
  export type { Script, ScriptAsync, Handler, ReactiveTreeNodeDecl, ReactiveTreeNodeDriver, ReactiveTreeNodeContext } from "./core/TreeNode.js";