@storybook/react-native 10.3.0 → 10.3.1
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.js +50 -5
- package/dist/metro/withStorybook.js +2 -6
- package/dist/node.js +2 -6
- package/dist/repack/withStorybook.js +2 -6
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -471,6 +471,7 @@ var BUILDING_BLOCK_recomputeInvalidatedAtoms = (store2) => {
|
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
if (hasChangedDeps) {
|
|
474
|
+
invalidatedAtoms.set(a, aState.n);
|
|
474
475
|
readAtomState(store2, a);
|
|
475
476
|
mountDependencies(store2, a);
|
|
476
477
|
}
|
|
@@ -494,9 +495,19 @@ var BUILDING_BLOCK_readAtomState = (store2, atom2) => {
|
|
|
494
495
|
const mountDependencies = buildingBlocks[17];
|
|
495
496
|
const setAtomStateValueOrPromise = buildingBlocks[20];
|
|
496
497
|
const registerAbortHandler = buildingBlocks[26];
|
|
498
|
+
const storeEpochHolder = buildingBlocks[28];
|
|
497
499
|
const atomState = ensureAtomState(store2, atom2);
|
|
500
|
+
const storeEpochNumber = storeEpochHolder[0];
|
|
498
501
|
if (isAtomStateInitialized(atomState)) {
|
|
499
|
-
if (
|
|
502
|
+
if (
|
|
503
|
+
// If the atom is mounted, we can use cached atom state,
|
|
504
|
+
// because it should have been updated by dependencies.
|
|
505
|
+
// We can't use the cache if the atom is invalidated.
|
|
506
|
+
mountedMap.has(atom2) && invalidatedAtoms.get(atom2) !== atomState.n || // If atom is not mounted, we can use cached atom state,
|
|
507
|
+
// only if store hasn't been mutated.
|
|
508
|
+
atomState.m === storeEpochNumber
|
|
509
|
+
) {
|
|
510
|
+
atomState.m = storeEpochNumber;
|
|
500
511
|
return atomState;
|
|
501
512
|
}
|
|
502
513
|
let hasChangedDeps = false;
|
|
@@ -507,6 +518,7 @@ var BUILDING_BLOCK_readAtomState = (store2, atom2) => {
|
|
|
507
518
|
}
|
|
508
519
|
}
|
|
509
520
|
if (!hasChangedDeps) {
|
|
521
|
+
atomState.m = storeEpochNumber;
|
|
510
522
|
return atomState;
|
|
511
523
|
}
|
|
512
524
|
}
|
|
@@ -597,6 +609,7 @@ var BUILDING_BLOCK_readAtomState = (store2, atom2) => {
|
|
|
597
609
|
}
|
|
598
610
|
};
|
|
599
611
|
const prevEpochNumber = atomState.n;
|
|
612
|
+
const prevInvalidated = invalidatedAtoms.get(atom2) === prevEpochNumber;
|
|
600
613
|
try {
|
|
601
614
|
if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production") {
|
|
602
615
|
storeMutationSet.delete(store2);
|
|
@@ -619,15 +632,17 @@ var BUILDING_BLOCK_readAtomState = (store2, atom2) => {
|
|
|
619
632
|
pruneDependencies();
|
|
620
633
|
}
|
|
621
634
|
(_a = storeHooks.r) == null ? void 0 : _a.call(storeHooks, atom2);
|
|
635
|
+
atomState.m = storeEpochNumber;
|
|
622
636
|
return atomState;
|
|
623
637
|
} catch (error) {
|
|
624
638
|
delete atomState.v;
|
|
625
639
|
atomState.e = error;
|
|
626
640
|
++atomState.n;
|
|
641
|
+
atomState.m = storeEpochNumber;
|
|
627
642
|
return atomState;
|
|
628
643
|
} finally {
|
|
629
644
|
isSync = false;
|
|
630
|
-
if (
|
|
645
|
+
if (atomState.n !== prevEpochNumber && prevInvalidated) {
|
|
631
646
|
invalidatedAtoms.set(atom2, atomState.n);
|
|
632
647
|
changedAtoms.add(atom2);
|
|
633
648
|
(_b = storeHooks.c) == null ? void 0 : _b.call(storeHooks, atom2);
|
|
@@ -665,6 +680,7 @@ var BUILDING_BLOCK_writeAtomState = (store2, atom2, ...args) => {
|
|
|
665
680
|
const writeAtomState = buildingBlocks[16];
|
|
666
681
|
const mountDependencies = buildingBlocks[17];
|
|
667
682
|
const setAtomStateValueOrPromise = buildingBlocks[20];
|
|
683
|
+
const storeEpochHolder = buildingBlocks[28];
|
|
668
684
|
let isSync = true;
|
|
669
685
|
const getter = (a) => returnAtomValue(readAtomState(store2, a));
|
|
670
686
|
const setter = (a, ...args2) => {
|
|
@@ -683,6 +699,7 @@ var BUILDING_BLOCK_writeAtomState = (store2, atom2, ...args) => {
|
|
|
683
699
|
setAtomStateValueOrPromise(store2, a, v);
|
|
684
700
|
mountDependencies(store2, a);
|
|
685
701
|
if (prevEpochNumber !== aState.n) {
|
|
702
|
+
++storeEpochHolder[0];
|
|
686
703
|
changedAtoms.add(a);
|
|
687
704
|
invalidateDependents(store2, a);
|
|
688
705
|
(_a = storeHooks.c) == null ? void 0 : _a.call(storeHooks, a);
|
|
@@ -867,14 +884,18 @@ var BUILDING_BLOCK_storeGet = (store2, atom2) => {
|
|
|
867
884
|
};
|
|
868
885
|
var BUILDING_BLOCK_storeSet = (store2, atom2, ...args) => {
|
|
869
886
|
const buildingBlocks = getInternalBuildingBlocks(store2);
|
|
887
|
+
const changedAtoms = buildingBlocks[3];
|
|
870
888
|
const flushCallbacks = buildingBlocks[12];
|
|
871
889
|
const recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
872
890
|
const writeAtomState = buildingBlocks[16];
|
|
891
|
+
const prevChangedAtomsSize = changedAtoms.size;
|
|
873
892
|
try {
|
|
874
893
|
return writeAtomState(store2, atom2, ...args);
|
|
875
894
|
} finally {
|
|
876
|
-
|
|
877
|
-
|
|
895
|
+
if (changedAtoms.size !== prevChangedAtomsSize) {
|
|
896
|
+
recomputeInvalidatedAtoms(store2);
|
|
897
|
+
flushCallbacks(store2);
|
|
898
|
+
}
|
|
878
899
|
}
|
|
879
900
|
};
|
|
880
901
|
var BUILDING_BLOCK_storeSub = (store2, atom2, listener) => {
|
|
@@ -983,7 +1004,9 @@ function buildStore(...buildArgs) {
|
|
|
983
1004
|
/* @__PURE__ */ new WeakMap(),
|
|
984
1005
|
// abortHandlersMap
|
|
985
1006
|
BUILDING_BLOCK_registerAbortHandler,
|
|
986
|
-
BUILDING_BLOCK_abortPromise
|
|
1007
|
+
BUILDING_BLOCK_abortPromise,
|
|
1008
|
+
// store epoch
|
|
1009
|
+
[0]
|
|
987
1010
|
].map((fn, i) => buildArgs[i] || fn);
|
|
988
1011
|
buildingBlockMap.set(store2, Object.freeze(buildingBlocks));
|
|
989
1012
|
return store2;
|
|
@@ -1155,6 +1178,28 @@ function useAtomValue(atom2, options) {
|
|
|
1155
1178
|
}
|
|
1156
1179
|
}
|
|
1157
1180
|
if (typeof delay === "number") {
|
|
1181
|
+
console.warn(`[DEPRECATED] delay option is deprecated and will be removed in v3.
|
|
1182
|
+
|
|
1183
|
+
Migration guide:
|
|
1184
|
+
|
|
1185
|
+
Create a custom hook like the following.
|
|
1186
|
+
|
|
1187
|
+
function useAtomValueWithDelay<Value>(
|
|
1188
|
+
atom: Atom<Value>,
|
|
1189
|
+
options: { delay: number },
|
|
1190
|
+
): Value {
|
|
1191
|
+
const { delay } = options
|
|
1192
|
+
const store = useStore(options)
|
|
1193
|
+
const [value, setValue] = useState(() => store.get(atom))
|
|
1194
|
+
useEffect(() => {
|
|
1195
|
+
const unsub = store.sub(atom, () => {
|
|
1196
|
+
setTimeout(() => setValue(store.get(atom)), delay)
|
|
1197
|
+
})
|
|
1198
|
+
return unsub
|
|
1199
|
+
}, [store, atom, delay])
|
|
1200
|
+
return value
|
|
1201
|
+
}
|
|
1202
|
+
`);
|
|
1158
1203
|
setTimeout(rerender, delay);
|
|
1159
1204
|
return;
|
|
1160
1205
|
}
|
|
@@ -647,11 +647,7 @@ function createMcpHandler(configPath, wss) {
|
|
|
647
647
|
{ McpServer },
|
|
648
648
|
{ ValibotJsonSchemaAdapter },
|
|
649
649
|
{ HttpTransport },
|
|
650
|
-
{
|
|
651
|
-
addListAllDocumentationTool,
|
|
652
|
-
addGetDocumentationTool,
|
|
653
|
-
addGetComponentStoryDocumentationTool
|
|
654
|
-
},
|
|
650
|
+
{ addListAllDocumentationTool, addGetDocumentationTool, addGetStoryDocumentationTool },
|
|
655
651
|
{ storyInstructions: storyInstructions2 },
|
|
656
652
|
{ buildIndex: buildIndex2 },
|
|
657
653
|
valibot,
|
|
@@ -690,7 +686,7 @@ function createMcpHandler(configPath, wss) {
|
|
|
690
686
|
).withContext();
|
|
691
687
|
addListAllDocumentationTool(server);
|
|
692
688
|
addGetDocumentationTool(server);
|
|
693
|
-
|
|
689
|
+
addGetStoryDocumentationTool(server);
|
|
694
690
|
server.tool(
|
|
695
691
|
{
|
|
696
692
|
name: "get-storybook-story-instructions",
|
package/dist/node.js
CHANGED
|
@@ -412,11 +412,7 @@ function createMcpHandler(configPath, wss) {
|
|
|
412
412
|
{ McpServer },
|
|
413
413
|
{ ValibotJsonSchemaAdapter },
|
|
414
414
|
{ HttpTransport },
|
|
415
|
-
{
|
|
416
|
-
addListAllDocumentationTool,
|
|
417
|
-
addGetDocumentationTool,
|
|
418
|
-
addGetComponentStoryDocumentationTool
|
|
419
|
-
},
|
|
415
|
+
{ addListAllDocumentationTool, addGetDocumentationTool, addGetStoryDocumentationTool },
|
|
420
416
|
{ storyInstructions: storyInstructions2 },
|
|
421
417
|
{ buildIndex: buildIndex2 },
|
|
422
418
|
valibot,
|
|
@@ -455,7 +451,7 @@ function createMcpHandler(configPath, wss) {
|
|
|
455
451
|
).withContext();
|
|
456
452
|
addListAllDocumentationTool(server);
|
|
457
453
|
addGetDocumentationTool(server);
|
|
458
|
-
|
|
454
|
+
addGetStoryDocumentationTool(server);
|
|
459
455
|
server.tool(
|
|
460
456
|
{
|
|
461
457
|
name: "get-storybook-story-instructions",
|
|
@@ -645,11 +645,7 @@ function createMcpHandler(configPath, wss) {
|
|
|
645
645
|
{ McpServer },
|
|
646
646
|
{ ValibotJsonSchemaAdapter },
|
|
647
647
|
{ HttpTransport },
|
|
648
|
-
{
|
|
649
|
-
addListAllDocumentationTool,
|
|
650
|
-
addGetDocumentationTool,
|
|
651
|
-
addGetComponentStoryDocumentationTool
|
|
652
|
-
},
|
|
648
|
+
{ addListAllDocumentationTool, addGetDocumentationTool, addGetStoryDocumentationTool },
|
|
653
649
|
{ storyInstructions: storyInstructions2 },
|
|
654
650
|
{ buildIndex: buildIndex2 },
|
|
655
651
|
valibot,
|
|
@@ -688,7 +684,7 @@ function createMcpHandler(configPath, wss) {
|
|
|
688
684
|
).withContext();
|
|
689
685
|
addListAllDocumentationTool(server);
|
|
690
686
|
addGetDocumentationTool(server);
|
|
691
|
-
|
|
687
|
+
addGetStoryDocumentationTool(server);
|
|
692
688
|
server.tool(
|
|
693
689
|
{
|
|
694
690
|
name: "get-storybook-story-instructions",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.1",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,36 +43,36 @@
|
|
|
43
43
|
"metro/**/*"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@storybook/mcp": "^0.
|
|
47
|
-
"@storybook/react": "10.3.
|
|
48
|
-
"@storybook/react-native-theming": "^10.3.
|
|
49
|
-
"@storybook/react-native-ui": "^10.3.
|
|
50
|
-
"@storybook/react-native-ui-common": "^10.3.
|
|
46
|
+
"@storybook/mcp": "^0.6.1",
|
|
47
|
+
"@storybook/react": "^10.3.1",
|
|
48
|
+
"@storybook/react-native-theming": "^10.3.1",
|
|
49
|
+
"@storybook/react-native-ui": "^10.3.1",
|
|
50
|
+
"@storybook/react-native-ui-common": "^10.3.1",
|
|
51
51
|
"@tmcp/adapter-valibot": "^0.1.4",
|
|
52
|
-
"@tmcp/transport-http": "^0.8.
|
|
52
|
+
"@tmcp/transport-http": "^0.8.5",
|
|
53
53
|
"commander": "^14.0.2",
|
|
54
|
-
"dedent": "^1.7.
|
|
54
|
+
"dedent": "^1.7.2",
|
|
55
55
|
"deepmerge": "^4.3.1",
|
|
56
56
|
"esbuild-register": "^3.6.0",
|
|
57
57
|
"glob": "^13.0.0",
|
|
58
58
|
"react-native-url-polyfill": "^3.0.0",
|
|
59
59
|
"setimmediate": "^1.0.5",
|
|
60
|
-
"tmcp": "^1.
|
|
61
|
-
"valibot": "^1.
|
|
62
|
-
"ws": "^8.
|
|
60
|
+
"tmcp": "^1.19.3",
|
|
61
|
+
"valibot": "^1.3.1",
|
|
62
|
+
"ws": "^8.20.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/jest": "^29.4.3",
|
|
66
66
|
"@types/react": "~19.2.14",
|
|
67
67
|
"babel-jest": "^29.7.0",
|
|
68
|
-
"babel-preset-expo": "^
|
|
68
|
+
"babel-preset-expo": "^55.0.13",
|
|
69
69
|
"jest": "^29.7.0",
|
|
70
|
-
"jest-expo": "~55.0.
|
|
71
|
-
"jotai": "^2.
|
|
70
|
+
"jest-expo": "~55.0.11",
|
|
71
|
+
"jotai": "^2.19.0",
|
|
72
72
|
"react": "19.2.0",
|
|
73
|
-
"react-native": "0.83.
|
|
74
|
-
"storybook": "10.3.
|
|
75
|
-
"test-renderer": "^0.
|
|
73
|
+
"react-native": "0.83.4",
|
|
74
|
+
"storybook": "^10.3.1",
|
|
75
|
+
"test-renderer": "^0.15.0",
|
|
76
76
|
"tsup": "^8.5.0",
|
|
77
77
|
"typescript": "~5.9.3"
|
|
78
78
|
},
|