import { Channel as Channel$1 } from 'storybook/internal/channels'; import * as storybook_internal_types from 'storybook/internal/types'; import { Args as Args$1, Renderer, StoryContext, DecoratorApplicator, StoryId, Addon_StoryWrapper, PreparedStory, Globals, GlobalTypes, StoryIndex, StoryName, ComponentTitle, IndexEntry, Path as Path$1, StoryAnnotationsOrFn, NormalizedComponentAnnotations, NormalizedStoryAnnotations, ModuleExports, CSFFile, NormalizedProjectAnnotations, ModuleExport, PreparedMeta, ProjectAnnotations, StepRunner, ComposedStoryFn, Store_CSFExports, ComposeStoryFn, LegacyStoryAnnotationsOrFn, ComponentAnnotations, NamedOrDefaultProjectAnnotations, ModuleImportFn, StoryContextForEnhancers, Parameters, StrictArgTypes as StrictArgTypes$1, LegacyStoryFn, DecoratorFunction, PartialStoryFn, StoryContextUpdate, NormalizedStoriesSpecifier, Addon_StorySortParameterV7, DocsContextProps, ResolvedModuleExportType, ResolvedModuleExportFromType, StoryRenderOptions, RenderContextCallbacks, RenderToCanvas, ViewMode } from 'storybook/internal/types'; import * as storybook_internal_csf from 'storybook/internal/csf'; import { Story, Meta, CleanupCallback, StoryContext as StoryContext$1, Args as Args$2, StrictArgTypes as StrictArgTypes$2 } from 'storybook/internal/csf'; import { RequestData, ArgTypesRequestPayload } from 'storybook/internal/core-events'; declare class AddonStore { constructor(); private channel; private promise; private resolve; getChannel: () => Channel$1; ready: () => Promise; hasChannel: () => boolean; setChannel: (channel: Channel$1) => void; } declare const addons: AddonStore; interface Hook { name: string; memoizedState?: any; deps?: any[] | undefined; } interface Effect { create: () => (() => void) | void; destroy?: (() => void) | void; } type AbstractFunction = (...args: any[]) => any; declare class HooksContext { hookListsMap: WeakMap; mountedDecorators: Set; prevMountedDecorators: Set; currentHooks: Hook[]; nextHookIndex: number; currentPhase: 'MOUNT' | 'UPDATE' | 'NONE'; currentEffects: Effect[]; prevEffects: Effect[]; currentDecoratorName: string | null; hasUpdates: boolean; currentContext: StoryContext | null; renderListener: (storyId: StoryId) => void; constructor(); init(): void; clean(): void; getNextHook(): Hook; triggerEffects(): void; addRenderListeners(): void; removeRenderListeners(): void; } declare const applyHooks: (applyDecorators: DecoratorApplicator) => DecoratorApplicator; /** * Returns a memoized value. * * @example * * ```ts * const memoizedValue = useMemo(() => { * return doExpensiveCalculation(a, b); * }, [a, b]); * ``` * * @template T The type of the memoized value. * @param {() => T} nextCreate A function that returns the memoized value. * @param {any[]} [deps] An optional array of dependencies. If any of the dependencies change, the * memoized value will be recomputed. * @returns {T} The memoized value. */ declare function useMemo(nextCreate: () => T, deps?: any[]): T; /** * Returns a memoized callback. * * @example * * ```ts * const memoizedCallback = useCallback(() => { * doSomething(a, b); * }, [a, b]); * ``` * * @template T The type of the callback function. * @param {T} callback The callback function to memoize. * @param {any[]} [deps] An optional array of dependencies. If any of the dependencies change, the * memoized callback will be recomputed. * @returns {T} The memoized callback. */ declare function useCallback(callback: T, deps?: any[]): T; /** * Returns a mutable ref object. * * @example * * ```ts * const ref = useRef(0); * ref.current = 1; * ``` * * @template T The type of the ref object. * @param {T} initialValue The initial value of the ref object. * @returns {{ current: T }} The mutable ref object. */ declare function useRef(initialValue: T): { current: T; }; /** * Returns a stateful value and a function to update it. * * @example * * ```ts * const [count, setCount] = useState(0); * setCount(count + 1); * ``` * * @template S The type of the state. * @param {(() => S) | S} initialState The initial state value or a function that returns the * initial state value. * @returns {[S, (update: ((prevState: S) => S) | S) => void]} An array containing the current state * value and a function to update it. */ declare function useState(initialState: (() => S) | S): [S, (update: ((prevState: S) => S) | S) => void]; /** * Given a file name, creates an object with utilities to manage a log file. It creates a temporary * log file which you can manage with the returned functions. You can then decide whether to move * the log file to the users project, or remove it. * * @example * * ```tsx * const initialState = { count: 0 }; * * function reducer(state, action) { * switch (action.type) { * case 'increment': * return { count: state.count + 1 }; * case 'decrement': * return { count: state.count - 1 }; * default: * throw new Error(); * } * } * } * function Counter() { * const [state, dispatch] = useReducer(reducer, initialState); * return ( * <> * Count: {state.count} * * * * ); * } * ``` */ declare function useReducer(reducer: (state: S, action: A) => S, initialState: S): [S, (action: A) => void]; declare function useReducer(reducer: (state: S, action: A) => S, initialArg: I, init: (initialArg: I) => S): [S, (action: A) => void]; /** * Triggers a side effect, see https://reactjs.org/docs/hooks-reference.html#usestate Effects are * triggered synchronously after rendering the story * * @example * * ```ts * useEffect(() => { * // Do something after rendering the story * return () => { * // Do something when the component unmounts or the effect is re-run * }; * }, [dependency1, dependency2]); * ``` * * @param {() => (() => void) | void} create A function that creates the effect. It should return a * cleanup function, or nothing. * @param {any[]} [deps] An optional array of dependencies. If any of the dependencies change, the * effect will be re-run. * @returns {void} */ declare function useEffect(create: () => (() => void) | void, deps?: any[]): void; interface Listener$1 { (...args: any[]): void; } interface EventMap { [eventId: string]: Listener$1; } /** * Subscribes to events emitted by the Storybook channel and returns a function to emit events. * * @example * * ```ts * // Subscribe to an event and emit it * const emit = useChannel({ 'my-event': (arg1, arg2) => console.log(arg1, arg2) }); * emit('my-event', 'Hello', 'world!'); * ``` * * @param {EventMap} eventMap A map of event listeners to subscribe to. * @param {any[]} [deps=[]] An optional array of dependencies. If any of the dependencies change, * the event listeners will be re-subscribed. Default is `[]` * @returns {(...args: any[]) => void} A function to emit events to the Storybook channel. */ declare function useChannel(eventMap: EventMap, deps?: any[]): (eventName: string, ...args: any) => void; /** * Returns the current story context, including the story's ID, parameters, and other metadata. * * @example * * ```ts * const { id, parameters } = useStoryContext(); * console.log(`Current story ID: ${id}`); * console.log(`Current story parameters: ${JSON.stringify(parameters)}`); * ``` * * @template TRenderer The type of the story's renderer. * @template TArgs The type of the story's args. * @returns {StoryContext} The current story context. */ declare function useStoryContext(): StoryContext; /** * Returns the value of a specific parameter for the current story, or a default value if the * parameter is not set. * * @example * * ```ts * // Retrieve the value of a parameter named "myParam" * const myParamValue = useParameter('myParam', 'default value'); * console.log(`The value of myParam is: ${myParamValue}`); * ``` * * @template S The type of the parameter value. * @param {string} parameterKey The key of the parameter to retrieve. * @param {S} [defaultValue] An optional default value to return if the parameter is not set. * @returns {S | undefined} The value of the parameter, or the default value if the parameter is not * set. */ declare function useParameter(parameterKey: string, defaultValue?: S): S | undefined; /** * Returns the current args for the story, and functions to update and reset them. * * @example * * ```ts * const [args, updateArgs, resetArgs] = useArgs<{ name: string; age: number }>(); * console.log(`Current args: ${JSON.stringify(args)}`); * updateArgs({ name: 'John' }); * resetArgs(['name']); * ``` * * @template TArgs The type of the story's args. * @returns {[TArgs, (newArgs: Partial) => void, (argNames?: (keyof TArgs)[]) => void]} An * array containing the current args, a function to update them, and a function to reset them. */ declare function useArgs(): [ TArgs, (newArgs: Partial) => void, (argNames?: (keyof TArgs)[]) => void ]; /** * Returns the current global args for the story, and a function to update them. * * @example * * ```ts * const [globals, updateGlobals] = useGlobals(); * console.log(`Current globals: ${JSON.stringify(globals)}`); * updateGlobals({ theme: 'dark' }); * ``` * * @returns {[Args, (newGlobals: Args) => void]} An array containing the current global args, and a * function to update them. */ declare function useGlobals(): [Args$1, (newGlobals: Args$1) => void]; type MakeDecoratorResult = (...args: any) => any; interface MakeDecoratorOptions { name: string; parameterName: string; skipIfNoParametersOrOptions?: boolean; wrapper: Addon_StoryWrapper; } /** * Creates a Storybook decorator function that can be used to wrap stories with additional * functionality. * * @example * * ```jsx * const myDecorator = makeDecorator({ * name: 'My Decorator', * parameterName: 'myDecorator', * wrapper: (storyFn, context, { options }) => { * const { myOption } = options; *
{storyFn()}
; * }, * }); * * export const decorators = [myDecorator]; * ``` * * @param {MakeDecoratorOptions} options - The options for the decorator. * @param {string} options.name - The name of the decorator. * @param {string} options.parameterName - The name of the parameter that will be used to pass * options to the decorator. * @param {Addon_StoryWrapper} options.wrapper - The function that will be used to wrap the story. * @param {boolean} [options.skipIfNoParametersOrOptions=false] - Whether to skip the decorator if * no options or parameters are provided. Default is `false` * @returns {MakeDecoratorResult} A function that can be used as a Storybook decorator. */ declare const makeDecorator: ({ name, parameterName, wrapper, skipIfNoParametersOrOptions, }: MakeDecoratorOptions) => MakeDecoratorResult; type ChannelHandler = (event: ChannelEvent) => void; interface ChannelTransport { send(event: ChannelEvent, options?: any): void; setHandler(handler: ChannelHandler): void; } interface ChannelEvent { type: string; from: string; args: any[]; } interface Listener { (...args: any[]): void; } /** * Structural interface for Channel, used in type declarations to avoid nominal incompatibility * between source and dist Channel class declarations. */ interface ChannelLike { readonly isAsync: boolean; readonly hasTransport: boolean; addListener(eventName: string, listener: Listener): void; emit(eventName: string, ...args: any): void; last(eventName: string): any; eventNames(): string[]; listenerCount(eventName: string): number; listeners(eventName: string): Listener[] | undefined; once(eventName: string, listener: Listener): void; removeAllListeners(eventName?: string): void; removeListener(eventName: string, listener: Listener): void; on(eventName: string, listener: Listener): void; off(eventName: string, listener: Listener): void; } interface ChannelArgsSingle { transport?: ChannelTransport; async?: boolean; } interface ChannelArgsMulti { transports: ChannelTransport[]; async?: boolean; } declare class Channel implements ChannelLike { readonly isAsync: boolean; private sender; private events; private data; private readonly transports; constructor(input: ChannelArgsMulti); constructor(input: ChannelArgsSingle); get hasTransport(): boolean; addListener(eventName: string, listener: Listener): void; emit(eventName: string, ...args: any): void; last(eventName: string): any; eventNames(): string[]; listenerCount(eventName: string): number; listeners(eventName: string): Listener[] | undefined; once(eventName: string, listener: Listener): void; removeAllListeners(eventName?: string): void; removeListener(eventName: string, listener: Listener): void; on(eventName: string, listener: Listener): void; off(eventName: string, listener: Listener): void; private handleEvent; private onceListener; } /** In-process channel with no transport — the default for unit tests and manager story mocks. */ declare function mockChannel(): Channel; declare class ArgsStore { initialArgsByStoryId: Record; argsByStoryId: Record; get(storyId: StoryId): Args$1; setInitial(story: PreparedStory): void; updateFromDelta(story: PreparedStory, delta: Args$1): void; updateFromPersisted(story: PreparedStory, persisted: Args$1): void; update(storyId: StoryId, argsUpdate: Partial): void; } declare class GlobalsStore { allowedGlobalNames: Set; initialGlobals: Globals; globals: Globals; constructor({ globals, globalTypes, }: { globals?: Globals; globalTypes?: GlobalTypes; }); set({ globals, globalTypes }: { globals?: Globals; globalTypes?: GlobalTypes; }): void; filterAllowedGlobals(globals: Globals): Globals; updateFromPersisted(persisted: Globals): void; get(): Globals; update(newGlobals: Globals): void; } type StorySpecifier = StoryId | { name: StoryName; title: ComponentTitle; } | '*'; declare class StoryIndexStore { entries: StoryIndex['entries']; constructor({ entries }?: StoryIndex); entryFromSpecifier(specifier: StorySpecifier): IndexEntry | undefined; storyIdToEntry(storyId: StoryId): IndexEntry; importPathToEntry(importPath: Path$1): IndexEntry; } declare function normalizeStory(key: StoryId, storyAnnotations: StoryAnnotationsOrFn, meta: NormalizedComponentAnnotations): NormalizedStoryAnnotations; declare function processCSFFile(moduleExports: ModuleExports, importPath: Path$1, title: ComponentTitle): CSFFile; declare function prepareStory(storyAnnotations: NormalizedStoryAnnotations, componentAnnotations: NormalizedComponentAnnotations, projectAnnotations: NormalizedProjectAnnotations): PreparedStory; declare function prepareMeta(componentAnnotations: NormalizedComponentAnnotations, projectAnnotations: NormalizedProjectAnnotations, moduleExport: ModuleExport): PreparedMeta; declare function normalizeProjectAnnotations({ argTypes, argTypesEnhancers, decorators, loaders, beforeEach, afterEach, initialGlobals, ...annotations }: ProjectAnnotations): NormalizedProjectAnnotations; declare const normalizeArrays: (array: T[] | T | undefined) => T[]; declare function composeConfigs(moduleExportList: ModuleExports[]): NormalizedProjectAnnotations; /** * Compose step runners to create a single step runner that applies each step runner in order. * * A step runner is a function that takes a defined step: * * @example * * ```ts * step('label', () => {}); * ``` * * ...and runs it. The prototypical example is from `core/interactions` where the step runner will * decorate all instrumented code inside the step with information about the label. * * In theory it is possible to have more than one addon that wants to run steps; they can be * composed together in a similar fashion to decorators. In some ways step runners are like * decorators except it is not intended that they change the context or the play function. * * The basic implementation of a step runner is `async (label, play, context) => play(context)` -- * in fact this is what `composeStepRunners([])` will do. * * @param stepRunners An array of StepRunner * @returns A StepRunner that is the composition of the arguments */ declare function composeStepRunners(stepRunners: StepRunner[]): StepRunner; declare global { var globalProjectAnnotations: NormalizedProjectAnnotations; var defaultProjectAnnotations: ProjectAnnotations; } declare function setDefaultProjectAnnotations(_defaultProjectAnnotations: ProjectAnnotations): void; declare function setProjectAnnotations(projectAnnotations: NamedOrDefaultProjectAnnotations | NamedOrDefaultProjectAnnotations[]): NormalizedProjectAnnotations; declare function composeStory(storyAnnotations: LegacyStoryAnnotationsOrFn, componentAnnotations: ComponentAnnotations, projectAnnotations?: ProjectAnnotations, defaultConfig?: ProjectAnnotations, exportsName?: string): ComposedStoryFn>; declare function composeStories(storiesImport: TModule, globalConfig: ProjectAnnotations, composeStoryFn?: ComposeStoryFn): {}; type WrappedStoryRef = { __pw_type: 'jsx'; props: Record; } | { __pw_type: 'importRef'; }; type UnwrappedJSXStoryRef = { __pw_type: 'jsx'; type: UnwrappedImportStoryRef; }; type UnwrappedImportStoryRef = ComposedStoryFn; declare global { function __pwUnwrapObject(storyRef: WrappedStoryRef): Promise; } declare function createPlaywrightTest(baseTest: TFixture): TFixture; declare function getCsfFactoryAnnotations(story: LegacyStoryAnnotationsOrFn | Story, meta?: ComponentAnnotations | Meta, projectAnnotations?: ProjectAnnotations): { story: storybook_internal_csf.StoryAnnotations; meta: ComponentAnnotations; preview: storybook_internal_types.NormalizedProjectAnnotations; } | { story: LegacyStoryAnnotationsOrFn; meta: ComponentAnnotations | ComponentAnnotations | undefined; preview: ProjectAnnotations | undefined; }; interface Report { type: string; version?: number; result: T; status: 'failed' | 'passed' | 'warning'; } declare class ReporterAPI { reports: Report[]; addReport(report: Report): Promise; } declare class StoryStore { importFn: ModuleImportFn; storyIndex: StoryIndexStore; projectAnnotations: NormalizedProjectAnnotations; userGlobals: GlobalsStore; args: ArgsStore; hooks: Record>; cleanupCallbacks: Record; cachedCSFFiles?: Record>; processCSFFileWithCache: typeof processCSFFile; prepareMetaWithCache: typeof prepareMeta; prepareStoryWithCache: typeof prepareStory; constructor(storyIndex: StoryIndex, importFn: ModuleImportFn, projectAnnotations: ProjectAnnotations); setProjectAnnotations(projectAnnotations: ProjectAnnotations): void; onStoriesChanged({ importFn, storyIndex, }: { importFn?: ModuleImportFn; storyIndex?: StoryIndex; }): Promise; storyIdToEntry(storyId: StoryId): Promise; loadCSFFileByStoryId(storyId: StoryId): Promise>; loadAllCSFFiles(): Promise['cachedCSFFiles']>; cacheAllCSFFiles(): Promise; preparedMetaFromCSFFile({ csfFile }: { csfFile: CSFFile; }): PreparedMeta; loadStory({ storyId }: { storyId: StoryId; }): Promise>; storyFromCSFFile({ storyId, csfFile, }: { storyId: StoryId; csfFile: CSFFile; }): PreparedStory; componentStoriesFromCSFFile({ csfFile, }: { csfFile: CSFFile; }): PreparedStory[]; loadEntry(id: StoryId): Promise<{ entryExports: ModuleExports; csfFiles: CSFFile[]; }>; getStoryContext(story: PreparedStory, { forceInitialArgs }?: { forceInitialArgs?: boolean | undefined; }): { args: storybook_internal_csf.Args; initialGlobals: storybook_internal_csf.Globals; globalTypes: storybook_internal_csf.GlobalTypes | undefined; userGlobals: storybook_internal_csf.Globals; reporting: ReporterAPI; globals: { [x: string]: any; }; hooks: unknown; component?: (TRenderer & { T: any; })["component"] | undefined; subcomponents?: Record | undefined; parameters: storybook_internal_csf.Parameters; initialArgs: storybook_internal_csf.Args; argTypes: storybook_internal_csf.StrictArgTypes; componentId: storybook_internal_csf.ComponentId; title: storybook_internal_csf.ComponentTitle; kind: storybook_internal_csf.ComponentTitle; id: StoryId; name: storybook_internal_csf.StoryName; story: storybook_internal_csf.StoryName; tags: storybook_internal_csf.Tag[]; moduleExport: storybook_internal_types.ModuleExport; originalStoryFn: storybook_internal_csf.ArgsStoryFn; undecoratedStoryFn: storybook_internal_csf.LegacyStoryFn; unboundStoryFn: storybook_internal_csf.LegacyStoryFn; applyLoaders: (context: storybook_internal_csf.StoryContext) => Promise>; applyBeforeEach: (context: storybook_internal_csf.StoryContext) => Promise; applyAfterEach: (context: storybook_internal_csf.StoryContext) => Promise; playFunction?: ((context: storybook_internal_csf.StoryContext) => Promise | void) | undefined; runStep: storybook_internal_csf.StepRunner; mount: (context: storybook_internal_csf.StoryContext) => () => Promise; testingLibraryRender?: (...args: never[]) => unknown; renderToCanvas?: storybook_internal_types.RenderToCanvas | undefined; usesMount: boolean; storyGlobals: storybook_internal_csf.Globals; } & Pick, "allArgs" | "argsByTarget" | "unmappedArgs">; addCleanupCallbacks(story: PreparedStory, ...callbacks: CleanupCallback[]): void; cleanupStory(story: PreparedStory): Promise; extract(options?: { includeDocsOnly?: boolean; }): Record>; } /** * Safely combine parameters recursively. Only copy objects when needed. Algorithm = always * overwrite the existing value UNLESS both values are plain objects. In this case flag the key as * "special" and handle it with a heuristic. */ declare const combineParameters: (...parameterSets: (Parameters | undefined)[]) => Parameters; type PropDescriptor = string[] | RegExp; declare const filterArgTypes: (argTypes: StrictArgTypes$1, include?: PropDescriptor, exclude?: PropDescriptor) => Partial>; /** The fields {@link inferControls} reads; the full enhancer context is structurally assignable. */ type InferControlsContext = Pick, 'argTypes' | 'parameters'>; declare const inferControls: ((context: InferControlsContext) => StrictArgTypes$1) & { secondPass?: boolean; }; declare function decorateStory(storyFn: LegacyStoryFn, decorator: DecoratorFunction, bindWithContext: (storyFn: LegacyStoryFn) => PartialStoryFn): LegacyStoryFn; /** * Currently StoryContextUpdates are allowed to have any key in the type. However, you cannot * overwrite any of the build-it "static" keys. * * @param inputContextUpdate StoryContextUpdate * @returns StoryContextUpdate */ declare function sanitizeStoryContextUpdate({ componentId, title, kind, id, name, story, parameters, initialArgs, argTypes, ...update }?: StoryContextUpdate): StoryContextUpdate; declare function defaultDecorateStory(storyFn: LegacyStoryFn, decorators: DecoratorFunction[]): LegacyStoryFn; declare const combineArgs: (value: any, update: any) => Args$1; declare const userOrAutoTitleFromSpecifier: (fileName: string | number, entry: NormalizedStoriesSpecifier, userTitle?: string) => string | undefined; declare const userOrAutoTitle: (fileName: string, storiesEntries: NormalizedStoriesSpecifier[], userTitle?: string) => string | undefined; declare const sortStoriesV7: (stories: IndexEntry[], storySortParameter: Addon_StorySortParameterV7, fileNameOrder: Path$1[]) => IndexEntry[]; declare class DocsContext implements DocsContextProps { channel: Channel$1; protected store: StoryStore; renderStoryToElement: DocsContextProps['renderStoryToElement']; private componentStoriesValue; private storyIdToCSFFile; private exportToStory; private exportsToCSFFile; private nameToStoryId; private attachedCSFFiles; private primaryStory?; filterByAutodocs?: boolean; constructor(channel: Channel$1, store: StoryStore, renderStoryToElement: DocsContextProps['renderStoryToElement'], /** The CSF files known (via the index) to be refererenced by this docs file */ csfFiles: CSFFile[]); referenceCSFFile(csfFile: CSFFile): void; attachCSFFile(csfFile: CSFFile): void; referenceMeta(metaExports: ModuleExports, attach: boolean): void; get projectAnnotations(): storybook_internal_types.NormalizedProjectAnnotations; private resolveAttachedModuleExportType; private resolveModuleExport; resolveOf(moduleExportOrType: ModuleExport | TType, validTypes?: TType[]): ResolvedModuleExportFromType; storyIdByName: (storyName: StoryName) => string; componentStories: () => PreparedStory[]; getComponentId: (component: Renderer["component"]) => string | undefined; componentStoriesFromCSFFile: (csfFile: CSFFile) => PreparedStory[]; storyById: (storyId?: StoryId) => PreparedStory; getStoryContext: (story: PreparedStory) => { loaded: {}; viewMode: string; args: storybook_internal_csf.Args; initialGlobals: storybook_internal_csf.Globals; globalTypes: storybook_internal_csf.GlobalTypes | undefined; userGlobals: storybook_internal_csf.Globals; reporting: ReporterAPI; globals: { [x: string]: any; }; hooks: unknown; component?: (TRenderer & { T: any; })["component"] | undefined; subcomponents?: Record | undefined; parameters: storybook_internal_csf.Parameters; initialArgs: storybook_internal_csf.Args; argTypes: storybook_internal_csf.StrictArgTypes; componentId: storybook_internal_csf.ComponentId; title: storybook_internal_csf.ComponentTitle; kind: storybook_internal_csf.ComponentTitle; id: StoryId; name: StoryName; story: StoryName; tags: storybook_internal_csf.Tag[]; moduleExport: ModuleExport; originalStoryFn: storybook_internal_csf.ArgsStoryFn; undecoratedStoryFn: storybook_internal_csf.LegacyStoryFn; unboundStoryFn: storybook_internal_csf.LegacyStoryFn; applyLoaders: (context: storybook_internal_csf.StoryContext) => Promise>; applyBeforeEach: (context: storybook_internal_csf.StoryContext) => Promise; applyAfterEach: (context: storybook_internal_csf.StoryContext) => Promise; playFunction?: ((context: storybook_internal_csf.StoryContext) => Promise | void) | undefined; runStep: storybook_internal_csf.StepRunner; mount: (context: storybook_internal_csf.StoryContext) => () => Promise; testingLibraryRender?: (...args: never[]) => unknown; renderToCanvas?: storybook_internal_types.RenderToCanvas | undefined; usesMount: boolean; storyGlobals: storybook_internal_csf.Globals; allArgs: any; argsByTarget: any; unmappedArgs: any; }; loadStory: (id: StoryId) => Promise>; } type RenderType = 'story' | 'docs'; /** * A "Render" represents the rendering of a single entry to a single location * * The implementations of render are used for two key purposes: * * - Tracking the state of the rendering as it moves between preparing, rendering and tearing down. * - Tracking what is rendered to know if a change requires re-rendering or teardown + recreation. */ interface Render { renderId: number; type: RenderType; id: StoryId; isPreparing: () => boolean; isEqual: (other: Render) => boolean; disableKeyListeners: boolean; teardown?: (options: { viewModeChanged: boolean; }) => Promise; torndown: boolean; renderToElement: (canvasElement: TRenderer['canvasElement'], renderStoryToElement?: any, options?: StoryRenderOptions) => Promise; } /** * A CsfDocsRender is a render of a docs entry that is rendered based on a CSF file. * * The expectation is the primary CSF file which is the `importPath` for the entry will define a * story which may contain the actual rendered JSX code for the template in the `docs.page` * parameter. * * Use cases: * * - Autodocs, where there is no story, and we fall back to the globally defined template. */ declare class CsfDocsRender implements Render { protected channel: Channel$1; protected store: StoryStore; entry: IndexEntry; private callbacks; readonly renderId: number; readonly type: RenderType; readonly subtype = "csf"; readonly id: StoryId; story?: PreparedStory; rerender?: () => Promise; teardownRender?: (options: { viewModeChanged?: boolean; }) => Promise; torndown: boolean; readonly disableKeyListeners = false; preparing: boolean; csfFiles?: CSFFile[]; constructor(channel: Channel$1, store: StoryStore, entry: IndexEntry, callbacks: RenderContextCallbacks); isPreparing(): boolean; prepare(): Promise; isEqual(other: Render): boolean; docsContext(renderStoryToElement: DocsContextProps['renderStoryToElement']): DocsContext; renderToElement(canvasElement: TRenderer['canvasElement'], renderStoryToElement: DocsContextProps['renderStoryToElement']): Promise; teardown({ viewModeChanged }?: { viewModeChanged?: boolean; }): Promise; } /** * A MdxDocsRender is a render of a docs entry that comes from a true MDX file, that is a `.mdx` * file that doesn't get compiled to a CSF file. * * A MDX render can reference (import) zero or more CSF files that contain stories. * * Use cases: * * - *.mdx file that may or may not reference a specific CSF file with `` */ declare class MdxDocsRender implements Render { protected channel: Channel$1; protected store: StoryStore; entry: IndexEntry; private callbacks; readonly renderId: number; readonly type: RenderType; readonly subtype = "mdx"; readonly id: StoryId; private exports?; rerender?: () => Promise; teardownRender?: (options: { viewModeChanged?: boolean; }) => Promise; torndown: boolean; readonly disableKeyListeners = false; preparing: boolean; csfFiles?: CSFFile[]; attachedCsfFile?: CSFFile; attachedStory?: PreparedStory; constructor(channel: Channel$1, store: StoryStore, entry: IndexEntry, callbacks: RenderContextCallbacks); isPreparing(): boolean; prepare(): Promise; isEqual(other: Render): boolean; docsContext(renderStoryToElement: DocsContextProps['renderStoryToElement']): DocsContext; renderToElement(canvasElement: TRenderer['canvasElement'], renderStoryToElement: DocsContextProps['renderStoryToElement']): Promise; teardown({ viewModeChanged }?: { viewModeChanged?: boolean; }): Promise; } type RenderPhase = 'preparing' | 'loading' | 'beforeEach' | 'rendering' | 'playing' | 'played' | 'completing' | 'completed' | 'afterEach' | 'finished' | 'aborted' | 'errored'; declare class StoryRender implements Render { channel: Channel$1; store: StoryStore; private renderToScreen; private callbacks; id: StoryId; viewMode: StoryContext['viewMode']; renderOptions: StoryRenderOptions; readonly renderId: number; type: RenderType; story?: PreparedStory; phase?: RenderPhase; private abortController; private canvasElement?; private notYetRendered; private rerenderEnqueued; disableKeyListeners: boolean; private teardownRender; torndown: boolean; constructor(channel: Channel$1, store: StoryStore, renderToScreen: RenderToCanvas, callbacks: RenderContextCallbacks & { showStoryDuringRender?: () => void; }, id: StoryId, viewMode: StoryContext['viewMode'], renderOptions?: StoryRenderOptions, story?: PreparedStory); private runPhase; private checkIfAborted; prepare(): Promise; isEqual(other: Render): boolean; isPreparing(): boolean; isPending(): boolean; renderToElement(canvasElement: TRenderer['canvasElement']): Promise; private storyContext; render({ initial, forceRemount, }?: { initial?: boolean; forceRemount?: boolean; }): Promise; /** * Rerender the story. If the story is currently pending (loading/rendering), the rerender will be * enqueued, and will be executed after the current render is completed. Rerendering while playing * will not be enqueued, and will be executed immediately, to support rendering args changes while * playing. */ rerender(): Promise; remount(): Promise; cancelRender(): void; cancelPlayFunction(): void; teardown(): Promise; } type MaybePromise$1 = Promise | T; declare class Preview { importFn: ModuleImportFn; getProjectAnnotations: () => MaybePromise$1>; protected channel: Channel$1; protected storyStoreValue?: StoryStore; renderToCanvas?: RenderToCanvas; storyRenders: StoryRender[]; previewEntryError?: Error; private projectAnnotationsBeforeInitialization?; private beforeAllCleanup?; protected storeInitializationPromise: Promise; protected resolveStoreInitializationPromise: () => void; protected rejectStoreInitializationPromise: (err: Error) => void; constructor(importFn: ModuleImportFn, getProjectAnnotations: () => MaybePromise$1>, channel?: Channel$1, shouldInitialize?: boolean); get storyStore(): StoryStore; protected initialize(): Promise; ready(): Promise; setupListeners(): void; getProjectAnnotationsOrRenderError(): Promise>; initializeWithProjectAnnotations(projectAnnotations: ProjectAnnotations): Promise; runBeforeAllHook(projectAnnotations: ProjectAnnotations): Promise; getStoryIndexFromServer(): Promise; protected initializeWithStoryIndex(storyIndex: StoryIndex): void; setInitialGlobals(): Promise; emitGlobals(): void; onGetProjectAnnotationsChanged({ getProjectAnnotations, }: { getProjectAnnotations: () => MaybePromise$1>; }): Promise; onStoryIndexChanged(): Promise; onStoriesChanged({ importFn, storyIndex, }: { importFn?: ModuleImportFn; storyIndex?: StoryIndex; }): Promise; onUpdateGlobals({ globals: updatedGlobals, currentStory, }: { globals: Globals; currentStory?: PreparedStory; }): Promise; onUpdateArgs({ storyId, updatedArgs }: { storyId: StoryId; updatedArgs: Args$1; }): Promise; onRequestArgTypesInfo({ id, payload }: RequestData): Promise; onResetArgs({ storyId, argNames }: { storyId: string; argNames?: string[]; }): Promise; onForceReRender(): Promise; onForceRemount({ storyId }: { storyId: StoryId; }): Promise; onStoryHotUpdated(): Promise; renderStoryToElement(story: PreparedStory, element: TRenderer['canvasElement'], callbacks: RenderContextCallbacks, options: StoryRenderOptions): () => Promise; teardownRender(render: StoryRender | CsfDocsRender | MdxDocsRender, { viewModeChanged }?: { viewModeChanged?: boolean; }): Promise; loadStory({ storyId }: { storyId: StoryId; }): Promise>; getStoryContext(story: PreparedStory, { forceInitialArgs }?: { forceInitialArgs?: boolean | undefined; }): { args: Args$1; initialGlobals: Globals; globalTypes: storybook_internal_csf.GlobalTypes | undefined; userGlobals: Globals; reporting: ReporterAPI; globals: { [x: string]: any; }; hooks: unknown; component?: (TRenderer & { T: any; })["component"] | undefined; subcomponents?: Record | undefined; parameters: storybook_internal_csf.Parameters; initialArgs: Args$1; argTypes: storybook_internal_csf.StrictArgTypes; componentId: storybook_internal_csf.ComponentId; title: storybook_internal_csf.ComponentTitle; kind: storybook_internal_csf.ComponentTitle; id: StoryId; name: storybook_internal_csf.StoryName; story: storybook_internal_csf.StoryName; tags: storybook_internal_csf.Tag[]; moduleExport: storybook_internal_types.ModuleExport; originalStoryFn: storybook_internal_csf.ArgsStoryFn; undecoratedStoryFn: storybook_internal_csf.LegacyStoryFn; unboundStoryFn: storybook_internal_csf.LegacyStoryFn; applyLoaders: (context: storybook_internal_csf.StoryContext) => Promise>; applyBeforeEach: (context: storybook_internal_csf.StoryContext) => Promise; applyAfterEach: (context: storybook_internal_csf.StoryContext) => Promise; playFunction?: ((context: storybook_internal_csf.StoryContext) => Promise | void) | undefined; runStep: storybook_internal_csf.StepRunner; mount: (context: storybook_internal_csf.StoryContext) => () => Promise; testingLibraryRender?: (...args: never[]) => unknown; renderToCanvas?: RenderToCanvas | undefined; usesMount: boolean; storyGlobals: Globals; } & Pick, "allArgs" | "argsByTarget" | "unmappedArgs">; extract(options?: { includeDocsOnly: boolean; }): Promise>>; renderPreviewEntryError(reason: string, err: Error): void; } interface SelectionSpecifier { storySpecifier: StorySpecifier; viewMode: ViewMode; args?: Args$1; globals?: Args$1; } interface Selection { storyId: StoryId; viewMode: ViewMode; } interface SelectionStore { selectionSpecifier: SelectionSpecifier | null; selection?: Selection; setSelection(selection: Selection): void; setQueryParams(queryParams: Record): void; } interface View { prepareForStory(story: PreparedStory): TStorybookRoot; prepareForDocs(options?: { scrollReset?: boolean; }): TStorybookRoot; showErrorDisplay(err: { message?: string; stack?: string; }): void; showNoPreview(): void; showPreparingStory(options?: { immediate: boolean; }): void; showPreparingDocs(options?: { immediate: boolean; }): void; showMain(): void; showDocs(): void; showStory(): void; showStoryDuringRender(): void; } type PossibleRender = StoryRender | CsfDocsRender | MdxDocsRender; declare class PreviewWithSelection extends Preview { importFn: ModuleImportFn; getProjectAnnotations: () => MaybePromise$1>; selectionStore: SelectionStore; view: View; currentSelection?: Selection; currentRender?: PossibleRender; constructor(importFn: ModuleImportFn, getProjectAnnotations: () => MaybePromise$1>, selectionStore: SelectionStore, view: View); setupListeners(): void; setInitialGlobals(): Promise; initializeWithStoryIndex(storyIndex: StoryIndex): Promise; selectSpecifiedStory(): Promise; onGetProjectAnnotationsChanged({ getProjectAnnotations, }: { getProjectAnnotations: () => MaybePromise$1>; }): Promise; onStoriesChanged({ importFn, storyIndex, }: { importFn?: ModuleImportFn; storyIndex?: StoryIndex; }): Promise; onKeydown(event: KeyboardEvent): void; onSetCurrentStory(selection: { storyId: StoryId; viewMode?: ViewMode; }): Promise; onUpdateQueryParams(queryParams: any): void; onUpdateGlobals({ globals }: { globals: Globals; }): Promise; onUpdateArgs({ storyId, updatedArgs }: { storyId: StoryId; updatedArgs: Args$1; }): Promise; onPreloadStories({ ids }: { ids: string[]; }): Promise; protected renderSelection({ persistedArgs }?: { persistedArgs?: Args$1; }): Promise; teardownRender(render: PossibleRender, { viewModeChanged }?: { viewModeChanged?: boolean; }): Promise; mainStoryCallbacks(storyId: StoryId): { showStoryDuringRender: () => void; showMain: () => void; showError: (err: { title: string; description: string; }) => void; showException: (err: Error) => void; }; renderPreviewEntryError(reason: string, err: Error): void; renderMissingStory(): void; renderStoryLoadingException(storySpecifier: StorySpecifier, err: Error): void; renderException(storyId: StoryId, error: Error): void; renderError(storyId: StoryId, { title, description }: { title: string; description: string; }): void; } declare class PreviewWeb extends PreviewWithSelection { importFn: ModuleImportFn; getProjectAnnotations: () => MaybePromise$1>; constructor(importFn: ModuleImportFn, getProjectAnnotations: () => MaybePromise$1>); } declare class UrlStore implements SelectionStore { selectionSpecifier: SelectionSpecifier | null; selection?: Selection; constructor(); setSelection(selection: Selection): void; setQueryParams(queryParams: Record): void; } declare enum Mode { 'MAIN' = "MAIN", 'NOPREVIEW' = "NOPREVIEW", 'PREPARING_STORY' = "PREPARING_STORY", 'PREPARING_DOCS' = "PREPARING_DOCS", 'ERROR' = "ERROR" } declare const layoutClassMap: { readonly centered: "sb-main-centered"; readonly fullscreen: "sb-main-fullscreen"; readonly padded: "sb-main-padded"; }; type Layout = keyof typeof layoutClassMap | 'none'; declare class WebView implements View { private currentLayoutClass?; private testing; private preparingTimeout?; constructor(); prepareForStory(story: PreparedStory): HTMLElement; storyRoot(): HTMLElement; prepareForDocs({ scrollReset }?: { scrollReset?: boolean; }): HTMLElement; docsRoot(): HTMLElement; applyLayout(layout?: Layout): void; /** * Injects a BCP-47 lang attribute to the story root, or removes it if `lang` is null. */ applyHtmlLang(element: HTMLElement, lang?: string): void; checkIfLayoutExists(layout: keyof typeof layoutClassMap): void; showMode(mode: Mode): void; showErrorDisplay({ message, stack }: { message?: string | undefined; stack?: string | undefined; }): void; showNoPreview(): void; showPreparingStory({ immediate }?: { immediate?: boolean | undefined; }): void; showPreparingDocs({ immediate }?: { immediate?: boolean | undefined; }): void; showMain(): void; showDocs(): void; showStory(): void; showStoryDuringRender(): void; } declare function simulateDOMContentLoaded(): void; declare function simulatePageLoad($container: any): void; type ReducedStoryContext = Omit, 'abortSignal' | 'canvasElement' | 'step' | 'context'>; declare function emitTransformCode(source: string | undefined, context: ReducedStoryContext): Promise; declare function pauseAnimations(atEnd?: boolean): CleanupCallback; declare function waitForAnimations(signal?: AbortSignal): Promise; /** * Actions represent the type of change to a location value. */ declare enum Action { /** * A POP indicates a change to an arbitrary index in the history stack, such * as a back or forward navigation. It does not describe the direction of the * navigation, only that the current index changed. * * Note: This is the default action for newly created history objects. */ Pop = "POP", /** * A PUSH indicates a new entry being added to the history stack, such as when * a link is clicked and a new page loads. When this happens, all subsequent * entries in the stack are lost. */ Push = "PUSH", /** * A REPLACE indicates the entry at the current index in the history stack * being replaced by a new one. */ Replace = "REPLACE" } /** * The pathname, search, and hash values of a URL. */ interface Path { /** * A URL pathname, beginning with a /. */ pathname: string; /** * A URL search string, beginning with a ?. */ search: string; /** * A URL fragment identifier, beginning with a #. */ hash: string; } /** * An entry in a history stack. A location contains information about the * URL path, as well as possibly some arbitrary state and a key. */ interface Location extends Path { /** * A value of arbitrary data associated with this location. */ state: any; /** * A unique string associated with this location. May be used to safely store * and retrieve data in some other storage API, like `localStorage`. * * Note: This value is always "default" on the initial location. */ key: string; } /** * Map of routeId -> data returned from a loader/action/error */ interface RouteData { [routeId: string]: any; } declare enum ResultType { data = "data", deferred = "deferred", redirect = "redirect", error = "error" } /** * Successful result from a loader or action */ interface SuccessResult { type: ResultType.data; data: any; statusCode?: number; headers?: Headers; } /** * Successful defer() result from a loader or action */ interface DeferredResult { type: ResultType.deferred; deferredData: DeferredData; statusCode?: number; headers?: Headers; } /** * Redirect result from a loader or action */ interface RedirectResult { type: ResultType.redirect; status: number; location: string; revalidate: boolean; reloadDocument?: boolean; } /** * Unsuccessful result from a loader or action */ interface ErrorResult { type: ResultType.error; error: any; headers?: Headers; } /** * Result from a loader or action - potentially successful or unsuccessful */ type DataResult = SuccessResult | DeferredResult | RedirectResult | ErrorResult; type LowerCaseFormMethod = "get" | "post" | "put" | "patch" | "delete"; type UpperCaseFormMethod = Uppercase; /** * Active navigation/fetcher form methods are exposed in lowercase on the * RouterState */ type FormMethod = LowerCaseFormMethod; /** * In v7, active navigation/fetcher form methods are exposed in uppercase on the * RouterState. This is to align with the normalization done via fetch(). */ type V7_FormMethod = UpperCaseFormMethod; type FormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "application/json" | "text/plain"; type JsonObject = { [Key in string]: JsonValue; } & { [Key in string]?: JsonValue | undefined; }; type JsonArray = JsonValue[] | readonly JsonValue[]; type JsonPrimitive = string | number | boolean | null; type JsonValue = JsonPrimitive | JsonObject | JsonArray; /** * @private * Internal interface to pass around for action submissions, not intended for * external consumption */ type Submission = { formMethod: FormMethod | V7_FormMethod; formAction: string; formEncType: FormEncType; formData: FormData; json: undefined; text: undefined; } | { formMethod: FormMethod | V7_FormMethod; formAction: string; formEncType: FormEncType; formData: undefined; json: JsonValue; text: undefined; } | { formMethod: FormMethod | V7_FormMethod; formAction: string; formEncType: FormEncType; formData: undefined; json: undefined; text: string; }; /** * @private * Arguments passed to route loader/action functions. Same for now but we keep * this as a private implementation detail in case they diverge in the future. */ interface DataFunctionArgs { request: Request; params: Params; context?: any; } /** * Arguments passed to loader functions */ interface LoaderFunctionArgs extends DataFunctionArgs { } /** * Arguments passed to action functions */ interface ActionFunctionArgs extends DataFunctionArgs { } /** * Loaders and actions can return anything except `undefined` (`null` is a * valid return value if there is no data to return). Responses are preferred * and will ease any future migration to Remix */ type DataFunctionValue = Response | NonNullable | null; /** * Route loader function signature */ interface LoaderFunction { (args: LoaderFunctionArgs): Promise | DataFunctionValue; } /** * Route action function signature */ interface ActionFunction { (args: ActionFunctionArgs): Promise | DataFunctionValue; } /** * Route shouldRevalidate function signature. This runs after any submission * (navigation or fetcher), so we flatten the navigation/fetcher submission * onto the arguments. It shouldn't matter whether it came from a navigation * or a fetcher, what really matters is the URLs and the formData since loaders * have to re-run based on the data models that were potentially mutated. */ interface ShouldRevalidateFunction { (args: { currentUrl: URL; currentParams: AgnosticDataRouteMatch["params"]; nextUrl: URL; nextParams: AgnosticDataRouteMatch["params"]; formMethod?: Submission["formMethod"]; formAction?: Submission["formAction"]; formEncType?: Submission["formEncType"]; text?: Submission["text"]; formData?: Submission["formData"]; json?: Submission["json"]; actionResult?: DataResult; defaultShouldRevalidate: boolean; }): boolean; } /** * Keys we cannot change from within a lazy() function. We spread all other keys * onto the route. Either they're meaningful to the router, or they'll get * ignored. */ type ImmutableRouteKey = "lazy" | "caseSensitive" | "path" | "id" | "index" | "children"; type RequireOne = Exclude<{ [K in keyof T]: K extends Key ? Omit & Required> : never; }[keyof T], undefined>; /** * lazy() function to load a route definition, which can add non-matching * related properties to a route */ interface LazyRouteFunction { (): Promise>>; } /** * Base RouteObject with common props shared by all types of routes */ type AgnosticBaseRouteObject = { caseSensitive?: boolean; path?: string; id?: string; loader?: LoaderFunction; action?: ActionFunction; hasErrorBoundary?: boolean; shouldRevalidate?: ShouldRevalidateFunction; handle?: any; lazy?: LazyRouteFunction; }; /** * Index routes must not have children */ type AgnosticIndexRouteObject = AgnosticBaseRouteObject & { children?: undefined; index: true; }; /** * Non-index routes may have children, but cannot have index */ type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & { children?: AgnosticRouteObject[]; index?: false; }; /** * A route object represents a logical route, with (optionally) its child * routes organized in a tree-like structure. */ type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject; type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & { id: string; }; type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & { children?: AgnosticDataRouteObject[]; id: string; }; /** * A data route object, which is just a RouteObject with a required unique ID */ type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject; /** * The parameters that were parsed from the URL path. */ type Params = { readonly [key in Key]: string | undefined; }; /** * A RouteMatch contains info about how a route matched a URL. */ interface AgnosticRouteMatch { /** * The names and values of dynamic parameters in the URL. */ params: Params; /** * The portion of the URL pathname that was matched. */ pathname: string; /** * The portion of the URL pathname that was matched before child routes. */ pathnameBase: string; /** * The route object that was used to match. */ route: RouteObjectType; } interface AgnosticDataRouteMatch extends AgnosticRouteMatch { } declare class DeferredData { private pendingKeysSet; private controller; private abortPromise; private unlistenAbortSignal; private subscribers; data: Record; init?: ResponseInit; deferredKeys: string[]; constructor(data: Record, responseInit?: ResponseInit); private trackPromise; private onSettle; private emit; subscribe(fn: (aborted: boolean, settledKey?: string) => void): () => boolean; cancel(): void; resolveData(signal: AbortSignal): Promise; get done(): boolean; get unwrappedData(): {}; get pendingKeys(): string[]; } /** * State maintained internally by the router. During a navigation, all states * reflect the the "old" location unless otherwise noted. */ interface RouterState { /** * The action of the most recent navigation */ historyAction: Action; /** * The current location reflected by the router */ location: Location; /** * The current set of route matches */ matches: AgnosticDataRouteMatch[]; /** * Tracks whether we've completed our initial data load */ initialized: boolean; /** * Current scroll position we should start at for a new view * - number -> scroll position to restore to * - false -> do not restore scroll at all (used during submissions) * - null -> don't have a saved position, scroll to hash or top of page */ restoreScrollPosition: number | false | null; /** * Indicate whether this navigation should skip resetting the scroll position * if we are unable to restore the scroll position */ preventScrollReset: boolean; /** * Tracks the state of the current navigation */ navigation: Navigation; /** * Tracks any in-progress revalidations */ revalidation: RevalidationState; /** * Data from the loaders for the current matches */ loaderData: RouteData; /** * Data from the action for the current matches */ actionData: RouteData | null; /** * Errors caught from loaders for the current matches */ errors: RouteData | null; /** * Map of current fetchers */ fetchers: Map; /** * Map of current blockers */ blockers: Map; } /** * Data that can be passed into hydrate a Router from SSR */ type HydrationState = Partial>; /** * Potential states for state.navigation */ type NavigationStates = { Idle: { state: "idle"; location: undefined; formMethod: undefined; formAction: undefined; formEncType: undefined; formData: undefined; json: undefined; text: undefined; }; Loading: { state: "loading"; location: Location; formMethod: Submission["formMethod"] | undefined; formAction: Submission["formAction"] | undefined; formEncType: Submission["formEncType"] | undefined; formData: Submission["formData"] | undefined; json: Submission["json"] | undefined; text: Submission["text"] | undefined; }; Submitting: { state: "submitting"; location: Location; formMethod: Submission["formMethod"]; formAction: Submission["formAction"]; formEncType: Submission["formEncType"]; formData: Submission["formData"]; json: Submission["json"]; text: Submission["text"]; }; }; type Navigation = NavigationStates[keyof NavigationStates]; type RevalidationState = "idle" | "loading"; /** * Potential states for fetchers */ type FetcherStates = { Idle: { state: "idle"; formMethod: undefined; formAction: undefined; formEncType: undefined; text: undefined; formData: undefined; json: undefined; data: TData | undefined; " _hasFetcherDoneAnything "?: boolean; }; Loading: { state: "loading"; formMethod: Submission["formMethod"] | undefined; formAction: Submission["formAction"] | undefined; formEncType: Submission["formEncType"] | undefined; text: Submission["text"] | undefined; formData: Submission["formData"] | undefined; json: Submission["json"] | undefined; data: TData | undefined; " _hasFetcherDoneAnything "?: boolean; }; Submitting: { state: "submitting"; formMethod: Submission["formMethod"]; formAction: Submission["formAction"]; formEncType: Submission["formEncType"]; text: Submission["text"]; formData: Submission["formData"]; json: Submission["json"]; data: TData | undefined; " _hasFetcherDoneAnything "?: boolean; }; }; type Fetcher = FetcherStates[keyof FetcherStates]; interface BlockerBlocked { state: "blocked"; reset(): void; proceed(): void; location: Location; } interface BlockerUnblocked { state: "unblocked"; reset: undefined; proceed: undefined; location: undefined; } interface BlockerProceeding { state: "proceeding"; reset: undefined; proceed: undefined; location: Location; } type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding; /** * NOTE: If you refactor this to split up the modules into separate files, * you'll need to update the rollup config for react-router-dom-v5-compat. */ declare global { var __staticRouterHydrationData: HydrationState | undefined; } /** * Canonical install/read surface for Storybook's shared addons channel. * * Each runtime (manager, preview, dev server) installs one channel instance here. The module slot * is the source of truth; {@link setChannel} also mirrors to `__STORYBOOK_ADDONS_CHANNEL__` * so legacy code and builder preamble that read the global slot stay in sync. */ /** * Returns the installed addons channel, or `null` before one exists. * * The global slot wins over the module cache so duplicate copies of this module (e.g. dev-server * preset code and `.storybook` service registration loading different bundles) still observe * `setChannel` from whichever copy installed the live websocket channel. */ declare function getChannel(): ChannelLike | null; /** Installs (or replaces) the shared addons channel. Pass `null` to clear. */ declare function setChannel(next: ChannelLike | null): void; /** Clears the shared channel slot. Alias for `setChannel(null)`. */ declare function clearChannel(): void; /** Installs a noop in-process channel — used by server presets and unit tests. */ declare function installNoopChannel(): void; /** * Installs a noop channel when none is present yet. * * Prefer explicit `setChannel` / `installNoopChannel` at runtime entry points. This helper remains for * tests and tooling that need an in-process channel without a mock transport. */ declare function ensureChannel(): void; /** The Standard Typed interface. This is a base type extended by other specs. */ interface StandardTypedV1 { /** The Standard properties. */ readonly "~standard": StandardTypedV1.Props; } declare namespace StandardTypedV1 { /** The Standard Typed properties interface. */ interface Props { /** The version number of the standard. */ readonly version: 1; /** The vendor name of the schema library. */ readonly vendor: string; /** Inferred types associated with the schema. */ readonly types?: Types | undefined; } /** The Standard Typed types interface. */ interface Types { /** The input type of the schema. */ readonly input: Input; /** The output type of the schema. */ readonly output: Output; } /** Infers the input type of a Standard Typed. */ type InferInput = NonNullable["input"]; /** Infers the output type of a Standard Typed. */ type InferOutput = NonNullable["output"]; } /** The Standard Schema interface. */ interface StandardSchemaV1 { /** The Standard Schema properties. */ readonly "~standard": StandardSchemaV1.Props; } declare namespace StandardSchemaV1 { /** The Standard Schema properties interface. */ interface Props extends StandardTypedV1.Props { /** Validates unknown input values. */ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; } /** The result interface of the validate function. */ type Result = SuccessResult | FailureResult; /** The result interface if validation succeeds. */ interface SuccessResult { /** The typed output value. */ readonly value: Output; /** A falsy value for `issues` indicates success. */ readonly issues?: undefined; } interface Options { /** Explicit support for additional vendor-specific parameters, if needed. */ readonly libraryOptions?: Record | undefined; } /** The result interface if validation fails. */ interface FailureResult { /** The issues of failed validation. */ readonly issues: ReadonlyArray; } /** The issue interface of the failure output. */ interface Issue { /** The error message of the issue. */ readonly message: string; /** The path of the issue, if any. */ readonly path?: ReadonlyArray | undefined; } /** The path segment interface of the issue. */ interface PathSegment { /** The key representing a path segment. */ readonly key: PropertyKey; } /** The Standard types interface. */ interface Types extends StandardTypedV1.Types { } /** Infers the input type of a Standard. */ type InferInput = StandardTypedV1.InferInput; /** Infers the output type of a Standard. */ type InferOutput = StandardTypedV1.InferOutput; } /** Generic Standard Schema constraint used across open-service definitions. */ type AnySchema = StandardSchemaV1; /** Stable alias for service identifiers across definition, runtime, and registration APIs. */ type ServiceId = string; /** Public schema shape exposed when describing a schema-backed service contract. */ type SchemaDescriptor = AnySchema; /** Raw caller-facing value type accepted by a schema-backed operation. */ type InferSchemaInput = StandardSchemaV1.InferInput; /** Parsed value type produced by a schema after validation. */ type InferSchemaOutput = StandardSchemaV1.InferOutput; /** * Named schema maps are the core inference surface for inline open-service authoring. * * `defineService()` infers one input-schema map and one output-schema map per operation family * (queries and commands). Keeping those maps separate gives TypeScript a place to correlate the * `input` and `output` properties of each inline object before it contextually types sibling * callbacks like `handler`, `load`, `staticPath`, and `staticInputs`. */ type OperationInputSchemas = Record; /** * Output-schema maps must stay key-aligned with their input-schema map. * * The authoring helper uses this alias instead of a plain `Record` so each * operation key retains its own input/output schema pair during inference. */ type MatchingOutputSchemas = { [TKey in keyof TInputSchemas]: AnySchema; }; /** * Internal utility used to keep handler maps assignable without collapsing everything to `unknown`. */ type BivariantCallback = { bivarianceHack(...args: TArgs): TResult; }['bivarianceHack']; /** * Runtime command map derived directly from the inferred command schema maps. * * Queries only need command-call typing, not the full command definition objects, so this helper * keeps query contexts readable while still preserving exact input/output types per command. */ type CommandFunctions> = { [TKey in keyof TCommandInputSchemas]: BivariantCallback<[ input: InferSchemaInput ], Promise>>; }; /** * Coarse lifecycle of a query's `load`, modeled after TanStack Query's `status`. * * - `pending` — no successful load has completed yet (and none has failed). The query may still * expose `data` (the synchronous "current best" handler result), but nothing has been loaded. * - `error` — the most recent attempt (load rejection, or a synchronous handler / validation throw) * failed. `data` keeps the last successful value, if any. * - `success` — a load has completed (or the query has no `load`, so there is nothing to load). */ type QueryStatus = 'pending' | 'error' | 'success'; /** * Whether a `load` is currently running, modeled after TanStack Query's `fetchStatus` — but named * with our own `load` vocabulary because open-service "loads" are any slow async work (computation, * extraction, I/O), not specifically remote fetching. * * - `loading` — a `load` is in flight (the first load, or a reactive background re-load). * - `idle` — no `load` is currently running. */ type LoadStatus = 'loading' | 'idle'; /** * The reactive state of a subscribed query: its current `data` plus the lifecycle of its `load`. * * `data` and `status` are independent. `data` is the synchronous handler result ("current best * effort") and holds the last successful value (or `undefined` before the first success / when a * handler throws), while `status`/`loadStatus`/`error` describe the asynchronous `load` lifecycle * tracked per subscription. A query with no `load` is `success`/`idle` from its first emission. * * `isLoading` is intentionally "any load in flight" (TanStack's `isFetching`), and * `isInitialLoading` is "a load is in flight and there is nothing to show yet"; the names follow our * `load` vocabulary rather than TanStack's `fetch`/`load` split. Unlike TanStack Query, a * subscription here can attach to a query whose `data` is already cached in service state, so * `isInitialLoading` additionally requires `data === undefined` — it never flags over cached data. */ type QueryState = { /** Last successfully produced value; `undefined` before the first success. */ data: TData | undefined; /** The failure that produced `status: 'error'`, otherwise `undefined`. */ error: Error | undefined; status: QueryStatus; loadStatus: LoadStatus; /** `status === 'pending'`. */ isPending: boolean; /** `status === 'success'`. */ isSuccess: boolean; /** `status === 'error'`. */ isError: boolean; /** `loadStatus === 'loading'` — any load in flight, foreground or background. */ isLoading: boolean; /** `isPending && isLoading && data === undefined` — a first load with nothing to show yet. */ isInitialLoading: boolean; /** `isLoading && !isPending` — a background re-load while data is already shown. */ isRefreshing: boolean; }; /** * Public runtime shape of a query. * * - `.get(input)` reads synchronously: it validates input, runs the handler against current state, * and returns the validated result. It does **not** fire the query's `load` — it is a pure * "current best effort" read. (Reads of *other* queries from inside a handler or `load` body still * participate in dependency tracking, so `.loaded()` and subscriptions trigger those dependency * loads; a bare consumer `.get()` does not.) * - `.loaded(input)` awaits the full load — this query's `load` plus every transitively read * dependency — before resolving with the validated result. * - `.subscribe(input, callback)` invokes `callback` synchronously with the current {@link QueryState} * and again whenever tracked state or the load lifecycle changes (deduped on the whole state). * Subscribing is what fires the query's reactive `load`. * * There is intentionally no bare-call form: a previous `query(input)` that returned synchronously * *and* fired the `load` behind the scenes was removed because the implicit background load was * confusing. Read with `.get(input)`, await with `.loaded(input)`, observe with `.subscribe(...)`. * * Queries whose input schema resolves to `undefined` (for example `v.void()`) may be called with * zero arguments: `query.get()`, `query.loaded()`. */ type InputQuery = { get(input: TInput): TOutput; loaded(input: TInput): Promise; subscribe(input: TInput, callback: (state: QueryState) => void): () => void; subscribe(input: TInput, selector: (value: TOutput) => TSelected, callback: (state: QueryState) => void): () => void; }; /** Zero-argument overloads merged into {@link Query} when the input schema is void. */ type VoidQuery = { get(): TOutput; loaded(): Promise; subscribe(callback: (state: QueryState) => void): () => void; subscribe(selector: (value: TOutput) => TSelected, callback: (state: QueryState) => void): () => void; }; type Query = undefined extends TInput ? VoidQuery & InputQuery : InputQuery; /** * Runtime query map derived directly from the inferred query schema maps. * * The query counterpart to {@link CommandFunctions}: it preserves each sibling query's exact * input/output types on the read-only `self.queries` handle, so a handler or `load` can call * `self.queries.someQuery.get(input)` without manual casts. `defineService` computes this map from * the inferred query schema maps and threads it into the handler/load contexts as their `TQueries`; * the erased {@link AnyQueryFunctions} bound is used everywhere the concrete map is not known. */ type QueryFunctions> = { [TKey in keyof TQueryInputSchemas]: Query, InferSchemaOutput>; }; /** * Permissive bound for a `self.queries` handle. * * Every {@link Query} — input or void — structurally satisfies {@link InputQuery} (the void * overloads are additive), so this is the supertype that any concrete {@link QueryFunctions} map is * assignable to. It is the bound (and erased default) for the `TQueries` parameter below, which lets * the precise per-service map flow into handler contexts while still erasing cleanly into the * structural `AnyQueryDefinition` storage constraint. Using `Query` here instead * would wrongly demand the void zero-arg overloads from input queries. */ type AnyQueryFunctions = Record>; /** * Read-only service handle exposed to query handlers. * * Query handlers are strict readers: they can read state and call sibling queries, but they cannot * mutate state and cannot invoke commands. Mutations belong in commands; load-side preparation * belongs in `load`. */ type QuerySelf = { readonly state: TState; queries: TQueries; }; /** * Load handle exposed to `load` functions. * * `load` may read state and queries, and may invoke declared commands to mutate state. It does * not receive `setState` directly — all writes must flow through commands so authors keep one * documented mutation surface per service. */ type LoadSelf = MatchingOutputSchemas, TQueries extends AnyQueryFunctions = AnyQueryFunctions> = QuerySelf & { commands: CommandFunctions; }; /** * Mutable service handle exposed to command handlers. * * Commands receive both `setState` for direct state mutation and `commands` so one command can * delegate to another within the same service. */ type CommandSelf = MatchingOutputSchemas, TQueries extends AnyQueryFunctions = AnyQueryFunctions> = LoadSelf & { setState(mutate: (state: TState) => void): void; }; type ServiceSummary = { id: ServiceId; description?: string; queryNames: string[]; commandNames: string[]; }; type OperationDescriptor = { name: string; description?: string; input: SchemaDescriptor; output: SchemaDescriptor; /** Present when the query declares `staticPath` at definition time. */ staticPath?: true; }; type ServiceDescriptor = { id: ServiceId; description?: string; queries: Record; commands: Record; }; /** Context passed to query handlers. */ type QueryCtx = { self: QuerySelf; getService: ServiceRegistryApi['getService']; }; /** Context passed to `load` functions and static-input enumerators. */ type LoadCtx = MatchingOutputSchemas, TQueries extends AnyQueryFunctions = AnyQueryFunctions> = { self: LoadSelf; getService: ServiceRegistryApi['getService']; }; /** Static input enumerator stored on registered definitions; always receives load context. */ type RegisteredStaticInputs = BivariantCallback<[ ctx: LoadCtx ], unknown[] | Promise>; /** Context passed to command handlers. */ type CommandCtx = MatchingOutputSchemas, TQueries extends AnyQueryFunctions = AnyQueryFunctions> = { self: CommandSelf; getService: ServiceRegistryApi['getService']; }; /** * Declarative definition for one query. * * Queries validate caller input synchronously, run a synchronous read-only handler, and validate * the resolved output. The optional `load` hook is fired by subscriptions (reactively) and by * `.loaded()` callers (drained to completion), deduped per `(service, query, input)` while one is * already in flight — a bare `.get()` read never fires it. * * Queries that participate in static JSON generation declare `staticPath` at definition time. * `staticInputs` may also be declared here when the input list has no runtime dependencies; inputs * that need registry or story-index context belong in server registration instead. */ type QueryDefinition = MatchingOutputSchemas, TQueries extends AnyQueryFunctions = AnyQueryFunctions> = { description?: string; /** * When true, hides this query from `describeService()` output. Defaults to false. Does not disable * the query at runtime — callers with a service handle can still invoke it. */ internal?: boolean; input: TInputSchema; output: TOutputSchema; /** Logical path for the serialized state snapshot, relative to this service's output folder. */ staticPath?: BivariantCallback<[input: InferSchemaOutput], string>; /** Dependency-free static build inputs declared alongside the public contract. */ staticInputs?: BivariantCallback<[ ], InferSchemaInput[] | Promise[]>>; handler?: BivariantCallback<[ input: InferSchemaOutput, ctx: QueryCtx ], InferSchemaInput>; load?: BivariantCallback<[ input: InferSchemaOutput, ctx: LoadCtx ], void | Promise>; }; /** * Declarative definition for one command. * * Commands validate caller input, run against a mutable context, and validate the resolved output. */ type CommandDefinition = MatchingOutputSchemas, TQueries extends AnyQueryFunctions = AnyQueryFunctions> = { description?: string; /** * When true, hides this command from `describeService()` output. Defaults to false. Does not * disable the command at runtime — callers with a service handle can still invoke it. */ internal?: boolean; input: TInputSchema; output: TOutputSchema; handler?: BivariantCallback<[ input: InferSchemaOutput, ctx: CommandCtx ], InferSchemaInput | Promise>>; }; /** Internal structural constraint used to store any query definition in a record. */ type AnyQueryDefinition = { description?: string; internal?: boolean; input: AnySchema; output: AnySchema; staticPath?: BivariantCallback<[input: unknown], string>; staticInputs?: RegisteredStaticInputs; handler?: BivariantCallback<[input: unknown, ctx: QueryCtx], unknown>; load?: BivariantCallback<[input: unknown, ctx: LoadCtx], void | Promise>; }; /** Internal structural constraint used to store any command definition in a record. */ type AnyCommandDefinition = { description?: string; internal?: boolean; input: AnySchema; output: AnySchema; handler?: BivariantCallback<[ input: unknown, ctx: CommandCtx ], unknown | Promise>; }; /** Named query map attached to a service definition. */ type Queries = Record>; /** Named command map attached to a service definition. */ type Commands = Record>; /** Top-level description of a service: identity, initial state, queries, and commands. */ type ServiceDefinition, TCommands extends Commands, TId extends ServiceId = ServiceId> = { id: TId; description?: string; /** * When true, hides this service from `listServices()` output. Defaults to false. Does not disable * the service at runtime — callers can still resolve it through `getService()`. */ internal?: boolean; /** * Initial state for the service. Must be a plain object (not a primitive, `null`, or array) — see * {@link ServiceState} for why. The authoring boundary (`defineService`) enforces this; the runtime * type stays `TState` so already-constructed definitions flow through the registry unchanged. */ initialState: TState; queries: TQueries; commands: TCommands; }; /** Structural constraint for any service definition stored in the registry. */ type AnyServiceDefinition = ServiceDefinition, Commands>; /** Runtime service instance derived from a `ServiceDefinition`. */ type ServiceInstance, TCommands extends Commands> = { queries: { [TKey in keyof TQueries]: TQueries[TKey] extends { input: infer TInputSchema extends AnySchema; output: infer TOutputSchema extends AnySchema; } ? Query, InferSchemaOutput> : never; }; commands: { [TKey in keyof TCommands]: TCommands[TKey] extends { input: infer TInputSchema extends AnySchema; output: infer TOutputSchema extends AnySchema; } ? (input: InferSchemaInput) => Promise> : never; }; }; /** Runtime instance type recovered from one authored service definition. */ type ServiceInstanceOf = TDefinition extends ServiceDefinition ? ServiceInstance : never; interface ServiceRegistryApi { listServices(): Promise; describeService(serviceId: ServiceId): Promise; getService(serviceId: ServiceId): TInstance; } type RuntimeService = ServiceInstance, Commands> & ServiceRegistryApi; type ServiceQueryRegistration = { /** Static build inputs that may depend on registry or other server context. */ staticInputs?: RegisteredStaticInputs; }; type ServiceCommandRegistration> = Pick; type ServiceRegistrationOptions, TCommands extends Commands> = { queries?: { [TKey in keyof TQueries]?: ServiceQueryRegistration; }; commands?: { [TKey in keyof TCommands]?: ServiceCommandRegistration; }; }; //#endregion //#region src/methods/fallback/fallback.d.ts /** * Fallback type. */ type Fallback>> = MaybeDeepReadonly> | ((dataset?: OutputDataset, InferIssue>, config?: Config>) => MaybeDeepReadonly>); /** * Schema with fallback type. */ type SchemaWithFallback>, TFallback$1 extends Fallback> = TSchema & { /** * The fallback value. */ readonly fallback: TFallback$1; }; //#endregion //#region src/methods/fallback/fallbackAsync.d.ts /** * Fallback async type. */ type FallbackAsync> | BaseSchemaAsync>> = MaybeDeepReadonly> | ((dataset?: OutputDataset, InferIssue>, config?: Config>) => MaybePromise>>); /** * Schema with fallback async type. */ type SchemaWithFallbackAsync> | BaseSchemaAsync>, TFallback$1 extends FallbackAsync> = Omit & { /** * The fallback value. */ readonly fallback: TFallback$1; /** * Whether it's async. */ readonly async: true; /** * The Standard Schema properties. * * @internal */ readonly "~standard": StandardProps, InferOutput>; /** * Parses unknown input values. * * @param dataset The input dataset. * @param config The configuration. * * @returns The output dataset. * * @internal */ readonly "~run": (dataset: UnknownDataset, config: Config>) => Promise, InferIssue>>; }; //#endregion //#region src/types/metadata.d.ts /** * Base metadata interface. */ interface BaseMetadata { /** * The object kind. */ readonly kind: "metadata"; /** * The metadata type. */ readonly type: string; /** * The metadata reference. */ readonly reference: (...args: any[]) => BaseMetadata; /** * The input, output and issue type. * * @internal */ readonly "~types"?: { readonly input: TInput$1; readonly output: TInput$1; readonly issue: never; } | undefined; } //#endregion //#region src/types/dataset.d.ts /** * Unknown dataset interface. */ interface UnknownDataset { /** * Whether is's typed. */ typed?: false; /** * The dataset value. */ value: unknown; /** * The dataset issues. */ issues?: undefined; } /** * Success dataset interface. */ interface SuccessDataset { /** * Whether is's typed. */ typed: true; /** * The dataset value. */ value: TValue$1; /** * The dataset issues. */ issues?: undefined; } /** * Partial dataset interface. */ interface PartialDataset> { /** * Whether is's typed. */ typed: true; /** * The dataset value. */ value: TValue$1; /** * The dataset issues. */ issues: [TIssue, ...TIssue[]]; } /** * Failure dataset interface. */ interface FailureDataset> { /** * Whether is's typed. */ typed: false; /** * The dataset value. */ value: unknown; /** * The dataset issues. */ issues: [TIssue, ...TIssue[]]; } /** * Output dataset type. */ type OutputDataset> = SuccessDataset | PartialDataset | FailureDataset; //#endregion //#region src/types/standard.d.ts /** * The Standard Schema properties interface. */ interface StandardProps { /** * The version number of the standard. */ readonly version: 1; /** * The vendor name of the schema library. */ readonly vendor: "valibot"; /** * Validates unknown input values. */ readonly validate: (value: unknown) => StandardResult | Promise>; /** * Inferred types associated with the schema. */ readonly types?: StandardTypes | undefined; } /** * The result interface of the validate function. */ type StandardResult = StandardSuccessResult | StandardFailureResult; /** * The result interface if validation succeeds. */ interface StandardSuccessResult { /** * The typed output value. */ readonly value: TOutput$1; /** * The non-existent issues. */ readonly issues?: undefined; } /** * The result interface if validation fails. */ interface StandardFailureResult { /** * The issues of failed validation. */ readonly issues: readonly StandardIssue[]; } /** * The issue interface of the failure output. */ interface StandardIssue { /** * The error message of the issue. */ readonly message: string; /** * The path of the issue, if any. */ readonly path?: readonly (PropertyKey | StandardPathItem)[] | undefined; } /** * The path item interface of the issue. */ interface StandardPathItem { /** * The key of the path item. */ readonly key: PropertyKey; } /** * The Standard Schema types interface. */ interface StandardTypes { /** * The input type of the schema. */ readonly input: TInput$1; /** * The output type of the schema. */ readonly output: TOutput$1; } //#endregion //#region src/types/schema.d.ts /** * Base schema interface. */ interface BaseSchema> { /** * The object kind. */ readonly kind: "schema"; /** * The schema type. */ readonly type: string; /** * The schema reference. */ readonly reference: (...args: any[]) => BaseSchema>; /** * The expected property. */ readonly expects: string; /** * Whether it's async. */ readonly async: false; /** * The Standard Schema properties. * * @internal */ readonly "~standard": StandardProps; /** * Parses unknown input values. * * @param dataset The input dataset. * @param config The configuration. * * @returns The output dataset. * * @internal */ readonly "~run": (dataset: UnknownDataset, config: Config>) => OutputDataset; /** * The input, output and issue type. * * @internal */ readonly "~types"?: { readonly input: TInput$1; readonly output: TOutput$1; readonly issue: TIssue; } | undefined; } /** * Base schema async interface. */ interface BaseSchemaAsync> extends Omit, "reference" | "async" | "~run"> { /** * The schema reference. */ readonly reference: (...args: any[]) => BaseSchema> | BaseSchemaAsync>; /** * Whether it's async. */ readonly async: true; /** * Parses unknown input values. * * @param dataset The input dataset. * @param config The configuration. * * @returns The output dataset. * * @internal */ readonly "~run": (dataset: UnknownDataset, config: Config>) => Promise>; } //#endregion //#region src/types/transformation.d.ts /** * Base transformation interface. */ interface BaseTransformation> { /** * The object kind. */ readonly kind: "transformation"; /** * The transformation type. */ readonly type: string; /** * The transformation reference. */ readonly reference: (...args: any[]) => BaseTransformation>; /** * Whether it's async. */ readonly async: false; /** * Transforms known input values. * * @param dataset The input dataset. * @param config The configuration. * * @returns The output dataset. * * @internal */ readonly "~run": (dataset: SuccessDataset, config: Config>) => OutputDataset | TIssue>; /** * The input, output and issue type. * * @internal */ readonly "~types"?: { readonly input: TInput$1; readonly output: TOutput$1; readonly issue: TIssue; } | undefined; } /** * Base transformation async interface. */ interface BaseTransformationAsync> extends Omit, "reference" | "async" | "~run"> { /** * The transformation reference. */ readonly reference: (...args: any[]) => BaseTransformation> | BaseTransformationAsync>; /** * Whether it's async. */ readonly async: true; /** * Transforms known input values. * * @param dataset The input dataset. * @param config The configuration. * * @returns The output dataset. * * @internal */ readonly "~run": (dataset: SuccessDataset, config: Config>) => Promise | TIssue>>; } //#endregion //#region src/types/validation.d.ts /** * Base validation interface. */ interface BaseValidation> { /** * The object kind. */ readonly kind: "validation"; /** * The validation type. */ readonly type: string; /** * The validation reference. */ readonly reference: (...args: any[]) => BaseValidation>; /** * The expected property. */ readonly expects: string | null; /** * Whether it's async. */ readonly async: false; /** * Validates known input values. * * @param dataset The input dataset. * @param config The configuration. * * @returns The output dataset. * * @internal */ readonly "~run": (dataset: OutputDataset>, config: Config>) => OutputDataset | TIssue>; /** * The input, output and issue type. * * @internal */ readonly "~types"?: { readonly input: TInput$1; readonly output: TOutput$1; readonly issue: TIssue; } | undefined; } /** * Base validation async interface. */ interface BaseValidationAsync> extends Omit, "reference" | "async" | "~run"> { /** * The validation reference. */ readonly reference: (...args: any[]) => BaseValidation> | BaseValidationAsync>; /** * Whether it's async. */ readonly async: true; /** * Validates known input values. * * @param dataset The input dataset. * @param config The configuration. * * @returns The output dataset. * * @internal */ readonly "~run": (dataset: OutputDataset>, config: Config>) => Promise | TIssue>>; } //#endregion //#region src/types/infer.d.ts /** * Infer input type. */ type InferInput> | BaseSchemaAsync> | BaseValidation> | BaseValidationAsync> | BaseTransformation> | BaseTransformationAsync> | BaseMetadata> = NonNullable["input"]; /** * Infer output type. */ type InferOutput> | BaseSchemaAsync> | BaseValidation> | BaseValidationAsync> | BaseTransformation> | BaseTransformationAsync> | BaseMetadata> = NonNullable["output"]; /** * Infer issue type. */ type InferIssue> | BaseSchemaAsync> | BaseValidation> | BaseValidationAsync> | BaseTransformation> | BaseTransformationAsync> | BaseMetadata> = NonNullable["issue"]; /** * Constructs a type that is maybe readonly. */ type MaybeReadonly = TValue$1 | Readonly; /** * Constructs a type that is deeply readonly. */ type DeepReadonly = TValue$1 extends Record | readonly unknown[] ? { readonly [TKey in keyof TValue$1]: DeepReadonly } : TValue$1; /** * Constructs a type that is maybe deeply readonly. */ type MaybeDeepReadonly = TValue$1 | DeepReadonly; /** * Constructs a type that is maybe a promise. */ type MaybePromise = TValue$1 | Promise; /** * Prettifies a type for better readability. * * Hint: This type has no effect and is only used so that TypeScript displays * the final type in the preview instead of the utility types used. */ type Prettify = { [TKey in keyof TObject]: TObject[TKey] } & {}; /** * Marks specific keys as optional. */ type MarkOptional = { [TKey in keyof TObject]?: unknown } & Omit & Partial>; //#endregion //#region src/types/other.d.ts /** * Error message type. */ type ErrorMessage> = ((issue: TIssue) => string) | string; /** * Default type. */ type Default>, TInput$1 extends null | undefined> = MaybeDeepReadonly | TInput$1> | ((dataset?: UnknownDataset, config?: Config>) => MaybeDeepReadonly | TInput$1>) | undefined; /** * Default async type. */ type DefaultAsync> | BaseSchemaAsync>, TInput$1 extends null | undefined> = MaybeDeepReadonly | TInput$1> | ((dataset?: UnknownDataset, config?: Config>) => MaybePromise | TInput$1>>) | undefined; /** * Default value type. */ type DefaultValue>, null | undefined> | DefaultAsync> | BaseSchemaAsync>, null | undefined>> = TDefault extends DefaultAsync> | BaseSchemaAsync>, infer TInput> ? TDefault extends ((dataset?: UnknownDataset, config?: Config>) => MaybePromise | TInput>>) ? Awaited> : TDefault : never; //#endregion //#region src/types/object.d.ts /** * Optional entry schema type. */ type OptionalEntrySchema = ExactOptionalSchema>, unknown> | NullishSchema>, unknown> | OptionalSchema>, unknown>; /** * Optional entry schema async type. */ type OptionalEntrySchemaAsync = ExactOptionalSchemaAsync> | BaseSchemaAsync>, unknown> | NullishSchemaAsync> | BaseSchemaAsync>, unknown> | OptionalSchemaAsync> | BaseSchemaAsync>, unknown>; /** * Object entries interface. */ interface ObjectEntries { [key: string]: BaseSchema> | SchemaWithFallback>, unknown> | OptionalEntrySchema; } /** * Object entries async interface. */ interface ObjectEntriesAsync { [key: string]: BaseSchema> | BaseSchemaAsync> | SchemaWithFallback>, unknown> | SchemaWithFallbackAsync> | BaseSchemaAsync>, unknown> | OptionalEntrySchema | OptionalEntrySchemaAsync; } /** * Infer entries input type. */ type InferEntriesInput = { -readonly [TKey in keyof TEntries$1]: InferInput }; /** * Infer entries output type. */ type InferEntriesOutput = { -readonly [TKey in keyof TEntries$1]: InferOutput }; /** * Optional input keys type. */ type OptionalInputKeys = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? TKey : never }[keyof TEntries$1]; /** * Optional output keys type. */ type OptionalOutputKeys = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? undefined extends TEntries$1[TKey]["default"] ? TKey : never : never }[keyof TEntries$1]; /** * Input with question marks type. */ type InputWithQuestionMarks> = MarkOptional>; /** * Output with question marks type. */ type OutputWithQuestionMarks> = MarkOptional>; /** * Readonly output keys type. */ type ReadonlyOutputKeys = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends { readonly pipe: readonly unknown[]; } ? ReadonlyAction extends TEntries$1[TKey]["pipe"][number] ? TKey : never : never }[keyof TEntries$1]; /** * Output with readonly type. */ type OutputWithReadonly>> = ReadonlyOutputKeys extends never ? TObject : Readonly & Pick>>; /** * Infer object input type. */ type InferObjectInput = Prettify>>; /** * Infer object output type. */ type InferObjectOutput = Prettify>>>; /** * Infer object issue type. */ type InferObjectIssue = InferIssue; //#endregion //#region src/types/issue.d.ts /** * Array path item interface. */ interface ArrayPathItem { /** * The path item type. */ readonly type: "array"; /** * The path item origin. */ readonly origin: "value"; /** * The path item input. */ readonly input: MaybeReadonly; /** * The path item key. */ readonly key: number; /** * The path item value. */ readonly value: unknown; } /** * Map path item interface. */ interface MapPathItem { /** * The path item type. */ readonly type: "map"; /** * The path item origin. */ readonly origin: "key" | "value"; /** * The path item input. */ readonly input: Map; /** * The path item key. */ readonly key: unknown; /** * The path item value. */ readonly value: unknown; } /** * Object path item interface. */ interface ObjectPathItem { /** * The path item type. */ readonly type: "object"; /** * The path item origin. */ readonly origin: "key" | "value"; /** * The path item input. */ readonly input: Record; /** * The path item key. */ readonly key: string; /** * The path item value. */ readonly value: unknown; } /** * Set path item interface. */ interface SetPathItem { /** * The path item type. */ readonly type: "set"; /** * The path item origin. */ readonly origin: "value"; /** * The path item input. */ readonly input: Set; /** * The path item key. */ readonly key: null; /** * The path item key. */ readonly value: unknown; } /** * Unknown path item interface. */ interface UnknownPathItem { /** * The path item type. */ readonly type: "unknown"; /** * The path item origin. */ readonly origin: "key" | "value"; /** * The path item input. */ readonly input: unknown; /** * The path item key. */ readonly key: unknown; /** * The path item value. */ readonly value: unknown; } /** * Issue path item type. */ type IssuePathItem = ArrayPathItem | MapPathItem | ObjectPathItem | SetPathItem | UnknownPathItem; /** * Base issue interface. */ interface BaseIssue extends Config> { /** * The issue kind. */ readonly kind: "schema" | "validation" | "transformation"; /** * The issue type. */ readonly type: string; /** * The raw input data. */ readonly input: TInput$1; /** * The expected property. */ readonly expected: string | null; /** * The received property. */ readonly received: string; /** * The error message. */ readonly message: string; /** * The input requirement. */ readonly requirement?: unknown | undefined; /** * The issue path. */ readonly path?: [IssuePathItem, ...IssuePathItem[]] | undefined; /** * The sub issues. */ readonly issues?: [BaseIssue, ...BaseIssue[]] | undefined; } //#endregion //#region src/types/config.d.ts /** * Config interface. */ interface Config> { /** * The selected language. */ readonly lang?: string | undefined; /** * The error message. */ readonly message?: ErrorMessage | undefined; /** * Whether it should be aborted early. */ readonly abortEarly?: boolean | undefined; /** * Whether a pipe should be aborted early. */ readonly abortPipeEarly?: boolean | undefined; } //#endregion //#region src/schemas/array/types.d.ts /** * Array issue interface. */ interface ArrayIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "array"; /** * The expected property. */ readonly expected: "Array"; } //#endregion //#region src/schemas/array/array.d.ts /** * Array schema interface. */ interface ArraySchema>, TMessage extends ErrorMessage | undefined> extends BaseSchema[], InferOutput[], ArrayIssue | InferIssue> { /** * The schema type. */ readonly type: "array"; /** * The schema reference. */ readonly reference: typeof array; /** * The expected property. */ readonly expects: "Array"; /** * The array item schema. */ readonly item: TItem$1; /** * The error message. */ readonly message: TMessage; } /** * Creates an array schema. * * @param item The item schema. * * @returns An array schema. */ declare function array>>(item: TItem$1): ArraySchema; /** * Creates an array schema. * * @param item The item schema. * @param message The error message. * * @returns An array schema. */ declare function array>, const TMessage extends ErrorMessage | undefined>(item: TItem$1, message: TMessage): ArraySchema; //#endregion //#region src/schemas/custom/types.d.ts /** * Custom issue interface. */ interface CustomIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "custom"; /** * The expected property. */ readonly expected: "unknown"; } //#endregion //#region src/schemas/custom/custom.d.ts /** * Check type. */ type Check = (input: unknown) => boolean; /** * Custom schema interface. */ interface CustomSchema | undefined> extends BaseSchema { /** * The schema type. */ readonly type: "custom"; /** * The schema reference. */ readonly reference: typeof custom; /** * The expected property. */ readonly expects: "unknown"; /** * The type check function. */ readonly check: Check; /** * The error message. */ readonly message: TMessage; } /** * Creates a custom schema. * * @param check The type check function. * * @returns A custom schema. */ declare function custom(check: Check): CustomSchema; /** * Creates a custom schema. * * @param check The type check function. * @param message The error message. * * @returns A custom schema. */ declare function custom | undefined = ErrorMessage | undefined>(check: Check, message: TMessage): CustomSchema; //#endregion //#region src/schemas/exactOptional/exactOptional.d.ts /** * Exact optional schema interface. */ interface ExactOptionalSchema>, TDefault extends Default> extends BaseSchema, InferOutput, InferIssue> { /** * The schema type. */ readonly type: "exact_optional"; /** * The schema reference. */ readonly reference: typeof exactOptional; /** * The expected property. */ readonly expects: TWrapped$1["expects"]; /** * The wrapped schema. */ readonly wrapped: TWrapped$1; /** * The default value. */ readonly default: TDefault; } /** * Creates an exact optional schema. * * @param wrapped The wrapped schema. * * @returns An exact optional schema. */ declare function exactOptional>>(wrapped: TWrapped$1): ExactOptionalSchema; /** * Creates an exact optional schema. * * @param wrapped The wrapped schema. * @param default_ The default value. * * @returns An exact optional schema. */ declare function exactOptional>, const TDefault extends Default>(wrapped: TWrapped$1, default_: TDefault): ExactOptionalSchema; //#endregion //#region src/schemas/exactOptional/exactOptionalAsync.d.ts /** * Exact optional schema async interface. */ interface ExactOptionalSchemaAsync> | BaseSchemaAsync>, TDefault extends DefaultAsync> extends BaseSchemaAsync, InferOutput, InferIssue> { /** * The schema type. */ readonly type: "exact_optional"; /** * The schema reference. */ readonly reference: typeof exactOptional | typeof exactOptionalAsync; /** * The expected property. */ readonly expects: TWrapped$1["expects"]; /** * The wrapped schema. */ readonly wrapped: TWrapped$1; /** * The default value. */ readonly default: TDefault; } /** * Creates an exact optional schema. * * @param wrapped The wrapped schema. * * @returns An exact optional schema. */ declare function exactOptionalAsync> | BaseSchemaAsync>>(wrapped: TWrapped$1): ExactOptionalSchemaAsync; /** * Creates an exact optional schema. * * @param wrapped The wrapped schema. * @param default_ The default value. * * @returns An exact optional schema. */ declare function exactOptionalAsync> | BaseSchemaAsync>, const TDefault extends DefaultAsync>(wrapped: TWrapped$1, default_: TDefault): ExactOptionalSchemaAsync; //#endregion //#region src/schemas/looseObject/types.d.ts /** * Loose object issue interface. */ interface LooseObjectIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "loose_object"; /** * The expected property. */ readonly expected: "Object" | `"${string}"`; } //#endregion //#region src/schemas/looseObject/looseObject.d.ts /** * Loose object schema interface. */ interface LooseObjectSchema | undefined> extends BaseSchema & { [key: string]: unknown; }, InferObjectOutput & { [key: string]: unknown; }, LooseObjectIssue | InferObjectIssue> { /** * The schema type. */ readonly type: "loose_object"; /** * The schema reference. */ readonly reference: typeof looseObject; /** * The expected property. */ readonly expects: "Object"; /** * The entries schema. */ readonly entries: TEntries$1; /** * The error message. */ readonly message: TMessage; } /** * Creates a loose object schema. * * @param entries The entries schema. * * @returns A loose object schema. */ declare function looseObject(entries: TEntries$1): LooseObjectSchema; /** * Creates a loose object schema. * * @param entries The entries schema. * @param message The error message. * * @returns A loose object schema. */ declare function looseObject | undefined>(entries: TEntries$1, message: TMessage): LooseObjectSchema; //#endregion //#region src/schemas/nullish/types.d.ts /** * Infer nullish output type. */ type InferNullishOutput> | BaseSchemaAsync>, TDefault extends DefaultAsync> = undefined extends TDefault ? InferOutput | null | undefined : InferOutput | Extract, null | undefined>; //#endregion //#region src/schemas/nullish/nullish.d.ts /** * Nullish schema interface. */ interface NullishSchema>, TDefault extends Default> extends BaseSchema | null | undefined, InferNullishOutput, InferIssue> { /** * The schema type. */ readonly type: "nullish"; /** * The schema reference. */ readonly reference: typeof nullish; /** * The expected property. */ readonly expects: `(${TWrapped$1["expects"]} | null | undefined)`; /** * The wrapped schema. */ readonly wrapped: TWrapped$1; /** * The default value. */ readonly default: TDefault; } /** * Creates a nullish schema. * * @param wrapped The wrapped schema. * * @returns A nullish schema. */ declare function nullish>>(wrapped: TWrapped$1): NullishSchema; /** * Creates a nullish schema. * * @param wrapped The wrapped schema. * @param default_ The default value. * * @returns A nullish schema. */ declare function nullish>, const TDefault extends Default>(wrapped: TWrapped$1, default_: TDefault): NullishSchema; //#endregion //#region src/schemas/nullish/nullishAsync.d.ts /** * Nullish schema async interface. */ interface NullishSchemaAsync> | BaseSchemaAsync>, TDefault extends DefaultAsync> extends BaseSchemaAsync | null | undefined, InferNullishOutput, InferIssue> { /** * The schema type. */ readonly type: "nullish"; /** * The schema reference. */ readonly reference: typeof nullish | typeof nullishAsync; /** * The expected property. */ readonly expects: `(${TWrapped$1["expects"]} | null | undefined)`; /** * The wrapped schema. */ readonly wrapped: TWrapped$1; /** * The default value. */ readonly default: TDefault; } /** * Creates a nullish schema. * * @param wrapped The wrapped schema. * * @returns A nullish schema. */ declare function nullishAsync> | BaseSchemaAsync>>(wrapped: TWrapped$1): NullishSchemaAsync; /** * Creates a nullish schema. * * @param wrapped The wrapped schema. * @param default_ The default value. * * @returns A nullish schema. */ declare function nullishAsync> | BaseSchemaAsync>, const TDefault extends DefaultAsync>(wrapped: TWrapped$1, default_: TDefault): NullishSchemaAsync; //#endregion //#region src/schemas/object/types.d.ts /** * Object issue interface. */ interface ObjectIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "object"; /** * The expected property. */ readonly expected: "Object" | `"${string}"`; } //#endregion //#region src/schemas/object/object.d.ts /** * Object schema interface. */ interface ObjectSchema | undefined> extends BaseSchema, InferObjectOutput, ObjectIssue | InferObjectIssue> { /** * The schema type. */ readonly type: "object"; /** * The schema reference. */ readonly reference: typeof object; /** * The expected property. */ readonly expects: "Object"; /** * The entries schema. */ readonly entries: TEntries$1; /** * The error message. */ readonly message: TMessage; } /** * Creates an object schema. * * Hint: This schema removes unknown entries. The output will only include the * entries you specify. To include unknown entries, use `looseObject`. To * return an issue for unknown entries, use `strictObject`. To include and * validate unknown entries, use `objectWithRest`. * * @param entries The entries schema. * * @returns An object schema. */ declare function object(entries: TEntries$1): ObjectSchema; /** * Creates an object schema. * * Hint: This schema removes unknown entries. The output will only include the * entries you specify. To include unknown entries, use `looseObject`. To * return an issue for unknown entries, use `strictObject`. To include and * validate unknown entries, use `objectWithRest`. * * @param entries The entries schema. * @param message The error message. * * @returns An object schema. */ declare function object | undefined>(entries: TEntries$1, message: TMessage): ObjectSchema; //#endregion //#region src/schemas/optional/types.d.ts /** * Infer optional output type. */ type InferOptionalOutput> | BaseSchemaAsync>, TDefault extends DefaultAsync> = undefined extends TDefault ? InferOutput | undefined : InferOutput | Extract, undefined>; //#endregion //#region src/schemas/optional/optional.d.ts /** * Optional schema interface. */ interface OptionalSchema>, TDefault extends Default> extends BaseSchema | undefined, InferOptionalOutput, InferIssue> { /** * The schema type. */ readonly type: "optional"; /** * The schema reference. */ readonly reference: typeof optional; /** * The expected property. */ readonly expects: `(${TWrapped$1["expects"]} | undefined)`; /** * The wrapped schema. */ readonly wrapped: TWrapped$1; /** * The default value. */ readonly default: TDefault; } /** * Creates an optional schema. * * @param wrapped The wrapped schema. * * @returns An optional schema. */ declare function optional>>(wrapped: TWrapped$1): OptionalSchema; /** * Creates an optional schema. * * @param wrapped The wrapped schema. * @param default_ The default value. * * @returns An optional schema. */ declare function optional>, const TDefault extends Default>(wrapped: TWrapped$1, default_: TDefault): OptionalSchema; //#endregion //#region src/schemas/optional/optionalAsync.d.ts /** * Optional schema async interface. */ interface OptionalSchemaAsync> | BaseSchemaAsync>, TDefault extends DefaultAsync> extends BaseSchemaAsync | undefined, InferOptionalOutput, InferIssue> { /** * The schema type. */ readonly type: "optional"; /** * The schema reference. */ readonly reference: typeof optional | typeof optionalAsync; /** * The expected property. */ readonly expects: `(${TWrapped$1["expects"]} | undefined)`; /** * The wrapped schema. */ readonly wrapped: TWrapped$1; /** * The default value. */ readonly default: TDefault; } /** * Creates an optional schema. * * @param wrapped The wrapped schema. * * @returns An optional schema. */ declare function optionalAsync> | BaseSchemaAsync>>(wrapped: TWrapped$1): OptionalSchemaAsync; /** * Creates an optional schema. * * @param wrapped The wrapped schema. * @param default_ The default value. * * @returns An optional schema. */ declare function optionalAsync> | BaseSchemaAsync>, const TDefault extends DefaultAsync>(wrapped: TWrapped$1, default_: TDefault): OptionalSchemaAsync; //#endregion //#region src/schemas/record/types.d.ts /** * Record issue interface. */ interface RecordIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "record"; /** * The expected property. */ readonly expected: "Object"; } /** * Is literal type. */ type IsLiteral = string extends TKey$1 ? false : number extends TKey$1 ? false : symbol extends TKey$1 ? false : TKey$1 extends Brand ? false : true; /** * Optional keys type. */ type OptionalKeys> = { [TKey in keyof TObject]: IsLiteral extends true ? TKey : never }[keyof TObject]; /** * With question marks type. * * Hint: We mark an entry as optional if we detect that its key is a literal * type. The reason for this is that it is not technically possible to detect * missing literal keys without restricting the key schema to `string`, `enum` * and `picklist`. However, if `enum` and `picklist` are used, it is better to * use `object` with `entriesFromList` because it already covers the needed * functionality. This decision also reduces the bundle size of `record`, * because it only needs to check the entries of the input and not any missing * keys. */ type WithQuestionMarks> = MarkOptional>; /** * With readonly type. */ type WithReadonly> | BaseSchemaAsync>, TObject extends WithQuestionMarks>> = TValue$1 extends { readonly pipe: readonly unknown[]; } ? ReadonlyAction extends TValue$1["pipe"][number] ? Readonly : TObject : TObject; /** * Infer record input type. */ type InferRecordInput> | BaseSchemaAsync>, TValue$1 extends BaseSchema> | BaseSchemaAsync>> = Prettify, InferInput>>>; /** * Infer record output type. */ type InferRecordOutput> | BaseSchemaAsync>, TValue$1 extends BaseSchema> | BaseSchemaAsync>> = Prettify, InferOutput>>>>; //#endregion //#region src/schemas/record/record.d.ts /** * Record schema interface. */ interface RecordSchema>, TValue$1 extends BaseSchema>, TMessage extends ErrorMessage | undefined> extends BaseSchema, InferRecordOutput, RecordIssue | InferIssue | InferIssue> { /** * The schema type. */ readonly type: "record"; /** * The schema reference. */ readonly reference: typeof record; /** * The expected property. */ readonly expects: "Object"; /** * The record key schema. */ readonly key: TKey$1; /** * The record value schema. */ readonly value: TValue$1; /** * The error message. */ readonly message: TMessage; } /** * Creates a record schema. * * @param key The key schema. * @param value The value schema. * * @returns A record schema. */ declare function record>, const TValue$1 extends BaseSchema>>(key: TKey$1, value: TValue$1): RecordSchema; /** * Creates a record schema. * * @param key The key schema. * @param value The value schema. * @param message The error message. * * @returns A record schema. */ declare function record>, const TValue$1 extends BaseSchema>, const TMessage extends ErrorMessage | undefined>(key: TKey$1, value: TValue$1, message: TMessage): RecordSchema; //#endregion //#region src/schemas/string/string.d.ts /** * String issue interface. */ interface StringIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "string"; /** * The expected property. */ readonly expected: "string"; } /** * String schema interface. */ interface StringSchema | undefined> extends BaseSchema { /** * The schema type. */ readonly type: "string"; /** * The schema reference. */ readonly reference: typeof string; /** * The expected property. */ readonly expects: "string"; /** * The error message. */ readonly message: TMessage; } /** * Creates a string schema. * * @returns A string schema. */ declare function string(): StringSchema; /** * Creates a string schema. * * @param message The error message. * * @returns A string schema. */ declare function string | undefined>(message: TMessage): StringSchema; //#endregion //#region src/schemas/undefined/undefined.d.ts /** * Undefined issue interface. */ interface UndefinedIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "undefined"; /** * The expected property. */ readonly expected: "undefined"; } /** * Undefined schema interface. */ interface UndefinedSchema | undefined> extends BaseSchema { /** * The schema type. */ readonly type: "undefined"; /** * The schema reference. */ readonly reference: typeof undefined_; /** * The expected property. */ readonly expects: "undefined"; /** * The error message. */ readonly message: TMessage; } /** * Creates an undefined schema. * * @returns An undefined schema. */ declare function undefined_(): UndefinedSchema; /** * Creates an undefined schema. * * @param message The error message. * * @returns An undefined schema. */ declare function undefined_ | undefined>(message: TMessage): UndefinedSchema; //#endregion //#region src/schemas/void/void.d.ts /** * Void issue interface. */ interface VoidIssue extends BaseIssue { /** * The issue kind. */ readonly kind: "schema"; /** * The issue type. */ readonly type: "void"; /** * The expected property. */ readonly expected: "void"; } /** * Void schema interface. */ interface VoidSchema | undefined> extends BaseSchema { /** * The schema type. */ readonly type: "void"; /** * The schema reference. */ readonly reference: typeof void_; /** * The expected property. */ readonly expects: "void"; /** * The error message. */ readonly message: TMessage; } /** * Creates a void schema. * * @returns A void schema. */ declare function void_(): VoidSchema; /** * Creates a void schema. * * @param message The error message. * * @returns A void schema. */ declare function void_ | undefined>(message: TMessage): VoidSchema; //#endregion //#region src/actions/brand/brand.d.ts /** * Brand symbol. */ declare const BrandSymbol: unique symbol; /** * Brand name type. */ type BrandName = string | number | symbol; /** * Brand interface. */ interface Brand { [BrandSymbol]: { [TValue in TName]: TValue }; } //#endregion //#region src/actions/readonly/readonly.d.ts /** * Readonly output type. */ type ReadonlyOutput = TInput$1 extends Map ? ReadonlyMap : TInput$1 extends Set ? ReadonlySet : Readonly; /** * Readonly action interface. */ interface ReadonlyAction extends BaseTransformation, never> { /** * The action type. */ readonly type: "readonly"; /** * The action reference. */ readonly reference: typeof readonly; } /** * Creates a readonly transformation action. * * @returns A readonly action. */ declare function readonly(): ReadonlyAction; /** Free-form error attached to a payload or subcomponent. */ interface DocgenError { name: string; message: string; } /** Compact JSDoc tag map: tag name → list of tag values (e.g. `@example a` → `{ example: ['a'] }`). */ type DocgenJsDocTags = Record; /** * Docgen payload returned by `core/docgen`'s `docgen` query. * * Component-only fields (props, descriptions, subcomponents). Story snippets and file-level * imports live in `core/story-docs` when `experimentalDocgenServer` is enabled. */ interface DocgenPayload { id: string; name: string; /** CSF story file import path from the index entry (same as component manifest `path`). */ path: string; description?: string; summary?: string; jsDocTags: DocgenJsDocTags; /** Renderer-converted argTypes derived from integration-specific docgen data at write time. */ argTypes?: StrictArgTypes$2; subcomponents?: Record; error?: DocgenError; [key: string]: unknown; } /** Component-level summary + docgen for one subcomponent. */ interface DocgenSubcomponent { name: string; path: string; description?: string; summary?: string; import?: string; jsDocTags: DocgenJsDocTags; /** Renderer-converted argTypes derived from integration-specific docgen data at write time. */ argTypes?: StrictArgTypes$2; error?: DocgenError; [key: string]: unknown; } /** Free-form error attached to a story snippet entry. */ interface StoryDocsError { name: string; message: string; } /** Snippet + metadata for one story under a component. */ interface StoryDoc { id: string; name: string; snippet?: string; description?: string; summary?: string; error?: StoryDocsError; } /** Story docs keyed by story id for O(1) lookup and fine-grained open-service subscriptions. */ type StoryDocsById = Record; /** * Story-docs payload returned by `core/story-docs`'s `storyDocs` query. * * Carries per-story snippets and descriptions plus file-level import statements. Import snippets * do not currently honor the component `@import` JSDoc override tag — see the story-docs service * README for details. */ interface StoryDocsPayload { id: string; name: string; /** CSF story file import path from the index entry. */ path: string; /** Suggested import statement(s) prepended to story snippets in docs. */ import?: string; stories: StoryDocsById; error?: StoryDocsError; } type StoryDocsServiceState = { /** Extracted story docs keyed by component id. Populated by the `extractStoryDocs` command. */ components: Record; }; interface SBBaseType { required?: boolean; raw?: string; } type SBScalarType = SBBaseType & { name: 'boolean' | 'string' | 'number' | 'function' | 'symbol' | 'date'; }; type SBArrayType = SBBaseType & { name: 'array'; value: SBType; }; type SBNodeType = SBBaseType & { name: 'node'; renderer: string; }; type SBObjectType = SBBaseType & { name: 'object'; value: Record; }; type SBEnumType = SBBaseType & { name: 'enum'; value: (string | number)[]; }; type SBIntersectionType = SBBaseType & { name: 'intersection'; value: SBType[]; }; type SBUnionType = SBBaseType & { name: 'union'; value: SBType[]; }; type SBLiteralType = SBBaseType & { name: 'literal'; value: unknown; }; type SBTupleType = SBBaseType & { name: 'tuple'; value: SBType[]; }; type SBOtherType = SBBaseType & { name: 'other'; value: string; }; type SBType = SBScalarType | SBEnumType | SBArrayType | SBNodeType | SBObjectType | SBIntersectionType | SBUnionType | SBLiteralType | SBTupleType | SBOtherType; type ControlType = 'object' | 'boolean' | 'check' | 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select' | 'number' | 'range' | 'file' | 'color' | 'date' | 'text'; type ConditionalTest = { truthy?: boolean; } | { exists: boolean; } | { eq: any; } | { neq: any; }; type ConditionalValue = { arg: string; } | { global: string; }; type Conditional = ConditionalValue & ConditionalTest; interface ControlBase { [key: string]: any; /** @see https://storybook.js.org/docs/api/arg-types#controltype */ type?: ControlType; disable?: boolean; } type Control = ControlType | false | (ControlBase & (ControlBase | { type: 'color'; /** @see https://storybook.js.org/docs/api/arg-types#controlpresetcolors */ presetColors?: string[]; } | { type: 'file'; /** @see https://storybook.js.org/docs/api/arg-types#controlaccept */ accept?: string; } | { type: 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select'; /** @see https://storybook.js.org/docs/api/arg-types#controllabels */ labels?: { [options: string]: string; }; } | { type: 'number' | 'range'; /** @see https://storybook.js.org/docs/api/arg-types#controlmax */ max?: number; /** @see https://storybook.js.org/docs/api/arg-types#controlmin */ min?: number; /** @see https://storybook.js.org/docs/api/arg-types#controlstep */ step?: number; })); interface InputType { /** @see https://storybook.js.org/docs/api/arg-types#control */ control?: Control; /** @see https://storybook.js.org/docs/api/arg-types#description */ description?: string; /** @see https://storybook.js.org/docs/api/arg-types#if */ if?: Conditional; /** @see https://storybook.js.org/docs/api/arg-types#mapping */ mapping?: { [key: string]: any; }; /** @see https://storybook.js.org/docs/api/arg-types#name */ name?: string; /** @see https://storybook.js.org/docs/api/arg-types#options */ options?: readonly any[]; /** @see https://storybook.js.org/docs/api/arg-types#table */ table?: { [key: string]: unknown; /** @see https://storybook.js.org/docs/api/arg-types#tablecategory */ category?: string; /** @see https://storybook.js.org/docs/api/arg-types#tabledefaultvalue */ defaultValue?: { summary?: string | undefined; detail?: string | undefined; }; /** @see https://storybook.js.org/docs/api/arg-types#tabledisable */ disable?: boolean; /** @see https://storybook.js.org/docs/api/arg-types#tablesubcategory */ subcategory?: string; /** @see https://storybook.js.org/docs/api/arg-types#tabletype */ type?: { summary?: string | undefined; detail?: string | undefined; }; }; /** @see https://storybook.js.org/docs/api/arg-types#type */ type?: SBType | SBScalarType['name']; /** * @deprecated Use `table.defaultValue.summary` instead. * @see https://storybook.js.org/docs/api/arg-types#defaultvalue */ defaultValue?: any; [key: string]: any; } interface StrictInputType extends InputType { name: string; type?: SBType; } interface Args { [name: string]: any; } type StrictArgTypes = { [name in keyof TArgs]: StrictInputType; }; declare const previewCoreServiceDefs: (ServiceDefinition; }, undefined>, OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, { readonly extractStoryDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllStoryDocs: UndefinedSchema; }, { readonly extractStoryDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly extractAllStoryDocs: VoidSchema; }, QueryFunctions<{ readonly storyDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly storyDocsForAllComponents: VoidSchema; }, { readonly storyDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly storyDocsForAllComponents: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"storyDocs\" has internal: true but must be prefixed with \"_\""; }); readonly storyDocsForAllComponents: QueryDefinition, RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, { readonly extractStoryDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllStoryDocs: UndefinedSchema; }, { readonly extractStoryDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly extractAllStoryDocs: VoidSchema; }, QueryFunctions<{ readonly storyDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly storyDocsForAllComponents: VoidSchema; }, { readonly storyDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly storyDocsForAllComponents: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"storyDocsForAllComponents\" has internal: true but must be prefixed with \"_\""; }); } & { readonly storyDocs: { output: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; }; readonly storyDocsForAllComponents: { output: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; }; }, { readonly extractStoryDocs: CommandDefinition; }, undefined>, OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, { readonly extractStoryDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllStoryDocs: UndefinedSchema; }, { readonly extractStoryDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly extractAllStoryDocs: VoidSchema; }, QueryFunctions<{ readonly storyDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly storyDocsForAllComponents: VoidSchema; }, { readonly storyDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly storyDocsForAllComponents: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"extractStoryDocs\" has internal: true but must be prefixed with \"_\""; }); readonly extractAllStoryDocs: CommandDefinition, VoidSchema, { readonly extractStoryDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllStoryDocs: UndefinedSchema; }, { readonly extractStoryDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly extractAllStoryDocs: VoidSchema; }, QueryFunctions<{ readonly storyDocs: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly storyDocsForAllComponents: VoidSchema; }, { readonly storyDocs: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly storyDocsForAllComponents: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"extractAllStoryDocs\" has internal: true but must be prefixed with \"_\""; }); } & { readonly extractStoryDocs: { output: OptionalSchema; readonly name: StringSchema; readonly path: StringSchema; readonly import: OptionalSchema, undefined>; readonly stories: RecordSchema, ObjectSchema<{ readonly id: StringSchema; readonly name: StringSchema; readonly snippet: OptionalSchema, undefined>; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>; }; readonly extractAllStoryDocs: { output: VoidSchema; }; }, "core/story-docs"> | ServiceDefinition<{ components: Record; }, { readonly docgen: QueryDefinition<{ components: Record; }, ObjectSchema<{ readonly id: StringSchema; }, undefined>, OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>, { readonly extractDocgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllDocgen: UndefinedSchema; }, { readonly extractDocgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly extractAllDocgen: VoidSchema; }, QueryFunctions<{ readonly docgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly docgenForAllComponents: VoidSchema; }, { readonly docgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly docgenForAllComponents: RecordSchema, LooseObjectSchema<{ readonly subcomponents: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"docgen\" has internal: true but must be prefixed with \"_\""; }); readonly docgenForAllComponents: QueryDefinition<{ components: Record; }, VoidSchema, RecordSchema, LooseObjectSchema<{ readonly subcomponents: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>, { readonly extractDocgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllDocgen: UndefinedSchema; }, { readonly extractDocgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly extractAllDocgen: VoidSchema; }, QueryFunctions<{ readonly docgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly docgenForAllComponents: VoidSchema; }, { readonly docgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly docgenForAllComponents: RecordSchema, LooseObjectSchema<{ readonly subcomponents: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"docgenForAllComponents\" has internal: true but must be prefixed with \"_\""; }); } & { readonly docgen: { output: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; }; readonly docgenForAllComponents: { output: RecordSchema, LooseObjectSchema<{ readonly subcomponents: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; }; }, { readonly extractDocgen: CommandDefinition<{ components: Record; }, ObjectSchema<{ readonly id: StringSchema; }, undefined>, OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>, { readonly extractDocgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllDocgen: UndefinedSchema; }, { readonly extractDocgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly extractAllDocgen: VoidSchema; }, QueryFunctions<{ readonly docgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly docgenForAllComponents: VoidSchema; }, { readonly docgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly docgenForAllComponents: RecordSchema, LooseObjectSchema<{ readonly subcomponents: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"extractDocgen\" has internal: true but must be prefixed with \"_\""; }); readonly extractAllDocgen: CommandDefinition<{ components: Record; }, UndefinedSchema, VoidSchema, { readonly extractDocgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly extractAllDocgen: UndefinedSchema; }, { readonly extractDocgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly extractAllDocgen: VoidSchema; }, QueryFunctions<{ readonly docgen: ObjectSchema<{ readonly id: StringSchema; }, undefined>; readonly docgenForAllComponents: VoidSchema; }, { readonly docgen: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; readonly docgenForAllComponents: RecordSchema, LooseObjectSchema<{ readonly subcomponents: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; }>> & ({ internal?: false; } | { __internal_naming_error: "Operation \"extractAllDocgen\" has internal: true but must be prefixed with \"_\""; }); } & { readonly extractDocgen: { output: OptionalSchema, LooseObjectSchema<{ import: OptionalSchema, undefined>; name: StringSchema; path: StringSchema; description: OptionalSchema, undefined>; summary: OptionalSchema, undefined>; jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; argTypes: OptionalSchema, undefined>, undefined>; error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; }, undefined>, undefined>, undefined>; readonly name: StringSchema; readonly path: StringSchema; readonly description: OptionalSchema, undefined>; readonly summary: OptionalSchema, undefined>; readonly jsDocTags: RecordSchema, ArraySchema, undefined>, undefined>; readonly argTypes: OptionalSchema, undefined>, undefined>; readonly error: OptionalSchema; readonly message: StringSchema; }, undefined>, undefined>; readonly id: StringSchema; }, undefined>, undefined>; }; readonly extractAllDocgen: { output: VoidSchema; }; }, "core/docgen">)[]; /** Maps a list of service definitions to `{ [id]: instance }`, keyed by each definition's id. */ type CoreServices = { [Def in TDefs[number] as Def['id']]: ServiceInstanceOf; }; /** Core services registered in the preview. */ type PreviewCoreServices = CoreServices; /** Module-level `getService` overloads keyed by a per-runtime core-service map. */ interface TypedGetService { (serviceId: K): TMap[K]; (serviceId: ServiceId): TInstance; } /** System tags used throughout Storybook for categorizing and filtering stories and docs entries. */ declare const Tag: { /** Indicates that autodocs should be generated for this component */ readonly AUTODOCS: "autodocs"; /** MDX documentation attached to a component's stories file */ readonly ATTACHED_MDX: "attached-mdx"; /** Standalone MDX documentation not attached to stories */ readonly UNATTACHED_MDX: "unattached-mdx"; /** Story has a play function */ readonly PLAY_FN: "play-fn"; /** Story has a test function */ readonly TEST_FN: "test-fn"; /** Development environment tag */ readonly DEV: "dev"; /** Test environment tag */ readonly TEST: "test"; /** Manifest generation tag */ readonly MANIFEST: "manifest"; }; /** * Tags can be any string, including custom user-defined tags. The Tag constant above defines the * system tags used by Storybook. */ type Tag = string; /** * Preview-side entrypoint for the open-service architecture. * * Import from here in preview (renderer) code. This entrypoint is intentionally renderer-agnostic — * it exposes only registration with no React dependencies. Use `.subscribe()` on queries to react * to state changes in your renderer. * * Define services with `storybook/open-service`. The manager entrypoint (`./manager.ts`) adds * `useServiceQuery` and `useServiceCommand` on top of relay registration. * * Quick start: * * ```ts * import { registerService } from 'storybook/preview-api'; * * const service = registerService(myServiceDef); * * service.queries.color.subscribe(undefined, ({ data }) => { * document.body.style.background = data ?? 'transparent'; * }); * ``` */ declare const getService: TypedGetService; /** * Registers a service in the preview and returns its runtime surface. * * The preview is a leaf (`relay: false`). Builders install the addons channel before preview config * loads, so registration can assume the channel is already present. */ declare function registerService, TCommands extends Commands>(definition: ServiceDefinition, registration?: ServiceRegistrationOptions): ServiceInstance & ServiceRegistryApi; export { DocsContext, HooksContext, Preview, PreviewWeb, PreviewWithSelection, type PropDescriptor, type Report, ReporterAPI, type SelectionStore, StoryStore, Tag, UrlStore, type View, WebView, addons, applyHooks, clearChannel, combineArgs, combineParameters, composeConfigs, composeStepRunners, composeStories, composeStory, createPlaywrightTest, decorateStory, defaultDecorateStory, emitTransformCode, ensureChannel, filterArgTypes, getChannel, getCsfFactoryAnnotations, getService, inferControls, installNoopChannel, makeDecorator, mockChannel, normalizeArrays, normalizeProjectAnnotations, normalizeStory, pauseAnimations, prepareMeta, prepareStory, registerService, sanitizeStoryContextUpdate, setChannel, setDefaultProjectAnnotations, setProjectAnnotations, simulateDOMContentLoaded, simulatePageLoad, sortStoriesV7, useArgs, useCallback, useChannel, useEffect, useGlobals, useMemo, useParameter, useReducer, useRef, useState, useStoryContext, userOrAutoTitle, userOrAutoTitleFromSpecifier, waitForAnimations };