1 | import { Component, FunctionComponent, ReactElement, ReactNode } from 'react';
|
2 | import { Conditional } from '@storybook/csf';
|
3 | import { RouterData } from '@storybook/router';
|
4 | import { Listener } from '@storybook/channels';
|
5 | import Store, { Options } from './store';
|
6 | import type { StoriesHash, Story, Root, Group } from './lib/stories';
|
7 | import type { ComposedRef, Refs } from './modules/refs';
|
8 | import { isGroup, isRoot, isStory } from './lib/stories';
|
9 | import * as provider from './modules/provider';
|
10 | import * as addons from './modules/addons';
|
11 | import * as channel from './modules/channel';
|
12 | import * as notifications from './modules/notifications';
|
13 | import * as settings from './modules/settings';
|
14 | import * as releaseNotes from './modules/release-notes';
|
15 | import * as stories from './modules/stories';
|
16 | import * as refs from './modules/refs';
|
17 | import * as layout from './modules/layout';
|
18 | import * as shortcuts from './modules/shortcuts';
|
19 | import * as url from './modules/url';
|
20 | import * as version from './modules/versions';
|
21 | import * as globals from './modules/globals';
|
22 | declare const ActiveTabs: {
|
23 | SIDEBAR: "sidebar";
|
24 | CANVAS: "canvas";
|
25 | ADDONS: "addons";
|
26 | };
|
27 | export { default as merge } from './lib/merge';
|
28 | export type { Options as StoreOptions, Listener as ChannelListener };
|
29 | export { ActiveTabs };
|
30 | export declare type ModuleArgs = RouterData & ProviderData & {
|
31 | mode?: 'production' | 'development';
|
32 | state: State;
|
33 | fullAPI: API;
|
34 | store: Store;
|
35 | };
|
36 | export declare type State = layout.SubState & stories.SubState & refs.SubState & notifications.SubState & version.SubState & url.SubState & shortcuts.SubState & releaseNotes.SubState & settings.SubState & globals.SubState & RouterData & Other;
|
37 | export declare 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;
|
38 | interface Other {
|
39 | [key: string]: any;
|
40 | }
|
41 | export interface Combo {
|
42 | api: API;
|
43 | state: State;
|
44 | }
|
45 | interface ProviderData {
|
46 | provider: provider.Provider;
|
47 | }
|
48 | export declare type ManagerProviderProps = RouterData & ProviderData & {
|
49 | docsMode: boolean;
|
50 | children: ReactNode | ((props: Combo) => ReactNode);
|
51 | };
|
52 | export declare type StoryId = string;
|
53 | export declare type StoryKind = string;
|
54 | export interface Args {
|
55 | [key: string]: any;
|
56 | }
|
57 | export interface ArgType {
|
58 | name?: string;
|
59 | description?: string;
|
60 | defaultValue?: any;
|
61 | if?: Conditional;
|
62 | [key: string]: any;
|
63 | }
|
64 | export interface ArgTypes {
|
65 | [key: string]: ArgType;
|
66 | }
|
67 | export interface Parameters {
|
68 | [key: string]: any;
|
69 | }
|
70 | export declare const combineParameters: (...parameterSets: Parameters[]) => any;
|
71 | export declare type ModuleFn = (m: ModuleArgs) => Module;
|
72 | interface Module {
|
73 | init?: () => void;
|
74 | api?: unknown;
|
75 | state?: unknown;
|
76 | }
|
77 | declare class ManagerProvider extends Component<ManagerProviderProps, State> {
|
78 | api: API;
|
79 | modules: Module[];
|
80 | static displayName: string;
|
81 | constructor(props: ManagerProviderProps);
|
82 | static getDerivedStateFromProps(props: ManagerProviderProps, state: State): {
|
83 | location: Partial<Location>;
|
84 | path: string;
|
85 | refId: string;
|
86 | viewMode: string;
|
87 | storyId: string;
|
88 | layout: layout.Layout;
|
89 | ui: layout.UI;
|
90 | selectedPanel: string;
|
91 | theme: import("@storybook/theming").ThemeVars;
|
92 | storiesHash: StoriesHash;
|
93 | storiesConfigured: boolean;
|
94 | storiesFailed?: Error;
|
95 | refs: Record<string, ComposedRef>;
|
96 | notifications: notifications.Notification[];
|
97 | versions: version.Versions & version.UnknownEntries;
|
98 | lastVersionCheck: number;
|
99 | dismissedVersionNotification: string;
|
100 | customQueryParams: url.QueryParams;
|
101 | shortcuts: shortcuts.Shortcuts;
|
102 | releaseNotesViewed: string[];
|
103 | settings: settings.Settings;
|
104 | globals?: import("@storybook/csf").Globals;
|
105 | globalTypes?: import("@storybook/csf").GlobalTypes;
|
106 | navigate: (to: string | number, { plain, ...options }?: any) => void;
|
107 | singleStory?: boolean;
|
108 | };
|
109 | shouldComponentUpdate(nextProps: ManagerProviderProps, nextState: State): boolean;
|
110 | initModules: () => void;
|
111 | render(): JSX.Element;
|
112 | }
|
113 | interface ManagerConsumerProps<P = unknown> {
|
114 | filter?: (combo: Combo) => P;
|
115 | children: FunctionComponent<P> | ReactNode;
|
116 | }
|
117 | declare function ManagerConsumer<P = Combo>({ filter, children, }: ManagerConsumerProps<P>): ReactElement;
|
118 | export declare function useStorybookState(): State;
|
119 | export declare function useStorybookApi(): API;
|
120 | export type { StoriesHash, Story, Root, Group, ComposedRef, Refs };
|
121 | export { ManagerConsumer as Consumer, ManagerProvider as Provider, isGroup, isRoot, isStory };
|
122 | export interface EventMap {
|
123 | [eventId: string]: Listener;
|
124 | }
|
125 | export declare const useChannel: (eventMap: EventMap, deps?: any[]) => (type: string, ...args: any[]) => void;
|
126 | export declare function useStoryPrepared(storyId?: StoryId): boolean;
|
127 | export declare function useParameter<S>(parameterKey: string, defaultValue?: S): S;
|
128 | declare type StateMerger<S> = (input: S) => S;
|
129 | export declare function useSharedState<S>(stateId: string, defaultState?: S): [S, (newStateOrMerger: S | StateMerger<S>, options?: Options) => void];
|
130 | export declare function useAddonState<S>(addonId: string, defaultState?: S): [S, (newStateOrMerger: S | StateMerger<S>, options?: Options) => void];
|
131 | export declare function useArgs(): [Args, (newArgs: Args) => void, (argNames?: string[]) => void];
|
132 | export declare function useGlobals(): [Args, (newGlobals: Args) => void];
|
133 | export declare function useGlobalTypes(): ArgTypes;
|
134 | export declare function useArgTypes(): ArgTypes;
|