@storybook/api

  • Version 6.2.9
  • Published
  • 311 kB
  • 20 dependencies
  • MIT license

Install

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

Overview

Core Storybook API & Context

Index

Variables

variable ActiveTabs

const ActiveTabs: { SIDEBAR: 'sidebar'; CANVAS: 'canvas'; ADDONS: 'addons' };

    Functions

    function combineParameters

    combineParameters: (...parameterSets: Parameters[]) => any;

      function Consumer

      Consumer: <P = Combo>({ filter, children }: ManagerConsumerProps<P>) => any;

        function isGroup

        isGroup: (item: Item) => item is Group;

          function isRoot

          isRoot: (item: Item) => item is Root;

            function isStory

            isStory: (item: Item) => item is Story;

              function merge

              merge: (a: any, b: any) => any;

                function useAddonState

                useAddonState: <S>(
                addonId: string,
                defaultState?: S
                ) => [S, (newStateOrMerger: S | StateMerger<S>, options?: Options) => void];

                  function useArgs

                  useArgs: () => [Args, (newArgs: Args) => void, (argNames?: string[]) => void];

                    function useArgTypes

                    useArgTypes: () => ArgTypes;

                      function useChannel

                      useChannel: (
                      eventMap: EventMap,
                      deps?: any[]
                      ) => (type: string, ...args: any[]) => void;

                        function useGlobals

                        useGlobals: () => [Args, (newGlobals: Args) => void];

                          function useGlobalTypes

                          useGlobalTypes: () => ArgTypes;

                            function useParameter

                            useParameter: <S>(parameterKey: string, defaultValue?: S) => S;

                              function useSharedState

                              useSharedState: <S>(
                              stateId: string,
                              defaultState?: S
                              ) => [S, (newStateOrMerger: S | StateMerger<S>, options?: Options) => void];

                                function useStorybookApi

                                useStorybookApi: () => API;

                                  function useStorybookState

                                  useStorybookState: () => State;

                                    Classes

                                    class Provider

                                    class ManagerProvider extends Component<ManagerProviderProps, State> {}

                                      constructor

                                      constructor(props: any);

                                        property api

                                        api: API;

                                          property displayName

                                          static displayName: string;

                                            property getDerivedStateFromProps

                                            static getDerivedStateFromProps: (
                                            props: ManagerProviderProps,
                                            state: State
                                            ) => {
                                            location: import('@reach/router').WindowLocation<unknown>;
                                            path: string;
                                            refId: string;
                                            viewMode: string;
                                            storyId: string;
                                            layout: layout.Layout;
                                            ui: layout.UI;
                                            selectedPanel: string;
                                            theme: import('@storybook/theming').ThemeVars;
                                            storiesHash: StoriesHash;
                                            storiesConfigured: boolean;
                                            storiesFailed?: Error;
                                            refs: Record<string, refs.ComposedRef>;
                                            notifications: notifications.Notification[];
                                            versions: version.Versions & version.UnknownEntries;
                                            lastVersionCheck: number;
                                            dismissedVersionNotification: string;
                                            customQueryParams: url.QueryParams;
                                            shortcuts: shortcuts.Shortcuts;
                                            releaseNotesViewed: string[];
                                            settings: settings.Settings;
                                            globals: Args;
                                            navigate?: import('@reach/router').NavigateFn;
                                            };

                                              property initModules

                                              initModules: () => void;

                                                property modules

                                                modules: Module[];

                                                  method render

                                                  render: () => any;

                                                    method shouldComponentUpdate

                                                    shouldComponentUpdate: (
                                                    nextProps: ManagerProviderProps,
                                                    nextState: State
                                                    ) => boolean;

                                                      Interfaces

                                                      interface Args

                                                      interface Args {}

                                                        index signature

                                                        [key: string]: any;

                                                          interface ArgType

                                                          interface ArgType {}

                                                            property defaultValue

                                                            defaultValue?: any;

                                                              property description

                                                              description?: string;

                                                                property name

                                                                name?: string;

                                                                  index signature

                                                                  [key: string]: any;

                                                                    interface ArgTypes

                                                                    interface ArgTypes {}

                                                                      index signature

                                                                      [key: string]: ArgType;

                                                                        interface Combo

                                                                        interface Combo {}

                                                                          property api

                                                                          api: API;

                                                                            property state

                                                                            state: State;

                                                                              interface EventMap

                                                                              interface EventMap {}

                                                                                index signature

                                                                                [eventId: string]: Listener;

                                                                                  interface Group

                                                                                  interface Group {}

                                                                                    property children

                                                                                    children: StoryId[];

                                                                                      property depth

                                                                                      depth: number;

                                                                                        property id

                                                                                        id: StoryId;

                                                                                          property isComponent

                                                                                          isComponent: boolean;

                                                                                            property isLeaf

                                                                                            isLeaf: false;

                                                                                              property isRoot

                                                                                              isRoot: false;

                                                                                                property name

                                                                                                name: string;

                                                                                                  property parameters

                                                                                                  parameters?: {
                                                                                                  docsOnly?: boolean;
                                                                                                  viewMode?: ViewMode;
                                                                                                  };

                                                                                                    property parent

                                                                                                    parent?: StoryId;

                                                                                                      property refId

                                                                                                      refId?: string;

                                                                                                        property renderLabel

                                                                                                        renderLabel?: (item: Group) => React.ReactNode;

                                                                                                          interface Parameters

                                                                                                          interface Parameters {}

                                                                                                            index signature

                                                                                                            [key: string]: any;

                                                                                                              interface Root

                                                                                                              interface Root {}

                                                                                                                property children

                                                                                                                children: StoryId[];

                                                                                                                  property depth

                                                                                                                  depth: 0;

                                                                                                                    property id

                                                                                                                    id: StoryId;

                                                                                                                      property isComponent

                                                                                                                      isComponent: false;

                                                                                                                        property isLeaf

                                                                                                                        isLeaf: false;

                                                                                                                          property isRoot

                                                                                                                          isRoot: true;

                                                                                                                            property name

                                                                                                                            name: string;

                                                                                                                              property refId

                                                                                                                              refId?: string;

                                                                                                                                property renderLabel

                                                                                                                                renderLabel?: (item: Root) => React.ReactNode;

                                                                                                                                  property startCollapsed

                                                                                                                                  startCollapsed?: boolean;

                                                                                                                                    interface StoreOptions

                                                                                                                                    interface Options {}

                                                                                                                                      property persistence

                                                                                                                                      persistence: 'none' | 'session' | string;

                                                                                                                                        interface StoriesHash

                                                                                                                                        interface StoriesHash {}

                                                                                                                                          index signature

                                                                                                                                          [id: string]: Root | Group | Story;

                                                                                                                                            interface Story

                                                                                                                                            interface Story {}

                                                                                                                                              property args

                                                                                                                                              args: Args;

                                                                                                                                                property children

                                                                                                                                                children?: StoryId[];

                                                                                                                                                  property depth

                                                                                                                                                  depth: number;

                                                                                                                                                    property id

                                                                                                                                                    id: StoryId;

                                                                                                                                                      property initialArgs

                                                                                                                                                      initialArgs: Args;

                                                                                                                                                        property isComponent

                                                                                                                                                        isComponent: boolean;

                                                                                                                                                          property isLeaf

                                                                                                                                                          isLeaf: true;

                                                                                                                                                            property isRoot

                                                                                                                                                            isRoot: false;

                                                                                                                                                              property kind

                                                                                                                                                              kind: StoryKind;

                                                                                                                                                                property name

                                                                                                                                                                name: string;

                                                                                                                                                                  property parameters

                                                                                                                                                                  parameters?: {
                                                                                                                                                                  fileName: string;
                                                                                                                                                                  options: {
                                                                                                                                                                  [optionName: string]: any;
                                                                                                                                                                  };
                                                                                                                                                                  docsOnly?: boolean;
                                                                                                                                                                  viewMode?: ViewMode;
                                                                                                                                                                  [parameterName: string]: any;
                                                                                                                                                                  };

                                                                                                                                                                    property parent

                                                                                                                                                                    parent: StoryId;

                                                                                                                                                                      property refId

                                                                                                                                                                      refId?: string;

                                                                                                                                                                        property renderLabel

                                                                                                                                                                        renderLabel?: (item: Story) => React.ReactNode;

                                                                                                                                                                          Type Aliases

                                                                                                                                                                          type API

                                                                                                                                                                          type API = addons.SubAPI &
                                                                                                                                                                          channel.SubAPI &
                                                                                                                                                                          provider.SubAPI &
                                                                                                                                                                          stories.SubAPI &
                                                                                                                                                                          refs.SubAPI &
                                                                                                                                                                          globals.SubAPI &
                                                                                                                                                                          layout.SubAPI &
                                                                                                                                                                          notifications.SubAPI &
                                                                                                                                                                          shortcuts.SubAPI &
                                                                                                                                                                          releaseNotes.SubAPI &
                                                                                                                                                                          settings.SubAPI &
                                                                                                                                                                          version.SubAPI &
                                                                                                                                                                          url.SubAPI &
                                                                                                                                                                          Other;

                                                                                                                                                                            type ManagerProviderProps

                                                                                                                                                                            type ManagerProviderProps = RouterData &
                                                                                                                                                                            ProviderData & {
                                                                                                                                                                            docsMode: boolean;
                                                                                                                                                                            children: ReactNode | ((props: Combo) => ReactNode);
                                                                                                                                                                            };

                                                                                                                                                                              type ModuleArgs

                                                                                                                                                                              type ModuleArgs = RouterData &
                                                                                                                                                                              ProviderData & {
                                                                                                                                                                              mode?: 'production' | 'development';
                                                                                                                                                                              state: State;
                                                                                                                                                                              fullAPI: API;
                                                                                                                                                                              store: Store;
                                                                                                                                                                              };

                                                                                                                                                                                type ModuleFn

                                                                                                                                                                                type ModuleFn = (m: ModuleArgs) => Module;

                                                                                                                                                                                  type State

                                                                                                                                                                                  type State = layout.SubState &
                                                                                                                                                                                  stories.SubState &
                                                                                                                                                                                  refs.SubState &
                                                                                                                                                                                  notifications.SubState &
                                                                                                                                                                                  version.SubState &
                                                                                                                                                                                  url.SubState &
                                                                                                                                                                                  shortcuts.SubState &
                                                                                                                                                                                  releaseNotes.SubState &
                                                                                                                                                                                  settings.SubState &
                                                                                                                                                                                  globals.SubState &
                                                                                                                                                                                  RouterData &
                                                                                                                                                                                  Other;

                                                                                                                                                                                    type StoryId

                                                                                                                                                                                    type StoryId = string;

                                                                                                                                                                                      type StoryKind

                                                                                                                                                                                      type StoryKind = string;

                                                                                                                                                                                        Package Files (4)

                                                                                                                                                                                        Dependencies (20)

                                                                                                                                                                                        Dev Dependencies (4)

                                                                                                                                                                                        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/api.

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