@eclipse-glsp/client 2.4.0-next.414 → 2.4.0-next.416
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.
- package/lib/base/auto-complete/auto-complete-widget.d.ts +3 -0
- package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js +20 -12
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- package/lib/base/auto-complete/base-autocomplete-palette.d.ts.map +1 -1
- package/lib/base/auto-complete/base-autocomplete-palette.js +2 -1
- package/lib/base/auto-complete/base-autocomplete-palette.js.map +1 -1
- package/lib/base/messages.d.ts +54 -0
- package/lib/base/messages.d.ts.map +1 -0
- package/lib/base/messages.js +77 -0
- package/lib/base/messages.js.map +1 -0
- package/lib/base/messages.json +82 -0
- package/lib/base/shortcuts/available-shortcuts-extension.d.ts.map +1 -1
- package/lib/base/shortcuts/available-shortcuts-extension.js +5 -4
- package/lib/base/shortcuts/available-shortcuts-extension.js.map +1 -1
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.d.ts.map +1 -1
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js +21 -11
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -1
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.d.ts.map +1 -1
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js +4 -4
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js.map +1 -1
- package/lib/features/accessibility/global-keylistener-tool.d.ts.map +1 -1
- package/lib/features/accessibility/global-keylistener-tool.js +15 -4
- package/lib/features/accessibility/global-keylistener-tool.js.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.d.ts +0 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js +12 -39
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js.map +1 -1
- package/lib/features/accessibility/search/search-palette.d.ts.map +1 -1
- package/lib/features/accessibility/search/search-palette.js +3 -2
- package/lib/features/accessibility/search/search-palette.js.map +1 -1
- package/lib/features/accessibility/search/search-tool.d.ts.map +1 -1
- package/lib/features/accessibility/search/search-tool.js +9 -3
- package/lib/features/accessibility/search/search-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.js +10 -5
- package/lib/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.js.map +1 -1
- package/lib/features/change-bounds/resize/resize-default-tool.d.ts.map +1 -1
- package/lib/features/change-bounds/resize/resize-default-tool.js +9 -3
- package/lib/features/change-bounds/resize/resize-default-tool.js.map +1 -1
- package/lib/features/change-bounds/resize/resize-tool.d.ts.map +1 -1
- package/lib/features/change-bounds/resize/resize-tool.js +29 -9
- package/lib/features/change-bounds/resize/resize-tool.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +2 -0
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +57 -35
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +9 -3
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/viewport/viewport-tool.d.ts.map +1 -1
- package/lib/features/viewport/viewport-tool.js +21 -5
- package/lib/features/viewport/viewport-tool.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts.map +1 -1
- package/lib/views/glsp-projection-view.js +2 -1
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/package.json +3 -3
- package/src/base/auto-complete/auto-complete-widget.ts +21 -10
- package/src/base/auto-complete/base-autocomplete-palette.ts +2 -1
- package/src/base/messages.json +82 -0
- package/src/base/messages.ts +96 -0
- package/src/base/shortcuts/available-shortcuts-extension.ts +5 -4
- package/src/features/accessibility/element-navigation/diagram-navigation-tool.ts +17 -5
- package/src/features/accessibility/focus-tracker/focus-tracker-tool.ts +3 -3
- package/src/features/accessibility/global-keylistener-tool.ts +17 -4
- package/src/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.ts +13 -47
- package/src/features/accessibility/search/search-palette.ts +3 -2
- package/src/features/accessibility/search/search-tool.ts +11 -3
- package/src/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.ts +11 -4
- package/src/features/change-bounds/resize/resize-default-tool.ts +11 -3
- package/src/features/change-bounds/resize/resize-tool.ts +29 -7
- package/src/features/tool-palette/tool-palette.ts +60 -34
- package/src/features/tools/change-bounds/change-bounds-tool.ts +11 -3
- package/src/features/viewport/viewport-tool.ts +23 -5
- package/src/index.ts +1 -0
- package/src/views/glsp-projection-view.tsx +2 -1
- package/lib/features/accessibility/toast/messages.json +0 -18
- package/src/features/accessibility/toast/messages.json +0 -18
|
@@ -26,28 +26,18 @@ import {
|
|
|
26
26
|
TriggerNodeCreationAction
|
|
27
27
|
} from '@eclipse-glsp/sprotty';
|
|
28
28
|
import { injectable } from 'inversify';
|
|
29
|
+
import { messages } from '../../../base/messages';
|
|
29
30
|
import { EnableDefaultToolsAction, EnableToolsAction } from '../../../base/tool-manager/tool';
|
|
30
|
-
import {
|
|
31
|
-
changeCodiconClass,
|
|
32
|
-
compare,
|
|
33
|
-
createIcon,
|
|
34
|
-
createToolGroup,
|
|
35
|
-
EnableToolPaletteAction,
|
|
36
|
-
ToolPalette
|
|
37
|
-
} from '../../tool-palette/tool-palette';
|
|
31
|
+
import { compare, createIcon, createToolGroup, EnableToolPaletteAction, ToolPalette } from '../../tool-palette/tool-palette';
|
|
38
32
|
import { MouseDeleteTool } from '../../tools/deletion/delete-tool';
|
|
39
33
|
import { MarqueeMouseTool } from '../../tools/marquee-selection/marquee-mouse-tool';
|
|
40
34
|
import { FocusDomAction } from '../actions';
|
|
41
35
|
import { EdgeAutocompletePaletteMetadata } from '../edge-autocomplete/edge-autocomplete-palette';
|
|
42
36
|
import { ElementNavigatorKeyListener } from '../element-navigation/diagram-navigation-tool';
|
|
43
37
|
import { KeyboardNodeGridMetadata } from '../keyboard-grid/constants';
|
|
44
|
-
import * as messages from '../toast/messages.json';
|
|
45
38
|
import { ShowToastMessageAction } from '../toast/toast-handler';
|
|
46
39
|
|
|
47
40
|
const SEARCH_ICON_ID = 'search';
|
|
48
|
-
const PALETTE_ICON_ID = 'tools';
|
|
49
|
-
const CHEVRON_DOWN_ICON_ID = 'chevron-right';
|
|
50
|
-
const PALETTE_HEIGHT = '500px';
|
|
51
41
|
const SELECTION_TOOL_KEY: KeyCode[] = ['Digit1', 'Numpad1'];
|
|
52
42
|
const DELETION_TOOL_KEY: KeyCode[] = ['Digit2', 'Numpad2'];
|
|
53
43
|
const MARQUEE_TOOL_KEY: KeyCode[] = ['Digit3', 'Numpad3'];
|
|
@@ -103,9 +93,10 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
103
93
|
}
|
|
104
94
|
|
|
105
95
|
protected override initializeContents(_containerElement: HTMLElement): void {
|
|
106
|
-
this.containerElement.setAttribute('aria-label',
|
|
96
|
+
this.containerElement.setAttribute('aria-label', messages.tool_palette.label);
|
|
107
97
|
this.containerElement.tabIndex = 20;
|
|
108
98
|
this.containerElement.classList.add('accessibility-tool-palette');
|
|
99
|
+
this.addMinimizePaletteButton();
|
|
109
100
|
this.createHeader();
|
|
110
101
|
this.createBody();
|
|
111
102
|
this.lastActiveButton = this.defaultToolsButton;
|
|
@@ -147,31 +138,6 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
147
138
|
}
|
|
148
139
|
}
|
|
149
140
|
|
|
150
|
-
protected override addMinimizePaletteButton(): void {
|
|
151
|
-
const baseDiv = document.getElementById(this.options.baseDiv);
|
|
152
|
-
const minPaletteDiv = document.createElement('div');
|
|
153
|
-
minPaletteDiv.classList.add('minimize-palette-button');
|
|
154
|
-
this.containerElement.classList.add('collapsible-palette');
|
|
155
|
-
if (baseDiv) {
|
|
156
|
-
const insertedDiv = baseDiv.insertBefore(minPaletteDiv, baseDiv.firstChild);
|
|
157
|
-
const minimizeIcon = createIcon(CHEVRON_DOWN_ICON_ID);
|
|
158
|
-
this.updateMinimizePaletteButtonTooltip(minPaletteDiv);
|
|
159
|
-
minimizeIcon.onclick = _event => {
|
|
160
|
-
if (this.isPaletteMaximized()) {
|
|
161
|
-
this.containerElement.style.overflow = 'hidden';
|
|
162
|
-
this.containerElement.style.maxHeight = '0px';
|
|
163
|
-
} else {
|
|
164
|
-
this.containerElement.style.overflow = 'visible';
|
|
165
|
-
this.containerElement.style.maxHeight = PALETTE_HEIGHT;
|
|
166
|
-
}
|
|
167
|
-
this.updateMinimizePaletteButtonTooltip(minPaletteDiv);
|
|
168
|
-
changeCodiconClass(minimizeIcon, PALETTE_ICON_ID);
|
|
169
|
-
changeCodiconClass(minimizeIcon, CHEVRON_DOWN_ICON_ID);
|
|
170
|
-
};
|
|
171
|
-
insertedDiv.appendChild(minimizeIcon);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
141
|
protected override createBody(): void {
|
|
176
142
|
const bodyDiv = document.createElement('div');
|
|
177
143
|
bodyDiv.classList.add('palette-body');
|
|
@@ -199,11 +165,11 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
199
165
|
|
|
200
166
|
if (this.paletteItems.length === 0) {
|
|
201
167
|
const noResultsDiv = document.createElement('div');
|
|
202
|
-
noResultsDiv.innerText =
|
|
168
|
+
noResultsDiv.innerText = messages.tool_palette.no_items;
|
|
203
169
|
noResultsDiv.classList.add('tool-button');
|
|
204
170
|
bodyDiv.appendChild(noResultsDiv);
|
|
205
171
|
}
|
|
206
|
-
//
|
|
172
|
+
// Replace existing body to refresh filtered entries
|
|
207
173
|
if (this.bodyDiv) {
|
|
208
174
|
this.containerElement.removeChild(this.bodyDiv);
|
|
209
175
|
}
|
|
@@ -261,7 +227,7 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
261
227
|
protected override createDefaultToolButton(): HTMLElement {
|
|
262
228
|
const button = createIcon('inspect');
|
|
263
229
|
button.id = 'btn_default_tools';
|
|
264
|
-
button.title =
|
|
230
|
+
button.title = messages.tool_palette.selection_button;
|
|
265
231
|
button.onclick = this.onClickStaticToolButton(button);
|
|
266
232
|
button.appendChild(this.createKeyboardShotcut(SELECTION_TOOL_KEY[0]));
|
|
267
233
|
|
|
@@ -270,7 +236,7 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
270
236
|
|
|
271
237
|
protected override createMouseDeleteToolButton(): HTMLElement {
|
|
272
238
|
const deleteToolButton = createIcon('chrome-close');
|
|
273
|
-
deleteToolButton.title =
|
|
239
|
+
deleteToolButton.title = messages.tool_palette.delete_button;
|
|
274
240
|
deleteToolButton.onclick = this.onClickStaticToolButton(deleteToolButton, MouseDeleteTool.ID);
|
|
275
241
|
deleteToolButton.appendChild(this.createKeyboardShotcut(DELETION_TOOL_KEY[0]));
|
|
276
242
|
|
|
@@ -279,10 +245,10 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
279
245
|
|
|
280
246
|
protected override createMarqueeToolButton(): HTMLElement {
|
|
281
247
|
const marqueeToolButton = createIcon('screen-full');
|
|
282
|
-
marqueeToolButton.title =
|
|
248
|
+
marqueeToolButton.title = messages.tool_palette.marquee_button;
|
|
283
249
|
const toastMessageAction = ShowToastMessageAction.createWithTimeout({
|
|
284
250
|
id: Symbol.for(ElementNavigatorKeyListener.name),
|
|
285
|
-
message: messages.tool_palette.
|
|
251
|
+
message: messages.tool_palette.marquee_message
|
|
286
252
|
});
|
|
287
253
|
marqueeToolButton.onclick = this.onClickStaticToolButton(marqueeToolButton, MarqueeMouseTool.ID, toastMessageAction);
|
|
288
254
|
marqueeToolButton.appendChild(this.createKeyboardShotcut(MARQUEE_TOOL_KEY[0]));
|
|
@@ -292,7 +258,7 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
292
258
|
|
|
293
259
|
protected override createValidateButton(): HTMLElement {
|
|
294
260
|
const validateToolButton = createIcon('pass');
|
|
295
|
-
validateToolButton.title =
|
|
261
|
+
validateToolButton.title = messages.tool_palette.validate_button;
|
|
296
262
|
validateToolButton.onclick = _event => {
|
|
297
263
|
const modelIds: string[] = [this.modelRootId];
|
|
298
264
|
this.actionDispatcher.dispatch(RequestMarkersAction.create(modelIds));
|
|
@@ -330,7 +296,7 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
330
296
|
}
|
|
331
297
|
};
|
|
332
298
|
searchIcon.classList.add('search-icon');
|
|
333
|
-
searchIcon.title =
|
|
299
|
+
searchIcon.title = messages.tool_palette.search_button;
|
|
334
300
|
searchIcon.appendChild(this.createKeyboardShotcut(SEARCH_TOOL_KEY[0]));
|
|
335
301
|
|
|
336
302
|
return searchIcon;
|
|
@@ -342,7 +308,7 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
342
308
|
searchField.tabIndex = 21;
|
|
343
309
|
searchField.id = this.containerElement.id + '_search_field';
|
|
344
310
|
searchField.type = 'text';
|
|
345
|
-
searchField.placeholder =
|
|
311
|
+
searchField.placeholder = messages.tool_palette.search_placeholder;
|
|
346
312
|
searchField.style.display = 'none';
|
|
347
313
|
searchField.onkeyup = ev => {
|
|
348
314
|
this.requestFilterUpdate(this.searchField.value);
|
|
@@ -34,6 +34,7 @@ import { BaseAutocompletePalette } from '../../../base/auto-complete/base-autoco
|
|
|
34
34
|
|
|
35
35
|
import { AutocompleteSuggestion, IAutocompleteSuggestionProvider } from '../../../base/auto-complete/autocomplete-suggestion-providers';
|
|
36
36
|
import { applyCssClasses, deleteCssClasses } from '../../../base/feedback/css-feedback';
|
|
37
|
+
import { messages } from '../../../base/messages';
|
|
37
38
|
import { RepositionAction } from '../../../features/viewport/reposition';
|
|
38
39
|
import { GEdge } from '../../../model';
|
|
39
40
|
|
|
@@ -121,8 +122,8 @@ export class SearchAutocompletePalette extends BaseAutocompletePalette {
|
|
|
121
122
|
protected override initializeContents(containerElement: HTMLElement): void {
|
|
122
123
|
super.initializeContents(containerElement);
|
|
123
124
|
|
|
124
|
-
this.autocompleteWidget.inputField.placeholder =
|
|
125
|
-
containerElement.setAttribute('aria-label',
|
|
125
|
+
this.autocompleteWidget.inputField.placeholder = messages.search.placeholder;
|
|
126
|
+
containerElement.setAttribute('aria-label', messages.search.label);
|
|
126
127
|
}
|
|
127
128
|
protected getSuggestionProviders(root: Readonly<GModelRoot>, input: string): IAutocompleteSuggestionProvider[] {
|
|
128
129
|
return [
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { Action, GModelElement, KeyListener, matchesKeystroke, SetUIExtensionVisibilityAction, TYPES } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { inject, injectable } from 'inversify';
|
|
19
|
+
import { messages, repeatOnMessagesUpdated } from '../../../base/messages';
|
|
19
20
|
import type { IShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
20
21
|
import { BaseTool } from '../../tools/base-tools';
|
|
21
22
|
import { SearchAutocompletePalette } from './search-palette';
|
|
@@ -36,9 +37,16 @@ export class SearchAutocompletePaletteTool extends BaseTool {
|
|
|
36
37
|
enable(): void {
|
|
37
38
|
this.toDisposeOnDisable.push(
|
|
38
39
|
this.keyTool.registerListener(this.keyListener),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
repeatOnMessagesUpdated(() =>
|
|
41
|
+
this.shortcutManager.register(SearchAutocompletePaletteTool.TOKEN, [
|
|
42
|
+
{
|
|
43
|
+
shortcuts: ['CTRL', 'F'],
|
|
44
|
+
description: messages.search.shortcut_activate,
|
|
45
|
+
group: messages.shortcut.group_search,
|
|
46
|
+
position: 0
|
|
47
|
+
}
|
|
48
|
+
])
|
|
49
|
+
)
|
|
42
50
|
);
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
matchesKeystroke
|
|
29
29
|
} from '@eclipse-glsp/sprotty';
|
|
30
30
|
import { inject, injectable } from 'inversify';
|
|
31
|
+
import { messages, repeatOnMessagesUpdated } from '../../../base/messages';
|
|
31
32
|
import { SelectionService } from '../../../base/selection-service';
|
|
32
33
|
import type { IShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
33
34
|
import { getAbsolutePositionByPoint } from '../../../utils/viewpoint-util';
|
|
@@ -35,7 +36,6 @@ import { BaseTool } from '../../tools/base-tools';
|
|
|
35
36
|
import type { ZoomFactors } from '../../viewport/zoom-viewport-action';
|
|
36
37
|
import { ElementNavigatorKeyListener } from '../element-navigation/diagram-navigation-tool';
|
|
37
38
|
import { EnableKeyboardGridAction, KeyboardGridCellSelectedAction, KeyboardGridKeyboardEventAction } from '../keyboard-grid/action';
|
|
38
|
-
import * as messages from '../toast/messages.json';
|
|
39
39
|
import { HideToastAction, ShowToastMessageAction } from '../toast/toast-handler';
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -59,9 +59,16 @@ export class GridCellZoomTool extends BaseTool {
|
|
|
59
59
|
enable(): void {
|
|
60
60
|
this.toDisposeOnDisable.push(
|
|
61
61
|
this.keyTool.registerListener(this.zoomKeyListener),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
repeatOnMessagesUpdated(() =>
|
|
63
|
+
this.shortcutManager.register(GridCellZoomTool.TOKEN, [
|
|
64
|
+
{
|
|
65
|
+
shortcuts: ['CTRL', '+'],
|
|
66
|
+
description: messages.grid.shortcut_zoom_in,
|
|
67
|
+
group: messages.shortcut.group_zoom,
|
|
68
|
+
position: 0
|
|
69
|
+
}
|
|
70
|
+
])
|
|
71
|
+
)
|
|
65
72
|
);
|
|
66
73
|
}
|
|
67
74
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { KeyListener, matchesKeystroke, TYPES, type Action, type GModelElement, type IActionDispatcher } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { inject, injectable } from 'inversify';
|
|
19
|
+
import { messages, repeatOnMessagesUpdated } from '../../../base/messages';
|
|
19
20
|
import { SelectionService } from '../../../base/selection-service';
|
|
20
21
|
import type { ShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
21
22
|
import { EnableToolsAction } from '../../../base/tool-manager/tool';
|
|
@@ -67,9 +68,16 @@ export class DefaultResizeKeyTool extends BaseEditTool {
|
|
|
67
68
|
enable(): void {
|
|
68
69
|
this.toDisposeOnDisable.push(
|
|
69
70
|
this.keyTool.registerListener(this.keyListener),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
repeatOnMessagesUpdated(() =>
|
|
72
|
+
this.shortcutManager.register(DefaultResizeKeyTool.TOKEN, [
|
|
73
|
+
{
|
|
74
|
+
shortcuts: ['ALT', 'A'],
|
|
75
|
+
description: messages.resize.shortcut_activate,
|
|
76
|
+
group: messages.shortcut.group_resize,
|
|
77
|
+
position: 0
|
|
78
|
+
}
|
|
79
|
+
])
|
|
80
|
+
)
|
|
73
81
|
);
|
|
74
82
|
}
|
|
75
83
|
}
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
import { KeyListener, matchesKeystroke, TYPES, type Action, type GModelElement } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { inject, injectable } from 'inversify';
|
|
19
19
|
import { Disposable } from 'vscode-jsonrpc';
|
|
20
|
+
import { messages, repeatOnMessagesUpdated } from '../../../base/messages';
|
|
20
21
|
import { SelectionService } from '../../../base/selection-service';
|
|
21
22
|
import type { ShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
22
|
-
import * as messages from '../../accessibility/toast/messages.json';
|
|
23
23
|
import { ShowToastMessageAction } from '../../accessibility/toast/toast-handler';
|
|
24
24
|
import { BaseEditTool } from '../../tools/base-tools';
|
|
25
25
|
import { isResizable } from '../model';
|
|
@@ -100,12 +100,34 @@ export class ResizeKeyTool extends BaseEditTool {
|
|
|
100
100
|
|
|
101
101
|
this.toDisposeOnDisable.push(
|
|
102
102
|
this.keyTool.registerListener(this.keyListener),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
repeatOnMessagesUpdated(() =>
|
|
104
|
+
this.shortcutManager.register(ResizeKeyTool.TOKEN, [
|
|
105
|
+
{
|
|
106
|
+
shortcuts: ['Escape'],
|
|
107
|
+
description: messages.resize.shortcut_deactivate,
|
|
108
|
+
group: messages.shortcut.group_resize,
|
|
109
|
+
position: 0
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
shortcuts: ['+'],
|
|
113
|
+
description: messages.resize.shortcut_increase,
|
|
114
|
+
group: messages.shortcut.group_resize,
|
|
115
|
+
position: 1
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
shortcuts: ['-'],
|
|
119
|
+
description: messages.resize.shortcut_decrease,
|
|
120
|
+
group: messages.shortcut.group_resize,
|
|
121
|
+
position: 2
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
shortcuts: ['CTRL', '0'],
|
|
125
|
+
description: messages.resize.shortcut_reset,
|
|
126
|
+
group: messages.shortcut.group_resize,
|
|
127
|
+
position: 3
|
|
128
|
+
}
|
|
129
|
+
])
|
|
130
|
+
),
|
|
109
131
|
Disposable.create(() => {
|
|
110
132
|
this.dispatchActions(this.keyListener.disable());
|
|
111
133
|
})
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { inject, injectable, optional, postConstruct } from 'inversify';
|
|
36
36
|
import { EditorContextService, IEditModeListener } from '../../base/editor-context-service';
|
|
37
37
|
import { FocusTracker } from '../../base/focus/focus-tracker';
|
|
38
|
+
import { messages, repeatOnMessagesUpdated } from '../../base/messages';
|
|
38
39
|
import { IDiagramStartup } from '../../base/model/diagram-loader';
|
|
39
40
|
import { EnableDefaultToolsAction, EnableToolsAction } from '../../base/tool-manager/tool';
|
|
40
41
|
import { GLSPAbstractUIExtension } from '../../base/ui-extension/ui-extension';
|
|
@@ -89,6 +90,8 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
89
90
|
protected paletteItems: PaletteItem[];
|
|
90
91
|
protected paletteItemsCopy: PaletteItem[] = [];
|
|
91
92
|
protected dynamic = false;
|
|
93
|
+
protected toggleButton?: HTMLElement;
|
|
94
|
+
protected headerDiv?: HTMLElement;
|
|
92
95
|
protected bodyDiv?: HTMLElement;
|
|
93
96
|
protected lastActiveButton?: HTMLElement;
|
|
94
97
|
protected defaultToolsButton: HTMLElement;
|
|
@@ -105,6 +108,13 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
105
108
|
@postConstruct()
|
|
106
109
|
postConstruct(): void {
|
|
107
110
|
this.editorContext.onEditModeChanged(change => this.editModeChanged(change.newValue, change.oldValue));
|
|
111
|
+
repeatOnMessagesUpdated(
|
|
112
|
+
() => {
|
|
113
|
+
this.createHeader();
|
|
114
|
+
this.addMinimizePaletteButton();
|
|
115
|
+
},
|
|
116
|
+
{ initial: false }
|
|
117
|
+
);
|
|
108
118
|
}
|
|
109
119
|
|
|
110
120
|
override initialize(): boolean {
|
|
@@ -115,10 +125,11 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
115
125
|
}
|
|
116
126
|
|
|
117
127
|
protected initializeContents(containerElement: HTMLElement): void {
|
|
128
|
+
this.addMinimizePaletteButton();
|
|
118
129
|
this.createHeader();
|
|
119
130
|
this.createBody();
|
|
120
131
|
this.lastActiveButton = this.defaultToolsButton;
|
|
121
|
-
containerElement.setAttribute('aria-label',
|
|
132
|
+
containerElement.setAttribute('aria-label', messages.tool_palette.label);
|
|
122
133
|
}
|
|
123
134
|
|
|
124
135
|
protected override onBeforeShow(_containerElement: HTMLElement, root: Readonly<GModelRoot>): void {
|
|
@@ -128,32 +139,40 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
128
139
|
|
|
129
140
|
protected addMinimizePaletteButton(): void {
|
|
130
141
|
const baseDiv = document.getElementById(this.options.baseDiv);
|
|
131
|
-
|
|
132
|
-
|
|
142
|
+
if (!baseDiv) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const toggleButton = document.createElement('div');
|
|
146
|
+
toggleButton.classList.add('minimize-palette-button');
|
|
133
147
|
this.containerElement.classList.add('collapsible-palette');
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
const minimizeIcon = createIcon(CHEVRON_DOWN_ICON_ID);
|
|
149
|
+
this.updateMinimizePaletteButtonTooltip(toggleButton);
|
|
150
|
+
minimizeIcon.onclick = _event => {
|
|
151
|
+
if (this.isPaletteMaximized()) {
|
|
152
|
+
this.containerElement.style.maxHeight = '0px';
|
|
153
|
+
} else {
|
|
154
|
+
this.containerElement.style.maxHeight = PALETTE_HEIGHT;
|
|
155
|
+
}
|
|
156
|
+
this.updateMinimizePaletteButtonTooltip(toggleButton);
|
|
157
|
+
changeCodiconClass(minimizeIcon, PALETTE_ICON_ID);
|
|
158
|
+
changeCodiconClass(minimizeIcon, CHEVRON_DOWN_ICON_ID);
|
|
159
|
+
};
|
|
160
|
+
toggleButton.appendChild(minimizeIcon);
|
|
161
|
+
|
|
162
|
+
// Replace existing header to refresh
|
|
163
|
+
if (this.toggleButton) {
|
|
164
|
+
this.toggleButton.replaceWith(toggleButton);
|
|
165
|
+
} else {
|
|
166
|
+
baseDiv.insertBefore(toggleButton, baseDiv.firstChild);
|
|
149
167
|
}
|
|
168
|
+
this.toggleButton = toggleButton;
|
|
150
169
|
}
|
|
151
170
|
|
|
152
171
|
protected updateMinimizePaletteButtonTooltip(button: HTMLDivElement): void {
|
|
153
172
|
if (this.isPaletteMaximized()) {
|
|
154
|
-
button.title =
|
|
173
|
+
button.title = messages.tool_palette.minimize;
|
|
155
174
|
} else {
|
|
156
|
-
button.title =
|
|
175
|
+
button.title = messages.tool_palette.maximize;
|
|
157
176
|
}
|
|
158
177
|
}
|
|
159
178
|
|
|
@@ -176,26 +195,33 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
176
195
|
});
|
|
177
196
|
if (this.paletteItems.length === 0) {
|
|
178
197
|
const noResultsDiv = document.createElement('div');
|
|
179
|
-
noResultsDiv.innerText =
|
|
198
|
+
noResultsDiv.innerText = messages.tool_palette.no_items;
|
|
180
199
|
noResultsDiv.classList.add('tool-button');
|
|
181
200
|
bodyDiv.appendChild(noResultsDiv);
|
|
182
201
|
}
|
|
183
202
|
// Remove existing body to refresh filtered entries
|
|
184
203
|
if (this.bodyDiv) {
|
|
185
|
-
this.
|
|
204
|
+
this.bodyDiv.replaceWith(bodyDiv);
|
|
205
|
+
} else {
|
|
206
|
+
this.containerElement.appendChild(bodyDiv);
|
|
186
207
|
}
|
|
187
|
-
this.containerElement.appendChild(bodyDiv);
|
|
188
208
|
this.bodyDiv = bodyDiv;
|
|
189
209
|
}
|
|
190
210
|
|
|
191
211
|
protected createHeader(): void {
|
|
192
|
-
this.addMinimizePaletteButton();
|
|
193
212
|
const headerCompartment = document.createElement('div');
|
|
194
213
|
headerCompartment.classList.add('palette-header');
|
|
195
214
|
headerCompartment.append(this.createHeaderTitle());
|
|
196
215
|
headerCompartment.appendChild(this.createHeaderTools());
|
|
197
216
|
headerCompartment.appendChild((this.searchField = this.createHeaderSearchField()));
|
|
198
|
-
|
|
217
|
+
|
|
218
|
+
// Replace existing header to refresh
|
|
219
|
+
if (this.headerDiv) {
|
|
220
|
+
this.headerDiv.replaceWith(headerCompartment);
|
|
221
|
+
} else {
|
|
222
|
+
this.containerElement.appendChild(headerCompartment);
|
|
223
|
+
}
|
|
224
|
+
this.headerDiv = headerCompartment;
|
|
199
225
|
}
|
|
200
226
|
|
|
201
227
|
protected createHeaderTools(): HTMLElement {
|
|
@@ -237,7 +263,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
237
263
|
protected createDefaultToolButton(): HTMLElement {
|
|
238
264
|
const button = createIcon('inspect');
|
|
239
265
|
button.id = 'btn_default_tools';
|
|
240
|
-
button.title =
|
|
266
|
+
button.title = messages.tool_palette.selection_button;
|
|
241
267
|
button.onclick = this.onClickStaticToolButton(button);
|
|
242
268
|
button.ariaLabel = button.title;
|
|
243
269
|
button.tabIndex = 1;
|
|
@@ -246,7 +272,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
246
272
|
|
|
247
273
|
protected createMouseDeleteToolButton(): HTMLElement {
|
|
248
274
|
const deleteToolButton = createIcon('chrome-close');
|
|
249
|
-
deleteToolButton.title =
|
|
275
|
+
deleteToolButton.title = messages.tool_palette.delete_button;
|
|
250
276
|
deleteToolButton.onclick = this.onClickStaticToolButton(deleteToolButton, MouseDeleteTool.ID);
|
|
251
277
|
deleteToolButton.ariaLabel = deleteToolButton.title;
|
|
252
278
|
deleteToolButton.tabIndex = 1;
|
|
@@ -255,7 +281,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
255
281
|
|
|
256
282
|
protected createMarqueeToolButton(): HTMLElement {
|
|
257
283
|
const marqueeToolButton = createIcon('screen-full');
|
|
258
|
-
marqueeToolButton.title =
|
|
284
|
+
marqueeToolButton.title = messages.tool_palette.marquee_button;
|
|
259
285
|
marqueeToolButton.onclick = this.onClickStaticToolButton(marqueeToolButton, MarqueeMouseTool.ID);
|
|
260
286
|
marqueeToolButton.ariaLabel = marqueeToolButton.title;
|
|
261
287
|
marqueeToolButton.tabIndex = 1;
|
|
@@ -264,7 +290,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
264
290
|
|
|
265
291
|
protected createValidateButton(): HTMLElement {
|
|
266
292
|
const validateActionButton = createIcon('pass');
|
|
267
|
-
validateActionButton.title =
|
|
293
|
+
validateActionButton.title = messages.tool_palette.validate_button;
|
|
268
294
|
validateActionButton.onclick = _event => {
|
|
269
295
|
const modelIds: string[] = [this.modelRootId];
|
|
270
296
|
this.actionDispatcher.dispatch(RequestMarkersAction.create(modelIds, { reason: MarkersReason.BATCH }));
|
|
@@ -277,7 +303,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
277
303
|
|
|
278
304
|
protected createResetViewportButton(): HTMLElement {
|
|
279
305
|
const resetViewportButton = createIcon('screen-normal');
|
|
280
|
-
resetViewportButton.title =
|
|
306
|
+
resetViewportButton.title = messages.tool_palette.reset_viewport_button;
|
|
281
307
|
resetViewportButton.onclick = _event => {
|
|
282
308
|
this.actionDispatcher.dispatch(OriginViewportAction.create());
|
|
283
309
|
resetViewportButton.focus();
|
|
@@ -289,7 +315,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
289
315
|
|
|
290
316
|
protected createToggleGridButton(): HTMLElement {
|
|
291
317
|
const toggleGridButton = createIcon('symbol-numeric');
|
|
292
|
-
toggleGridButton.title =
|
|
318
|
+
toggleGridButton.title = messages.tool_palette.toggle_grid_button;
|
|
293
319
|
toggleGridButton.onclick = () => {
|
|
294
320
|
if (this.gridManager?.isGridVisible) {
|
|
295
321
|
toggleGridButton.classList.remove(CLICKED_CSS_CLASS);
|
|
@@ -309,7 +335,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
309
335
|
|
|
310
336
|
protected createToggleDebugButton(): HTMLElement {
|
|
311
337
|
const toggleDebugButton = createIcon('debug');
|
|
312
|
-
toggleDebugButton.title =
|
|
338
|
+
toggleDebugButton.title = messages.tool_palette.debug_mode_button;
|
|
313
339
|
toggleDebugButton.onclick = () => {
|
|
314
340
|
if (this.debugManager?.isDebugEnabled) {
|
|
315
341
|
toggleDebugButton.classList.remove(CLICKED_CSS_CLASS);
|
|
@@ -341,7 +367,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
341
367
|
}
|
|
342
368
|
};
|
|
343
369
|
searchIcon.classList.add('search-icon');
|
|
344
|
-
searchIcon.title =
|
|
370
|
+
searchIcon.title = messages.tool_palette.search_button;
|
|
345
371
|
searchIcon.ariaLabel = searchIcon.title;
|
|
346
372
|
searchIcon.tabIndex = 1;
|
|
347
373
|
return searchIcon;
|
|
@@ -352,7 +378,7 @@ export class ToolPalette extends GLSPAbstractUIExtension implements IActionHandl
|
|
|
352
378
|
searchField.classList.add('search-input');
|
|
353
379
|
searchField.id = this.containerElement.id + '_search_field';
|
|
354
380
|
searchField.type = 'text';
|
|
355
|
-
searchField.placeholder =
|
|
381
|
+
searchField.placeholder = messages.tool_palette.search_placeholder;
|
|
356
382
|
searchField.style.display = 'none';
|
|
357
383
|
searchField.onkeyup = () => this.requestFilterUpdate(this.searchField.value);
|
|
358
384
|
searchField.onkeydown = ev => this.clearOnEscape(ev);
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
} from '@eclipse-glsp/sprotty';
|
|
41
41
|
import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener';
|
|
42
42
|
import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
|
|
43
|
+
import { messages, repeatOnMessagesUpdated } from '../../../base/messages';
|
|
43
44
|
import { ISelectionListener, SelectionService } from '../../../base/selection-service';
|
|
44
45
|
import type { IShortcutManager } from '../../../base/shortcuts/shortcuts-manager';
|
|
45
46
|
import {
|
|
@@ -117,9 +118,16 @@ export class ChangeBoundsTool extends BaseEditTool {
|
|
|
117
118
|
const createMoveKeyListener = this.createMoveKeyListener();
|
|
118
119
|
this.toDisposeOnDisable.push(
|
|
119
120
|
this.keyTool.registerListener(createMoveKeyListener),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
repeatOnMessagesUpdated(() =>
|
|
122
|
+
this.shortcutManager.register(ChangeBoundsTool.TOKEN, [
|
|
123
|
+
{
|
|
124
|
+
shortcuts: ['⬅ ⬆ ➡ ⬇'],
|
|
125
|
+
description: messages.move.shortcut_move,
|
|
126
|
+
group: messages.shortcut.group_move,
|
|
127
|
+
position: 0
|
|
128
|
+
}
|
|
129
|
+
])
|
|
130
|
+
)
|
|
123
131
|
);
|
|
124
132
|
if (Disposable.is(createMoveKeyListener)) {
|
|
125
133
|
this.toDisposeOnDisable.push(createMoveKeyListener);
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { TYPES } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { inject, injectable } from 'inversify';
|
|
19
|
+
import { messages, repeatOnMessagesUpdated } from '../../base/messages';
|
|
19
20
|
import type { IShortcutManager } from '../../base/shortcuts/shortcuts-manager';
|
|
20
21
|
import { BaseTool } from '../tools/base-tools';
|
|
21
22
|
import { MoveViewportKeyListener, ZoomKeyListener } from './viewport-key-listener';
|
|
@@ -44,11 +45,28 @@ export class ViewportKeyTool extends BaseTool {
|
|
|
44
45
|
this.toDisposeOnDisable.push(
|
|
45
46
|
this.keyTool.registerListener(this.moveKeyListener),
|
|
46
47
|
this.keyTool.registerListener(this.zoomKeyListener),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
repeatOnMessagesUpdated(() =>
|
|
49
|
+
this.shortcutManager.register(ViewportKeyTool.TOKEN, [
|
|
50
|
+
{
|
|
51
|
+
shortcuts: ['⬅ ⬆ ➡ ⬇'],
|
|
52
|
+
description: messages.viewport.shortcut_move_viewport,
|
|
53
|
+
group: messages.shortcut.group_move,
|
|
54
|
+
position: 0
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
shortcuts: ['+ -'],
|
|
58
|
+
description: messages.viewport.shortcut_zoom_viewport,
|
|
59
|
+
group: messages.shortcut.group_zoom,
|
|
60
|
+
position: 0
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
shortcuts: ['+ -'],
|
|
64
|
+
description: messages.viewport.shortcut_zoom_element,
|
|
65
|
+
group: messages.shortcut.group_zoom,
|
|
66
|
+
position: 0
|
|
67
|
+
}
|
|
68
|
+
])
|
|
69
|
+
)
|
|
52
70
|
);
|
|
53
71
|
}
|
|
54
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from './base/feedback/set-model-command';
|
|
|
33
33
|
export * from './base/feedback/update-model-command';
|
|
34
34
|
export * from './base/focus/focus-state-change-action';
|
|
35
35
|
export * from './base/focus/focus-tracker';
|
|
36
|
+
export * from './base/messages';
|
|
36
37
|
export * from './base/model/diagram-loader';
|
|
37
38
|
export * from './base/model/glsp-model-source';
|
|
38
39
|
export * from './base/model/model-initialization-constraint';
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
} from '@eclipse-glsp/sprotty';
|
|
35
35
|
import { inject, injectable, optional } from 'inversify';
|
|
36
36
|
import { VNode, VNodeStyle, h } from 'snabbdom';
|
|
37
|
+
import { messages } from '../base/messages';
|
|
37
38
|
import { GridStyle, IGridManager } from '../features/grid/grid-manager';
|
|
38
39
|
import { GridProperty } from '../features/grid/grid-style';
|
|
39
40
|
|
|
@@ -53,7 +54,7 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
53
54
|
</div>
|
|
54
55
|
);
|
|
55
56
|
setAttr(rootNode, 'tabindex', 1);
|
|
56
|
-
setAttr(rootNode, 'aria-label',
|
|
57
|
+
setAttr(rootNode, 'aria-label', messages.diagram.label);
|
|
57
58
|
|
|
58
59
|
return rootNode;
|
|
59
60
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"navigation": {
|
|
3
|
-
"default_navigation_mode_activated": "Navigation On: Use arrow keys to select preceding (←) or succeding (→) elements. Use the up (↑) and down (↓) arrows to navigate paths. Press 'N' to exit.",
|
|
4
|
-
"default_navigation_mode_deactivated": "Navigation Off: Press 'N' for default navigation, 'ALT+N' for position based navigation.",
|
|
5
|
-
"local_navigation_mode_activated": "Position based Nav On: Navigate nearest elements using arrow keys: (↑) for above, (↓) for below, (←) for previous, (→) for next element. Press 'ALT+N' to exit.",
|
|
6
|
-
"local_navigation_mode_deactivated": "Position based Nav Off: Press 'N' for default navigation, 'ALT+N' for position based navigation."
|
|
7
|
-
},
|
|
8
|
-
"focus": {
|
|
9
|
-
"focus_on": "Currently focused: ",
|
|
10
|
-
"focus_off": "Currently no element is focused."
|
|
11
|
-
},
|
|
12
|
-
"resize": {
|
|
13
|
-
"resize_mode_activated": "Resize On: Use plus(+) and minus(-) to resize, 'CTRL'+'0' for default size. Press 'ESC' to exit.",
|
|
14
|
-
"resize_mode_deactivated": "Resize Off: Press 'ALT'+'A' for resize mode."
|
|
15
|
-
},
|
|
16
|
-
"grid": { "zoom_in_grid": "Select a digit from 1-9 to zoom in on the respective box." },
|
|
17
|
-
"tool_palette": { "marqueeTool": "Currently marquee tool is only usable with mouse." }
|
|
18
|
-
}
|