UNPKG

2.86 kBTypeScriptView Raw
1import { Args, ComponentAnnotations, AnnotatedStoryFn, StoryAnnotations, StrictArgs, DecoratorFunction, LoaderFunction, StoryContext as StoryContext$1, ProjectAnnotations, NamedOrDefaultProjectAnnotations, NormalizedProjectAnnotations } from 'storybook/internal/types';
2export { ArgTypes, Args, Parameters, StrictArgs } from 'storybook/internal/types';
3import { W as WebComponentsRenderer } from './types-9976a2c9.js';
4import 'lit';
5
6/**
7 * Metadata to configure the stories for a component.
8 *
9 * @see [Default export](https://storybook.js.org/docs/api/csf#default-export)
10 */
11type Meta<TArgs = Args> = ComponentAnnotations<WebComponentsRenderer, TArgs>;
12/**
13 * Story function that represents a CSFv2 component example.
14 *
15 * @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
16 */
17type StoryFn<TArgs = Args> = AnnotatedStoryFn<WebComponentsRenderer, TArgs>;
18/**
19 * Story object that represents a CSFv3 component example.
20 *
21 * @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
22 */
23type StoryObj<TArgs = Args> = StoryAnnotations<WebComponentsRenderer, TArgs>;
24type Decorator<TArgs = StrictArgs> = DecoratorFunction<WebComponentsRenderer, TArgs>;
25type Loader<TArgs = StrictArgs> = LoaderFunction<WebComponentsRenderer, TArgs>;
26type StoryContext<TArgs = StrictArgs> = StoryContext$1<WebComponentsRenderer, TArgs>;
27type Preview = ProjectAnnotations<WebComponentsRenderer>;
28
29declare function isValidComponent(tagName: string): boolean;
30declare function isValidMetaData(customElements: any): boolean;
31/** @param customElements `any` for now as spec is not super stable yet */
32declare function setCustomElements(customElements: any): void;
33declare function setCustomElementsManifest(customElements: any): void;
34declare function getCustomElements(): any;
35
36/**
37 * Function that sets the globalConfig of your storybook. The global config is the preview module of
38 * your .storybook folder.
39 *
40 * It should be run a single time, so that your global config (e.g. decorators) is applied to your
41 * stories when using `composeStories` or `composeStory`.
42 *
43 * Example:
44 *
45 * ```jsx
46 * // setup-file.js
47 * import { setProjectAnnotations } from '@storybook/web-components';
48 * import projectAnnotations from './.storybook/preview';
49 *
50 * setProjectAnnotations(projectAnnotations);
51 * ```
52 *
53 * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')
54 */
55declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations<any> | NamedOrDefaultProjectAnnotations<any>[]): NormalizedProjectAnnotations<WebComponentsRenderer>;
56
57export { Decorator, Loader, Meta, Preview, StoryContext, StoryFn, StoryObj, WebComponentsRenderer, getCustomElements, isValidComponent, isValidMetaData, setCustomElements, setCustomElementsManifest, setProjectAnnotations };