1 | import * as _storybook_core_types from '@storybook/core/types';
|
2 | import { StoryIndex, PreparedStory, NormalizedStoriesSpecifier, StorybookConfig as StorybookConfig$1 } from '@storybook/core/types';
|
3 | import { ReactRenderer } from '@storybook/react';
|
4 | import * as react_jsx_runtime from 'react/jsx-runtime';
|
5 | import { Channel } from '@storybook/core/channels';
|
6 | import { StoryContext } from '@storybook/csf';
|
7 | import { PreviewWithSelection } from '@storybook/core/preview-api';
|
8 | import { Theme } from '@storybook/react-native-theming';
|
9 | export { Theme, darkTheme, theme } from '@storybook/react-native-theming';
|
10 |
|
11 | interface Storage {
|
12 | getItem: (key: string) => Promise<string | null>;
|
13 | setItem: (key: string, value: string) => Promise<void>;
|
14 | }
|
15 | type StoryKind = string;
|
16 | type StoryName = string;
|
17 | type InitialSelection = `${StoryKind}--${StoryName}` | {
|
18 | |
19 |
|
20 |
|
21 | kind: StoryKind;
|
22 | |
23 |
|
24 |
|
25 | name: StoryName;
|
26 | };
|
27 | type DeepPartial<T> = T extends object ? {
|
28 | [P in keyof T]?: DeepPartial<T[P]>;
|
29 | } : T;
|
30 | type Params = {
|
31 | onDeviceUI?: boolean;
|
32 | enableWebsockets?: boolean;
|
33 | query?: string;
|
34 | host?: string;
|
35 | port?: number;
|
36 | secured?: boolean;
|
37 | initialSelection?: InitialSelection;
|
38 | shouldPersistSelection?: boolean;
|
39 | theme: DeepPartial<Theme>;
|
40 | storage?: Storage;
|
41 | };
|
42 | declare class View {
|
43 | _storyIndex: StoryIndex;
|
44 | _setStory: (story: StoryContext<ReactRenderer>) => void;
|
45 | _forceRerender: () => void;
|
46 | _ready: boolean;
|
47 | _preview: PreviewWithSelection<ReactRenderer>;
|
48 | _asyncStorageStoryId: string;
|
49 | _webUrl: string;
|
50 | _storage: Storage;
|
51 | _channel: Channel;
|
52 | _idToPrepared: Record<string, PreparedStory<ReactRenderer>>;
|
53 | constructor(preview: PreviewWithSelection<ReactRenderer>, channel: Channel);
|
54 | _getInitialStory: ({ initialSelection, shouldPersistSelection, }?: Partial<Params>) => Promise<{
|
55 | storySpecifier: string;
|
56 | viewMode: string;
|
57 | }>;
|
58 | _getServerChannel: (params?: Partial<Params>) => Channel;
|
59 | createPreparedStoryMapping: () => Promise<void>;
|
60 | getStorybookUI: (params?: Partial<Params>) => () => react_jsx_runtime.JSX.Element;
|
61 | }
|
62 |
|
63 |
|
64 | interface ReactNativeOptions {
|
65 | |
66 |
|
67 |
|
68 | playFn?: boolean;
|
69 | }
|
70 | declare function prepareStories({ storyEntries, options, }: {
|
71 | storyEntries: Array<NormalizedStoriesSpecifier & {
|
72 | req: any;
|
73 | }>;
|
74 | options?: ReactNativeOptions;
|
75 | }): {
|
76 | index: StoryIndex;
|
77 | importMap: Record<string, any>;
|
78 | };
|
79 | declare const getProjectAnnotations: (view: View, annotations: any[]) => () => Promise<_storybook_core_types.NormalizedProjectAnnotations<ReactRenderer>>;
|
80 | declare function start({ annotations, storyEntries, options, }: {
|
81 | storyEntries: Array<NormalizedStoriesSpecifier & {
|
82 | req: any;
|
83 | }>;
|
84 | annotations: any[];
|
85 | options?: ReactNativeOptions;
|
86 | }): View;
|
87 | declare function updateView(viewInstance: View, annotations: any[], normalizedStories: Array<NormalizedStoriesSpecifier & {
|
88 | req: any;
|
89 | }>, options?: ReactNativeOptions): void;
|
90 |
|
91 | interface StorybookConfig {
|
92 | stories: StorybookConfig$1['stories'];
|
93 | addons: string[];
|
94 | reactNative?: ReactNativeOptions;
|
95 | }
|
96 |
|
97 | export { StorybookConfig, getProjectAnnotations, prepareStories, start, updateView };
|