@theia/terminal-manager 1.67.0-next.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +31 -0
  2. package/lib/browser/terminal-manager-frontend-contribution.d.ts +25 -0
  3. package/lib/browser/terminal-manager-frontend-contribution.d.ts.map +1 -0
  4. package/lib/browser/terminal-manager-frontend-contribution.js +173 -0
  5. package/lib/browser/terminal-manager-frontend-contribution.js.map +1 -0
  6. package/lib/browser/terminal-manager-frontend-module.d.ts +5 -0
  7. package/lib/browser/terminal-manager-frontend-module.d.ts.map +1 -0
  8. package/lib/browser/terminal-manager-frontend-module.js +55 -0
  9. package/lib/browser/terminal-manager-frontend-module.js.map +1 -0
  10. package/lib/browser/terminal-manager-frontend-view-contribution.d.ts +27 -0
  11. package/lib/browser/terminal-manager-frontend-view-contribution.d.ts.map +1 -0
  12. package/lib/browser/terminal-manager-frontend-view-contribution.js +278 -0
  13. package/lib/browser/terminal-manager-frontend-view-contribution.js.map +1 -0
  14. package/lib/browser/terminal-manager-preferences.d.ts +12 -0
  15. package/lib/browser/terminal-manager-preferences.d.ts.map +1 -0
  16. package/lib/browser/terminal-manager-preferences.js +42 -0
  17. package/lib/browser/terminal-manager-preferences.js.map +1 -0
  18. package/lib/browser/terminal-manager-tree-model.d.ts +71 -0
  19. package/lib/browser/terminal-manager-tree-model.d.ts.map +1 -0
  20. package/lib/browser/terminal-manager-tree-model.js +299 -0
  21. package/lib/browser/terminal-manager-tree-model.js.map +1 -0
  22. package/lib/browser/terminal-manager-tree-widget.d.ts +40 -0
  23. package/lib/browser/terminal-manager-tree-widget.d.ts.map +1 -0
  24. package/lib/browser/terminal-manager-tree-widget.js +276 -0
  25. package/lib/browser/terminal-manager-tree-widget.js.map +1 -0
  26. package/lib/browser/terminal-manager-types.d.ts +77 -0
  27. package/lib/browser/terminal-manager-types.d.ts.map +1 -0
  28. package/lib/browser/terminal-manager-types.js +117 -0
  29. package/lib/browser/terminal-manager-types.js.map +1 -0
  30. package/lib/browser/terminal-manager-widget.d.ts +108 -0
  31. package/lib/browser/terminal-manager-widget.d.ts.map +1 -0
  32. package/lib/browser/terminal-manager-widget.js +616 -0
  33. package/lib/browser/terminal-manager-widget.js.map +1 -0
  34. package/lib/package.spec.d.ts +1 -0
  35. package/lib/package.spec.d.ts.map +1 -0
  36. package/lib/package.spec.js +26 -0
  37. package/lib/package.spec.js.map +1 -0
  38. package/package.json +40 -0
  39. package/src/browser/terminal-manager-frontend-contribution.ts +164 -0
  40. package/src/browser/terminal-manager-frontend-module.ts +64 -0
  41. package/src/browser/terminal-manager-frontend-view-contribution.ts +309 -0
  42. package/src/browser/terminal-manager-preferences.ts +52 -0
  43. package/src/browser/terminal-manager-tree-model.ts +336 -0
  44. package/src/browser/terminal-manager-tree-widget.tsx +305 -0
  45. package/src/browser/terminal-manager-types.ts +173 -0
  46. package/src/browser/terminal-manager-widget.ts +686 -0
  47. package/src/browser/terminal-manager.css +51 -0
  48. package/src/package.spec.ts +27 -0
@@ -0,0 +1,173 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { Command, MenuPath } from '@theia/core';
18
+ import {
19
+ SelectableTreeNode,
20
+ CompositeTreeNode,
21
+ SplitPanel,
22
+ codicon,
23
+ ExpandableTreeNode,
24
+ Widget,
25
+ } from '@theia/core/lib/browser';
26
+ import { TerminalWidgetFactoryOptions, TerminalWidgetImpl } from '@theia/terminal/lib/browser/terminal-widget-impl';
27
+
28
+ export namespace TerminalManagerCommands {
29
+ export const MANAGER_NEW_TERMINAL_GROUP = Command.toDefaultLocalizedCommand({
30
+ id: 'terminal:new-in-manager-toolbar',
31
+ category: 'Terminal Manager',
32
+ label: 'Create New Terminal Group',
33
+ iconClass: codicon('split-horizontal'),
34
+ });
35
+ export const MANAGER_DELETE_TERMINAL = Command.toDefaultLocalizedCommand({
36
+ id: 'terminal:delete-terminal',
37
+ category: 'Terminal Manager',
38
+ label: 'Delete Terminal',
39
+ iconClass: codicon('trash'),
40
+ });
41
+ export const MANAGER_RENAME_TERMINAL = Command.toDefaultLocalizedCommand({
42
+ id: 'terminal: rename-terminal',
43
+ category: 'Terminal Manager',
44
+ label: 'Rename...',
45
+ iconClass: codicon('edit'),
46
+ });
47
+ export const MANAGER_NEW_PAGE_BOTTOM_TOOLBAR = Command.toDefaultLocalizedCommand({
48
+ id: 'terminal:new-manager-page',
49
+ category: 'Terminal Manager',
50
+ label: 'Create New Terminal Page',
51
+ iconClass: codicon('new-file'),
52
+ });
53
+ export const MANAGER_DELETE_PAGE = Command.toDefaultLocalizedCommand({
54
+ id: 'terminal:delete-page',
55
+ category: 'Terminal Manager',
56
+ label: 'Delete Page',
57
+ iconClass: codicon('trash'),
58
+ });
59
+ export const MANAGER_ADD_TERMINAL_TO_GROUP = Command.toDefaultLocalizedCommand({
60
+ id: 'terminal:manager-split-horizontal',
61
+ category: 'Terminal Manager',
62
+ label: 'Add terminal to group',
63
+ iconClass: codicon('split-vertical'),
64
+ });
65
+ export const MANAGER_DELETE_GROUP = Command.toDefaultLocalizedCommand({
66
+ id: 'terminal:manager-delete-group',
67
+ category: 'Terminal Manager',
68
+ label: 'Delete Group...',
69
+ iconClass: codicon('trash'),
70
+ });
71
+ export const MANAGER_SHOW_TREE_TOOLBAR = Command.toDefaultLocalizedCommand({
72
+ id: 'terminal:manager-toggle-tree',
73
+ category: 'Terminal Manager',
74
+ label: 'Toggle Tree View',
75
+ iconClass: codicon('list-tree'),
76
+ });
77
+
78
+ export const MANAGER_MAXIMIZE_BOTTOM_PANEL_TOOLBAR = Command.toDefaultLocalizedCommand({
79
+ id: 'terminal:manager-maximize-bottom-panel',
80
+ category: 'Terminal Manager',
81
+ label: 'Maximize Bottom Panel',
82
+ });
83
+ export const MANAGER_MINIMIZE_BOTTOM_PANEL_TOOLBAR = Command.toDefaultLocalizedCommand({
84
+ id: 'terminal:manager-minimize-bottom-panel',
85
+ category: 'Terminal Manager',
86
+ label: 'Minimize Bottom Panel',
87
+ });
88
+ export const MANAGER_CLEAR_ALL = Command.toDefaultLocalizedCommand({
89
+ id: 'terminal:manager-clear-all',
90
+ category: 'Terminal Manager',
91
+ label: 'Reset Terminal Manager layout',
92
+ iconClass: codicon('trash'),
93
+ });
94
+ export const MANAGER_OPEN_VIEW: Command = {
95
+ id: 'terminal:open-manager',
96
+ category: 'View',
97
+ label: 'Open Terminal Manager',
98
+ };
99
+ export const MANAGER_CLOSE_VIEW: Command = {
100
+ id: 'terminal:close-manager',
101
+ category: 'View',
102
+ label: 'Close Terminal Manager',
103
+ };
104
+ }
105
+
106
+ export const TERMINAL_MANAGER_TREE_CONTEXT_MENU = ['terminal-manager-tree-context-menu'];
107
+ export namespace TerminalManagerTreeTypes {
108
+ export type TerminalKey = `terminal-${string}`;
109
+ export const generateTerminalKey = (widget: TerminalWidgetImpl): TerminalKey => {
110
+ const { created } = widget.options as TerminalWidgetFactoryOptions;
111
+ return `terminal-${created}`;
112
+ };
113
+ export const isTerminalKey = (obj: unknown): obj is TerminalKey => typeof obj === 'string' && obj.startsWith('terminal-');
114
+ export interface TerminalNode extends SelectableTreeNode, CompositeTreeNode {
115
+ terminal: true;
116
+ isEditing: boolean;
117
+ label: string;
118
+ id: TerminalKey;
119
+ parentGroupId: GroupId;
120
+ }
121
+
122
+ export type GroupId = `group-${string}`;
123
+ export const isGroupId = (obj: unknown): obj is GroupId => typeof obj === 'string' && obj.startsWith('group-');
124
+ export interface GroupSplitPanel extends SplitPanel {
125
+ id: GroupId;
126
+ }
127
+ export interface TerminalGroupNode extends SelectableTreeNode, ExpandableTreeNode {
128
+ terminalGroup: true;
129
+ isEditing: boolean;
130
+ label: string;
131
+ id: GroupId;
132
+ parentPageId: PageId;
133
+ counter: number;
134
+ children: readonly TerminalNode[]
135
+ }
136
+
137
+ export type PageId = `page-${string}`;
138
+ export const isPageId = (obj: unknown): obj is PageId => typeof obj === 'string' && obj.startsWith('page-');
139
+ export interface PageSplitPanel extends SplitPanel {
140
+ id: PageId;
141
+ }
142
+ export interface PageNode extends SelectableTreeNode, ExpandableTreeNode {
143
+ page: true;
144
+ children: TerminalGroupNode[];
145
+ isEditing: boolean;
146
+ label: string;
147
+ id: PageId;
148
+ counter: number;
149
+ }
150
+
151
+ export type TerminalManagerTreeNode = PageNode | TerminalNode | TerminalGroupNode;
152
+ export type TerminalManagerValidId = PageId | TerminalKey | GroupId;
153
+ export const isPageNode = (obj: unknown): obj is PageNode => !!obj && typeof obj === 'object' && 'page' in obj;
154
+ export const isTerminalNode = (obj: unknown): obj is TerminalNode => !!obj && typeof obj === 'object' && 'terminal' in obj;
155
+ export const isGroupNode = (obj: unknown): obj is TerminalGroupNode => !!obj && typeof obj === 'object' && 'terminalGroup' in obj;
156
+ export const isTerminalManagerTreeNode = (
157
+ obj: unknown,
158
+ ): obj is PageNode | TerminalNode => isPageNode(obj) || isTerminalNode(obj) || isGroupNode(obj);
159
+ export interface SelectionChangedEvent {
160
+ activePageId: PageId | undefined;
161
+ activeTerminalId: TerminalKey | undefined;
162
+ activeGroupId: GroupId | undefined;
163
+ }
164
+
165
+ export type ContextMenuArgs = [Widget, TerminalManagerValidId];
166
+ export const toContextMenuArgs = (widget: Widget, node: TerminalManagerTreeNode): ContextMenuArgs => [widget, node.id as TerminalManagerValidId];
167
+
168
+ export const PAGE_NODE_MENU: MenuPath = ['terminal-manager-page-node'];
169
+ export const GROUP_NODE_MENU: MenuPath = ['terminal-manager-group-node'];
170
+ export const TERMINAL_NODE_MENU: MenuPath = ['terminal-manager-terminal-node'];
171
+ }
172
+
173
+ export type ReactInteraction<T = Element, U = MouseEvent> = React.MouseEvent<T, U> | React.KeyboardEvent<T>;