@storybook/client-api

  • Version 6.3.7
  • Published
  • 292 kB
  • 18 dependencies
  • MIT license

Install

npm i @storybook/client-api
yarn add @storybook/client-api
pnpm add @storybook/client-api

Overview

Storybook Client API

Index

Variables

Functions

Classes

Interfaces

Type Aliases

Variables

variable inferControls

const inferControls: ArgTypesEnhancer;

    Functions

    function addArgsEnhancer

    addArgsEnhancer: (enhancer: ArgsEnhancer) => void;

      function addArgTypesEnhancer

      addArgTypesEnhancer: (enhancer: ArgTypesEnhancer) => void;

        function addDecorator

        addDecorator: (decorator: any, deprecationWarning?: boolean) => void;

          function addLoader

          addLoader: (loader: any, deprecationWarning?: boolean) => void;

            function addParameters

            addParameters: (parameters: any, deprecationWarning?: boolean) => void;

              function combineParameters

              combineParameters: (...parameterSets: Parameters[]) => any;
              • 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.

              function defaultDecorateStory

              defaultDecorateStory: (storyFn: any, decorators: DecoratorFunction[]) => any;

                function filterArgTypes

                filterArgTypes: (
                argTypes: any,
                include?: PropDescriptor,
                exclude?: PropDescriptor
                ) => any;

                  function getQueryParam

                  getQueryParam: (
                  key: string
                  ) => string | string[] | import('qs').ParsedQs | import('qs').ParsedQs[];

                    function getQueryParams

                    getQueryParams: () => any;

                      function pathToId

                      pathToId: (path: string) => string;

                        function setGlobalRender

                        setGlobalRender: (render: any) => void;

                          function simulateDOMContentLoaded

                          simulateDOMContentLoaded: () => void;

                            function simulatePageLoad

                            simulatePageLoad: ($container: any) => void;

                              function useAddonState

                              useAddonState: <S>(addonId: string, defaultState?: S) => [S, (s: S) => void];

                                function useSharedState

                                useSharedState: <S>(sharedId: string, defaultState?: S) => [S, (s: S) => void];

                                  Classes

                                  class ClientApi

                                  class ClientApi {}

                                    constructor

                                    constructor({
                                    storyStore,
                                    decorateStory,
                                    noStoryModuleAddMethodHotDispose,
                                    }: ClientApiParams);

                                      property addArgsEnhancer

                                      addArgsEnhancer: (enhancer: ArgsEnhancer) => void;

                                        property addArgTypesEnhancer

                                        addArgTypesEnhancer: (enhancer: ArgTypesEnhancer) => void;

                                          property addDecorator

                                          addDecorator: (decorator: any) => void;

                                            property addLoader

                                            addLoader: (loader: any) => void;

                                              property addParameters

                                              addParameters: (parameters: any) => void;

                                                property clearDecorators

                                                clearDecorators: () => void;

                                                  property getStorybook

                                                  getStorybook: () => import('./types').GetStorybookKind[];

                                                    property globalRender

                                                    globalRender: any;

                                                      property raw

                                                      raw: () => import('./types').PublishedStoreItem[];

                                                        property setAddon

                                                        setAddon: (addon: any) => void;

                                                          property store

                                                          store: () => StoryStore;

                                                            property storiesOf

                                                            storiesOf: <StoryFnReturnType = unknown>(kind: string, m: any) => any;

                                                              class ConfigApi

                                                              class ConfigApi {}

                                                                constructor

                                                                constructor({ storyStore }: { storyStore: StoryStore });

                                                                  property configure

                                                                  configure: (
                                                                  loaders: () => void,
                                                                  module: any,
                                                                  showDeprecationWarning?: boolean
                                                                  ) => void;

                                                                    class StoryStore

                                                                    class StoryStore {}

                                                                      constructor

                                                                      constructor(params: { channel: any });

                                                                        property fromId

                                                                        fromId: (id: string) => PublishedStoreItem | null;

                                                                          property getDataForManager

                                                                          getDataForManager: () => {
                                                                          v: number;
                                                                          globalParameters: any;
                                                                          globals: any;
                                                                          error: ErrorLike;
                                                                          kindParameters: { [x: string]: any };
                                                                          stories: {};
                                                                          };

                                                                            property getError

                                                                            getError: () => ErrorLike | undefined;

                                                                              property getSelection

                                                                              getSelection: () => StoreSelection;

                                                                                property getStoriesForKind

                                                                                getStoriesForKind: (kind: string) => PublishedStoreItem[];

                                                                                  property getStoriesJsonData

                                                                                  getStoriesJsonData: () => {
                                                                                  v: number;
                                                                                  globalParameters: Pick<Parameters, string>;
                                                                                  kindParameters: { [x: string]: Pick<any, string> };
                                                                                  stories: {};
                                                                                  };

                                                                                    property pushToManager

                                                                                    pushToManager: () => void;

                                                                                      property remove

                                                                                      remove: (id: string, { allowUnsafe }?: AllowUnsafeOption) => void;

                                                                                        property setError

                                                                                        setError: (err: ErrorLike) => void;

                                                                                          method addArgsEnhancer

                                                                                          addArgsEnhancer: (argsEnhancer: ArgsEnhancer) => void;

                                                                                            method addArgTypesEnhancer

                                                                                            addArgTypesEnhancer: (argTypesEnhancer: ArgTypesEnhancer) => void;

                                                                                              method addGlobalMetadata

                                                                                              addGlobalMetadata: ({ parameters, decorators, loaders }: StoryMetadata) => void;

                                                                                                method addKindMetadata

                                                                                                addKindMetadata: (
                                                                                                kind: string,
                                                                                                { parameters, decorators, loaders }: StoryMetadata
                                                                                                ) => void;

                                                                                                  method addStory

                                                                                                  addStory: (
                                                                                                  {
                                                                                                  id,
                                                                                                  kind,
                                                                                                  name,
                                                                                                  storyFn: original,
                                                                                                  parameters: storyParameters,
                                                                                                  decorators: storyDecorators,
                                                                                                  loaders: storyLoaders,
                                                                                                  }: AddStoryArgs,
                                                                                                  {
                                                                                                  applyDecorators,
                                                                                                  allowUnsafe,
                                                                                                  }: {
                                                                                                  applyDecorators: (fn: any, decorators: DecoratorFunction[]) => any;
                                                                                                  } & AllowUnsafeOption
                                                                                                  ) => void;

                                                                                                    method cleanHooks

                                                                                                    cleanHooks: (id: string) => void;

                                                                                                      method cleanHooksForKind

                                                                                                      cleanHooksForKind: (kind: string) => void;

                                                                                                        method clearError

                                                                                                        clearError: () => void;

                                                                                                          method clearGlobalDecorators

                                                                                                          clearGlobalDecorators: () => void;

                                                                                                            method combineStoryParameters

                                                                                                            combineStoryParameters: (parameters: any, kind: any) => any;

                                                                                                              method ensureKind

                                                                                                              ensureKind: (kind: string) => void;

                                                                                                                method extract

                                                                                                                extract: (options?: StoryOptions & { normalizeParameters?: boolean }) => {};

                                                                                                                  method finishConfiguring

                                                                                                                  finishConfiguring: () => void;

                                                                                                                    method getRawStory

                                                                                                                    getRawStory: (kind: string, name: string) => PublishedStoreItem;

                                                                                                                      method getStorybook

                                                                                                                      getStorybook: () => GetStorybookKind[];

                                                                                                                        method getStoryKinds

                                                                                                                        getStoryKinds: () => string[];

                                                                                                                          method isSingleStoryMode

                                                                                                                          isSingleStoryMode: () => boolean;

                                                                                                                            method raw

                                                                                                                            raw: (options?: StoryOptions) => PublishedStoreItem[];

                                                                                                                              method removeStoryKind

                                                                                                                              removeStoryKind: (kind: string, { allowUnsafe }?: AllowUnsafeOption) => void;

                                                                                                                                method resetStoryArgs

                                                                                                                                resetStoryArgs: (id: string, argNames?: string[]) => void;

                                                                                                                                  method setSelection

                                                                                                                                  setSelection: (selection: StoreSelection) => void;

                                                                                                                                    method setSelectionSpecifier

                                                                                                                                    setSelectionSpecifier: (selectionSpecifier: StoreSelectionSpecifier) => void;

                                                                                                                                      method setupListeners

                                                                                                                                      setupListeners: () => void;

                                                                                                                                        method shouldBlockAddingKindMetadata

                                                                                                                                        shouldBlockAddingKindMetadata: (kind: string) => boolean;

                                                                                                                                          method shouldBlockAddingStory

                                                                                                                                          shouldBlockAddingStory: (id: string) => boolean;

                                                                                                                                            method sortedStories

                                                                                                                                            sortedStories: () => StoreItem[];

                                                                                                                                              method startConfiguring

                                                                                                                                              startConfiguring: () => void;

                                                                                                                                                method updateGlobals

                                                                                                                                                updateGlobals: (newGlobals: any) => void;

                                                                                                                                                  method updateStoryArgs

                                                                                                                                                  updateStoryArgs: (id: string, newArgs: any) => void;

                                                                                                                                                    Interfaces

                                                                                                                                                    interface ClientApiAddon

                                                                                                                                                    interface ClientApiAddon<StoryFnReturnType = unknown> extends Addon {}

                                                                                                                                                      property apply

                                                                                                                                                      apply: (a: StoryApi<StoryFnReturnType>, b: any[]) => any;

                                                                                                                                                        interface ClientApiAddons

                                                                                                                                                        interface ClientApiAddons<StoryFnReturnType> {}

                                                                                                                                                          index signature

                                                                                                                                                          [key: string]: ClientApiAddon<StoryFnReturnType>;

                                                                                                                                                            interface ClientApiParams

                                                                                                                                                            interface ClientApiParams {}

                                                                                                                                                              property decorateStory

                                                                                                                                                              decorateStory?: DecorateStoryFunction;

                                                                                                                                                                property noStoryModuleAddMethodHotDispose

                                                                                                                                                                noStoryModuleAddMethodHotDispose?: boolean;

                                                                                                                                                                  property storyStore

                                                                                                                                                                  storyStore: StoryStore;

                                                                                                                                                                    interface ErrorLike

                                                                                                                                                                    interface ErrorLike {}

                                                                                                                                                                      property message

                                                                                                                                                                      message: string;

                                                                                                                                                                        property stack

                                                                                                                                                                        stack: string;

                                                                                                                                                                          interface GetStorybookKind

                                                                                                                                                                          interface GetStorybookKind {}

                                                                                                                                                                            property fileName

                                                                                                                                                                            fileName: string;

                                                                                                                                                                              property kind

                                                                                                                                                                              kind: string;

                                                                                                                                                                                property stories

                                                                                                                                                                                stories: GetStorybookStory[];

                                                                                                                                                                                  interface GetStorybookStory

                                                                                                                                                                                  interface GetStorybookStory {}

                                                                                                                                                                                    property name

                                                                                                                                                                                    name: string;

                                                                                                                                                                                      property render

                                                                                                                                                                                      render: StoryFn;

                                                                                                                                                                                        interface StoreData

                                                                                                                                                                                        interface StoreData {}

                                                                                                                                                                                          index signature

                                                                                                                                                                                          [key: string]: StoreItem;

                                                                                                                                                                                            interface StoreSelection

                                                                                                                                                                                            interface StoreSelection {}

                                                                                                                                                                                              property storyId

                                                                                                                                                                                              storyId: StoryId;

                                                                                                                                                                                                property viewMode

                                                                                                                                                                                                viewMode: ViewMode;

                                                                                                                                                                                                  interface StoreSelectionSpecifier

                                                                                                                                                                                                  interface StoreSelectionSpecifier {}

                                                                                                                                                                                                    property args

                                                                                                                                                                                                    args?: Args;

                                                                                                                                                                                                      property globals

                                                                                                                                                                                                      globals?: Args;

                                                                                                                                                                                                        property singleStory

                                                                                                                                                                                                        singleStory?: boolean;

                                                                                                                                                                                                          property storySpecifier

                                                                                                                                                                                                          storySpecifier: StorySpecifier;

                                                                                                                                                                                                            property viewMode

                                                                                                                                                                                                            viewMode: ViewMode;

                                                                                                                                                                                                              interface StoryMetadata

                                                                                                                                                                                                              interface StoryMetadata {}

                                                                                                                                                                                                                property decorators

                                                                                                                                                                                                                decorators?: DecoratorFunction[];

                                                                                                                                                                                                                  property loaders

                                                                                                                                                                                                                  loaders?: LoaderFunction[];

                                                                                                                                                                                                                    property parameters

                                                                                                                                                                                                                    parameters?: Parameters;

                                                                                                                                                                                                                      Type Aliases

                                                                                                                                                                                                                      type AddStoryArgs

                                                                                                                                                                                                                      type AddStoryArgs = StoryIdentifier & {
                                                                                                                                                                                                                      storyFn: StoryFn<any>;
                                                                                                                                                                                                                      parameters?: Parameters;
                                                                                                                                                                                                                      decorators?: DecoratorFunction[];
                                                                                                                                                                                                                      loaders?: LoaderFunction[];
                                                                                                                                                                                                                      };

                                                                                                                                                                                                                        type ArgsEnhancer

                                                                                                                                                                                                                        type ArgsEnhancer = (context: StoryContext) => Args;

                                                                                                                                                                                                                          type ArgTypesEnhancer

                                                                                                                                                                                                                          type ArgTypesEnhancer = (context: StoryContext) => ArgTypes;

                                                                                                                                                                                                                            type ClientApiReturnFn

                                                                                                                                                                                                                            type ClientApiReturnFn<StoryFnReturnType> = (
                                                                                                                                                                                                                            ...args: any[]
                                                                                                                                                                                                                            ) => StoryApi<StoryFnReturnType>;

                                                                                                                                                                                                                              type PropDescriptor

                                                                                                                                                                                                                              type PropDescriptor = string[] | RegExp;

                                                                                                                                                                                                                                type PublishedStoreItem

                                                                                                                                                                                                                                type PublishedStoreItem = StoreItem & {
                                                                                                                                                                                                                                globals: Args;
                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                  type RenderContext

                                                                                                                                                                                                                                  type RenderContext = RenderContextWithoutStoryContext & {
                                                                                                                                                                                                                                  storyContext: StoryContext;
                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                    type RenderContextWithoutStoryContext

                                                                                                                                                                                                                                    type RenderContextWithoutStoryContext = StoreItem & {
                                                                                                                                                                                                                                    forceRender: boolean;
                                                                                                                                                                                                                                    showMain: () => void;
                                                                                                                                                                                                                                    showError: (error: { title: string; description: string }) => void;
                                                                                                                                                                                                                                    showException: (err: Error) => void;
                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                      type SBArrayType

                                                                                                                                                                                                                                      type SBArrayType = SBBaseType & {
                                                                                                                                                                                                                                      name: 'array';
                                                                                                                                                                                                                                      value: SBType;
                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                        type SBEnumType

                                                                                                                                                                                                                                        type SBEnumType = SBBaseType & {
                                                                                                                                                                                                                                        name: 'enum';
                                                                                                                                                                                                                                        value: (string | number)[];
                                                                                                                                                                                                                                        };

                                                                                                                                                                                                                                          type SBIntersectionType

                                                                                                                                                                                                                                          type SBIntersectionType = SBBaseType & {
                                                                                                                                                                                                                                          name: 'intersection';
                                                                                                                                                                                                                                          value: SBType[];
                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                            type SBObjectType

                                                                                                                                                                                                                                            type SBObjectType = SBBaseType & {
                                                                                                                                                                                                                                            name: 'object';
                                                                                                                                                                                                                                            value: Record<string, SBType>;
                                                                                                                                                                                                                                            };

                                                                                                                                                                                                                                              type SBOtherType

                                                                                                                                                                                                                                              type SBOtherType = SBBaseType & {
                                                                                                                                                                                                                                              name: 'other';
                                                                                                                                                                                                                                              value: string;
                                                                                                                                                                                                                                              };

                                                                                                                                                                                                                                                type SBScalarType

                                                                                                                                                                                                                                                type SBScalarType = SBBaseType & {
                                                                                                                                                                                                                                                name: 'boolean' | 'string' | 'number' | 'function';
                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                  type SBType

                                                                                                                                                                                                                                                  type SBType =
                                                                                                                                                                                                                                                  | SBScalarType
                                                                                                                                                                                                                                                  | SBEnumType
                                                                                                                                                                                                                                                  | SBArrayType
                                                                                                                                                                                                                                                  | SBObjectType
                                                                                                                                                                                                                                                  | SBIntersectionType
                                                                                                                                                                                                                                                  | SBUnionType
                                                                                                                                                                                                                                                  | SBOtherType;

                                                                                                                                                                                                                                                    type SBUnionType

                                                                                                                                                                                                                                                    type SBUnionType = SBBaseType & {
                                                                                                                                                                                                                                                    name: 'union';
                                                                                                                                                                                                                                                    value: SBType[];
                                                                                                                                                                                                                                                    };

                                                                                                                                                                                                                                                      type StoreItem

                                                                                                                                                                                                                                                      type StoreItem = StoryIdentifier & {
                                                                                                                                                                                                                                                      parameters: Parameters;
                                                                                                                                                                                                                                                      getDecorated: () => StoryFn<any>;
                                                                                                                                                                                                                                                      getOriginal: () => StoryFn<any>;
                                                                                                                                                                                                                                                      applyLoaders: () => Promise<StoryContext>;
                                                                                                                                                                                                                                                      runPlayFunction: () => Promise<any>;
                                                                                                                                                                                                                                                      storyFn: StoryFn<any>;
                                                                                                                                                                                                                                                      unboundStoryFn: StoryFn<any>;
                                                                                                                                                                                                                                                      hooks: HooksContext;
                                                                                                                                                                                                                                                      args: Args;
                                                                                                                                                                                                                                                      initialArgs: Args;
                                                                                                                                                                                                                                                      argTypes: ArgTypes;
                                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                                        type StorySpecifier

                                                                                                                                                                                                                                                        type StorySpecifier =
                                                                                                                                                                                                                                                        | StoryId
                                                                                                                                                                                                                                                        | {
                                                                                                                                                                                                                                                        name: StoryName;
                                                                                                                                                                                                                                                        kind: StoryKind;
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                        | '*';

                                                                                                                                                                                                                                                          Package Files (13)

                                                                                                                                                                                                                                                          Dependencies (18)

                                                                                                                                                                                                                                                          Dev Dependencies (0)

                                                                                                                                                                                                                                                          No dev dependencies.

                                                                                                                                                                                                                                                          Peer Dependencies (2)

                                                                                                                                                                                                                                                          Badge

                                                                                                                                                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@storybook/client-api.

                                                                                                                                                                                                                                                          • Markdown
                                                                                                                                                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@storybook/client-api)
                                                                                                                                                                                                                                                          • HTML
                                                                                                                                                                                                                                                            <a href="https://www.jsdocs.io/package/@storybook/client-api"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>