1 | import { TabBar, Widget, DockPanel, Panel } from '@phosphor/widgets';
|
2 | import { AttachedProperty } from '@phosphor/properties';
|
3 | import { TabBarRenderer, SideTabBar } from './tab-bars';
|
4 | import { SidebarMenuWidget, SidebarMenu } from './sidebar-menu-widget';
|
5 | import { SplitPositionHandler } from './split-panels';
|
6 | import { FrontendApplicationStateService } from '../frontend-application-state';
|
7 | import { TheiaDockPanel } from './theia-dock-panel';
|
8 | import { SidePanelToolbar } from './side-panel-toolbar';
|
9 | import { TabBarToolbarRegistry, TabBarToolbar } from './tab-bar-toolbar';
|
10 | import { DisposableCollection } from '../../common/disposable';
|
11 | import { ContextMenuRenderer } from '../context-menu-renderer';
|
12 | import { MenuPath } from '../../common/menu';
|
13 | import { SidebarBottomMenuWidget } from './sidebar-bottom-menu-widget';
|
14 | import { SidebarTopMenuWidget } from './sidebar-top-menu-widget';
|
15 |
|
16 | export declare const LEFT_RIGHT_AREA_CLASS = "theia-app-sides";
|
17 | export declare const SidePanelHandlerFactory: unique symbol;
|
18 | export declare const SIDE_PANEL_TOOLBAR_CONTEXT_MENU: MenuPath;
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | export declare class SidePanelHandler {
|
24 | |
25 |
|
26 |
|
27 |
|
28 | protected static readonly rankProperty: AttachedProperty<Widget, number | undefined>;
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | tabBar: SideTabBar;
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 | topMenu: SidebarMenuWidget;
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 | bottomMenu: SidebarMenuWidget;
|
48 | |
49 |
|
50 |
|
51 | toolBar: SidePanelToolbar;
|
52 | |
53 |
|
54 |
|
55 |
|
56 | dockPanel: TheiaDockPanel;
|
57 | |
58 |
|
59 |
|
60 |
|
61 | container: Panel;
|
62 | |
63 |
|
64 |
|
65 | readonly state: SidePanel.State;
|
66 | |
67 |
|
68 |
|
69 |
|
70 | protected side: 'left' | 'right';
|
71 | |
72 |
|
73 |
|
74 | protected options: SidePanel.Options;
|
75 | protected tabBarToolBarRegistry: TabBarToolbarRegistry;
|
76 | protected tabBarToolBarFactory: () => TabBarToolbar;
|
77 | protected tabBarRendererFactory: () => TabBarRenderer;
|
78 | protected sidebarTopWidgetFactory: () => SidebarTopMenuWidget;
|
79 | protected sidebarBottomWidgetFactory: () => SidebarBottomMenuWidget;
|
80 | protected splitPositionHandler: SplitPositionHandler;
|
81 | protected readonly applicationStateService: FrontendApplicationStateService;
|
82 | protected readonly dockPanelFactory: TheiaDockPanel.Factory;
|
83 | protected readonly contextMenuRenderer: ContextMenuRenderer;
|
84 | |
85 |
|
86 |
|
87 | create(side: 'left' | 'right', options: SidePanel.Options): void;
|
88 | protected createSideBar(): SideTabBar;
|
89 | protected createSidePanel(): TheiaDockPanel;
|
90 | protected createToolbar(): SidePanelToolbar;
|
91 | protected createSidebarTopMenu(): SidebarTopMenuWidget;
|
92 | protected createSidebarBottomMenu(): SidebarBottomMenuWidget;
|
93 | protected createSidebarMenu<T extends SidebarMenuWidget>(factory: () => T): T;
|
94 | protected showContextMenu(e: MouseEvent): void;
|
95 | protected createContainer(): Panel;
|
96 | /**
|
97 | * Create an object that describes the current side panel layout. This object may contain references
|
98 | * to widgets; these need to be transformed before the layout can be serialized.
|
99 | */
|
100 | getLayoutData(): SidePanel.LayoutData;
|
101 | /**
|
102 | * Apply a side panel layout that has been previously created with `getLayoutData`.
|
103 | */
|
104 | setLayoutData(layoutData: SidePanel.LayoutData): void;
|
105 | /**
|
106 | * Activate a widget residing in the side panel by ID.
|
107 | *
|
108 | * @returns the activated widget if it was found
|
109 | */
|
110 | activate(id: string): Widget | undefined;
|
111 | /**
|
112 | * Expand a widget residing in the side panel by ID. If no ID is given and the panel is
|
113 | * currently collapsed, the last active tab of this side panel is expanded. If no tab
|
114 | * was expanded previously, the first one is taken.
|
115 | *
|
116 | * @returns the expanded widget if it was found
|
117 | */
|
118 | expand(id?: string): Widget | undefined;
|
119 | /**
|
120 | * Collapse the sidebar so no items are expanded.
|
121 | */
|
122 | collapse(): Promise<void>;
|
123 | /**
|
124 | * Add a widget and its title to the dock panel and side bar.
|
125 | *
|
126 | * If the widget is already added, it will be moved.
|
127 | */
|
128 | addWidget(widget: Widget, options: SidePanel.WidgetOptions): void;
|
129 | /**
|
130 | * Add a menu to the sidebar top.
|
131 | *
|
132 | * If the menu is already added, it will be ignored.
|
133 | */
|
134 | addTopMenu(menu: SidebarMenu): void;
|
135 | /**
|
136 | * Remove a menu from the sidebar top.
|
137 | *
|
138 | * @param menuId id of the menu to remove
|
139 | */
|
140 | removeTopMenu(menuId: string): void;
|
141 | /**
|
142 | * Add a menu to the sidebar bottom.
|
143 | *
|
144 | * If the menu is already added, it will be ignored.
|
145 | */
|
146 | addBottomMenu(menu: SidebarMenu): void;
|
147 | /**
|
148 | * Remove a menu from the sidebar bottom.
|
149 | *
|
150 | * @param menuId id of the menu to remove
|
151 | */
|
152 | removeBottomMenu(menuId: string): void;
|
153 | protected updateToolbarTitle: () => void;
|
154 | |
155 |
|
156 |
|
157 | refresh(): void;
|
158 | |
159 |
|
160 |
|
161 |
|
162 |
|
163 | resize(size: number): void;
|
164 | |
165 |
|
166 |
|
167 |
|
168 | protected getPanelSize(): number | undefined;
|
169 | |
170 |
|
171 |
|
172 | protected getDefaultPanelSize(): number | undefined;
|
173 | |
174 |
|
175 |
|
176 |
|
177 | protected setPanelSize(size: number): Promise<void>;
|
178 | protected readonly toDisposeOnCurrentTabChanged: DisposableCollection;
|
179 | |
180 |
|
181 |
|
182 |
|
183 | protected onCurrentTabChanged(sender: SideTabBar, { currentTitle, currentIndex }: TabBar.ICurrentChangedArgs<Widget>): void;
|
184 | |
185 |
|
186 |
|
187 |
|
188 | protected onTabDetachRequested(sender: SideTabBar, { title, tab, clientX, clientY }: TabBar.ITabDetachRequestedArgs<Widget>): void;
|
189 | protected onWidgetAdded(sender: DockPanel, widget: Widget): void;
|
190 | protected onWidgetRemoved(sender: DockPanel, widget: Widget): void;
|
191 | protected updateSashState(sidePanelElement: Panel | null, sidePanelCollapsed: boolean): void;
|
192 | }
|
193 | export declare namespace SidePanel {
|
194 | |
195 |
|
196 |
|
197 | interface Options {
|
198 | |
199 |
|
200 |
|
201 |
|
202 |
|
203 | expandThreshold: number;
|
204 | |
205 |
|
206 |
|
207 |
|
208 | expandDuration: number;
|
209 | |
210 |
|
211 |
|
212 | initialSizeRatio: number;
|
213 | |
214 |
|
215 |
|
216 | emptySize: number;
|
217 | }
|
218 | |
219 |
|
220 |
|
221 | interface WidgetOptions {
|
222 | |
223 |
|
224 |
|
225 | rank?: number;
|
226 | }
|
227 | |
228 |
|
229 |
|
230 | interface LayoutData {
|
231 | type: 'sidepanel';
|
232 | items?: WidgetItem[];
|
233 | size?: number;
|
234 | }
|
235 | |
236 |
|
237 |
|
238 | interface WidgetItem extends WidgetOptions {
|
239 |
|
240 | widget?: Widget;
|
241 | expanded?: boolean;
|
242 | pinned?: boolean;
|
243 | }
|
244 | interface State {
|
245 | |
246 |
|
247 |
|
248 | empty: boolean;
|
249 | |
250 |
|
251 |
|
252 | expansion: ExpansionState;
|
253 | |
254 |
|
255 |
|
256 | pendingUpdate: Promise<void>;
|
257 | |
258 |
|
259 |
|
260 |
|
261 | lastActiveTabIndex?: number;
|
262 | |
263 |
|
264 |
|
265 |
|
266 | lastPanelSize?: number;
|
267 | }
|
268 | enum ExpansionState {
|
269 | collapsed = "collapsed",
|
270 | expanding = "expanding",
|
271 | expanded = "expanded",
|
272 | collapsing = "collapsing"
|
273 | }
|
274 | }
|
275 |
|
\ | No newline at end of file |