@storybook/react-native 7.6.15 → 8.0.0-alpha.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.d-ab512c60.d.ts +1355 -0
- package/dist/index.d.ts +64 -8
- package/dist/index.js +26 -22
- package/dist/preview.d.ts +1 -2
- package/package.json +12 -14
- package/readme.md +5 -0
- package/scripts/handle-args.js +1 -6
- package/V6.js +0 -1
- package/dist/V6.d.ts +0 -37
- package/dist/V6.js +0 -2400
- package/dist/View-425d6066.d.ts +0 -66
- package/dist/index.d-5b1baa07.d.ts +0 -3270
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,70 @@
|
|
|
1
|
-
import { N as NormalizedStoriesSpecifier,
|
|
1
|
+
import { S as StoryIndex, P as PreparedStory, N as NormalizedStoriesSpecifier, a as StorybookConfig$1 } from './index.d-ab512c60.js';
|
|
2
|
+
import { Theme } from '@storybook/react-native-theming';
|
|
2
3
|
export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
|
|
3
|
-
import
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import { StoryContext } from '@storybook/csf';
|
|
6
|
+
import { PreviewWithSelection } from '@storybook/preview-api';
|
|
7
|
+
import { ReactRenderer } from '@storybook/react';
|
|
8
|
+
import { Channel } from '@storybook/channels';
|
|
4
9
|
import 'file-system-cache';
|
|
5
|
-
import '@babel/core';
|
|
6
10
|
import 'http';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
interface Storage {
|
|
13
|
+
getItem: (key: string) => Promise<string | null>;
|
|
14
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
type StoryKind = string;
|
|
17
|
+
type StoryName = string;
|
|
18
|
+
type InitialSelection = `${StoryKind}--${StoryName}` | {
|
|
19
|
+
/**
|
|
20
|
+
* Kind is the default export name or the storiesOf("name") name
|
|
21
|
+
*/
|
|
22
|
+
kind: StoryKind;
|
|
23
|
+
/**
|
|
24
|
+
* Name is the named export or the .add("name") name
|
|
25
|
+
*/
|
|
26
|
+
name: StoryName;
|
|
27
|
+
};
|
|
28
|
+
type DeepPartial<T> = T extends object ? {
|
|
29
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
30
|
+
} : T;
|
|
31
|
+
type Params = {
|
|
32
|
+
onDeviceUI?: boolean;
|
|
33
|
+
enableWebsockets?: boolean;
|
|
34
|
+
query?: string;
|
|
35
|
+
host?: string;
|
|
36
|
+
port?: number;
|
|
37
|
+
secured?: boolean;
|
|
38
|
+
initialSelection?: InitialSelection;
|
|
39
|
+
shouldPersistSelection?: boolean;
|
|
40
|
+
tabOpen?: number;
|
|
41
|
+
isUIHidden?: boolean;
|
|
42
|
+
isSplitPanelVisible?: boolean;
|
|
43
|
+
shouldDisableKeyboardAvoidingView?: boolean;
|
|
44
|
+
keyboardAvoidingViewVerticalOffset?: number;
|
|
45
|
+
theme: DeepPartial<Theme>;
|
|
46
|
+
storage?: Storage;
|
|
47
|
+
};
|
|
48
|
+
declare class View {
|
|
49
|
+
_storyIndex: StoryIndex;
|
|
50
|
+
_setStory: (story: StoryContext<ReactRenderer>) => void;
|
|
51
|
+
_forceRerender: () => void;
|
|
52
|
+
_ready: boolean;
|
|
53
|
+
_preview: PreviewWithSelection<ReactRenderer>;
|
|
54
|
+
_asyncStorageStoryId: string;
|
|
55
|
+
_webUrl: string;
|
|
56
|
+
_storage: Storage;
|
|
57
|
+
_channel: Channel;
|
|
58
|
+
_idToPrepared: Record<string, PreparedStory<ReactRenderer>>;
|
|
59
|
+
constructor(preview: PreviewWithSelection<ReactRenderer>, channel: Channel);
|
|
60
|
+
_getInitialStory: ({ initialSelection, shouldPersistSelection, }?: Partial<Params>) => Promise<{
|
|
61
|
+
storySpecifier: string;
|
|
62
|
+
viewMode: string;
|
|
63
|
+
}>;
|
|
64
|
+
_getServerChannel: (params?: Partial<Params>) => Channel;
|
|
65
|
+
createPreparedStoryMapping: () => Promise<void>;
|
|
66
|
+
getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
|
67
|
+
}
|
|
12
68
|
|
|
13
69
|
declare function start({ annotations, storyEntries, }: {
|
|
14
70
|
storyEntries: Array<NormalizedStoriesSpecifier & {
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var require_dist = __commonJS({
|
|
|
51
51
|
var src_exports2 = {};
|
|
52
52
|
__export2(src_exports2, { Addon_TypesEnum: () => Addon_TypesEnum2 });
|
|
53
53
|
module2.exports = __toCommonJS2(src_exports2);
|
|
54
|
-
var Addon_TypesEnum2 = ((Addon_TypesEnum22) => (Addon_TypesEnum22.TAB = "tab", Addon_TypesEnum22.PANEL = "panel", Addon_TypesEnum22.TOOL = "tool", Addon_TypesEnum22.TOOLEXTRA = "toolextra", Addon_TypesEnum22.PREVIEW = "preview", Addon_TypesEnum22.experimental_PAGE = "page", Addon_TypesEnum22.experimental_SIDEBAR_BOTTOM = "sidebar-bottom", Addon_TypesEnum22.experimental_SIDEBAR_TOP = "sidebar-top", Addon_TypesEnum22
|
|
54
|
+
var Addon_TypesEnum2 = ((Addon_TypesEnum22) => (Addon_TypesEnum22.TAB = "tab", Addon_TypesEnum22.PANEL = "panel", Addon_TypesEnum22.TOOL = "tool", Addon_TypesEnum22.TOOLEXTRA = "toolextra", Addon_TypesEnum22.PREVIEW = "preview", Addon_TypesEnum22.experimental_PAGE = "page", Addon_TypesEnum22.experimental_SIDEBAR_BOTTOM = "sidebar-bottom", Addon_TypesEnum22.experimental_SIDEBAR_TOP = "sidebar-top", Addon_TypesEnum22))(Addon_TypesEnum2 || {});
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -69,7 +69,6 @@ var import_react_native_theming13 = require("@storybook/react-native-theming");
|
|
|
69
69
|
var import_csf2 = require("@storybook/csf");
|
|
70
70
|
var import_preview_api3 = require("@storybook/preview-api");
|
|
71
71
|
var import_manager_api3 = require("@storybook/manager-api");
|
|
72
|
-
var import_preview_web = require("@storybook/preview-api/dist/preview-web");
|
|
73
72
|
var import_channels2 = require("@storybook/channels");
|
|
74
73
|
|
|
75
74
|
// src/View.tsx
|
|
@@ -1468,7 +1467,7 @@ var Wrapper = ({ panels, addonSelected }) => {
|
|
|
1468
1467
|
const addonKeys = Object.keys(panels);
|
|
1469
1468
|
const content = addonKeys.map((id) => {
|
|
1470
1469
|
const selected = addonSelected === id;
|
|
1471
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Container2, { selected, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native8.ScrollView, { contentContainerStyle: { padding: theme3.panel.paddingHorizontal }, children: panels[id].render({ active: selected
|
|
1470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Container2, { selected, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native8.ScrollView, { contentContainerStyle: { padding: theme3.panel.paddingHorizontal }, children: panels[id].render({ active: selected }) }) }, id);
|
|
1472
1471
|
});
|
|
1473
1472
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: content });
|
|
1474
1473
|
};
|
|
@@ -2071,17 +2070,21 @@ var View11 = class {
|
|
|
2071
2070
|
const query = params.query || "";
|
|
2072
2071
|
const websocketType = params.secured ? "wss" : "ws";
|
|
2073
2072
|
const url = `${websocketType}://${host}${port}/${query}`;
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2073
|
+
const channel = new import_channels.Channel({
|
|
2074
|
+
transport: new import_channels.WebsocketTransport({
|
|
2075
|
+
url,
|
|
2076
|
+
onError: (e) => {
|
|
2077
|
+
console.log(`WebsocketTransport error ${JSON.stringify(e)}`);
|
|
2078
|
+
}
|
|
2079
|
+
}),
|
|
2080
|
+
async: true
|
|
2079
2081
|
});
|
|
2082
|
+
return channel;
|
|
2080
2083
|
};
|
|
2081
2084
|
createPreparedStoryMapping = async () => {
|
|
2082
2085
|
await Promise.all(
|
|
2083
2086
|
Object.keys(this._storyIndex.entries).map(async (storyId) => {
|
|
2084
|
-
this._idToPrepared[storyId] = await this._preview.
|
|
2087
|
+
this._idToPrepared[storyId] = await this._preview.loadStory({ storyId });
|
|
2085
2088
|
})
|
|
2086
2089
|
);
|
|
2087
2090
|
};
|
|
@@ -2095,6 +2098,7 @@ var View11 = class {
|
|
|
2095
2098
|
this._storage = storage;
|
|
2096
2099
|
const initialStory = this._getInitialStory(params);
|
|
2097
2100
|
if (enableWebsockets) {
|
|
2101
|
+
console.log("websockets enabled");
|
|
2098
2102
|
const channel = this._getServerChannel(params);
|
|
2099
2103
|
import_manager_api2.addons.setChannel(channel);
|
|
2100
2104
|
import_preview_api2.addons.setChannel(channel);
|
|
@@ -2110,7 +2114,7 @@ var View11 = class {
|
|
|
2110
2114
|
if (!this._ready) {
|
|
2111
2115
|
throw new Error("Storybook is not ready yet");
|
|
2112
2116
|
}
|
|
2113
|
-
return this._preview.
|
|
2117
|
+
return this._preview.getStoryContext(this._idToPrepared[id]);
|
|
2114
2118
|
},
|
|
2115
2119
|
getSelection: () => {
|
|
2116
2120
|
return this._preview.currentSelection;
|
|
@@ -2291,7 +2295,7 @@ function start({
|
|
|
2291
2295
|
}
|
|
2292
2296
|
// TODO what happened to this type?
|
|
2293
2297
|
};
|
|
2294
|
-
const
|
|
2298
|
+
const selectionStore = {
|
|
2295
2299
|
selection: null,
|
|
2296
2300
|
selectionSpecifier: null,
|
|
2297
2301
|
setQueryParams: () => {
|
|
@@ -2300,13 +2304,6 @@ function start({
|
|
|
2300
2304
|
preview.selectionStore.selection = selection;
|
|
2301
2305
|
}
|
|
2302
2306
|
};
|
|
2303
|
-
const preview = new import_preview_web.PreviewWithSelection(urlStore, previewView);
|
|
2304
|
-
const view = new View11(preview, channel);
|
|
2305
|
-
if (global) {
|
|
2306
|
-
global.__STORYBOOK_ADDONS_CHANNEL__ = channel;
|
|
2307
|
-
global.__STORYBOOK_PREVIEW__ = preview;
|
|
2308
|
-
global.__STORYBOOK_STORY_STORE__ = preview.storyStore;
|
|
2309
|
-
}
|
|
2310
2307
|
const getProjectAnnotations = async () => (0, import_preview_api3.composeConfigs)([
|
|
2311
2308
|
{
|
|
2312
2309
|
renderToCanvas: (context) => {
|
|
@@ -2324,11 +2321,18 @@ function start({
|
|
|
2324
2321
|
},
|
|
2325
2322
|
...annotations
|
|
2326
2323
|
]);
|
|
2327
|
-
preview.
|
|
2328
|
-
|
|
2324
|
+
const preview = new import_preview_api3.PreviewWithSelection(
|
|
2325
|
+
async (importPath) => importMap[importPath],
|
|
2329
2326
|
getProjectAnnotations,
|
|
2330
|
-
|
|
2331
|
-
|
|
2327
|
+
selectionStore,
|
|
2328
|
+
previewView
|
|
2329
|
+
);
|
|
2330
|
+
const view = new View11(preview, channel);
|
|
2331
|
+
if (global) {
|
|
2332
|
+
global.__STORYBOOK_ADDONS_CHANNEL__ = channel;
|
|
2333
|
+
global.__STORYBOOK_PREVIEW__ = preview;
|
|
2334
|
+
}
|
|
2335
|
+
preview.getStoryIndexFromServer = async () => index;
|
|
2332
2336
|
view._storyIndex = index;
|
|
2333
2337
|
return view;
|
|
2334
2338
|
}
|
package/dist/preview.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as _storybook_docs_tools from '@storybook/docs-tools';
|
|
2
|
-
import { R as Renderer, b as StoryContextForEnhancers,
|
|
2
|
+
import { R as Renderer, b as StoryContextForEnhancers, A as Args, c as StrictArgTypes } from './index.d-ab512c60.js';
|
|
3
3
|
import 'file-system-cache';
|
|
4
|
-
import '@babel/core';
|
|
5
4
|
import 'http';
|
|
6
5
|
|
|
7
6
|
declare const _default: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.1",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -52,19 +52,17 @@
|
|
|
52
52
|
"preset": "react-native"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@storybook/channels": "
|
|
56
|
-
"@storybook/client-logger": "
|
|
57
|
-
"@storybook/core-
|
|
58
|
-
"@storybook/core-
|
|
59
|
-
"@storybook/core-events": "^7.6.13",
|
|
55
|
+
"@storybook/channels": "8.0.0-rc.1",
|
|
56
|
+
"@storybook/client-logger": "8.0.0-rc.1",
|
|
57
|
+
"@storybook/core-common": "8.0.0-rc.1",
|
|
58
|
+
"@storybook/core-events": "8.0.0-rc.1",
|
|
60
59
|
"@storybook/csf": "^0.1.1",
|
|
61
|
-
"@storybook/docs-tools": "
|
|
60
|
+
"@storybook/docs-tools": "8.0.0-rc.1",
|
|
62
61
|
"@storybook/global": "^5.0.0",
|
|
63
|
-
"@storybook/manager-api": "
|
|
64
|
-
"@storybook/preview-api": "
|
|
65
|
-
"@storybook/
|
|
66
|
-
"@storybook/react": "^
|
|
67
|
-
"@storybook/react-native-theming": "^7.6.15",
|
|
62
|
+
"@storybook/manager-api": "8.0.0-rc.1",
|
|
63
|
+
"@storybook/preview-api": "8.0.0-rc.1",
|
|
64
|
+
"@storybook/react": "8.0.0-rc.1",
|
|
65
|
+
"@storybook/react-native-theming": "^8.0.0-alpha.1",
|
|
68
66
|
"chokidar": "^3.5.1",
|
|
69
67
|
"commander": "^8.2.0",
|
|
70
68
|
"dedent": "^1.5.1",
|
|
@@ -76,7 +74,7 @@
|
|
|
76
74
|
"util": "^0.12.4"
|
|
77
75
|
},
|
|
78
76
|
"devDependencies": {
|
|
79
|
-
"@storybook/types": "
|
|
77
|
+
"@storybook/types": "8.0.0-rc.1",
|
|
80
78
|
"@types/jest": "^29.4.3",
|
|
81
79
|
"@types/react": "~18.2.14",
|
|
82
80
|
"babel-jest": "^29.4.3",
|
|
@@ -98,5 +96,5 @@
|
|
|
98
96
|
"publishConfig": {
|
|
99
97
|
"access": "public"
|
|
100
98
|
},
|
|
101
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "1865884a1c866ff61bacd82d02fdc18e845e4132"
|
|
102
100
|
}
|
package/readme.md
CHANGED
|
@@ -279,6 +279,11 @@ You can pass these parameters to getStorybookUI call in your storybook entry poi
|
|
|
279
279
|
-- Disable KeyboardAvoidingView wrapping Storybook's view
|
|
280
280
|
keyboardAvoidingViewVerticalOffset: Number (0)
|
|
281
281
|
-- With shouldDisableKeyboardAvoidingView=true, this will set the keyboardverticaloffset (https://facebook.github.io/react-native/docs/keyboardavoidingview#keyboardverticaloffset) value for KeyboardAvoidingView wrapping Storybook's view
|
|
282
|
+
storage: Object (undefined)
|
|
283
|
+
-- {getItem: (key: string) => Promise<string | null>;setItem: (key: string, value: string) => Promise<void>;}
|
|
284
|
+
-- Custom storage to be used instead of AsyncStorage
|
|
285
|
+
shouldPersistSelection: Boolean (true)
|
|
286
|
+
-- Stores last selected story in your devices storage.
|
|
282
287
|
}
|
|
283
288
|
```
|
|
284
289
|
|
package/scripts/handle-args.js
CHANGED
|
@@ -9,12 +9,7 @@ function getArguments() {
|
|
|
9
9
|
'./.storybook'
|
|
10
10
|
)
|
|
11
11
|
.option('-js, --use-js', 'Use a js file for storybook.requires')
|
|
12
|
-
.option('-a, --absolute', 'Use absolute paths for story imports')
|
|
13
|
-
.option('-v6, --v6-store', 'Use v6 store, for storiesof compatibility')
|
|
14
|
-
.option(
|
|
15
|
-
'-rc, --v6-require-context',
|
|
16
|
-
'When using v6 store should use require.context to load stories'
|
|
17
|
-
);
|
|
12
|
+
.option('-a, --absolute', 'Use absolute paths for story imports');
|
|
18
13
|
|
|
19
14
|
program.parse();
|
|
20
15
|
|
package/V6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/V6';
|
package/dist/V6.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as Params } from './View-425d6066.js';
|
|
3
|
-
import { ClientApi } from '@storybook/preview-api';
|
|
4
|
-
import { L as LoaderFunction, A as Addon_StoryApi } from './index.d-5b1baa07.js';
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
import { ReactRenderer } from '@storybook/react';
|
|
7
|
-
export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
|
|
8
|
-
import '@storybook/csf';
|
|
9
|
-
import '@storybook/preview-web';
|
|
10
|
-
import '@storybook/channels';
|
|
11
|
-
import 'file-system-cache';
|
|
12
|
-
import '@babel/core';
|
|
13
|
-
import 'http';
|
|
14
|
-
|
|
15
|
-
interface RequireContext {
|
|
16
|
-
keys: () => string[];
|
|
17
|
-
(id: string): any;
|
|
18
|
-
resolve(id: string): string;
|
|
19
|
-
}
|
|
20
|
-
type Loadable = RequireContext | RequireContext[] | LoaderFunction;
|
|
21
|
-
|
|
22
|
-
declare const configure: (loadable: any, m: {
|
|
23
|
-
hot?: {
|
|
24
|
-
accept?: () => void;
|
|
25
|
-
};
|
|
26
|
-
}) => void;
|
|
27
|
-
|
|
28
|
-
type C = ClientApi<ReactRenderer>;
|
|
29
|
-
declare const addDecorator: C['addDecorator'];
|
|
30
|
-
declare const addParameters: C['addParameters'];
|
|
31
|
-
declare const addArgsEnhancer: C['addArgsEnhancer'];
|
|
32
|
-
declare const addArgTypesEnhancer: C['addArgTypesEnhancer'];
|
|
33
|
-
declare const raw: C['raw'];
|
|
34
|
-
declare const storiesOf: (kind: string, m: any) => Addon_StoryApi<ReactNode>;
|
|
35
|
-
declare const getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
|
36
|
-
|
|
37
|
-
export { Loadable, RequireContext, addArgTypesEnhancer, addArgsEnhancer, addDecorator, addParameters, configure, getStorybookUI, raw, storiesOf };
|