jotai-state-tree 1.3.5 → 1.3.6
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +2 -2
- package/dist/react.mjs +1 -1
- package/dist/{tree-BMaFqD3f.d.mts → tree-C2ADWEka.d.mts} +1 -1
- package/dist/{tree-BMaFqD3f.d.ts → tree-C2ADWEka.d.ts} +1 -1
- package/package.json +1 -1
- package/src/array.ts +1 -1
- package/src/tree.ts +5 -5
- package/dist/{chunk-E6MXYAAH.mjs → chunk-K2MLK6B7.mjs} +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as ISimpleType, a as IType, b as IIdentifierType, c as IIdentifierNumberType, d as ILiteralType, e as IEnumerationType, f as IFrozenType, M as ModelProperties, g as IModelType, h as MixinConfig, i as IMixin, j as IAnyType, k as IArrayType, l as IMapType, m as IOptionalType, n as IMaybeType, o as IMaybeNullType, p as IUnionType, U as UnionOptions, q as ILateType, r as IAnyModelType, R as ReferenceOptions, s as IReferenceType, t as ISafeReferenceType, u as IRefinementType, v as IDisposer, S as SnapshotIn, w as Instance, x as IReversibleJsonPatch } from './tree-
|
|
2
|
-
export { L as CustomTypeOptions, D as IAnyComplexType, E as IAnyMixin, G as IJsonPatch, z as IMSTArray, A as IMSTMap, y as IStateTreeNode, H as IValidationContext, K as IValidationError, J as IValidationResult, B as ModelInstance, F as ModelSelf, C as SnapshotOut, T as applyPatch, O as applySnapshot, aw as cleanupStaleEntries, ax as clearAllRegistries, aa as clone, aq as cloneDeep, a8 as destroy, a9 as detach, am as findAll, an as findFirst, as as freeze, a2 as getEnv, ag as getGlobalStore, a4 as getIdentifier, af as getMembers, ar as getOrCreatePath, Y as getParent, $ as getParentOfType, a0 as getPath, a1 as getPathParts, av as getRegistryStats, aj as getRelativePath, X as getRoot, N as getSnapshot, ap as getTreeStats, a3 as getType, _ as hasParent, al as haveSameRoot, a5 as isAlive, ak as isAncestor, at as isFrozen, a6 as isRoot, a7 as isStateTreeNode, ao as isValidReference, W as onAction, ay as onLifecycleChange, Q as onPatch, P as onSnapshot, V as recordPatches, ai as resetGlobalStore, ae as resolveIdentifier, ac as resolvePath, ah as setGlobalStore, Z as tryGetParent, ad as tryResolve, au as unfreeze, ab as walk } from './tree-
|
|
1
|
+
import { I as ISimpleType, a as IType, b as IIdentifierType, c as IIdentifierNumberType, d as ILiteralType, e as IEnumerationType, f as IFrozenType, M as ModelProperties, g as IModelType, h as MixinConfig, i as IMixin, j as IAnyType, k as IArrayType, l as IMapType, m as IOptionalType, n as IMaybeType, o as IMaybeNullType, p as IUnionType, U as UnionOptions, q as ILateType, r as IAnyModelType, R as ReferenceOptions, s as IReferenceType, t as ISafeReferenceType, u as IRefinementType, v as IDisposer, S as SnapshotIn, w as Instance, x as IReversibleJsonPatch } from './tree-C2ADWEka.mjs';
|
|
2
|
+
export { L as CustomTypeOptions, D as IAnyComplexType, E as IAnyMixin, G as IJsonPatch, z as IMSTArray, A as IMSTMap, y as IStateTreeNode, H as IValidationContext, K as IValidationError, J as IValidationResult, B as ModelInstance, F as ModelSelf, C as SnapshotOut, T as applyPatch, O as applySnapshot, aw as cleanupStaleEntries, ax as clearAllRegistries, aa as clone, aq as cloneDeep, a8 as destroy, a9 as detach, am as findAll, an as findFirst, as as freeze, a2 as getEnv, ag as getGlobalStore, a4 as getIdentifier, af as getMembers, ar as getOrCreatePath, Y as getParent, $ as getParentOfType, a0 as getPath, a1 as getPathParts, av as getRegistryStats, aj as getRelativePath, X as getRoot, N as getSnapshot, ap as getTreeStats, a3 as getType, _ as hasParent, al as haveSameRoot, a5 as isAlive, ak as isAncestor, at as isFrozen, a6 as isRoot, a7 as isStateTreeNode, ao as isValidReference, W as onAction, ay as onLifecycleChange, Q as onPatch, P as onSnapshot, V as recordPatches, ai as resetGlobalStore, ae as resolveIdentifier, ac as resolvePath, ah as setGlobalStore, Z as tryGetParent, ad as tryResolve, au as unfreeze, ab as walk } from './tree-C2ADWEka.mjs';
|
|
3
3
|
import 'jotai/vanilla/internals';
|
|
4
4
|
import 'jotai';
|
|
5
5
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as ISimpleType, a as IType, b as IIdentifierType, c as IIdentifierNumberType, d as ILiteralType, e as IEnumerationType, f as IFrozenType, M as ModelProperties, g as IModelType, h as MixinConfig, i as IMixin, j as IAnyType, k as IArrayType, l as IMapType, m as IOptionalType, n as IMaybeType, o as IMaybeNullType, p as IUnionType, U as UnionOptions, q as ILateType, r as IAnyModelType, R as ReferenceOptions, s as IReferenceType, t as ISafeReferenceType, u as IRefinementType, v as IDisposer, S as SnapshotIn, w as Instance, x as IReversibleJsonPatch } from './tree-
|
|
2
|
-
export { L as CustomTypeOptions, D as IAnyComplexType, E as IAnyMixin, G as IJsonPatch, z as IMSTArray, A as IMSTMap, y as IStateTreeNode, H as IValidationContext, K as IValidationError, J as IValidationResult, B as ModelInstance, F as ModelSelf, C as SnapshotOut, T as applyPatch, O as applySnapshot, aw as cleanupStaleEntries, ax as clearAllRegistries, aa as clone, aq as cloneDeep, a8 as destroy, a9 as detach, am as findAll, an as findFirst, as as freeze, a2 as getEnv, ag as getGlobalStore, a4 as getIdentifier, af as getMembers, ar as getOrCreatePath, Y as getParent, $ as getParentOfType, a0 as getPath, a1 as getPathParts, av as getRegistryStats, aj as getRelativePath, X as getRoot, N as getSnapshot, ap as getTreeStats, a3 as getType, _ as hasParent, al as haveSameRoot, a5 as isAlive, ak as isAncestor, at as isFrozen, a6 as isRoot, a7 as isStateTreeNode, ao as isValidReference, W as onAction, ay as onLifecycleChange, Q as onPatch, P as onSnapshot, V as recordPatches, ai as resetGlobalStore, ae as resolveIdentifier, ac as resolvePath, ah as setGlobalStore, Z as tryGetParent, ad as tryResolve, au as unfreeze, ab as walk } from './tree-
|
|
1
|
+
import { I as ISimpleType, a as IType, b as IIdentifierType, c as IIdentifierNumberType, d as ILiteralType, e as IEnumerationType, f as IFrozenType, M as ModelProperties, g as IModelType, h as MixinConfig, i as IMixin, j as IAnyType, k as IArrayType, l as IMapType, m as IOptionalType, n as IMaybeType, o as IMaybeNullType, p as IUnionType, U as UnionOptions, q as ILateType, r as IAnyModelType, R as ReferenceOptions, s as IReferenceType, t as ISafeReferenceType, u as IRefinementType, v as IDisposer, S as SnapshotIn, w as Instance, x as IReversibleJsonPatch } from './tree-C2ADWEka.js';
|
|
2
|
+
export { L as CustomTypeOptions, D as IAnyComplexType, E as IAnyMixin, G as IJsonPatch, z as IMSTArray, A as IMSTMap, y as IStateTreeNode, H as IValidationContext, K as IValidationError, J as IValidationResult, B as ModelInstance, F as ModelSelf, C as SnapshotOut, T as applyPatch, O as applySnapshot, aw as cleanupStaleEntries, ax as clearAllRegistries, aa as clone, aq as cloneDeep, a8 as destroy, a9 as detach, am as findAll, an as findFirst, as as freeze, a2 as getEnv, ag as getGlobalStore, a4 as getIdentifier, af as getMembers, ar as getOrCreatePath, Y as getParent, $ as getParentOfType, a0 as getPath, a1 as getPathParts, av as getRegistryStats, aj as getRelativePath, X as getRoot, N as getSnapshot, ap as getTreeStats, a3 as getType, _ as hasParent, al as haveSameRoot, a5 as isAlive, ak as isAncestor, at as isFrozen, a6 as isRoot, a7 as isStateTreeNode, ao as isValidReference, W as onAction, ay as onLifecycleChange, Q as onPatch, P as onSnapshot, V as recordPatches, ai as resetGlobalStore, ae as resolveIdentifier, ac as resolvePath, ah as setGlobalStore, Z as tryGetParent, ad as tryResolve, au as unfreeze, ab as walk } from './tree-C2ADWEka.js';
|
|
3
3
|
import 'jotai/vanilla/internals';
|
|
4
4
|
import 'jotai';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -565,11 +565,11 @@ var StateTreeNode = class {
|
|
|
565
565
|
return;
|
|
566
566
|
}
|
|
567
567
|
globalStore.set(this.valueAtom, value);
|
|
568
|
+
this.notifySnapshotChange();
|
|
568
569
|
this.notifyPatch(
|
|
569
570
|
{ op: "replace", path: this.$path, value },
|
|
570
571
|
{ op: "replace", path: this.$path, value: oldValue, oldValue }
|
|
571
572
|
);
|
|
572
|
-
this.notifySnapshotChange();
|
|
573
573
|
}
|
|
574
574
|
/** Add a child node */
|
|
575
575
|
addChild(key, child) {
|
|
@@ -671,11 +671,11 @@ var StateTreeNode = class {
|
|
|
671
671
|
/** Notify about a property change (for use by model proxy) */
|
|
672
672
|
notifyPropertyChange(propName, newValue, oldValue) {
|
|
673
673
|
const path = this.$path ? `${this.$path}/${propName}` : `/${propName}`;
|
|
674
|
+
this.notifySnapshotChange();
|
|
674
675
|
this.notifyPatch(
|
|
675
676
|
{ op: "replace", path, value: newValue },
|
|
676
677
|
{ op: "replace", path, value: oldValue, oldValue }
|
|
677
678
|
);
|
|
678
|
-
this.notifySnapshotChange();
|
|
679
679
|
}
|
|
680
680
|
/** Notify about a volatile state change (triggers snapshot listeners without patches) */
|
|
681
681
|
notifyVolatileChange() {
|
|
@@ -2581,7 +2581,7 @@ var MSTArray = class _MSTArray extends Array {
|
|
|
2581
2581
|
}
|
|
2582
2582
|
const store = getGlobalStore();
|
|
2583
2583
|
store.set(this.node.valueAtom, newArray);
|
|
2584
|
-
this.node.
|
|
2584
|
+
this.node.notifySnapshotChange();
|
|
2585
2585
|
patches.forEach((patch, idx) => {
|
|
2586
2586
|
this.node.notifyPatch(patch, reversePatches[idx]);
|
|
2587
2587
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
tryResolve,
|
|
60
60
|
unfreeze,
|
|
61
61
|
walk
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-K2MLK6B7.mjs";
|
|
63
63
|
|
|
64
64
|
// src/primitives.ts
|
|
65
65
|
function createSimpleType(name, validator, defaultValue) {
|
|
@@ -1590,7 +1590,7 @@ var MSTArray = class _MSTArray extends Array {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
const store = getGlobalStore();
|
|
1592
1592
|
store.set(this.node.valueAtom, newArray);
|
|
1593
|
-
this.node.
|
|
1593
|
+
this.node.notifySnapshotChange();
|
|
1594
1594
|
patches.forEach((patch, idx) => {
|
|
1595
1595
|
this.node.notifyPatch(patch, reversePatches[idx]);
|
|
1596
1596
|
});
|
package/dist/react.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ComponentType, FC, ReactNode } from 'react';
|
|
2
|
-
import { ag as getGlobalStore } from './tree-
|
|
3
|
-
export { az as hasStateTreeNode } from './tree-
|
|
2
|
+
import { ag as getGlobalStore } from './tree-C2ADWEka.mjs';
|
|
3
|
+
export { az as hasStateTreeNode } from './tree-C2ADWEka.mjs';
|
|
4
4
|
import 'jotai/vanilla/internals';
|
|
5
5
|
import 'jotai';
|
|
6
6
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ComponentType, FC, ReactNode } from 'react';
|
|
2
|
-
import { ag as getGlobalStore } from './tree-
|
|
3
|
-
export { az as hasStateTreeNode } from './tree-
|
|
2
|
+
import { ag as getGlobalStore } from './tree-C2ADWEka.js';
|
|
3
|
+
export { az as hasStateTreeNode } from './tree-C2ADWEka.js';
|
|
4
4
|
import 'jotai/vanilla/internals';
|
|
5
5
|
import 'jotai';
|
|
6
6
|
|
package/dist/react.js
CHANGED
|
@@ -176,11 +176,11 @@ var StateTreeNode = class {
|
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
globalStore.set(this.valueAtom, value);
|
|
179
|
+
this.notifySnapshotChange();
|
|
179
180
|
this.notifyPatch(
|
|
180
181
|
{ op: "replace", path: this.$path, value },
|
|
181
182
|
{ op: "replace", path: this.$path, value: oldValue, oldValue }
|
|
182
183
|
);
|
|
183
|
-
this.notifySnapshotChange();
|
|
184
184
|
}
|
|
185
185
|
/** Add a child node */
|
|
186
186
|
addChild(key, child) {
|
|
@@ -282,11 +282,11 @@ var StateTreeNode = class {
|
|
|
282
282
|
/** Notify about a property change (for use by model proxy) */
|
|
283
283
|
notifyPropertyChange(propName, newValue, oldValue) {
|
|
284
284
|
const path = this.$path ? `${this.$path}/${propName}` : `/${propName}`;
|
|
285
|
+
this.notifySnapshotChange();
|
|
285
286
|
this.notifyPatch(
|
|
286
287
|
{ op: "replace", path, value: newValue },
|
|
287
288
|
{ op: "replace", path, value: oldValue, oldValue }
|
|
288
289
|
);
|
|
289
|
-
this.notifySnapshotChange();
|
|
290
290
|
}
|
|
291
291
|
/** Notify about a volatile state change (triggers snapshot listeners without patches) */
|
|
292
292
|
notifyVolatileChange() {
|
package/dist/react.mjs
CHANGED
|
@@ -379,7 +379,7 @@ declare class StateTreeNode implements IStateTreeNode {
|
|
|
379
379
|
/** Notify patch listeners */
|
|
380
380
|
notifyPatch(patch: IJsonPatch, reversePatch: IReversibleJsonPatch): void;
|
|
381
381
|
/** Notify snapshot listeners */
|
|
382
|
-
|
|
382
|
+
notifySnapshotChange(): void;
|
|
383
383
|
/** Notify about a property change (for use by model proxy) */
|
|
384
384
|
notifyPropertyChange(propName: string, newValue: unknown, oldValue: unknown): void;
|
|
385
385
|
/** Notify about a volatile state change (triggers snapshot listeners without patches) */
|
|
@@ -379,7 +379,7 @@ declare class StateTreeNode implements IStateTreeNode {
|
|
|
379
379
|
/** Notify patch listeners */
|
|
380
380
|
notifyPatch(patch: IJsonPatch, reversePatch: IReversibleJsonPatch): void;
|
|
381
381
|
/** Notify snapshot listeners */
|
|
382
|
-
|
|
382
|
+
notifySnapshotChange(): void;
|
|
383
383
|
/** Notify about a property change (for use by model proxy) */
|
|
384
384
|
notifyPropertyChange(propName: string, newValue: unknown, oldValue: unknown): void;
|
|
385
385
|
/** Notify about a volatile state change (triggers snapshot listeners without patches) */
|
package/package.json
CHANGED
package/src/array.ts
CHANGED
|
@@ -374,7 +374,7 @@ class MSTArray<T> extends Array<T> implements IMSTArray<T> {
|
|
|
374
374
|
// Update the node's value silently
|
|
375
375
|
const store = getGlobalStore();
|
|
376
376
|
store.set(this.node.valueAtom, newArray);
|
|
377
|
-
this.node.
|
|
377
|
+
this.node.notifySnapshotChange();
|
|
378
378
|
|
|
379
379
|
// Notify patch listeners
|
|
380
380
|
patches.forEach((patch, idx) => {
|
package/src/tree.ts
CHANGED
|
@@ -285,14 +285,14 @@ export class StateTreeNode implements IStateTreeNode {
|
|
|
285
285
|
}
|
|
286
286
|
globalStore.set(this.valueAtom, value);
|
|
287
287
|
|
|
288
|
+
// Notify snapshot listeners (bubble up to root)
|
|
289
|
+
this.notifySnapshotChange();
|
|
290
|
+
|
|
288
291
|
// Notify patch listeners
|
|
289
292
|
this.notifyPatch(
|
|
290
293
|
{ op: "replace", path: this.$path, value },
|
|
291
294
|
{ op: "replace", path: this.$path, value: oldValue, oldValue },
|
|
292
295
|
);
|
|
293
|
-
|
|
294
|
-
// Notify snapshot listeners (bubble up to root)
|
|
295
|
-
this.notifySnapshotChange();
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
/** Add a child node */
|
|
@@ -406,7 +406,7 @@ export class StateTreeNode implements IStateTreeNode {
|
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
/** Notify snapshot listeners */
|
|
409
|
-
|
|
409
|
+
notifySnapshotChange() {
|
|
410
410
|
let current: StateTreeNode | null = this;
|
|
411
411
|
while (current) {
|
|
412
412
|
current.invalidateSnapshot();
|
|
@@ -419,11 +419,11 @@ export class StateTreeNode implements IStateTreeNode {
|
|
|
419
419
|
/** Notify about a property change (for use by model proxy) */
|
|
420
420
|
notifyPropertyChange(propName: string, newValue: unknown, oldValue: unknown) {
|
|
421
421
|
const path = this.$path ? `${this.$path}/${propName}` : `/${propName}`;
|
|
422
|
+
this.notifySnapshotChange();
|
|
422
423
|
this.notifyPatch(
|
|
423
424
|
{ op: "replace", path, value: newValue },
|
|
424
425
|
{ op: "replace", path, value: oldValue, oldValue },
|
|
425
426
|
);
|
|
426
|
-
this.notifySnapshotChange();
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
/** Notify about a volatile state change (triggers snapshot listeners without patches) */
|
|
@@ -134,11 +134,11 @@ var StateTreeNode = class {
|
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
globalStore.set(this.valueAtom, value);
|
|
137
|
+
this.notifySnapshotChange();
|
|
137
138
|
this.notifyPatch(
|
|
138
139
|
{ op: "replace", path: this.$path, value },
|
|
139
140
|
{ op: "replace", path: this.$path, value: oldValue, oldValue }
|
|
140
141
|
);
|
|
141
|
-
this.notifySnapshotChange();
|
|
142
142
|
}
|
|
143
143
|
/** Add a child node */
|
|
144
144
|
addChild(key, child) {
|
|
@@ -240,11 +240,11 @@ var StateTreeNode = class {
|
|
|
240
240
|
/** Notify about a property change (for use by model proxy) */
|
|
241
241
|
notifyPropertyChange(propName, newValue, oldValue) {
|
|
242
242
|
const path = this.$path ? `${this.$path}/${propName}` : `/${propName}`;
|
|
243
|
+
this.notifySnapshotChange();
|
|
243
244
|
this.notifyPatch(
|
|
244
245
|
{ op: "replace", path, value: newValue },
|
|
245
246
|
{ op: "replace", path, value: oldValue, oldValue }
|
|
246
247
|
);
|
|
247
|
-
this.notifySnapshotChange();
|
|
248
248
|
}
|
|
249
249
|
/** Notify about a volatile state change (triggers snapshot listeners without patches) */
|
|
250
250
|
notifyVolatileChange() {
|