1 | import type { ReactElement } from 'react';
|
2 | import { Channel } from '@storybook/channels';
|
3 | import type { API } from '@storybook/api';
|
4 | import type { RenderData as RouterData } from '@storybook/router';
|
5 | import type { ThemeVars } from '@storybook/theming';
|
6 | import { Types } from './types';
|
7 | export { Channel };
|
8 | export interface RenderOptions {
|
9 | active?: boolean;
|
10 | key?: string;
|
11 | }
|
12 | export interface Addon {
|
13 | title: (() => string) | string;
|
14 | type?: Types;
|
15 | id?: string;
|
16 | route?: (routeOptions: RouterData) => string;
|
17 | match?: (matchOptions: RouterData) => boolean;
|
18 | render: (renderOptions: RenderOptions) => ReactElement<any>;
|
19 | paramKey?: string;
|
20 | disabled?: boolean;
|
21 | hidden?: boolean;
|
22 | }
|
23 | export declare type Loader = (api: API) => void;
|
24 | export interface Collection {
|
25 | [key: string]: Addon;
|
26 | }
|
27 | interface ToolbarConfig {
|
28 | hidden?: boolean;
|
29 | }
|
30 | export interface Config {
|
31 | theme?: ThemeVars;
|
32 | toolbar?: {
|
33 | [id: string]: ToolbarConfig;
|
34 | };
|
35 | [key: string]: any;
|
36 | }
|
37 | export declare class AddonStore {
|
38 | constructor();
|
39 | private loaders;
|
40 | private elements;
|
41 | private config;
|
42 | private channel;
|
43 | private serverChannel;
|
44 | private promise;
|
45 | private resolve;
|
46 | getChannel: () => Channel;
|
47 | getServerChannel: () => Channel;
|
48 | ready: () => Promise<Channel>;
|
49 | hasChannel: () => boolean;
|
50 | hasServerChannel: () => boolean;
|
51 | setChannel: (channel: Channel) => void;
|
52 | setServerChannel: (channel: Channel) => void;
|
53 | getElements: (type: Types) => Collection;
|
54 | addPanel: (name: string, options: Addon) => void;
|
55 | add: (name: string, addon: Addon) => void;
|
56 | setConfig: (value: Config) => void;
|
57 | getConfig: () => Config;
|
58 | register: (name: string, registerCallback: (api: API) => void) => void;
|
59 | loadAddons: (api: any) => void;
|
60 | }
|
61 | export declare const addons: AddonStore;
|