@storybook/react-native 10.3.2-canary-20260423222934 → 10.3.2
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 +65 -32
- package/dist/metro/withStorybook.js +2 -2
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -324,6 +324,9 @@ function hasInitialValue(atom2) {
|
|
|
324
324
|
function isActuallyWritableAtom(atom2) {
|
|
325
325
|
return !!atom2.write;
|
|
326
326
|
}
|
|
327
|
+
function hasOnMount(atom2) {
|
|
328
|
+
return !!atom2.onMount;
|
|
329
|
+
}
|
|
327
330
|
function isAtomStateInitialized(atomState) {
|
|
328
331
|
return "v" in atomState || "e" in atomState;
|
|
329
332
|
}
|
|
@@ -347,13 +350,18 @@ function addPendingPromiseToDependency(atom2, promise, dependencyAtomState) {
|
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
function getMountedOrPendingDependents(atom2, atomState, mountedMap) {
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
const mounted = mountedMap.get(atom2);
|
|
354
|
+
const mountedDependents = mounted == null ? void 0 : mounted.t;
|
|
355
|
+
const pendingDependents = atomState.p;
|
|
356
|
+
if (!(mountedDependents == null ? void 0 : mountedDependents.size)) {
|
|
357
|
+
return pendingDependents;
|
|
358
|
+
}
|
|
359
|
+
if (!pendingDependents.size) {
|
|
360
|
+
return mountedDependents;
|
|
354
361
|
}
|
|
355
|
-
|
|
356
|
-
|
|
362
|
+
const dependents = new Set(mountedDependents);
|
|
363
|
+
for (const a of pendingDependents) {
|
|
364
|
+
dependents.add(a);
|
|
357
365
|
}
|
|
358
366
|
return dependents;
|
|
359
367
|
}
|
|
@@ -386,6 +394,7 @@ var BUILDING_BLOCK_ensureAtomState = (store2, atom2) => {
|
|
|
386
394
|
return atomState;
|
|
387
395
|
};
|
|
388
396
|
var BUILDING_BLOCK_flushCallbacks = (store2) => {
|
|
397
|
+
var _a;
|
|
389
398
|
const buildingBlocks = getInternalBuildingBlocks(store2);
|
|
390
399
|
const mountedMap = buildingBlocks[1];
|
|
391
400
|
const changedAtoms = buildingBlocks[3];
|
|
@@ -393,6 +402,9 @@ var BUILDING_BLOCK_flushCallbacks = (store2) => {
|
|
|
393
402
|
const unmountCallbacks = buildingBlocks[5];
|
|
394
403
|
const storeHooks = buildingBlocks[6];
|
|
395
404
|
const recomputeInvalidatedAtoms = buildingBlocks[13];
|
|
405
|
+
if (!storeHooks.f && !changedAtoms.size && !mountCallbacks.size && !unmountCallbacks.size) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
396
408
|
const errors = [];
|
|
397
409
|
const call = (fn) => {
|
|
398
410
|
try {
|
|
@@ -406,17 +418,26 @@ var BUILDING_BLOCK_flushCallbacks = (store2) => {
|
|
|
406
418
|
call(storeHooks.f);
|
|
407
419
|
}
|
|
408
420
|
const callbacks = /* @__PURE__ */ new Set();
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
421
|
+
for (const atom2 of changedAtoms) {
|
|
422
|
+
const listeners = (_a = mountedMap.get(atom2)) == null ? void 0 : _a.l;
|
|
423
|
+
if (listeners) {
|
|
424
|
+
for (const listener of listeners) {
|
|
425
|
+
callbacks.add(listener);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
414
429
|
changedAtoms.clear();
|
|
415
|
-
unmountCallbacks
|
|
430
|
+
for (const fn of unmountCallbacks) {
|
|
431
|
+
callbacks.add(fn);
|
|
432
|
+
}
|
|
416
433
|
unmountCallbacks.clear();
|
|
417
|
-
mountCallbacks
|
|
434
|
+
for (const fn of mountCallbacks) {
|
|
435
|
+
callbacks.add(fn);
|
|
436
|
+
}
|
|
418
437
|
mountCallbacks.clear();
|
|
419
|
-
callbacks
|
|
438
|
+
for (const fn of callbacks) {
|
|
439
|
+
call(fn);
|
|
440
|
+
}
|
|
420
441
|
if (changedAtoms.size) {
|
|
421
442
|
recomputeInvalidatedAtoms(store2);
|
|
422
443
|
}
|
|
@@ -433,36 +454,51 @@ var BUILDING_BLOCK_recomputeInvalidatedAtoms = (store2) => {
|
|
|
433
454
|
const ensureAtomState = buildingBlocks[11];
|
|
434
455
|
const readAtomState = buildingBlocks[14];
|
|
435
456
|
const mountDependencies = buildingBlocks[17];
|
|
436
|
-
|
|
457
|
+
if (!changedAtoms.size) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const sortedReversedAtoms = [];
|
|
461
|
+
const sortedReversedStates = [];
|
|
437
462
|
const visiting = /* @__PURE__ */ new WeakSet();
|
|
438
463
|
const visited = /* @__PURE__ */ new WeakSet();
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
464
|
+
const stackAtoms = [];
|
|
465
|
+
const stackStates = [];
|
|
466
|
+
for (const atom2 of changedAtoms) {
|
|
467
|
+
stackAtoms.push(atom2);
|
|
468
|
+
stackStates.push(ensureAtomState(store2, atom2));
|
|
469
|
+
}
|
|
470
|
+
while (stackAtoms.length) {
|
|
471
|
+
const top = stackAtoms.length - 1;
|
|
472
|
+
const a = stackAtoms[top];
|
|
473
|
+
const aState = stackStates[top];
|
|
443
474
|
if (visited.has(a)) {
|
|
444
|
-
|
|
475
|
+
stackAtoms.pop();
|
|
476
|
+
stackStates.pop();
|
|
445
477
|
continue;
|
|
446
478
|
}
|
|
447
479
|
if (visiting.has(a)) {
|
|
448
480
|
if (invalidatedAtoms.get(a) === aState.n) {
|
|
449
|
-
|
|
481
|
+
sortedReversedAtoms.push(a);
|
|
482
|
+
sortedReversedStates.push(aState);
|
|
450
483
|
} else if ((import_meta.env ? import_meta.env.MODE : void 0) !== "production" && invalidatedAtoms.has(a)) {
|
|
451
484
|
throw new Error("[Bug] invalidated atom exists");
|
|
452
485
|
}
|
|
453
486
|
visited.add(a);
|
|
454
|
-
|
|
487
|
+
stackAtoms.pop();
|
|
488
|
+
stackStates.pop();
|
|
455
489
|
continue;
|
|
456
490
|
}
|
|
457
491
|
visiting.add(a);
|
|
458
492
|
for (const d of getMountedOrPendingDependents(a, aState, mountedMap)) {
|
|
459
493
|
if (!visiting.has(d)) {
|
|
460
|
-
|
|
494
|
+
stackAtoms.push(d);
|
|
495
|
+
stackStates.push(ensureAtomState(store2, d));
|
|
461
496
|
}
|
|
462
497
|
}
|
|
463
498
|
}
|
|
464
|
-
for (let i =
|
|
465
|
-
const
|
|
499
|
+
for (let i = sortedReversedAtoms.length - 1; i >= 0; --i) {
|
|
500
|
+
const a = sortedReversedAtoms[i];
|
|
501
|
+
const aState = sortedReversedStates[i];
|
|
466
502
|
let hasChangedDeps = false;
|
|
467
503
|
for (const dep of aState.d.keys()) {
|
|
468
504
|
if (dep !== a && changedAtoms.has(dep)) {
|
|
@@ -524,12 +560,9 @@ var BUILDING_BLOCK_readAtomState = (store2, atom2) => {
|
|
|
524
560
|
}
|
|
525
561
|
let isSync = true;
|
|
526
562
|
const prevDeps = new Set(atomState.d.keys());
|
|
527
|
-
const nextDeps = /* @__PURE__ */ new Map();
|
|
528
563
|
const pruneDependencies = () => {
|
|
529
564
|
for (const a of prevDeps) {
|
|
530
|
-
|
|
531
|
-
atomState.d.delete(a);
|
|
532
|
-
}
|
|
565
|
+
atomState.d.delete(a);
|
|
533
566
|
}
|
|
534
567
|
};
|
|
535
568
|
const mountDependenciesIfAsync = () => {
|
|
@@ -559,7 +592,7 @@ var BUILDING_BLOCK_readAtomState = (store2, atom2) => {
|
|
|
559
592
|
try {
|
|
560
593
|
return returnAtomValue(aState);
|
|
561
594
|
} finally {
|
|
562
|
-
|
|
595
|
+
prevDeps.delete(a);
|
|
563
596
|
atomState.d.set(a, aState.n);
|
|
564
597
|
if (isPromiseLike(atomState.v)) {
|
|
565
598
|
addPendingPromiseToDependency(atom2, atomState.v, aState);
|
|
@@ -733,7 +766,7 @@ var BUILDING_BLOCK_mountDependencies = (store2, atom2) => {
|
|
|
733
766
|
const unmountAtom = buildingBlocks[19];
|
|
734
767
|
const atomState = ensureAtomState(store2, atom2);
|
|
735
768
|
const mounted = mountedMap.get(atom2);
|
|
736
|
-
if (mounted) {
|
|
769
|
+
if (mounted && atomState.d.size > 0) {
|
|
737
770
|
for (const [a, n] of atomState.d) {
|
|
738
771
|
if (!mounted.d.has(a)) {
|
|
739
772
|
const aState = ensureAtomState(store2, a);
|
|
@@ -783,7 +816,7 @@ var BUILDING_BLOCK_mountAtom = (store2, atom2) => {
|
|
|
783
816
|
t: /* @__PURE__ */ new Set()
|
|
784
817
|
};
|
|
785
818
|
mountedMap.set(atom2, mounted);
|
|
786
|
-
if (isActuallyWritableAtom(atom2)) {
|
|
819
|
+
if (isActuallyWritableAtom(atom2) && hasOnMount(atom2)) {
|
|
787
820
|
const processOnMount = () => {
|
|
788
821
|
let isSync = true;
|
|
789
822
|
const setAtom = (...args) => {
|
|
@@ -1118,7 +1118,7 @@ function withStorybook(config, options = {
|
|
|
1118
1118
|
type: "empty"
|
|
1119
1119
|
};
|
|
1120
1120
|
}
|
|
1121
|
-
if (moduleName === "tty" || moduleName === "os") {
|
|
1121
|
+
if (platform !== "web" && (moduleName === "tty" || moduleName === "os")) {
|
|
1122
1122
|
return {
|
|
1123
1123
|
type: "empty"
|
|
1124
1124
|
};
|
|
@@ -1202,7 +1202,7 @@ function withStorybook(config, options = {
|
|
|
1202
1202
|
type: "empty"
|
|
1203
1203
|
};
|
|
1204
1204
|
}
|
|
1205
|
-
if (moduleName === "tty" || moduleName === "os") {
|
|
1205
|
+
if (platform !== "web" && (moduleName === "tty" || moduleName === "os")) {
|
|
1206
1206
|
return {
|
|
1207
1207
|
type: "empty"
|
|
1208
1208
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "10.3.2
|
|
3
|
+
"version": "10.3.2",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@storybook/mcp": "^0.6.1",
|
|
47
|
-
"@storybook/react": "^10.3.
|
|
48
|
-
"@storybook/react-native-theming": "10.3.2
|
|
49
|
-
"@storybook/react-native-ui": "10.3.2
|
|
50
|
-
"@storybook/react-native-ui-common": "10.3.2
|
|
47
|
+
"@storybook/react": "^10.3.2",
|
|
48
|
+
"@storybook/react-native-theming": "^10.3.2",
|
|
49
|
+
"@storybook/react-native-ui": "^10.3.2",
|
|
50
|
+
"@storybook/react-native-ui-common": "^10.3.2",
|
|
51
51
|
"@tmcp/adapter-valibot": "^0.1.4",
|
|
52
52
|
"@tmcp/transport-http": "^0.8.5",
|
|
53
53
|
"commander": "^14.0.2",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"jotai": "^2.19.0",
|
|
72
72
|
"react": "19.2.0",
|
|
73
73
|
"react-native": "0.83.4",
|
|
74
|
-
"storybook": "^10.3.
|
|
74
|
+
"storybook": "^10.3.2",
|
|
75
75
|
"test-renderer": "^0.15.0",
|
|
76
76
|
"tsup": "^8.5.0",
|
|
77
77
|
"typescript": "~5.9.3"
|