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