1 |
|
2 | import * as t from './libs';
|
3 | export declare type ShellTheme = 'LIGHT' | 'DARK';
|
4 | export declare type IShell = {
|
5 | events: IShellEvents;
|
6 | state: IShellState;
|
7 | initial(state: IShellPartialState): IShell;
|
8 | register: ShellRegisterModule;
|
9 | main: ShellRegisterModule;
|
10 | load<P = Record<string, unknown>>(moduleId: string | number, options?: IShellLoadOptions<P>): Promise<IShellLoadResponse>;
|
11 | progress: IShellProgress;
|
12 | };
|
13 | export declare type ShellRegisterModule = (moduleId: string, importer: ShellImporter, options?: {
|
14 | timeout?: number;
|
15 | }) => IShell;
|
16 | export declare type IShellEvents = {
|
17 | events$: t.Observable<ShellEvent>;
|
18 | tree: t.ITreeEvents;
|
19 | progress: {
|
20 | start$: t.Observable<IShellProgressStart>;
|
21 | complete$: t.Observable<IShellProgressComplete>;
|
22 | };
|
23 | };
|
24 | export declare type IShellProgress = {
|
25 | start(options?: {
|
26 | duration?: number;
|
27 | color?: string;
|
28 | }): Promise<void>;
|
29 | complete(): void;
|
30 | };
|
31 | export declare type IShellLoadOptions<P = Record<string, unknown>> = {
|
32 | props?: P;
|
33 | progress?: number;
|
34 | simulateLatency?: number;
|
35 | };
|
36 | export declare type IShellContext = {
|
37 | shell: IShell;
|
38 | };
|
39 | export declare type ShellImporter<P = Record<string, unknown>> = (props?: P) => Promise<ShellImporterResponse>;
|
40 | export declare type ShellImporterResponse = {
|
41 | init: ShellImportInit;
|
42 | };
|
43 | export declare type ShellImportInit = (args: ShellImportInitArgs) => Promise<any>;
|
44 | export declare type ShellImportInitArgs = {
|
45 | shell: IShell;
|
46 | };
|
47 | export declare type IShellLoadResponse = {
|
48 | ok: boolean;
|
49 | count: number;
|
50 | error?: Error;
|
51 | timedOut: boolean;
|
52 | };
|
53 | export declare type IShellState = {
|
54 | readonly changed$: t.Observable<IShellStateChanged>;
|
55 | readonly header: IShellHeaderState;
|
56 | readonly tree: IShellTreeState;
|
57 | readonly body: IShellBodyState;
|
58 | readonly sidebar: IShellSidebarState;
|
59 | readonly footer: IShellFooterState;
|
60 | };
|
61 | export declare type IShellPartialState = Partial<{
|
62 | header: Partial<IShellHeaderState>;
|
63 | tree: Partial<IShellTreeState>;
|
64 | body: Partial<IShellBodyState>;
|
65 | sidebar: Partial<IShellSidebarState>;
|
66 | footer: Partial<IShellFooterState>;
|
67 | }>;
|
68 | export declare type IShellHeaderState = {
|
69 | el?: JSX.Element;
|
70 | foreground: IShellColor | string | number;
|
71 | background: IShellColor | string | number;
|
72 | border: IShellColor | string | number;
|
73 | height: IShellSize | number;
|
74 | };
|
75 | export declare type IShellTreeState = {
|
76 | root?: t.ITreeNode;
|
77 | current?: string;
|
78 | width: IShellSize | number;
|
79 | render?: {
|
80 | node?: t.RenderTreeNodeBody;
|
81 | icon?: t.RenderTreeIcon;
|
82 | panel?: t.RenderTreePanel;
|
83 | };
|
84 | };
|
85 | export declare type IShellBodyState = {
|
86 | el?: JSX.Element;
|
87 | foreground: IShellColor | string | number;
|
88 | background: IShellColor | string | number;
|
89 | };
|
90 | export declare type IShellSidebarState = {
|
91 | el?: JSX.Element;
|
92 | foreground: IShellColor | string | number;
|
93 | background: IShellColor | string | number;
|
94 | width: IShellSize | number;
|
95 | };
|
96 | export declare type IShellFooterState = {
|
97 | el?: JSX.Element;
|
98 | foreground: IShellColor | string | number;
|
99 | background: IShellColor | string | number;
|
100 | border: IShellColor | string | number;
|
101 | height: IShellSize | number;
|
102 | };
|
103 | export declare type IShellColor = {
|
104 | color: string;
|
105 | fadeSpeed: number;
|
106 | };
|
107 | export declare type IShellSize = {
|
108 | value: number;
|
109 | speed: number;
|
110 | };
|
111 | export declare type ShellEvent = t.TreeviewEvent | IShellProgressStartEvent | IShellProgressCompleteEvent;
|
112 | export declare type IShellProgressStartEvent = {
|
113 | type: 'SHELL/progress/start';
|
114 | payload: IShellProgressStart;
|
115 | };
|
116 | export declare type IShellProgressStart = {
|
117 | duration?: number;
|
118 | color?: string;
|
119 | };
|
120 | export declare type IShellProgressCompleteEvent = {
|
121 | type: 'SHELL/progress/complete';
|
122 | payload: IShellProgressComplete;
|
123 | };
|
124 | export declare type IShellProgressComplete = {
|
125 | success: boolean;
|
126 | };
|
127 | export declare type IShellStateChanged = t.IPropChanged & {
|
128 | field: 'header' | 'footer' | 'tree' | 'body' | 'sidebar';
|
129 | };
|