import type { Args, ComposedStoryFn, Store_CSFExports, StoryAnnotationsOrFn } from "storybook/internal/types"; import type { Meta, Preview, Story } from "./public-types"; import type { MarkoRenderer } from "./types"; type StoryInputForExport = Exports extends Story ? Input : never; export type ComposedStories = { [Key in Exclude]: ComposedStory; }; export type ComposedStory = ComposedStoryFn> & Marko.Template>; /** Function that sets the globalConfig of your storybook. The global config is the preview module of your .storybook folder. * * It should be run a single time, so that your global config (e.g. decorators) is applied to your stories when using `composeStories` or `composeStory`. * * Example: *```jsx * // setup.js (for jest) * import { setProjectAnnotations } from '@storybook/marko'; * import projectAnnotations from './.storybook/preview'; * * setProjectAnnotations(projectAnnotations); *``` * * @param projectAnnotations - e.g. (import projectAnnotations from '../.storybook/preview') */ export declare function setProjectAnnotations(projectAnnotations: Preview | Preview[]): void; /** * Function that will receive a story along with meta (e.g. a default export from a .stories file) * and optionally projectAnnotations e.g. (import * from '../.storybook/preview) * and will return a composed component that has all args/parameters/decorators/etc combined and applied to it. * * * It's very useful for reusing a story in scenarios outside of Storybook like unit testing. * * Example: *```jsx * import { composeStory } from '@storybook/marko'; * import { render, screen } from '@testing-library/marko'; * import Meta, { Primary as PrimaryStory } from './Button.stories'; * * const Primary = composeStory(PrimaryStory, Meta); * * test('renders primary button with Hello World', () => { * await render(Primary, { text: 'Hello world' }); * expect(screen.getByText(/Hello world/i)).not.toBeNull(); * }); *``` * * @param story * @param componentAnnotations - e.g. (import Meta from './Button.stories') * @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files. * @param [exportsName] - in case your story does not contain a name and you want it to have a name. */ export declare function composeStory = StoryAnnotationsOrFn>(story: Export, componentAnnotations: Meta, projectAnnotations?: Preview, exportsName?: string): ComposedStory; /** * Function that will receive a stories import (e.g. `import * as stories from './Button.stories'`) * and optionally projectAnnotations (e.g. `import * from '../.storybook/preview`) * and will return an object containing all the stories passed, but now as a composed component that has all args/parameters/decorators/etc combined and applied to it. * * * It's very useful for reusing stories in scenarios outside of Storybook like unit testing. * * Example: *```jsx * import { composeStories } from '@storybook/marko'; * import { render, screen } from '@testing-library/marko'; * import * as stories from './Button.stories'; * * const { Primary, Secondary } = composeStories(stories); * * test('renders primary button with Hello World', async () => { * await render(Primary, { text: 'Hello world' }); * expect(screen.getByText(/Hello world/i)).not.toBeNull(); * }); *``` * * @param csfExports - e.g. (import * as stories from './Button.stories') * @param [projectAnnotations] - e.g. (import * as projectAnnotations from '../.storybook/preview') this can be applied automatically if you use `setProjectAnnotations` in your setup files. */ export declare function composeStories(csfExports: Exports, projectAnnotations?: Preview): ComposedStories; export {};