@storybook/csf 0.1.9-next.0 → 0.1.10--canary.d841bb4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +18 -30
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -215,7 +215,7 @@ interface GlobalTypes {
|
|
215
215
|
interface StrictGlobalTypes {
|
216
216
|
[name: string]: StrictInputType;
|
217
217
|
}
|
218
|
-
|
218
|
+
interface Renderer {
|
219
219
|
/** What is the type of the `component` annotation in this renderer? */
|
220
220
|
component: unknown;
|
221
221
|
/** What does the story function return in this renderer? */
|
@@ -223,7 +223,7 @@ type Renderer = {
|
|
223
223
|
/** What type of element does this renderer render to? */
|
224
224
|
canvasElement: unknown;
|
225
225
|
T?: unknown;
|
226
|
-
}
|
226
|
+
}
|
227
227
|
/** @deprecated - use `Renderer` */
|
228
228
|
type AnyFramework = Renderer;
|
229
229
|
interface StoryContextForEnhancers<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryIdentifier {
|
@@ -247,26 +247,26 @@ interface StoryContextUpdate<TArgs = Args> {
|
|
247
247
|
[key: string]: any;
|
248
248
|
}
|
249
249
|
type ViewMode = 'story' | 'docs';
|
250
|
-
interface StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContextForEnhancers<TRenderer, TArgs>, Required<StoryContextUpdate<TArgs>> {
|
251
|
-
hooks: unknown;
|
252
|
-
viewMode: ViewMode;
|
253
|
-
originalStoryFn: StoryFn<TRenderer>;
|
254
|
-
}
|
255
250
|
type LoaderFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContextForLoaders<TRenderer, TArgs>) => Promise<Record<string, any> | void> | Record<string, any> | void;
|
256
251
|
type Awaitable<T> = T | PromiseLike<T>;
|
257
252
|
type CleanupCallback = () => Awaitable<unknown>;
|
258
|
-
type BeforeAll = () => Awaitable<CleanupCallback | void>;
|
259
253
|
type BeforeEach<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => Awaitable<CleanupCallback | void>;
|
260
|
-
interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> extends
|
254
|
+
interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContextForEnhancers<TRenderer, TArgs>, Required<StoryContextUpdate<TArgs>> {
|
261
255
|
loaded: Record<string, any>;
|
262
256
|
abortSignal: AbortSignal;
|
263
257
|
canvasElement: TRenderer['canvasElement'];
|
258
|
+
hooks: unknown;
|
259
|
+
originalStoryFn: StoryFn<TRenderer>;
|
260
|
+
viewMode: ViewMode;
|
261
|
+
step: StepFunction<TRenderer, TArgs>;
|
262
|
+
context: this;
|
264
263
|
}
|
264
|
+
/** @deprecated Use {@link StoryContext} instead. */
|
265
|
+
type StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContext<TRenderer, TArgs>;
|
266
|
+
/** @deprecated Use {@link StoryContext} instead. */
|
267
|
+
type PlayFunctionContext<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContext<TRenderer, TArgs>;
|
265
268
|
type StepLabel = string;
|
266
269
|
type StepFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (label: StepLabel, play: PlayFunction<TRenderer, TArgs>) => Promise<void> | void;
|
267
|
-
type PlayFunctionContext<TRenderer extends Renderer = Renderer, TArgs = Args> = StoryContext<TRenderer, TArgs> & {
|
268
|
-
step: StepFunction<TRenderer, TArgs>;
|
269
|
-
};
|
270
270
|
type PlayFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: PlayFunctionContext<TRenderer, TArgs>) => Promise<void> | void;
|
271
271
|
type PartialStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TRenderer['storyResult'];
|
272
272
|
type LegacyStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
@@ -276,8 +276,8 @@ type ArgsStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (args: T
|
|
276
276
|
type StoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = LegacyStoryFn<TRenderer, TArgs> | ArgsStoryFn<TRenderer, TArgs>;
|
277
277
|
type DecoratorFunction<TRenderer extends Renderer = Renderer, TArgs = Args> = (fn: PartialStoryFn<TRenderer, TArgs>, c: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
|
278
278
|
type DecoratorApplicator<TRenderer extends Renderer = Renderer, TArgs = Args> = (storyFn: LegacyStoryFn<TRenderer, TArgs>, decorators: DecoratorFunction<TRenderer, TArgs>[]) => LegacyStoryFn<TRenderer, TArgs>;
|
279
|
-
type StepRunner<TRenderer extends Renderer = Renderer, TArgs = Args> = (label: StepLabel, play: PlayFunction<TRenderer, TArgs>, context:
|
280
|
-
|
279
|
+
type StepRunner<TRenderer extends Renderer = Renderer, TArgs = Args> = (label: StepLabel, play: PlayFunction<TRenderer, TArgs>, context: StoryContext<TRenderer, TArgs>) => Promise<void>;
|
280
|
+
interface BaseAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> {
|
281
281
|
/**
|
282
282
|
* Wrapper components or Storybook decorators that wrap a story.
|
283
283
|
*
|
@@ -322,22 +322,10 @@ type BaseAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> = {
|
|
322
322
|
* Named tags for a story, used to filter stories in different contexts.
|
323
323
|
*/
|
324
324
|
tags?: Tag[];
|
325
|
-
}
|
326
|
-
|
325
|
+
}
|
326
|
+
interface ProjectAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> extends BaseAnnotations<TRenderer, TArgs> {
|
327
327
|
argsEnhancers?: ArgsEnhancer<TRenderer, Args>[];
|
328
328
|
argTypesEnhancers?: ArgTypesEnhancer<TRenderer, Args>[];
|
329
|
-
/**
|
330
|
-
* Lifecycle hook which runs once, before any loaders, decorators or stories, and may rerun when configuration changes or when reinitializing (e.g. between test runs).
|
331
|
-
* The function may be synchronous or asynchronous, and may return a cleanup function which may also be synchronous or asynchronous.
|
332
|
-
* The cleanup function is not guaranteed to run (e.g. when the browser closes), but runs when configuration changes or when reinitializing.
|
333
|
-
* This hook may only be defined globally (i.e. not on component or story level).
|
334
|
-
* When multiple hooks are specified, they are to be executed sequentially (and awaited) in the following order:
|
335
|
-
* - Addon hooks (in order of addons array in e.g. .storybook/main.js)
|
336
|
-
* - Annotation hooks (in order of previewAnnotations array in e.g. .storybook/main.js)
|
337
|
-
* - Preview hook (via e.g. .storybook/preview.js)
|
338
|
-
* Cleanup functions are executed sequentially in reverse order of initialization.
|
339
|
-
*/
|
340
|
-
beforeAll?: BeforeAll;
|
341
329
|
/**
|
342
330
|
* @deprecated Project `globals` renamed to `initiaGlobals`
|
343
331
|
*/
|
@@ -346,7 +334,7 @@ type ProjectAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> = B
|
|
346
334
|
globalTypes?: GlobalTypes;
|
347
335
|
applyDecorators?: DecoratorApplicator<TRenderer, Args>;
|
348
336
|
runStep?: StepRunner<TRenderer, TArgs>;
|
349
|
-
}
|
337
|
+
}
|
350
338
|
type StoryDescriptor$1 = string[] | RegExp;
|
351
339
|
interface ComponentAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args> extends BaseAnnotations<TRenderer, TArgs> {
|
352
340
|
/**
|
@@ -505,4 +493,4 @@ declare const parseKind: (kind: string, { rootSeparator, groupSeparator }: Separ
|
|
505
493
|
*/
|
506
494
|
declare const combineTags: (...tags: string[]) => string[];
|
507
495
|
|
508
|
-
export { AnnotatedStoryFn, AnyFramework, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations,
|
496
|
+
export { AnnotatedStoryFn, AnyFramework, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BeforeEach, CleanupCallback, ComponentAnnotations, ComponentId, ComponentTitle, Conditional, DecoratorApplicator, DecoratorFunction, GlobalTypes, Globals, IncludeExcludeOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoaderFunction, Parameters, PartialStoryFn, PlayFunction, PlayFunctionContext, ProjectAnnotations, Renderer, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, StepFunction, StepLabel, StepRunner, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryKind, StoryName, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, StrictParameters, Tag, ViewMode, combineTags, includeConditionalArg, isExportStory, parseKind, sanitize, storyNameFromExport, toId };
|