@storybook/react-native 10.3.1 → 10.4.0-canary-20260407134723

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.ts CHANGED
@@ -69,8 +69,9 @@ declare class View {
69
69
  _webUrl: string;
70
70
  _storage: Storage;
71
71
  _channel: Channel;
72
+ _options: any;
72
73
  _idToPrepared: Record<string, PreparedStory<ReactRenderer>>;
73
- constructor(preview: PreviewWithSelection<ReactRenderer>, channel: Channel);
74
+ constructor(preview: PreviewWithSelection<ReactRenderer>, channel: Channel, options: any);
74
75
  _storyIdExists: (storyId: string) => boolean;
75
76
  _getInitialStory: ({ initialSelection, shouldPersistSelection, }?: Partial<Params>) => Promise<{
76
77
  storySpecifier: string;
@@ -90,6 +91,7 @@ interface ReactNativeOptions {
90
91
  * Note that this is for future and play functions are not yet fully supported on native.
91
92
  */
92
93
  playFn?: boolean;
94
+ liteMode?: boolean;
93
95
  }
94
96
  declare function prepareStories({ storyEntries, options, storySort, }: {
95
97
  storyEntries: (NormalizedStoriesSpecifier & {
package/dist/index.js CHANGED
@@ -1378,10 +1378,12 @@ var View3 = class {
1378
1378
  _webUrl;
1379
1379
  _storage;
1380
1380
  _channel;
1381
+ _options;
1381
1382
  _idToPrepared = {};
1382
- constructor(preview, channel) {
1383
+ constructor(preview, channel, options) {
1383
1384
  this._preview = preview;
1384
1385
  this._channel = channel;
1386
+ this._options = options;
1385
1387
  }
1386
1388
  _storyIdExists = (storyId) => {
1387
1389
  return Object.keys(this._storyIndex.entries).includes(storyId);
@@ -1470,12 +1472,12 @@ var View3 = class {
1470
1472
  getStorybookUI = (params = {}) => {
1471
1473
  const {
1472
1474
  shouldPersistSelection = true,
1473
- onDeviceUI = true,
1474
1475
  enableWebsockets = false,
1475
1476
  storage,
1476
1477
  CustomUIComponent,
1477
1478
  hasStoryWrapper: storyViewWrapper = true
1478
1479
  } = params;
1480
+ const onDeviceUI = this._options.liteMode ? false : params.onDeviceUI ?? true;
1479
1481
  const getFullUI = (enabled) => {
1480
1482
  if (enabled) {
1481
1483
  try {
@@ -1489,7 +1491,11 @@ var View3 = class {
1489
1491
  return PlaceholderUI;
1490
1492
  };
1491
1493
  const FullUI = getFullUI(onDeviceUI && !CustomUIComponent);
1492
- this._storage = storage;
1494
+ this._storage = storage ?? {
1495
+ getItem: async (key) => null,
1496
+ setItem: async (key, value) => {
1497
+ }
1498
+ };
1493
1499
  const initialStory = this._getInitialStory(params);
1494
1500
  if (enableWebsockets) {
1495
1501
  const channel = this._getServerChannel(params);
@@ -1888,7 +1894,7 @@ function start({
1888
1894
  selectionStore,
1889
1895
  previewView
1890
1896
  );
1891
- const view = new View3(preview, channel);
1897
+ const view = new View3(preview, channel, options);
1892
1898
  if (global) {
1893
1899
  global.__STORYBOOK_ADDONS_CHANNEL__ = channel;
1894
1900
  global.__STORYBOOK_PREVIEW__ = preview;
@@ -202,7 +202,8 @@ var require_generate = __commonJS({
202
202
  docTools = true,
203
203
  host = void 0,
204
204
  port = void 0,
205
- secured = false
205
+ secured = false,
206
+ liteMode = false
206
207
  }) {
207
208
  const channelHost = host === "auto" ? getLocalIPAddress() : host;
208
209
  const storybookRequiresLocation = path3.resolve(
@@ -263,6 +264,9 @@ var require_generate = __commonJS({
263
264
  let options = "";
264
265
  let optionsVar = "";
265
266
  const reactNativeOptions = main.reactNative;
267
+ if (liteMode) {
268
+ reactNativeOptions.liteMode = true;
269
+ }
266
270
  if (reactNativeOptions && typeof reactNativeOptions === "object") {
267
271
  optionsVar = `const options = ${JSON.stringify(reactNativeOptions, null, 2)}`;
268
272
  options = "options";
@@ -307,6 +311,7 @@ declare global {
307
311
  const fileContent = `/* do not change this file, it is auto generated by storybook. */
308
312
  ${useJs ? "" : '/// <reference types="@storybook/react-native/metro-env" />\n'}import { start, updateView${useJs ? "" : ", View, type Features"} } from '@storybook/react-native';
309
313
 
314
+
310
315
  ${registeredAddons.join("\n")}
311
316
 
312
317
  const normalizedStories = [
@@ -202,7 +202,8 @@ var require_generate = __commonJS({
202
202
  docTools = true,
203
203
  host = void 0,
204
204
  port = void 0,
205
- secured = false
205
+ secured = false,
206
+ liteMode = false
206
207
  }) {
207
208
  const channelHost = host === "auto" ? getLocalIPAddress() : host;
208
209
  const storybookRequiresLocation = path3.resolve(
@@ -263,6 +264,9 @@ var require_generate = __commonJS({
263
264
  let options = "";
264
265
  let optionsVar = "";
265
266
  const reactNativeOptions = main.reactNative;
267
+ if (liteMode) {
268
+ reactNativeOptions.liteMode = true;
269
+ }
266
270
  if (reactNativeOptions && typeof reactNativeOptions === "object") {
267
271
  optionsVar = `const options = ${JSON.stringify(reactNativeOptions, null, 2)}`;
268
272
  options = "options";
@@ -307,6 +311,7 @@ declare global {
307
311
  const fileContent = `/* do not change this file, it is auto generated by storybook. */
308
312
  ${useJs ? "" : '/// <reference types="@storybook/react-native/metro-env" />\n'}import { start, updateView${useJs ? "" : ", View, type Features"} } from '@storybook/react-native';
309
313
 
314
+
310
315
  ${registeredAddons.join("\n")}
311
316
 
312
317
  const normalizedStories = [
@@ -0,0 +1,15 @@
1
+ import { W as WebsocketsOptions } from './index-6iAzVvXp.js';
2
+
3
+ interface WithStorybookOptions {
4
+ configPath?: string;
5
+ websockets?: WebsocketsOptions | 'auto';
6
+ useJs?: boolean;
7
+ enabled?: boolean;
8
+ docTools?: boolean;
9
+ liteMode?: boolean;
10
+ experimental_mcp?: boolean;
11
+ }
12
+
13
+ declare function withStorybook<T>(config: T, options?: WithStorybookOptions): T;
14
+
15
+ export { withStorybook };