@storybook/client-api

  • Version 6.2.9
  • Published
  • 212 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

variable inferControls

const inferControls: ArgTypesEnhancer;

    Functions

    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[]
            ) => (context?: any) => unknown;

              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 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 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 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 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 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 sortedStories

                                                                                                                            sortedStories: () => StoreItem[];

                                                                                                                              method startConfiguring

                                                                                                                              startConfiguring: () => void;

                                                                                                                                method storeGlobals

                                                                                                                                storeGlobals: () => 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 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 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>;
                                                                                                                                                                                                                                  storyFn: StoryFn<any>;
                                                                                                                                                                                                                                  unboundStoryFn: StoryFn<any>;
                                                                                                                                                                                                                                  hooks: HooksContext;
                                                                                                                                                                                                                                  args: Args;
                                                                                                                                                                                                                                  initialArgs: Args;
                                                                                                                                                                                                                                  argTypes: ArgTypes;
                                                                                                                                                                                                                                  };

                                                                                                                                                                                                                                    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>