1 | import { ReactElement } from 'react';
|
2 | import { RenderData } from '@storybook/router';
|
3 | import { ModuleFn } from '../index';
|
4 | import { Options } from '../store';
|
5 | export declare type ViewMode = 'story' | 'info' | 'settings' | 'page' | undefined | string;
|
6 | export declare enum types {
|
7 | TAB = "tab",
|
8 | PANEL = "panel",
|
9 | TOOL = "tool",
|
10 | PREVIEW = "preview",
|
11 | NOTES_ELEMENT = "notes-element"
|
12 | }
|
13 | export declare type Types = types | string;
|
14 | export interface RenderOptions {
|
15 | active: boolean;
|
16 | key: string;
|
17 | }
|
18 | export interface RouteOptions {
|
19 | storyId: string;
|
20 | viewMode: ViewMode;
|
21 | location: RenderData['location'];
|
22 | path: string;
|
23 | }
|
24 | export interface MatchOptions {
|
25 | storyId: string;
|
26 | viewMode: ViewMode;
|
27 | location: RenderData['location'];
|
28 | path: string;
|
29 | }
|
30 | export interface Addon {
|
31 | title: string;
|
32 | type?: Types;
|
33 | id?: string;
|
34 | route?: (routeOptions: RouteOptions) => string;
|
35 | match?: (matchOptions: MatchOptions) => boolean;
|
36 | render: (renderOptions: RenderOptions) => ReactElement<any>;
|
37 | paramKey?: string;
|
38 | disabled?: boolean;
|
39 | hidden?: boolean;
|
40 | }
|
41 | export interface Collection<T = Addon> {
|
42 | [key: string]: T;
|
43 | }
|
44 | declare type Panels = Collection<Addon>;
|
45 | declare type StateMerger<S> = (input: S) => S;
|
46 | export interface SubAPI {
|
47 | getElements: <T>(type: Types) => Collection<T>;
|
48 | getPanels: () => Panels;
|
49 | getStoryPanels: () => Panels;
|
50 | getSelectedPanel: () => string;
|
51 | setSelectedPanel: (panelName: string) => void;
|
52 | setAddonState<S>(addonId: string, newStateOrMerger: S | StateMerger<S>, options?: Options): Promise<S>;
|
53 | getAddonState<S>(addonId: string): S;
|
54 | }
|
55 | export declare function ensurePanel(panels: Panels, selectedPanel?: string, currentPanel?: string): string;
|
56 | export declare const init: ModuleFn;
|
57 | export {};
|