jotai-state-tree 1.7.3 → 1.7.5
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/{chunk-HHDXRF6H.mjs → chunk-I2ZPT6O4.mjs} +2 -5
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -5
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +2 -5
- package/dist/react.mjs +1 -1
- package/dist/{router-DzUdXVV7.d.mts → router-DwXAzNVB.d.mts} +1 -1
- package/dist/{router-DzUdXVV7.d.ts → router-DwXAzNVB.d.ts} +1 -1
- package/package.json +2 -2
- package/src/__tests__/router.test.tsx +4 -0
- package/src/model.ts +0 -3
- package/src/router.ts +2 -2
|
@@ -1821,9 +1821,6 @@ var ModelType = class _ModelType {
|
|
|
1821
1821
|
}
|
|
1822
1822
|
return descriptor.value;
|
|
1823
1823
|
}
|
|
1824
|
-
if (propStr === "toggle") {
|
|
1825
|
-
console.log("PROXY GET toggle:", propStr, "in allActions:", propStr in allActions, "keys:", Object.keys(allActions), "node alive:", node.$isAlive);
|
|
1826
|
-
}
|
|
1827
1824
|
if (propStr in allActions) {
|
|
1828
1825
|
return allActions[propStr];
|
|
1829
1826
|
}
|
|
@@ -3800,7 +3797,7 @@ var RouterModel = model("RouterModel", {
|
|
|
3800
3797
|
if (res === false) {
|
|
3801
3798
|
revert();
|
|
3802
3799
|
} else if (typeof res === "string") {
|
|
3803
|
-
self.
|
|
3800
|
+
self.replace(res);
|
|
3804
3801
|
} else {
|
|
3805
3802
|
proceed();
|
|
3806
3803
|
}
|
|
@@ -3811,7 +3808,7 @@ var RouterModel = model("RouterModel", {
|
|
|
3811
3808
|
if (result === false) {
|
|
3812
3809
|
revert();
|
|
3813
3810
|
} else if (typeof result === "string") {
|
|
3814
|
-
self.
|
|
3811
|
+
self.replace(result);
|
|
3815
3812
|
} else {
|
|
3816
3813
|
proceed();
|
|
3817
3814
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as
|
|
2
|
-
export {
|
|
1
|
+
import { I as IType, a as ISimpleType, b as ILiteralType, c as IEnumerationType, d as IFrozenType, e as IIdentifierType, f as IIdentifierNumberType, 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 } from './router-DwXAzNVB.mjs';
|
|
2
|
+
export { C as CustomTypeOptions, x as IActionRecorder, y as IActionRecording, z as IAnyComplexType, A as IAnyMixin, B as IHistoryEntry, D as IJsonPatch, E as IMSTArray, F as IMSTMap, G as IReversibleJsonPatch, H as IStateTreeNode, J as ITimeTravelManager, K as IUndoManager, L as IUndoManagerOptions, N as IValidationContext, O as IValidationError, P as IValidationResult, Q as ModelInstance, T as ModelSelf, V as RouteDefinition, W as RouterModel, X as SnapshotOut, Y as applyPatch, Z as applySnapshot, _ as cleanupStaleEntries, $ as clearAllRegistries, a0 as clone, a1 as cloneDeep, a2 as createActionRecorder, a3 as createRouter, a4 as createTimeTravelManager, a5 as createUndoManager, a6 as destroy, a7 as detach, a8 as findAll, a9 as findFirst, aa as freeze, ab as getEnv, ac as getGlobalStore, ad as getIdentifier, ae as getMembers, af as getOrCreatePath, ag as getParent, ah as getParentOfType, ai as getPath, aj as getPathParts, ak as getRegistryStats, al as getRelativePath, am as getRoot, an as getSnapshot, ao as getTreeStats, ap as getType, aq as hasParent, ar as haveSameRoot, as as isAlive, at as isAncestor, au as isFrozen, av as isRoot, aw as isStateTreeNode, ax as isValidReference, ay as onAction, az as onLifecycleChange, aA as onPatch, aB as onSnapshot, aC as recordPatches, aD as resetGlobalStore, aE as resolveIdentifier, aF as resolvePath, aG as setGlobalStore, aH as tryGetParent, aI as tryResolve, aJ as unfreeze, aK as walk } from './router-DwXAzNVB.mjs';
|
|
3
3
|
import 'jotai/vanilla/internals';
|
|
4
4
|
import 'jotai';
|
|
5
5
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as
|
|
2
|
-
export {
|
|
1
|
+
import { I as IType, a as ISimpleType, b as ILiteralType, c as IEnumerationType, d as IFrozenType, e as IIdentifierType, f as IIdentifierNumberType, 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 } from './router-DwXAzNVB.js';
|
|
2
|
+
export { C as CustomTypeOptions, x as IActionRecorder, y as IActionRecording, z as IAnyComplexType, A as IAnyMixin, B as IHistoryEntry, D as IJsonPatch, E as IMSTArray, F as IMSTMap, G as IReversibleJsonPatch, H as IStateTreeNode, J as ITimeTravelManager, K as IUndoManager, L as IUndoManagerOptions, N as IValidationContext, O as IValidationError, P as IValidationResult, Q as ModelInstance, T as ModelSelf, V as RouteDefinition, W as RouterModel, X as SnapshotOut, Y as applyPatch, Z as applySnapshot, _ as cleanupStaleEntries, $ as clearAllRegistries, a0 as clone, a1 as cloneDeep, a2 as createActionRecorder, a3 as createRouter, a4 as createTimeTravelManager, a5 as createUndoManager, a6 as destroy, a7 as detach, a8 as findAll, a9 as findFirst, aa as freeze, ab as getEnv, ac as getGlobalStore, ad as getIdentifier, ae as getMembers, af as getOrCreatePath, ag as getParent, ah as getParentOfType, ai as getPath, aj as getPathParts, ak as getRegistryStats, al as getRelativePath, am as getRoot, an as getSnapshot, ao as getTreeStats, ap as getType, aq as hasParent, ar as haveSameRoot, as as isAlive, at as isAncestor, au as isFrozen, av as isRoot, aw as isStateTreeNode, ax as isValidReference, ay as onAction, az as onLifecycleChange, aA as onPatch, aB as onSnapshot, aC as recordPatches, aD as resetGlobalStore, aE as resolveIdentifier, aF as resolvePath, aG as setGlobalStore, aH as tryGetParent, aI as tryResolve, aJ as unfreeze, aK as walk } from './router-DwXAzNVB.js';
|
|
3
3
|
import 'jotai/vanilla/internals';
|
|
4
4
|
import 'jotai';
|
|
5
5
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -1982,9 +1982,6 @@ var ModelType = class _ModelType {
|
|
|
1982
1982
|
}
|
|
1983
1983
|
return descriptor.value;
|
|
1984
1984
|
}
|
|
1985
|
-
if (propStr === "toggle") {
|
|
1986
|
-
console.log("PROXY GET toggle:", propStr, "in allActions:", propStr in allActions, "keys:", Object.keys(allActions), "node alive:", node.$isAlive);
|
|
1987
|
-
}
|
|
1988
1985
|
if (propStr in allActions) {
|
|
1989
1986
|
return allActions[propStr];
|
|
1990
1987
|
}
|
|
@@ -4622,7 +4619,7 @@ var RouterModel = model("RouterModel", {
|
|
|
4622
4619
|
if (res === false) {
|
|
4623
4620
|
revert();
|
|
4624
4621
|
} else if (typeof res === "string") {
|
|
4625
|
-
self.
|
|
4622
|
+
self.replace(res);
|
|
4626
4623
|
} else {
|
|
4627
4624
|
proceed();
|
|
4628
4625
|
}
|
|
@@ -4633,7 +4630,7 @@ var RouterModel = model("RouterModel", {
|
|
|
4633
4630
|
if (result === false) {
|
|
4634
4631
|
revert();
|
|
4635
4632
|
} else if (typeof result === "string") {
|
|
4636
|
-
self.
|
|
4633
|
+
self.replace(result);
|
|
4637
4634
|
} else {
|
|
4638
4635
|
proceed();
|
|
4639
4636
|
}
|
package/dist/index.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import React, { FC, ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { ac as getGlobalStore, J as ITimeTravelManager, L as IUndoManagerOptions, K as IUndoManager } from './router-DwXAzNVB.mjs';
|
|
3
|
+
export { aL as RouterContext, aM as hasStateTreeNode, aN as useRouter } from './router-DwXAzNVB.mjs';
|
|
4
4
|
import 'jotai/vanilla/internals';
|
|
5
5
|
import 'jotai';
|
|
6
6
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import React, { FC, ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { ac as getGlobalStore, J as ITimeTravelManager, L as IUndoManagerOptions, K as IUndoManager } from './router-DwXAzNVB.js';
|
|
3
|
+
export { aL as RouterContext, aM as hasStateTreeNode, aN as useRouter } from './router-DwXAzNVB.js';
|
|
4
4
|
import 'jotai/vanilla/internals';
|
|
5
5
|
import 'jotai';
|
|
6
6
|
|
package/dist/react.js
CHANGED
|
@@ -1595,9 +1595,6 @@ var ModelType = class _ModelType {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
return descriptor.value;
|
|
1597
1597
|
}
|
|
1598
|
-
if (propStr === "toggle") {
|
|
1599
|
-
console.log("PROXY GET toggle:", propStr, "in allActions:", propStr in allActions, "keys:", Object.keys(allActions), "node alive:", node.$isAlive);
|
|
1600
|
-
}
|
|
1601
1598
|
if (propStr in allActions) {
|
|
1602
1599
|
return allActions[propStr];
|
|
1603
1600
|
}
|
|
@@ -2751,7 +2748,7 @@ var RouterModel = model("RouterModel", {
|
|
|
2751
2748
|
if (res === false) {
|
|
2752
2749
|
revert();
|
|
2753
2750
|
} else if (typeof res === "string") {
|
|
2754
|
-
self.
|
|
2751
|
+
self.replace(res);
|
|
2755
2752
|
} else {
|
|
2756
2753
|
proceed();
|
|
2757
2754
|
}
|
|
@@ -2762,7 +2759,7 @@ var RouterModel = model("RouterModel", {
|
|
|
2762
2759
|
if (result === false) {
|
|
2763
2760
|
revert();
|
|
2764
2761
|
} else if (typeof result === "string") {
|
|
2765
|
-
self.
|
|
2762
|
+
self.replace(result);
|
|
2766
2763
|
} else {
|
|
2767
2764
|
proceed();
|
|
2768
2765
|
}
|
package/dist/react.mjs
CHANGED
|
@@ -725,4 +725,4 @@ declare function createRouter(config: {
|
|
|
725
725
|
declare const RouterContext: React.Context<any>;
|
|
726
726
|
declare function useRouter(): any;
|
|
727
727
|
|
|
728
|
-
export {
|
|
728
|
+
export { clearAllRegistries as $, type IAnyMixin as A, type IHistoryEntry as B, type CustomTypeOptions as C, type IJsonPatch as D, type IMSTArray as E, type IMSTMap as F, type IReversibleJsonPatch as G, type IStateTreeNode as H, type IType as I, type ITimeTravelManager as J, type IUndoManager as K, type IUndoManagerOptions as L, type ModelProperties as M, type IValidationContext as N, type IValidationError as O, type IValidationResult as P, type ModelInstance as Q, type ReferenceOptions as R, type SnapshotIn as S, type ModelSelf as T, type UnionOptions as U, RouteDefinition as V, RouterModel as W, type SnapshotOut as X, applyPatch as Y, applySnapshot as Z, cleanupStaleEntries as _, type ISimpleType as a, clone as a0, cloneDeep as a1, createActionRecorder as a2, createRouter as a3, createTimeTravelManager as a4, createUndoManager as a5, destroy as a6, detach as a7, findAll as a8, findFirst as a9, onPatch as aA, onSnapshot as aB, recordPatches as aC, resetGlobalStore as aD, resolveIdentifier as aE, resolvePath as aF, setGlobalStore as aG, tryGetParent as aH, tryResolve as aI, unfreeze as aJ, walk as aK, RouterContext as aL, hasStateTreeNode as aM, useRouter as aN, freeze as aa, getEnv as ab, getGlobalStore as ac, getIdentifier as ad, getMembers as ae, getOrCreatePath as af, getParent as ag, getParentOfType as ah, getPath as ai, getPathParts as aj, getRegistryStats as ak, getRelativePath as al, getRoot as am, getSnapshot as an, getTreeStats as ao, getType as ap, hasParent as aq, haveSameRoot as ar, isAlive as as, isAncestor as at, isFrozen as au, isRoot as av, isStateTreeNode as aw, isValidReference as ax, onAction as ay, onLifecycleChange as az, type ILiteralType as b, type IEnumerationType as c, type IFrozenType as d, type IIdentifierType as e, type IIdentifierNumberType as f, type IModelType as g, type MixinConfig as h, type IMixin as i, type IAnyType as j, type IArrayType as k, type IMapType as l, type IOptionalType as m, type IMaybeType as n, type IMaybeNullType as o, type IUnionType as p, type ILateType as q, type IAnyModelType as r, type IReferenceType as s, type ISafeReferenceType as t, type IRefinementType as u, type IDisposer as v, type Instance as w, type IActionRecorder as x, type IActionRecording as y, type IAnyComplexType as z };
|
|
@@ -725,4 +725,4 @@ declare function createRouter(config: {
|
|
|
725
725
|
declare const RouterContext: React.Context<any>;
|
|
726
726
|
declare function useRouter(): any;
|
|
727
727
|
|
|
728
|
-
export {
|
|
728
|
+
export { clearAllRegistries as $, type IAnyMixin as A, type IHistoryEntry as B, type CustomTypeOptions as C, type IJsonPatch as D, type IMSTArray as E, type IMSTMap as F, type IReversibleJsonPatch as G, type IStateTreeNode as H, type IType as I, type ITimeTravelManager as J, type IUndoManager as K, type IUndoManagerOptions as L, type ModelProperties as M, type IValidationContext as N, type IValidationError as O, type IValidationResult as P, type ModelInstance as Q, type ReferenceOptions as R, type SnapshotIn as S, type ModelSelf as T, type UnionOptions as U, RouteDefinition as V, RouterModel as W, type SnapshotOut as X, applyPatch as Y, applySnapshot as Z, cleanupStaleEntries as _, type ISimpleType as a, clone as a0, cloneDeep as a1, createActionRecorder as a2, createRouter as a3, createTimeTravelManager as a4, createUndoManager as a5, destroy as a6, detach as a7, findAll as a8, findFirst as a9, onPatch as aA, onSnapshot as aB, recordPatches as aC, resetGlobalStore as aD, resolveIdentifier as aE, resolvePath as aF, setGlobalStore as aG, tryGetParent as aH, tryResolve as aI, unfreeze as aJ, walk as aK, RouterContext as aL, hasStateTreeNode as aM, useRouter as aN, freeze as aa, getEnv as ab, getGlobalStore as ac, getIdentifier as ad, getMembers as ae, getOrCreatePath as af, getParent as ag, getParentOfType as ah, getPath as ai, getPathParts as aj, getRegistryStats as ak, getRelativePath as al, getRoot as am, getSnapshot as an, getTreeStats as ao, getType as ap, hasParent as aq, haveSameRoot as ar, isAlive as as, isAncestor as at, isFrozen as au, isRoot as av, isStateTreeNode as aw, isValidReference as ax, onAction as ay, onLifecycleChange as az, type ILiteralType as b, type IEnumerationType as c, type IFrozenType as d, type IIdentifierType as e, type IIdentifierNumberType as f, type IModelType as g, type MixinConfig as h, type IMixin as i, type IAnyType as j, type IArrayType as k, type IMapType as l, type IOptionalType as m, type IMaybeType as n, type IMaybeNullType as o, type IUnionType as p, type ILateType as q, type IAnyModelType as r, type IReferenceType as s, type ISafeReferenceType as t, type IRefinementType as u, type IDisposer as v, type Instance as w, type IActionRecorder as x, type IActionRecording as y, type IAnyComplexType as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jotai-state-tree",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "MobX-State-Tree API compatible library powered by Jotai",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"semantic-release": "^25.0.2",
|
|
78
78
|
"tsup": "^8.0.0",
|
|
79
79
|
"typedoc": "^0.28.15",
|
|
80
|
-
"typescript": "^
|
|
80
|
+
"typescript": "^6.0.3",
|
|
81
81
|
"vitest": "^4.0.16"
|
|
82
82
|
},
|
|
83
83
|
"repository": {
|
|
@@ -421,6 +421,8 @@ describe('State Router', () => {
|
|
|
421
421
|
popStateCallback(new PopStateEvent('popstate', { state: null }));
|
|
422
422
|
});
|
|
423
423
|
expect(router.pathname).toBe('/users/redirected');
|
|
424
|
+
expect(window.history.replaceState).toHaveBeenCalledWith(undefined, '', '/users/redirected');
|
|
425
|
+
expect(window.history.pushState).not.toHaveBeenCalled();
|
|
424
426
|
|
|
425
427
|
// 2. PopState promise rejection (should revert URL)
|
|
426
428
|
vi.stubGlobal('location', { pathname: '/files/error', search: '', hash: '' });
|
|
@@ -533,6 +535,8 @@ describe('State Router', () => {
|
|
|
533
535
|
popStateCallback(new PopStateEvent('popstate', { state: null }));
|
|
534
536
|
});
|
|
535
537
|
expect(r4.pathname).toBe('/users/redirected');
|
|
538
|
+
expect(window.history.replaceState).toHaveBeenCalledWith(undefined, '', '/users/redirected');
|
|
539
|
+
expect(window.history.pushState).not.toHaveBeenCalled();
|
|
536
540
|
|
|
537
541
|
// 5. popstate with async beforeNavigate resolving to false
|
|
538
542
|
const r5 = createRouter({
|
package/src/model.ts
CHANGED
|
@@ -359,9 +359,6 @@ class ModelType<
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
// Check actions
|
|
362
|
-
if (propStr === "toggle") {
|
|
363
|
-
console.log("PROXY GET toggle:", propStr, "in allActions:", propStr in allActions, "keys:", Object.keys(allActions), "node alive:", node.$isAlive);
|
|
364
|
-
}
|
|
365
362
|
if (propStr in allActions) {
|
|
366
363
|
return allActions[propStr];
|
|
367
364
|
}
|
package/src/router.ts
CHANGED
|
@@ -349,7 +349,7 @@ export const RouterModel = model("RouterModel", {
|
|
|
349
349
|
if (res === false) {
|
|
350
350
|
revert();
|
|
351
351
|
} else if (typeof res === "string") {
|
|
352
|
-
self.
|
|
352
|
+
self.replace(res);
|
|
353
353
|
} else {
|
|
354
354
|
proceed();
|
|
355
355
|
}
|
|
@@ -360,7 +360,7 @@ export const RouterModel = model("RouterModel", {
|
|
|
360
360
|
if (result === false) {
|
|
361
361
|
revert();
|
|
362
362
|
} else if (typeof result === "string") {
|
|
363
|
-
self.
|
|
363
|
+
self.replace(result);
|
|
364
364
|
} else {
|
|
365
365
|
proceed();
|
|
366
366
|
}
|