@storybook/preview-api 8.2.0-alpha.9 → 8.2.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +14 -42
- package/shim.d.ts +2 -0
- package/shim.js +1 -0
- package/shim.mjs +1 -0
- package/README.md +0 -12
- package/dist/index.d.ts +0 -838
- package/dist/index.js +0 -67
- package/dist/index.mjs +0 -86
- package/template/stories/global.d.ts +0 -11
- package/template/stories/import.js +0 -1
package/dist/index.d.ts
DELETED
@@ -1,838 +0,0 @@
|
|
1
|
-
import { Channel } from '@storybook/channels';
|
2
|
-
import * as _storybook_types from '@storybook/types';
|
3
|
-
import { Renderer, Args, StoryContext, StoryId, DecoratorApplicator, Addon_StoryWrapper, StoryName, ComponentTitle, StoryIndex, IndexEntry, Path, PreparedStory, Globals, GlobalTypes, LegacyStoryAnnotationsOrFn, NormalizedComponentAnnotations, NormalizedStoryAnnotations, ModuleExports, CSFFile, NormalizedProjectAnnotations, ModuleExport, PreparedMeta, ProjectAnnotations, StepRunner, NamedOrDefaultProjectAnnotations, ComponentAnnotations, ComposedStoryFn, Store_CSFExports, ComposeStoryFn, ModuleImportFn, StoryContextForLoaders, StoryContextForEnhancers, Parameters, StoryIndexV3, BoundStory, StrictArgTypes, ArgTypesEnhancer, LegacyStoryFn, DecoratorFunction, PartialStoryFn, StoryContextUpdate, NormalizedStoriesSpecifier, Addon_StorySortParameterV7, StoryRenderOptions, ViewMode, RenderToCanvas, RenderContextCallbacks, DocsContextProps, ResolvedModuleExportType, ResolvedModuleExportFromType } from '@storybook/types';
|
4
|
-
import { CleanupCallback } from '@storybook/csf';
|
5
|
-
import { RequestData, ArgTypesRequestPayload } from '@storybook/core-events';
|
6
|
-
import qs$1 from 'qs';
|
7
|
-
|
8
|
-
declare class AddonStore {
|
9
|
-
constructor();
|
10
|
-
private channel;
|
11
|
-
private promise;
|
12
|
-
private resolve;
|
13
|
-
getChannel: () => Channel;
|
14
|
-
ready: () => Promise<Channel>;
|
15
|
-
hasChannel: () => boolean;
|
16
|
-
setChannel: (channel: Channel) => void;
|
17
|
-
}
|
18
|
-
declare const addons: AddonStore;
|
19
|
-
|
20
|
-
interface Hook {
|
21
|
-
name: string;
|
22
|
-
memoizedState?: any;
|
23
|
-
deps?: any[] | undefined;
|
24
|
-
}
|
25
|
-
interface Effect {
|
26
|
-
create: () => (() => void) | void;
|
27
|
-
destroy?: (() => void) | void;
|
28
|
-
}
|
29
|
-
type AbstractFunction = (...args: any[]) => any;
|
30
|
-
declare class HooksContext<TRenderer extends Renderer, TArgs extends Args = Args> {
|
31
|
-
hookListsMap: WeakMap<AbstractFunction, Hook[]>;
|
32
|
-
mountedDecorators: Set<AbstractFunction>;
|
33
|
-
prevMountedDecorators: Set<AbstractFunction>;
|
34
|
-
currentHooks: Hook[];
|
35
|
-
nextHookIndex: number;
|
36
|
-
currentPhase: 'MOUNT' | 'UPDATE' | 'NONE';
|
37
|
-
currentEffects: Effect[];
|
38
|
-
prevEffects: Effect[];
|
39
|
-
currentDecoratorName: string | null;
|
40
|
-
hasUpdates: boolean;
|
41
|
-
currentContext: StoryContext<TRenderer, TArgs> | null;
|
42
|
-
renderListener: (storyId: StoryId) => void;
|
43
|
-
constructor();
|
44
|
-
init(): void;
|
45
|
-
clean(): void;
|
46
|
-
getNextHook(): Hook;
|
47
|
-
triggerEffects(): void;
|
48
|
-
addRenderListeners(): void;
|
49
|
-
removeRenderListeners(): void;
|
50
|
-
}
|
51
|
-
declare const applyHooks: <TRenderer extends Renderer>(applyDecorators: DecoratorApplicator<TRenderer>) => DecoratorApplicator<TRenderer>;
|
52
|
-
/**
|
53
|
-
* Returns a memoized value.
|
54
|
-
* @template T The type of the memoized value.
|
55
|
-
* @param {() => T} nextCreate A function that returns the memoized value.
|
56
|
-
* @param {any[]} [deps] An optional array of dependencies. If any of the dependencies change, the memoized value will be recomputed.
|
57
|
-
* @returns {T} The memoized value.
|
58
|
-
* @example
|
59
|
-
* const memoizedValue = useMemo(() => {
|
60
|
-
* return doExpensiveCalculation(a, b);
|
61
|
-
* }, [a, b]);
|
62
|
-
*/
|
63
|
-
declare function useMemo<T>(nextCreate: () => T, deps?: any[]): T;
|
64
|
-
/** Returns a memoized callback.
|
65
|
-
*
|
66
|
-
* @template T The type of the callback function.
|
67
|
-
* @param {T} callback The callback function to memoize.
|
68
|
-
* @param {any[]} [deps] An optional array of dependencies. If any of the dependencies change, the memoized callback will be recomputed.
|
69
|
-
* @returns {T} The memoized callback.
|
70
|
-
*
|
71
|
-
* @example
|
72
|
-
* const memoizedCallback = useCallback(
|
73
|
-
* () => {
|
74
|
-
* doSomething(a, b);
|
75
|
-
* },
|
76
|
-
* [a, b],
|
77
|
-
* );
|
78
|
-
*/
|
79
|
-
declare function useCallback<T>(callback: T, deps?: any[]): T;
|
80
|
-
/**
|
81
|
-
* Returns a mutable ref object.
|
82
|
-
*
|
83
|
-
* @template T The type of the ref object.
|
84
|
-
* @param {T} initialValue The initial value of the ref object.
|
85
|
-
* @returns {{ current: T }} The mutable ref object.
|
86
|
-
*
|
87
|
-
* @example
|
88
|
-
* const ref = useRef(0);
|
89
|
-
* ref.current = 1;
|
90
|
-
*/
|
91
|
-
declare function useRef<T>(initialValue: T): {
|
92
|
-
current: T;
|
93
|
-
};
|
94
|
-
/**
|
95
|
-
* Returns a stateful value and a function to update it.
|
96
|
-
*
|
97
|
-
* @template S The type of the state.
|
98
|
-
* @param {(() => S) | S} initialState The initial state value or a function that returns the initial state value.
|
99
|
-
* @returns {[S, (update: ((prevState: S) => S) | S) => void]} An array containing the current state value and a function to update it.
|
100
|
-
*
|
101
|
-
* @example
|
102
|
-
* const [count, setCount] = useState(0);
|
103
|
-
* setCount(count + 1);
|
104
|
-
*/
|
105
|
-
declare function useState<S>(initialState: (() => S) | S): [S, (update: ((prevState: S) => S) | S) => void];
|
106
|
-
/**
|
107
|
-
* A redux-like alternative to useState.
|
108
|
-
*
|
109
|
-
* @template S The type of the state.
|
110
|
-
* @template A The type of the action.
|
111
|
-
* @param {(state: S, action: A) => S} reducer The reducer function that returns the new state.
|
112
|
-
* @param {S | I} initialArg The initial state value or the initial argument for the init function.
|
113
|
-
* @param {(initialArg: I) => S} [init] An optional function that returns the initial state value.
|
114
|
-
* @returns {[S, (action: A) => void]} An array containing the current state value and a function to dispatch actions.
|
115
|
-
*
|
116
|
-
* @example
|
117
|
-
* const initialState = { count: 0 };
|
118
|
-
*
|
119
|
-
* function reducer(state, action) {
|
120
|
-
* switch (action.type) {
|
121
|
-
* case 'increment':
|
122
|
-
* return { count: state.count + 1 };
|
123
|
-
* case 'decrement':
|
124
|
-
* return { count: state.count - 1 };
|
125
|
-
* default:
|
126
|
-
* throw new Error();
|
127
|
-
* }
|
128
|
-
* }
|
129
|
-
*
|
130
|
-
* function Counter() {
|
131
|
-
* const [state, dispatch] = useReducer(reducer, initialState);
|
132
|
-
* return (
|
133
|
-
* <>
|
134
|
-
* Count: {state.count}
|
135
|
-
* <button onClick={() => dispatch({ type: 'increment' })}>+</button>
|
136
|
-
* <button onClick={() => dispatch({ type: 'decrement' })}>-</button>
|
137
|
-
* </>
|
138
|
-
* );
|
139
|
-
* }
|
140
|
-
*/
|
141
|
-
declare function useReducer<S, A>(reducer: (state: S, action: A) => S, initialState: S): [S, (action: A) => void];
|
142
|
-
declare function useReducer<S, I, A>(reducer: (state: S, action: A) => S, initialArg: I, init: (initialArg: I) => S): [S, (action: A) => void];
|
143
|
-
/**
|
144
|
-
* Triggers a side effect, see https://reactjs.org/docs/hooks-reference.html#usestate
|
145
|
-
* Effects are triggered synchronously after rendering the story
|
146
|
-
*
|
147
|
-
* @param {() => (() => void) | void} create A function that creates the effect. It should return a cleanup function, or nothing.
|
148
|
-
* @param {any[]} [deps] An optional array of dependencies. If any of the dependencies change, the effect will be re-run.
|
149
|
-
* @returns {void}
|
150
|
-
*
|
151
|
-
* @example
|
152
|
-
* useEffect(() => {
|
153
|
-
* // Do something after rendering the story
|
154
|
-
* return () => {
|
155
|
-
* // Do something when the component unmounts or the effect is re-run
|
156
|
-
* };
|
157
|
-
* }, [dependency1, dependency2]);
|
158
|
-
*/
|
159
|
-
declare function useEffect(create: () => (() => void) | void, deps?: any[]): void;
|
160
|
-
interface Listener {
|
161
|
-
(...args: any[]): void;
|
162
|
-
}
|
163
|
-
interface EventMap {
|
164
|
-
[eventId: string]: Listener;
|
165
|
-
}
|
166
|
-
/**
|
167
|
-
* Subscribes to events emitted by the Storybook channel and returns a function to emit events.
|
168
|
-
*
|
169
|
-
* @param {EventMap} eventMap A map of event listeners to subscribe to.
|
170
|
-
* @param {any[]} [deps=[]] An optional array of dependencies. If any of the dependencies change, the event listeners will be re-subscribed.
|
171
|
-
* @returns {(...args: any[]) => void} A function to emit events to the Storybook channel.
|
172
|
-
*
|
173
|
-
* @example
|
174
|
-
* // Subscribe to an event and emit it
|
175
|
-
* const emit = useChannel({ 'my-event': (arg1, arg2) => console.log(arg1, arg2) });
|
176
|
-
* emit('my-event', 'Hello', 'world!');
|
177
|
-
*/
|
178
|
-
declare function useChannel(eventMap: EventMap, deps?: any[]): (eventName: string, ...args: any) => void;
|
179
|
-
/**
|
180
|
-
* Returns the current story context, including the story's ID, parameters, and other metadata.
|
181
|
-
*
|
182
|
-
* @template TRenderer The type of the story's renderer.
|
183
|
-
* @template TArgs The type of the story's args.
|
184
|
-
* @returns {StoryContext<TRenderer>} The current story context.
|
185
|
-
*
|
186
|
-
* @example
|
187
|
-
* const { id, parameters } = useStoryContext();
|
188
|
-
* console.log(`Current story ID: ${id}`);
|
189
|
-
* console.log(`Current story parameters: ${JSON.stringify(parameters)}`);
|
190
|
-
*/
|
191
|
-
declare function useStoryContext<TRenderer extends Renderer, TArgs extends Args = Args>(): StoryContext<TRenderer>;
|
192
|
-
/**
|
193
|
-
* Returns the value of a specific parameter for the current story, or a default value if the parameter is not set.
|
194
|
-
*
|
195
|
-
* @template S The type of the parameter value.
|
196
|
-
* @param {string} parameterKey The key of the parameter to retrieve.
|
197
|
-
* @param {S} [defaultValue] An optional default value to return if the parameter is not set.
|
198
|
-
* @returns {S | undefined} The value of the parameter, or the default value if the parameter is not set.
|
199
|
-
*
|
200
|
-
* @example
|
201
|
-
* // Retrieve the value of a parameter named "myParam"
|
202
|
-
* const myParamValue = useParameter<string>('myParam', 'default value');
|
203
|
-
* console.log(`The value of myParam is: ${myParamValue}`);
|
204
|
-
*/
|
205
|
-
declare function useParameter<S>(parameterKey: string, defaultValue?: S): S | undefined;
|
206
|
-
/**
|
207
|
-
* Returns the current args for the story, and functions to update and reset them.
|
208
|
-
*
|
209
|
-
* @template TArgs The type of the story's args.
|
210
|
-
* @returns {[TArgs, (newArgs: Partial<TArgs>) => void, (argNames?: (keyof TArgs)[]) => void]} An array containing the current args, a function to update them, and a function to reset them.
|
211
|
-
*
|
212
|
-
* @example
|
213
|
-
* const [args, updateArgs, resetArgs] = useArgs<{ name: string, age: number }>();
|
214
|
-
* console.log(`Current args: ${JSON.stringify(args)}`);
|
215
|
-
* updateArgs({ name: 'John' });
|
216
|
-
* resetArgs(['name']);
|
217
|
-
*/
|
218
|
-
declare function useArgs<TArgs extends Args = Args>(): [
|
219
|
-
TArgs,
|
220
|
-
(newArgs: Partial<TArgs>) => void,
|
221
|
-
(argNames?: (keyof TArgs)[]) => void
|
222
|
-
];
|
223
|
-
/**
|
224
|
-
* Returns the current global args for the story, and a function to update them.
|
225
|
-
*
|
226
|
-
* @returns {[Args, (newGlobals: Args) => void]} An array containing the current global args, and a function to update them.
|
227
|
-
*
|
228
|
-
* @example
|
229
|
-
* const [globals, updateGlobals] = useGlobals();
|
230
|
-
* console.log(`Current globals: ${JSON.stringify(globals)}`);
|
231
|
-
* updateGlobals({ theme: 'dark' });
|
232
|
-
*/
|
233
|
-
declare function useGlobals(): [Args, (newGlobals: Args) => void];
|
234
|
-
|
235
|
-
type MakeDecoratorResult = (...args: any) => any;
|
236
|
-
interface MakeDecoratorOptions {
|
237
|
-
name: string;
|
238
|
-
parameterName: string;
|
239
|
-
skipIfNoParametersOrOptions?: boolean;
|
240
|
-
wrapper: Addon_StoryWrapper;
|
241
|
-
}
|
242
|
-
/**
|
243
|
-
* Creates a Storybook decorator function that can be used to wrap stories with additional functionality.
|
244
|
-
*
|
245
|
-
* @param {MakeDecoratorOptions} options - The options for the decorator.
|
246
|
-
* @param {string} options.name - The name of the decorator.
|
247
|
-
* @param {string} options.parameterName - The name of the parameter that will be used to pass options to the decorator.
|
248
|
-
* @param {Addon_StoryWrapper} options.wrapper - The function that will be used to wrap the story.
|
249
|
-
* @param {boolean} [options.skipIfNoParametersOrOptions=false] - Whether to skip the decorator if no options or parameters are provided.
|
250
|
-
* @returns {MakeDecoratorResult} A function that can be used as a Storybook decorator.
|
251
|
-
*
|
252
|
-
* @example
|
253
|
-
* const myDecorator = makeDecorator({
|
254
|
-
* name: 'My Decorator',
|
255
|
-
* parameterName: 'myDecorator',
|
256
|
-
* wrapper: (storyFn, context, { options }) => {
|
257
|
-
* const { myOption } = options;
|
258
|
-
* return <div style={{ backgroundColor: myOption }}>{storyFn()}</div>;
|
259
|
-
* },
|
260
|
-
* });
|
261
|
-
*
|
262
|
-
* export const decorators = [myDecorator];
|
263
|
-
*/
|
264
|
-
declare const makeDecorator: ({ name, parameterName, wrapper, skipIfNoParametersOrOptions, }: MakeDecoratorOptions) => MakeDecoratorResult;
|
265
|
-
|
266
|
-
declare function mockChannel(): Channel;
|
267
|
-
|
268
|
-
type StorySpecifier = StoryId | {
|
269
|
-
name: StoryName;
|
270
|
-
title: ComponentTitle;
|
271
|
-
} | '*';
|
272
|
-
declare class StoryIndexStore {
|
273
|
-
entries: StoryIndex['entries'];
|
274
|
-
constructor({ entries }?: StoryIndex);
|
275
|
-
entryFromSpecifier(specifier: StorySpecifier): IndexEntry | undefined;
|
276
|
-
storyIdToEntry(storyId: StoryId): IndexEntry;
|
277
|
-
importPathToEntry(importPath: Path): IndexEntry;
|
278
|
-
}
|
279
|
-
|
280
|
-
declare class ArgsStore {
|
281
|
-
initialArgsByStoryId: Record<StoryId, Args>;
|
282
|
-
argsByStoryId: Record<StoryId, Args>;
|
283
|
-
get(storyId: StoryId): Args;
|
284
|
-
setInitial(story: PreparedStory<any>): void;
|
285
|
-
updateFromDelta(story: PreparedStory<any>, delta: Args): void;
|
286
|
-
updateFromPersisted(story: PreparedStory<any>, persisted: Args): void;
|
287
|
-
update(storyId: StoryId, argsUpdate: Partial<Args>): void;
|
288
|
-
}
|
289
|
-
|
290
|
-
declare class GlobalsStore {
|
291
|
-
allowedGlobalNames: Set<string>;
|
292
|
-
initialGlobals: Globals;
|
293
|
-
globals: Globals;
|
294
|
-
constructor({ globals, globalTypes, }: {
|
295
|
-
globals?: Globals;
|
296
|
-
globalTypes?: GlobalTypes;
|
297
|
-
});
|
298
|
-
set({ globals, globalTypes }: {
|
299
|
-
globals?: Globals;
|
300
|
-
globalTypes?: GlobalTypes;
|
301
|
-
}): void;
|
302
|
-
filterAllowedGlobals(globals: Globals): Globals;
|
303
|
-
updateFromPersisted(persisted: Globals): void;
|
304
|
-
get(): Globals;
|
305
|
-
update(newGlobals: Globals): void;
|
306
|
-
}
|
307
|
-
|
308
|
-
declare function normalizeStory<TRenderer extends Renderer>(key: StoryId, storyAnnotations: LegacyStoryAnnotationsOrFn<TRenderer>, meta: NormalizedComponentAnnotations<TRenderer>): NormalizedStoryAnnotations<TRenderer>;
|
309
|
-
|
310
|
-
declare function processCSFFile<TRenderer extends Renderer>(moduleExports: ModuleExports, importPath: Path, title: ComponentTitle): CSFFile<TRenderer>;
|
311
|
-
|
312
|
-
declare function prepareStory<TRenderer extends Renderer>(storyAnnotations: NormalizedStoryAnnotations<TRenderer>, componentAnnotations: NormalizedComponentAnnotations<TRenderer>, projectAnnotations: NormalizedProjectAnnotations<TRenderer>): PreparedStory<TRenderer>;
|
313
|
-
declare function prepareMeta<TRenderer extends Renderer>(componentAnnotations: NormalizedComponentAnnotations<TRenderer>, projectAnnotations: NormalizedProjectAnnotations<TRenderer>, moduleExport: ModuleExport): PreparedMeta<TRenderer>;
|
314
|
-
|
315
|
-
declare function composeConfigs<TRenderer extends Renderer>(moduleExportList: ModuleExports[]): ProjectAnnotations<TRenderer>;
|
316
|
-
|
317
|
-
/**
|
318
|
-
* Compose step runners to create a single step runner that applies each step runner in order.
|
319
|
-
*
|
320
|
-
* A step runner is a function that takes a defined step: `step('label', () => { ... })`
|
321
|
-
* and runs it. The prototypical example is from `@storybook/addon-interactions` where the
|
322
|
-
* step runner will decorate all instrumented code inside the step with information about the
|
323
|
-
* label.
|
324
|
-
*
|
325
|
-
* In theory it is possible to have more than one addon that wants to run steps; they can be
|
326
|
-
* composed together in a similar fashion to decorators. In some ways step runners are like
|
327
|
-
* decorators except it is not intended that they change the context or the play function.
|
328
|
-
*
|
329
|
-
* The basic implementation of a step runner is `async (label, play, context) => play(context)`
|
330
|
-
* -- in fact this is what `composeStepRunners([])` will do.
|
331
|
-
*
|
332
|
-
* @param stepRunners an array of StepRunner
|
333
|
-
* @returns a StepRunner that is the composition of the arguments
|
334
|
-
*/
|
335
|
-
declare function composeStepRunners<TRenderer extends Renderer>(stepRunners: StepRunner<TRenderer>[]): StepRunner<TRenderer>;
|
336
|
-
|
337
|
-
declare function setProjectAnnotations<TRenderer extends Renderer = Renderer>(projectAnnotations: NamedOrDefaultProjectAnnotations<TRenderer> | NamedOrDefaultProjectAnnotations<TRenderer>[]): void;
|
338
|
-
declare function composeStory<TRenderer extends Renderer = Renderer, TArgs extends Args = Args>(storyAnnotations: LegacyStoryAnnotationsOrFn<TRenderer>, componentAnnotations: ComponentAnnotations<TRenderer, TArgs>, projectAnnotations?: ProjectAnnotations<TRenderer>, defaultConfig?: ProjectAnnotations<TRenderer>, exportsName?: string): ComposedStoryFn<TRenderer, Partial<TArgs>>;
|
339
|
-
declare function composeStories<TModule extends Store_CSFExports>(storiesImport: TModule, globalConfig: ProjectAnnotations<Renderer>, composeStoryFn: ComposeStoryFn): {};
|
340
|
-
type WrappedStoryRef = {
|
341
|
-
__pw_type: 'jsx' | 'importRef';
|
342
|
-
};
|
343
|
-
type UnwrappedJSXStoryRef = {
|
344
|
-
__pw_type: 'jsx';
|
345
|
-
type: ComposedStoryFn;
|
346
|
-
};
|
347
|
-
type UnwrappedImportStoryRef = ComposedStoryFn;
|
348
|
-
declare global {
|
349
|
-
function __pwUnwrapObject(storyRef: WrappedStoryRef): Promise<UnwrappedJSXStoryRef | UnwrappedImportStoryRef>;
|
350
|
-
}
|
351
|
-
declare function createPlaywrightTest<TFixture extends {
|
352
|
-
extend: any;
|
353
|
-
}>(baseTest: TFixture): TFixture;
|
354
|
-
|
355
|
-
declare class StoryStore<TRenderer extends Renderer> {
|
356
|
-
importFn: ModuleImportFn;
|
357
|
-
storyIndex: StoryIndexStore;
|
358
|
-
projectAnnotations: NormalizedProjectAnnotations<TRenderer>;
|
359
|
-
globals: GlobalsStore;
|
360
|
-
args: ArgsStore;
|
361
|
-
hooks: Record<StoryId, HooksContext<TRenderer>>;
|
362
|
-
cleanupCallbacks: Record<StoryId, CleanupCallback[] | undefined>;
|
363
|
-
cachedCSFFiles?: Record<Path, CSFFile<TRenderer>>;
|
364
|
-
processCSFFileWithCache: typeof processCSFFile;
|
365
|
-
prepareMetaWithCache: typeof prepareMeta;
|
366
|
-
prepareStoryWithCache: typeof prepareStory;
|
367
|
-
constructor(storyIndex: StoryIndex, importFn: ModuleImportFn, projectAnnotations: ProjectAnnotations<TRenderer>);
|
368
|
-
setProjectAnnotations(projectAnnotations: ProjectAnnotations<TRenderer>): void;
|
369
|
-
onStoriesChanged({ importFn, storyIndex, }: {
|
370
|
-
importFn?: ModuleImportFn;
|
371
|
-
storyIndex?: StoryIndex;
|
372
|
-
}): Promise<void>;
|
373
|
-
storyIdToEntry(storyId: StoryId): Promise<IndexEntry>;
|
374
|
-
loadCSFFileByStoryId(storyId: StoryId): Promise<CSFFile<TRenderer>>;
|
375
|
-
loadAllCSFFiles(): Promise<StoryStore<TRenderer>['cachedCSFFiles']>;
|
376
|
-
cacheAllCSFFiles(): Promise<void>;
|
377
|
-
preparedMetaFromCSFFile({ csfFile }: {
|
378
|
-
csfFile: CSFFile<TRenderer>;
|
379
|
-
}): PreparedMeta<TRenderer>;
|
380
|
-
loadStory({ storyId }: {
|
381
|
-
storyId: StoryId;
|
382
|
-
}): Promise<PreparedStory<TRenderer>>;
|
383
|
-
storyFromCSFFile({ storyId, csfFile, }: {
|
384
|
-
storyId: StoryId;
|
385
|
-
csfFile: CSFFile<TRenderer>;
|
386
|
-
}): PreparedStory<TRenderer>;
|
387
|
-
componentStoriesFromCSFFile({ csfFile, }: {
|
388
|
-
csfFile: CSFFile<TRenderer>;
|
389
|
-
}): PreparedStory<TRenderer>[];
|
390
|
-
loadEntry(id: StoryId): Promise<{
|
391
|
-
entryExports: ModuleExports;
|
392
|
-
csfFiles: CSFFile<TRenderer>[];
|
393
|
-
}>;
|
394
|
-
getStoryContext(story: PreparedStory<TRenderer>, { forceInitialArgs }?: {
|
395
|
-
forceInitialArgs?: boolean | undefined;
|
396
|
-
}): Omit<StoryContextForLoaders, 'viewMode'>;
|
397
|
-
addCleanupCallbacks(story: PreparedStory<TRenderer>, callbacks: CleanupCallback[]): void;
|
398
|
-
cleanupStory(story: PreparedStory<TRenderer>): Promise<void>;
|
399
|
-
extract(options?: {
|
400
|
-
includeDocsOnly?: boolean;
|
401
|
-
}): Record<StoryId, StoryContextForEnhancers<TRenderer>>;
|
402
|
-
getSetStoriesPayload(): {
|
403
|
-
v: number;
|
404
|
-
globals: _storybook_types.Globals;
|
405
|
-
globalParameters: {};
|
406
|
-
kindParameters: Parameters;
|
407
|
-
stories: Record<string, StoryContextForEnhancers<TRenderer, _storybook_types.Args>>;
|
408
|
-
};
|
409
|
-
getStoriesJsonData: () => StoryIndexV3;
|
410
|
-
raw(): BoundStory<TRenderer>[];
|
411
|
-
fromId(storyId: StoryId): BoundStory<TRenderer> | null;
|
412
|
-
}
|
413
|
-
|
414
|
-
/**
|
415
|
-
* Safely combine parameters recursively. Only copy objects when needed.
|
416
|
-
* Algorithm = always overwrite the existing value UNLESS both values
|
417
|
-
* are plain objects. In this case flag the key as "special" and handle
|
418
|
-
* it with a heuristic.
|
419
|
-
*/
|
420
|
-
declare const combineParameters: (...parameterSets: (Parameters | undefined)[]) => Parameters;
|
421
|
-
|
422
|
-
type PropDescriptor = string[] | RegExp;
|
423
|
-
declare const filterArgTypes: (argTypes: StrictArgTypes, include?: PropDescriptor, exclude?: PropDescriptor) => StrictArgTypes<_storybook_types.Args>;
|
424
|
-
|
425
|
-
declare const inferControls: ArgTypesEnhancer<Renderer>;
|
426
|
-
|
427
|
-
declare function decorateStory<TRenderer extends Renderer>(storyFn: LegacyStoryFn<TRenderer>, decorator: DecoratorFunction<TRenderer>, bindWithContext: (storyFn: LegacyStoryFn<TRenderer>) => PartialStoryFn<TRenderer>): LegacyStoryFn<TRenderer>;
|
428
|
-
/**
|
429
|
-
* Currently StoryContextUpdates are allowed to have any key in the type.
|
430
|
-
* However, you cannot overwrite any of the build-it "static" keys.
|
431
|
-
*
|
432
|
-
* @param inputContextUpdate StoryContextUpdate
|
433
|
-
* @returns StoryContextUpdate
|
434
|
-
*/
|
435
|
-
declare function sanitizeStoryContextUpdate({ componentId, title, kind, id, name, story, parameters, initialArgs, argTypes, ...update }?: StoryContextUpdate): StoryContextUpdate;
|
436
|
-
declare function defaultDecorateStory<TRenderer extends Renderer>(storyFn: LegacyStoryFn<TRenderer>, decorators: DecoratorFunction<TRenderer>[]): LegacyStoryFn<TRenderer>;
|
437
|
-
|
438
|
-
declare const combineArgs: (value: any, update: any) => Args;
|
439
|
-
|
440
|
-
declare const userOrAutoTitleFromSpecifier: (fileName: string | number, entry: NormalizedStoriesSpecifier, userTitle?: string) => string | undefined;
|
441
|
-
declare const userOrAutoTitle: (fileName: string, storiesEntries: NormalizedStoriesSpecifier[], userTitle?: string) => string | undefined;
|
442
|
-
|
443
|
-
declare const sortStoriesV7: (stories: IndexEntry[], storySortParameter: Addon_StorySortParameterV7, fileNameOrder: Path[]) => IndexEntry[];
|
444
|
-
|
445
|
-
type RenderType = 'story' | 'docs';
|
446
|
-
/**
|
447
|
-
* A "Render" represents the rendering of a single entry to a single location
|
448
|
-
*
|
449
|
-
* The implementations of render are used for two key purposes:
|
450
|
-
* - Tracking the state of the rendering as it moves between preparing, rendering and tearing down.
|
451
|
-
* - Tracking what is rendered to know if a change requires re-rendering or teardown + recreation.
|
452
|
-
*/
|
453
|
-
interface Render<TRenderer extends Renderer> {
|
454
|
-
type: RenderType;
|
455
|
-
id: StoryId;
|
456
|
-
isPreparing: () => boolean;
|
457
|
-
isEqual: (other: Render<TRenderer>) => boolean;
|
458
|
-
disableKeyListeners: boolean;
|
459
|
-
teardown?: (options: {
|
460
|
-
viewModeChanged: boolean;
|
461
|
-
}) => Promise<void>;
|
462
|
-
torndown: boolean;
|
463
|
-
renderToElement: (canvasElement: TRenderer['canvasElement'], renderStoryToElement?: any, options?: StoryRenderOptions) => Promise<void>;
|
464
|
-
}
|
465
|
-
|
466
|
-
type RenderPhase = 'preparing' | 'loading' | 'beforeEach' | 'rendering' | 'playing' | 'played' | 'completed' | 'aborted' | 'errored';
|
467
|
-
declare class StoryRender<TRenderer extends Renderer> implements Render<TRenderer> {
|
468
|
-
channel: Channel;
|
469
|
-
store: StoryStore<TRenderer>;
|
470
|
-
private renderToScreen;
|
471
|
-
private callbacks;
|
472
|
-
id: StoryId;
|
473
|
-
viewMode: ViewMode;
|
474
|
-
renderOptions: StoryRenderOptions;
|
475
|
-
type: RenderType;
|
476
|
-
story?: PreparedStory<TRenderer>;
|
477
|
-
phase?: RenderPhase;
|
478
|
-
private abortController?;
|
479
|
-
private canvasElement?;
|
480
|
-
private notYetRendered;
|
481
|
-
private rerenderEnqueued;
|
482
|
-
disableKeyListeners: boolean;
|
483
|
-
private teardownRender;
|
484
|
-
torndown: boolean;
|
485
|
-
constructor(channel: Channel, store: StoryStore<TRenderer>, renderToScreen: RenderToCanvas<TRenderer>, callbacks: RenderContextCallbacks<TRenderer>, id: StoryId, viewMode: ViewMode, renderOptions?: StoryRenderOptions, story?: PreparedStory<TRenderer>);
|
486
|
-
private runPhase;
|
487
|
-
prepare(): Promise<void>;
|
488
|
-
isEqual(other: Render<TRenderer>): boolean;
|
489
|
-
isPreparing(): boolean;
|
490
|
-
isPending(): boolean;
|
491
|
-
renderToElement(canvasElement: TRenderer['canvasElement']): Promise<void>;
|
492
|
-
private storyContext;
|
493
|
-
render({ initial, forceRemount, }?: {
|
494
|
-
initial?: boolean;
|
495
|
-
forceRemount?: boolean;
|
496
|
-
}): Promise<void>;
|
497
|
-
/**
|
498
|
-
* Rerender the story.
|
499
|
-
* If the story is currently pending (loading/rendering), the rerender will be enqueued,
|
500
|
-
* and will be executed after the current render is completed.
|
501
|
-
* Rerendering while playing will not be enqueued, and will be executed immediately, to support
|
502
|
-
* rendering args changes while playing.
|
503
|
-
*/
|
504
|
-
rerender(): Promise<void>;
|
505
|
-
remount(): Promise<void>;
|
506
|
-
cancelRender(): void;
|
507
|
-
teardown(): Promise<void>;
|
508
|
-
}
|
509
|
-
|
510
|
-
declare class DocsContext<TRenderer extends Renderer> implements DocsContextProps<TRenderer> {
|
511
|
-
channel: Channel;
|
512
|
-
protected store: StoryStore<TRenderer>;
|
513
|
-
renderStoryToElement: DocsContextProps<TRenderer>['renderStoryToElement'];
|
514
|
-
private componentStoriesValue;
|
515
|
-
private storyIdToCSFFile;
|
516
|
-
private exportToStory;
|
517
|
-
private exportsToCSFFile;
|
518
|
-
private nameToStoryId;
|
519
|
-
private attachedCSFFiles;
|
520
|
-
private primaryStory?;
|
521
|
-
constructor(channel: Channel, store: StoryStore<TRenderer>, renderStoryToElement: DocsContextProps<TRenderer>['renderStoryToElement'],
|
522
|
-
/** The CSF files known (via the index) to be refererenced by this docs file */
|
523
|
-
csfFiles: CSFFile<TRenderer>[]);
|
524
|
-
referenceCSFFile(csfFile: CSFFile<TRenderer>): void;
|
525
|
-
attachCSFFile(csfFile: CSFFile<TRenderer>): void;
|
526
|
-
referenceMeta(metaExports: ModuleExports, attach: boolean): void;
|
527
|
-
get projectAnnotations(): _storybook_types.NormalizedProjectAnnotations<TRenderer>;
|
528
|
-
private resolveAttachedModuleExportType;
|
529
|
-
private resolveModuleExport;
|
530
|
-
resolveOf<TType extends ResolvedModuleExportType>(moduleExportOrType: ModuleExport | TType, validTypes?: TType[]): ResolvedModuleExportFromType<TType, TRenderer>;
|
531
|
-
storyIdByName: (storyName: StoryName) => string;
|
532
|
-
componentStories: () => PreparedStory<TRenderer>[];
|
533
|
-
componentStoriesFromCSFFile: (csfFile: CSFFile<TRenderer>) => PreparedStory<TRenderer>[];
|
534
|
-
storyById: (storyId?: StoryId) => PreparedStory<TRenderer>;
|
535
|
-
getStoryContext: (story: PreparedStory<TRenderer>) => StoryContextForLoaders<TRenderer, _storybook_types.Args>;
|
536
|
-
loadStory: (id: StoryId) => Promise<PreparedStory<TRenderer>>;
|
537
|
-
}
|
538
|
-
|
539
|
-
/**
|
540
|
-
* A CsfDocsRender is a render of a docs entry that is rendered based on a CSF file.
|
541
|
-
*
|
542
|
-
* The expectation is the primary CSF file which is the `importPath` for the entry will
|
543
|
-
* define a story which may contain the actual rendered JSX code for the template in the
|
544
|
-
* `docs.page` parameter.
|
545
|
-
*
|
546
|
-
* Use cases:
|
547
|
-
* - Autodocs, where there is no story, and we fall back to the globally defined template.
|
548
|
-
*/
|
549
|
-
declare class CsfDocsRender<TRenderer extends Renderer> implements Render<TRenderer> {
|
550
|
-
protected channel: Channel;
|
551
|
-
protected store: StoryStore<TRenderer>;
|
552
|
-
entry: IndexEntry;
|
553
|
-
private callbacks;
|
554
|
-
readonly type: RenderType;
|
555
|
-
readonly subtype = "csf";
|
556
|
-
readonly id: StoryId;
|
557
|
-
story?: PreparedStory<TRenderer>;
|
558
|
-
rerender?: () => Promise<void>;
|
559
|
-
teardownRender?: (options: {
|
560
|
-
viewModeChanged?: boolean;
|
561
|
-
}) => Promise<void>;
|
562
|
-
torndown: boolean;
|
563
|
-
readonly disableKeyListeners = false;
|
564
|
-
preparing: boolean;
|
565
|
-
csfFiles?: CSFFile<TRenderer>[];
|
566
|
-
constructor(channel: Channel, store: StoryStore<TRenderer>, entry: IndexEntry, callbacks: RenderContextCallbacks<TRenderer>);
|
567
|
-
isPreparing(): boolean;
|
568
|
-
prepare(): Promise<void>;
|
569
|
-
isEqual(other: Render<TRenderer>): boolean;
|
570
|
-
docsContext(renderStoryToElement: DocsContextProps<TRenderer>['renderStoryToElement']): DocsContext<TRenderer>;
|
571
|
-
renderToElement(canvasElement: TRenderer['canvasElement'], renderStoryToElement: DocsContextProps<TRenderer>['renderStoryToElement']): Promise<void>;
|
572
|
-
teardown({ viewModeChanged }?: {
|
573
|
-
viewModeChanged?: boolean;
|
574
|
-
}): Promise<void>;
|
575
|
-
}
|
576
|
-
|
577
|
-
/**
|
578
|
-
* A MdxDocsRender is a render of a docs entry that comes from a true MDX file,
|
579
|
-
* that is a `.mdx` file that doesn't get compiled to a CSF file.
|
580
|
-
*
|
581
|
-
* A MDX render can reference (import) zero or more CSF files that contain stories.
|
582
|
-
*
|
583
|
-
* Use cases:
|
584
|
-
* - *.mdx file that may or may not reference a specific CSF file with `<Meta of={} />`
|
585
|
-
*/
|
586
|
-
declare class MdxDocsRender<TRenderer extends Renderer> implements Render<TRenderer> {
|
587
|
-
protected channel: Channel;
|
588
|
-
protected store: StoryStore<TRenderer>;
|
589
|
-
entry: IndexEntry;
|
590
|
-
private callbacks;
|
591
|
-
readonly type: RenderType;
|
592
|
-
readonly subtype = "mdx";
|
593
|
-
readonly id: StoryId;
|
594
|
-
private exports?;
|
595
|
-
rerender?: () => Promise<void>;
|
596
|
-
teardownRender?: (options: {
|
597
|
-
viewModeChanged?: boolean;
|
598
|
-
}) => Promise<void>;
|
599
|
-
torndown: boolean;
|
600
|
-
readonly disableKeyListeners = false;
|
601
|
-
preparing: boolean;
|
602
|
-
csfFiles?: CSFFile<TRenderer>[];
|
603
|
-
constructor(channel: Channel, store: StoryStore<TRenderer>, entry: IndexEntry, callbacks: RenderContextCallbacks<TRenderer>);
|
604
|
-
isPreparing(): boolean;
|
605
|
-
prepare(): Promise<void>;
|
606
|
-
isEqual(other: Render<TRenderer>): boolean;
|
607
|
-
docsContext(renderStoryToElement: DocsContextProps<TRenderer>['renderStoryToElement']): DocsContext<TRenderer>;
|
608
|
-
renderToElement(canvasElement: TRenderer['canvasElement'], renderStoryToElement: DocsContextProps<TRenderer>['renderStoryToElement']): Promise<void>;
|
609
|
-
teardown({ viewModeChanged }?: {
|
610
|
-
viewModeChanged?: boolean;
|
611
|
-
}): Promise<void>;
|
612
|
-
}
|
613
|
-
|
614
|
-
type MaybePromise<T> = Promise<T> | T;
|
615
|
-
declare class Preview<TRenderer extends Renderer> {
|
616
|
-
importFn: ModuleImportFn;
|
617
|
-
getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>;
|
618
|
-
protected channel: Channel;
|
619
|
-
/**
|
620
|
-
* @deprecated will be removed in 8.0, please use channel instead
|
621
|
-
*/
|
622
|
-
serverChannel?: Channel;
|
623
|
-
protected storyStoreValue?: StoryStore<TRenderer>;
|
624
|
-
renderToCanvas?: RenderToCanvas<TRenderer>;
|
625
|
-
storyRenders: StoryRender<TRenderer>[];
|
626
|
-
previewEntryError?: Error;
|
627
|
-
private projectAnnotationsBeforeInitialization?;
|
628
|
-
protected storeInitializationPromise: Promise<void>;
|
629
|
-
protected resolveStoreInitializationPromise: () => void;
|
630
|
-
protected rejectStoreInitializationPromise: (err: Error) => void;
|
631
|
-
constructor(importFn: ModuleImportFn, getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>, channel?: Channel, shouldInitialize?: boolean);
|
632
|
-
get storyStore(): {};
|
633
|
-
protected initialize(): Promise<void>;
|
634
|
-
ready(): Promise<void>;
|
635
|
-
setupListeners(): void;
|
636
|
-
getProjectAnnotationsOrRenderError(): Promise<ProjectAnnotations<TRenderer>>;
|
637
|
-
initializeWithProjectAnnotations(projectAnnotations: ProjectAnnotations<TRenderer>): Promise<void>;
|
638
|
-
getStoryIndexFromServer(): Promise<StoryIndex>;
|
639
|
-
protected initializeWithStoryIndex(storyIndex: StoryIndex): void;
|
640
|
-
setInitialGlobals(): Promise<void>;
|
641
|
-
emitGlobals(): void;
|
642
|
-
onGetProjectAnnotationsChanged({ getProjectAnnotations, }: {
|
643
|
-
getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>;
|
644
|
-
}): Promise<void>;
|
645
|
-
onStoryIndexChanged(): Promise<void>;
|
646
|
-
onStoriesChanged({ importFn, storyIndex, }: {
|
647
|
-
importFn?: ModuleImportFn;
|
648
|
-
storyIndex?: StoryIndex;
|
649
|
-
}): Promise<void>;
|
650
|
-
onUpdateGlobals({ globals }: {
|
651
|
-
globals: Globals;
|
652
|
-
}): Promise<void>;
|
653
|
-
onUpdateArgs({ storyId, updatedArgs }: {
|
654
|
-
storyId: StoryId;
|
655
|
-
updatedArgs: Args;
|
656
|
-
}): Promise<void>;
|
657
|
-
onRequestArgTypesInfo({ id, payload }: RequestData<ArgTypesRequestPayload>): Promise<void>;
|
658
|
-
onResetArgs({ storyId, argNames }: {
|
659
|
-
storyId: string;
|
660
|
-
argNames?: string[];
|
661
|
-
}): Promise<void>;
|
662
|
-
onForceReRender(): Promise<void>;
|
663
|
-
onForceRemount({ storyId }: {
|
664
|
-
storyId: StoryId;
|
665
|
-
}): Promise<void>;
|
666
|
-
renderStoryToElement(story: PreparedStory<TRenderer>, element: TRenderer['canvasElement'], callbacks: RenderContextCallbacks<TRenderer>, options: StoryRenderOptions): () => Promise<void>;
|
667
|
-
teardownRender(render: StoryRender<TRenderer> | CsfDocsRender<TRenderer> | MdxDocsRender<TRenderer>, { viewModeChanged }?: {
|
668
|
-
viewModeChanged?: boolean;
|
669
|
-
}): Promise<void>;
|
670
|
-
loadStory({ storyId }: {
|
671
|
-
storyId: StoryId;
|
672
|
-
}): Promise<PreparedStory<TRenderer>>;
|
673
|
-
getStoryContext(story: PreparedStory<TRenderer>, { forceInitialArgs }?: {
|
674
|
-
forceInitialArgs?: boolean | undefined;
|
675
|
-
}): Omit<_storybook_types.StoryContextForLoaders<Renderer, Args>, "viewMode">;
|
676
|
-
extract(options?: {
|
677
|
-
includeDocsOnly: boolean;
|
678
|
-
}): Promise<Record<string, _storybook_types.StoryContextForEnhancers<TRenderer, Args>>>;
|
679
|
-
renderPreviewEntryError(reason: string, err: Error): void;
|
680
|
-
}
|
681
|
-
|
682
|
-
interface SelectionSpecifier {
|
683
|
-
storySpecifier: StorySpecifier;
|
684
|
-
viewMode: ViewMode;
|
685
|
-
args?: Args;
|
686
|
-
globals?: Args;
|
687
|
-
}
|
688
|
-
interface Selection {
|
689
|
-
storyId: StoryId;
|
690
|
-
viewMode: ViewMode;
|
691
|
-
}
|
692
|
-
interface SelectionStore {
|
693
|
-
selectionSpecifier: SelectionSpecifier | null;
|
694
|
-
selection?: Selection;
|
695
|
-
setSelection(selection: Selection): void;
|
696
|
-
setQueryParams(queryParams: qs.ParsedQs): void;
|
697
|
-
}
|
698
|
-
|
699
|
-
interface View<TStorybookRoot> {
|
700
|
-
prepareForStory(story: PreparedStory<any>): TStorybookRoot;
|
701
|
-
prepareForDocs(): TStorybookRoot;
|
702
|
-
showErrorDisplay(err: {
|
703
|
-
message?: string;
|
704
|
-
stack?: string;
|
705
|
-
}): void;
|
706
|
-
showNoPreview(): void;
|
707
|
-
showPreparingStory(options?: {
|
708
|
-
immediate: boolean;
|
709
|
-
}): void;
|
710
|
-
showPreparingDocs(options?: {
|
711
|
-
immediate: boolean;
|
712
|
-
}): void;
|
713
|
-
showMain(): void;
|
714
|
-
showDocs(): void;
|
715
|
-
showStory(): void;
|
716
|
-
showStoryDuringRender(): void;
|
717
|
-
}
|
718
|
-
|
719
|
-
type PossibleRender<TRenderer extends Renderer> = StoryRender<TRenderer> | CsfDocsRender<TRenderer> | MdxDocsRender<TRenderer>;
|
720
|
-
declare class PreviewWithSelection<TRenderer extends Renderer> extends Preview<TRenderer> {
|
721
|
-
importFn: ModuleImportFn;
|
722
|
-
getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>;
|
723
|
-
selectionStore: SelectionStore;
|
724
|
-
view: View<TRenderer['canvasElement']>;
|
725
|
-
currentSelection?: Selection;
|
726
|
-
currentRender?: PossibleRender<TRenderer>;
|
727
|
-
constructor(importFn: ModuleImportFn, getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>, selectionStore: SelectionStore, view: View<TRenderer['canvasElement']>);
|
728
|
-
setupListeners(): void;
|
729
|
-
setInitialGlobals(): Promise<void>;
|
730
|
-
initializeWithStoryIndex(storyIndex: StoryIndex): Promise<void>;
|
731
|
-
selectSpecifiedStory(): Promise<void>;
|
732
|
-
onGetProjectAnnotationsChanged({ getProjectAnnotations, }: {
|
733
|
-
getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>;
|
734
|
-
}): Promise<void>;
|
735
|
-
onStoriesChanged({ importFn, storyIndex, }: {
|
736
|
-
importFn?: ModuleImportFn;
|
737
|
-
storyIndex?: StoryIndex;
|
738
|
-
}): Promise<void>;
|
739
|
-
onKeydown(event: KeyboardEvent): void;
|
740
|
-
onSetCurrentStory(selection: {
|
741
|
-
storyId: StoryId;
|
742
|
-
viewMode?: ViewMode;
|
743
|
-
}): Promise<void>;
|
744
|
-
onUpdateQueryParams(queryParams: any): void;
|
745
|
-
onUpdateGlobals({ globals }: {
|
746
|
-
globals: Globals;
|
747
|
-
}): Promise<void>;
|
748
|
-
onUpdateArgs({ storyId, updatedArgs }: {
|
749
|
-
storyId: StoryId;
|
750
|
-
updatedArgs: Args;
|
751
|
-
}): Promise<void>;
|
752
|
-
onPreloadStories({ ids }: {
|
753
|
-
ids: string[];
|
754
|
-
}): Promise<void>;
|
755
|
-
protected renderSelection({ persistedArgs }?: {
|
756
|
-
persistedArgs?: Args;
|
757
|
-
}): Promise<void>;
|
758
|
-
teardownRender(render: PossibleRender<TRenderer>, { viewModeChanged }?: {
|
759
|
-
viewModeChanged?: boolean;
|
760
|
-
}): Promise<void>;
|
761
|
-
mainStoryCallbacks(storyId: StoryId): {
|
762
|
-
showMain: () => void;
|
763
|
-
showError: (err: {
|
764
|
-
title: string;
|
765
|
-
description: string;
|
766
|
-
}) => void;
|
767
|
-
showException: (err: Error) => void;
|
768
|
-
};
|
769
|
-
renderPreviewEntryError(reason: string, err: Error): void;
|
770
|
-
renderMissingStory(): void;
|
771
|
-
renderStoryLoadingException(storySpecifier: StorySpecifier, err: Error): void;
|
772
|
-
renderException(storyId: StoryId, error: Error): void;
|
773
|
-
renderError(storyId: StoryId, { title, description }: {
|
774
|
-
title: string;
|
775
|
-
description: string;
|
776
|
-
}): void;
|
777
|
-
}
|
778
|
-
|
779
|
-
declare class PreviewWeb<TRenderer extends Renderer> extends PreviewWithSelection<TRenderer> {
|
780
|
-
importFn: ModuleImportFn;
|
781
|
-
getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>;
|
782
|
-
constructor(importFn: ModuleImportFn, getProjectAnnotations: () => MaybePromise<ProjectAnnotations<TRenderer>>);
|
783
|
-
}
|
784
|
-
|
785
|
-
declare class UrlStore implements SelectionStore {
|
786
|
-
selectionSpecifier: SelectionSpecifier | null;
|
787
|
-
selection?: Selection;
|
788
|
-
constructor();
|
789
|
-
setSelection(selection: Selection): void;
|
790
|
-
setQueryParams(queryParams: qs$1.ParsedQs): void;
|
791
|
-
}
|
792
|
-
|
793
|
-
declare enum Mode {
|
794
|
-
'MAIN' = "MAIN",
|
795
|
-
'NOPREVIEW' = "NOPREVIEW",
|
796
|
-
'PREPARING_STORY' = "PREPARING_STORY",
|
797
|
-
'PREPARING_DOCS' = "PREPARING_DOCS",
|
798
|
-
'ERROR' = "ERROR"
|
799
|
-
}
|
800
|
-
declare const layoutClassMap: {
|
801
|
-
readonly centered: "sb-main-centered";
|
802
|
-
readonly fullscreen: "sb-main-fullscreen";
|
803
|
-
readonly padded: "sb-main-padded";
|
804
|
-
};
|
805
|
-
type Layout = keyof typeof layoutClassMap | 'none';
|
806
|
-
declare class WebView implements View<HTMLElement> {
|
807
|
-
private currentLayoutClass?;
|
808
|
-
private testing;
|
809
|
-
private preparingTimeout?;
|
810
|
-
constructor();
|
811
|
-
prepareForStory(story: PreparedStory<any>): HTMLElement;
|
812
|
-
storyRoot(): HTMLElement;
|
813
|
-
prepareForDocs(): HTMLElement;
|
814
|
-
docsRoot(): HTMLElement;
|
815
|
-
applyLayout(layout?: Layout): void;
|
816
|
-
checkIfLayoutExists(layout: keyof typeof layoutClassMap): void;
|
817
|
-
showMode(mode: Mode): void;
|
818
|
-
showErrorDisplay({ message, stack }: {
|
819
|
-
message?: string | undefined;
|
820
|
-
stack?: string | undefined;
|
821
|
-
}): void;
|
822
|
-
showNoPreview(): void;
|
823
|
-
showPreparingStory({ immediate }?: {
|
824
|
-
immediate?: boolean | undefined;
|
825
|
-
}): void;
|
826
|
-
showPreparingDocs({ immediate }?: {
|
827
|
-
immediate?: boolean | undefined;
|
828
|
-
}): void;
|
829
|
-
showMain(): void;
|
830
|
-
showDocs(): void;
|
831
|
-
showStory(): void;
|
832
|
-
showStoryDuringRender(): void;
|
833
|
-
}
|
834
|
-
|
835
|
-
declare function simulateDOMContentLoaded(): void;
|
836
|
-
declare function simulatePageLoad($container: any): void;
|
837
|
-
|
838
|
-
export { DocsContext, HooksContext, Preview, PreviewWeb, PreviewWithSelection, PropDescriptor, SelectionStore, StoryStore, UrlStore, View, WebView, addons, applyHooks, combineArgs, combineParameters, composeConfigs, composeStepRunners, composeStories, composeStory, createPlaywrightTest, decorateStory, defaultDecorateStory, filterArgTypes, inferControls, makeDecorator, mockChannel, normalizeStory, prepareMeta, prepareStory, sanitizeStoryContextUpdate, setProjectAnnotations, simulateDOMContentLoaded, simulatePageLoad, sortStoriesV7, useArgs, useCallback, useChannel, useEffect, useGlobals, useMemo, useParameter, useReducer, useRef, useState, useStoryContext, userOrAutoTitle, userOrAutoTitleFromSpecifier };
|