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