reactronic 0.24.250 → 0.24.260

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.
@@ -55,11 +55,11 @@ export declare abstract class RxNode<E = unknown> {
55
55
  static setDefaultLoggingOptions(logging?: LoggingOptions): void;
56
56
  }
57
57
  export type RxNodeDecl<E = unknown> = {
58
- autorun?: Delegate<E>;
58
+ onChange?: Delegate<E>;
59
59
  key?: string;
60
60
  mode?: Mode;
61
- activation?: Delegate<E>;
62
- deactivation?: Delegate<E>;
61
+ onCreate?: Delegate<E>;
62
+ onDestroy?: Delegate<E>;
63
63
  triggers?: unknown;
64
64
  preset?: RxNodeDecl<E>;
65
65
  };
@@ -68,10 +68,10 @@ export type RxNodeDriver<E = unknown> = {
68
68
  readonly isPartitionSeparator: boolean;
69
69
  readonly predefine?: SimpleDelegate<E>;
70
70
  allocate(node: RxNode<E>): E;
71
- activate(node: RxNode<E>): void;
71
+ create(node: RxNode<E>): void;
72
72
  mount(node: RxNode<E>): void;
73
73
  update(node: RxNode<E>): void | Promise<void>;
74
- deactivate(node: RxNode<E>, isLeader: boolean): boolean;
74
+ destroy(node: RxNode<E>, isLeader: boolean): boolean;
75
75
  };
76
76
  export type RxNodeContext<T extends Object = Object> = {
77
77
  value: T;
@@ -82,10 +82,10 @@ export declare abstract class BaseDriver<E = unknown> implements RxNodeDriver<E>
82
82
  readonly predefine?: SimpleDelegate<E, void> | undefined;
83
83
  constructor(name: string, isPartitionSeparator: boolean, predefine?: SimpleDelegate<E, void> | undefined);
84
84
  abstract allocate(node: RxNode<E>): E;
85
- activate(node: RxNode<E>): void;
85
+ create(node: RxNode<E>): void;
86
86
  mount(node: RxNode<E>): void;
87
87
  update(node: RxNode<E>): void | Promise<void>;
88
- deactivate(node: RxNode<E>, isLeader: boolean): boolean;
88
+ destroy(node: RxNode<E>, isLeader: boolean): boolean;
89
89
  }
90
90
  export declare class RxNodeVariable<T extends Object = Object> {
91
91
  readonly defaultValue: T | undefined;
@@ -155,18 +155,18 @@ export class BaseDriver {
155
155
  this.isPartitionSeparator = isPartitionSeparator;
156
156
  this.predefine = predefine;
157
157
  }
158
- activate(node) {
158
+ create(node) {
159
159
  var _a;
160
160
  (_a = this.predefine) === null || _a === void 0 ? void 0 : _a.call(this, node.element);
161
- activateViaPresetChain(node.element, node.declaration);
161
+ invokeOnCreateViaPresetChain(node.element, node.declaration);
162
162
  }
163
163
  mount(node) {
164
164
  }
165
165
  update(node) {
166
- updateViaPresetChain(node.element, node.declaration);
166
+ invokeOnChangeViaPresetChain(node.element, node.declaration);
167
167
  }
168
- deactivate(node, isLeader) {
169
- deactivateViaPresetChain(node.element, node.declaration);
168
+ destroy(node, isLeader) {
169
+ invokeOnDestroyViaPresetChain(node.element, node.declaration);
170
170
  return isLeader;
171
171
  }
172
172
  }
@@ -198,29 +198,29 @@ function getModeViaPresetChain(declaration) {
198
198
  var _a;
199
199
  return (_a = declaration === null || declaration === void 0 ? void 0 : declaration.mode) !== null && _a !== void 0 ? _a : ((declaration === null || declaration === void 0 ? void 0 : declaration.preset) ? getModeViaPresetChain(declaration === null || declaration === void 0 ? void 0 : declaration.preset) : Mode.default);
200
200
  }
201
- function activateViaPresetChain(element, declaration) {
201
+ function invokeOnCreateViaPresetChain(element, declaration) {
202
202
  const preset = declaration.preset;
203
- const activation = declaration.activation;
204
- if (activation)
205
- activation(element, preset ? () => activateViaPresetChain(element, preset) : NOP);
203
+ const onCreate = declaration.onCreate;
204
+ if (onCreate)
205
+ onCreate(element, preset ? () => invokeOnCreateViaPresetChain(element, preset) : NOP);
206
206
  else if (preset)
207
- activateViaPresetChain(element, preset);
207
+ invokeOnCreateViaPresetChain(element, preset);
208
208
  }
209
- function updateViaPresetChain(element, declaration) {
209
+ function invokeOnChangeViaPresetChain(element, declaration) {
210
210
  const preset = declaration.preset;
211
- const autorun = declaration.autorun;
212
- if (autorun)
213
- autorun(element, preset ? () => updateViaPresetChain(element, preset) : NOP);
211
+ const onChange = declaration.onChange;
212
+ if (onChange)
213
+ onChange(element, preset ? () => invokeOnChangeViaPresetChain(element, preset) : NOP);
214
214
  else if (preset)
215
- updateViaPresetChain(element, preset);
215
+ invokeOnChangeViaPresetChain(element, preset);
216
216
  }
217
- function deactivateViaPresetChain(element, declaration) {
217
+ function invokeOnDestroyViaPresetChain(element, declaration) {
218
218
  const preset = declaration.preset;
219
- const deactivation = declaration.deactivation;
220
- if (deactivation)
221
- deactivation(element, preset ? () => deactivateViaPresetChain(element, preset) : NOP);
219
+ const onDestroy = declaration.onDestroy;
220
+ if (onDestroy)
221
+ onDestroy(element, preset ? () => invokeOnDestroyViaPresetChain(element, preset) : NOP);
222
222
  else if (preset)
223
- deactivateViaPresetChain(element, preset);
223
+ invokeOnDestroyViaPresetChain(element, preset);
224
224
  }
225
225
  class RxNodeContextImpl extends ObservableObject {
226
226
  constructor(variable, value) {
@@ -465,7 +465,7 @@ function mountOrRemountIfNecessary(node) {
465
465
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
466
466
  unobs(() => {
467
467
  node.stamp = Number.MAX_SAFE_INTEGER - 1;
468
- driver.activate(node);
468
+ driver.create(node);
469
469
  if (!node.has(Mode.manualMount)) {
470
470
  node.stamp = 0;
471
471
  if (node.host !== node)
@@ -510,7 +510,7 @@ function triggerDeactivation(seat, isLeader, individual) {
510
510
  if (individual && node.key !== node.declaration.key && !driver.isPartitionSeparator)
511
511
  console.log(`WARNING: it is recommended to assign explicit key for conditional element in order to avoid unexpected side effects: ${node.key}`);
512
512
  node.stamp = ~node.stamp;
513
- const childrenAreLeaders = unobs(() => driver.deactivate(node, isLeader));
513
+ const childrenAreLeaders = unobs(() => driver.destroy(node, isLeader));
514
514
  if (node.has(Mode.independentUpdate)) {
515
515
  seat.aux = undefined;
516
516
  const last = gLastToDispose;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.24.250",
3
+ "version": "0.24.260",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",