@codingame/monaco-vscode-accessibility-service-override 1.82.4 → 1.82.5-next.0

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.
@@ -0,0 +1,5 @@
1
+ import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
2
+
3
+ declare function getServiceOverride(): IEditorOverrideServices;
4
+
5
+ export { getServiceOverride as default };
@@ -0,0 +1,12 @@
1
+ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
2
+ import { IAccessibleViewService, AccessibleViewService } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleView';
3
+ import './vscode/src/vs/workbench/contrib/accessibility/browser/accessibility.contribution.js';
4
+ import './vscode/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.js';
5
+
6
+ function getServiceOverride() {
7
+ return {
8
+ [( IAccessibleViewService.toString())]: new SyncDescriptor(AccessibleViewService, [], true)
9
+ };
10
+ }
11
+
12
+ export { getServiceOverride as default };
@@ -0,0 +1,3 @@
1
+ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
2
+
3
+ export { n as default };
@@ -0,0 +1,11 @@
1
+ function __decorate(decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ }
7
+ function __param(paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ }
10
+
11
+ export { __decorate, __param };
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { default } from 'vscode/service-override/accessibility'
1
+ export { default } from './accessibility.js';
package/index.js CHANGED
@@ -1 +1 @@
1
- export { default } from 'vscode/service-override/accessibility'
1
+ export { default } from './accessibility.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-accessibility-service-override",
3
- "version": "1.82.4",
3
+ "version": "1.82.5-next.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,7 +18,7 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@1.82.4",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.82.5-next.0",
22
22
  "monaco-editor": "0.43.0"
23
23
  }
24
24
  }
@@ -0,0 +1,14 @@
1
+ import { registerAccessibilityConfiguration } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
2
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
3
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
4
+ import { UnfocusedViewDimmingContribution } from './unfocusedViewDimmingContribution.js';
5
+ import { EditorAccessibilityHelpContribution, HoverAccessibleViewContribution, NotificationAccessibleViewContribution, InlineCompletionsAccessibleViewContribution } from './accessibilityContributions.js';
6
+
7
+ registerAccessibilityConfiguration();
8
+ const workbenchRegistry = ( Registry.as(Extensions.Workbench));
9
+ workbenchRegistry.registerWorkbenchContribution(EditorAccessibilityHelpContribution, 4 );
10
+ workbenchRegistry.registerWorkbenchContribution(UnfocusedViewDimmingContribution, 3 );
11
+ const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
12
+ workbenchContributionsRegistry.registerWorkbenchContribution(HoverAccessibleViewContribution, 4 );
13
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotificationAccessibleViewContribution, 4 );
14
+ workbenchContributionsRegistry.registerWorkbenchContribution(InlineCompletionsAccessibleViewContribution, 4 );
@@ -0,0 +1,314 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
4
+ import { AccessibilityHelpNLS } from 'monaco-editor/esm/vs/editor/common/standaloneStrings.js';
5
+ import { ToggleTabFocusModeAction } from 'monaco-editor/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
6
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
7
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
8
+ import { accessibleViewIsShown } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
9
+ import * as strings from 'monaco-editor/esm/vs/base/common/strings.js';
10
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
11
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
12
+ import { NEW_UNTITLED_FILE_COMMAND_ID } from 'vscode/vscode/vs/workbench/contrib/files/browser/fileConstants';
13
+ import { ModesHoverController } from 'monaco-editor/esm/vs/editor/contrib/hover/browser/hover.js';
14
+ import { IContextViewService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
15
+ import { EditorContextKeys } from 'monaco-editor/esm/vs/editor/common/editorContextKeys.js';
16
+ import { getNotificationFromContext } from 'vscode/vscode/vs/workbench/browser/parts/notifications/notificationsCommands';
17
+ import { IListService, WorkbenchList } from 'monaco-editor/esm/vs/platform/list/browser/listService.js';
18
+ import { NotificationFocusedContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
19
+ import { IAccessibleViewService } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleView';
20
+ import { IHoverService } from 'vscode/vscode/vs/workbench/services/hover/browser/hover';
21
+ import { alert } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
22
+ import { AccessibilityHelpAction, AccessibleViewAction } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleViewActions';
23
+ import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
24
+ import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
25
+ import { InlineCompletionsController } from 'monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController.js';
26
+
27
+ class EditorAccessibilityHelpContribution extends Disposable {
28
+ constructor() {
29
+ super();
30
+ this._register(AccessibilityHelpAction.addImplementation(95, 'editor', async (accessor) => {
31
+ const codeEditorService = accessor.get(ICodeEditorService);
32
+ const accessibleViewService = accessor.get(IAccessibleViewService);
33
+ const instantiationService = accessor.get(IInstantiationService);
34
+ const commandService = accessor.get(ICommandService);
35
+ let codeEditor = codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor();
36
+ if (!codeEditor) {
37
+ await commandService.executeCommand(NEW_UNTITLED_FILE_COMMAND_ID);
38
+ codeEditor = codeEditorService.getActiveCodeEditor();
39
+ }
40
+ accessibleViewService.show(instantiationService.createInstance(AccessibilityHelpProvider, codeEditor));
41
+ }, EditorContextKeys.focus));
42
+ }
43
+ }
44
+ let AccessibilityHelpProvider = class AccessibilityHelpProvider {
45
+ onClose() {
46
+ this._editor.focus();
47
+ }
48
+ constructor(_editor, _keybindingService) {
49
+ this._editor = _editor;
50
+ this._keybindingService = _keybindingService;
51
+ this.options = { type: "help" , readMoreUrl: 'https://go.microsoft.com/fwlink/?linkid=851010' };
52
+ this.verbositySettingKey = "accessibility.verbosity.editor" ;
53
+ }
54
+ _descriptionForCommand(commandId, msg, noKbMsg) {
55
+ const kb = this._keybindingService.lookupKeybinding(commandId);
56
+ if (kb) {
57
+ return strings.format(msg, kb.getAriaLabel());
58
+ }
59
+ return strings.format(noKbMsg, commandId);
60
+ }
61
+ provideContent() {
62
+ const options = this._editor.getOptions();
63
+ const content = [];
64
+ if (options.get(60 )) {
65
+ if (options.get(89 )) {
66
+ content.push(AccessibilityHelpNLS.readonlyDiffEditor);
67
+ }
68
+ else {
69
+ content.push(AccessibilityHelpNLS.editableDiffEditor);
70
+ }
71
+ }
72
+ else {
73
+ if (options.get(89 )) {
74
+ content.push(AccessibilityHelpNLS.readonlyEditor);
75
+ }
76
+ else {
77
+ content.push(AccessibilityHelpNLS.editableEditor);
78
+ }
79
+ }
80
+ if (options.get(113 )) {
81
+ content.push(this._descriptionForCommand('editor.action.focusStickyScroll', AccessibilityHelpNLS.stickScrollKb, AccessibilityHelpNLS.stickScrollNoKb));
82
+ }
83
+ if (options.get(141 )) {
84
+ content.push(this._descriptionForCommand(ToggleTabFocusModeAction.ID, AccessibilityHelpNLS.tabFocusModeOnMsg, AccessibilityHelpNLS.tabFocusModeOnMsgNoKb));
85
+ }
86
+ else {
87
+ content.push(this._descriptionForCommand(ToggleTabFocusModeAction.ID, AccessibilityHelpNLS.tabFocusModeOffMsg, AccessibilityHelpNLS.tabFocusModeOffMsgNoKb));
88
+ }
89
+ return content.join('\n\n');
90
+ }
91
+ };
92
+ AccessibilityHelpProvider = ( __decorate([
93
+ ( __param(1, IKeybindingService))
94
+ ], AccessibilityHelpProvider));
95
+ class HoverAccessibleViewContribution extends Disposable {
96
+ constructor() {
97
+ super();
98
+ this._options = { language: 'typescript', type: "view" };
99
+ this._register(AccessibleViewAction.addImplementation(95, 'hover', accessor => {
100
+ const accessibleViewService = accessor.get(IAccessibleViewService);
101
+ const codeEditorService = accessor.get(ICodeEditorService);
102
+ const editor = codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor();
103
+ const editorHoverContent = editor ? ModesHoverController.get(editor)?.getWidgetContent() ?? undefined : undefined;
104
+ if (!editor || !editorHoverContent) {
105
+ return false;
106
+ }
107
+ this._options.language = editor?.getModel()?.getLanguageId() ?? undefined;
108
+ accessibleViewService.show({
109
+ verbositySettingKey: "accessibility.verbosity.hover" ,
110
+ provideContent() { return editorHoverContent; },
111
+ onClose() {
112
+ ModesHoverController.get(editor)?.focus();
113
+ },
114
+ options: this._options
115
+ });
116
+ return true;
117
+ }, EditorContextKeys.hoverFocused));
118
+ this._register(AccessibleViewAction.addImplementation(90, 'extension-hover', accessor => {
119
+ const accessibleViewService = accessor.get(IAccessibleViewService);
120
+ const contextViewService = accessor.get(IContextViewService);
121
+ const contextViewElement = contextViewService.getContextViewElement();
122
+ const extensionHoverContent = contextViewElement?.textContent ?? undefined;
123
+ const hoverService = accessor.get(IHoverService);
124
+ if (contextViewElement.classList.contains('accessible-view-container') || !extensionHoverContent) {
125
+ return false;
126
+ }
127
+ accessibleViewService.show({
128
+ verbositySettingKey: "accessibility.verbosity.hover" ,
129
+ provideContent() { return extensionHoverContent; },
130
+ onClose() {
131
+ hoverService.showAndFocusLastHover();
132
+ },
133
+ options: this._options
134
+ });
135
+ return true;
136
+ }));
137
+ this._register(AccessibilityHelpAction.addImplementation(115, 'accessible-view', accessor => {
138
+ accessor.get(IAccessibleViewService).showAccessibleViewHelp();
139
+ return true;
140
+ }, accessibleViewIsShown));
141
+ }
142
+ }
143
+ class NotificationAccessibleViewContribution extends Disposable {
144
+ constructor() {
145
+ super();
146
+ this._register(AccessibleViewAction.addImplementation(90, 'notifications', accessor => {
147
+ const accessibleViewService = accessor.get(IAccessibleViewService);
148
+ const listService = accessor.get(IListService);
149
+ const commandService = accessor.get(ICommandService);
150
+ function renderAccessibleView() {
151
+ const notification = getNotificationFromContext(listService);
152
+ if (!notification) {
153
+ return false;
154
+ }
155
+ commandService.executeCommand('notifications.showList');
156
+ let notificationIndex;
157
+ let length;
158
+ const list = listService.lastFocusedList;
159
+ if (list instanceof WorkbenchList) {
160
+ notificationIndex = list.indexOf(notification);
161
+ length = list.length;
162
+ }
163
+ if (notificationIndex === undefined) {
164
+ return false;
165
+ }
166
+ function focusList() {
167
+ commandService.executeCommand('notifications.showList');
168
+ if (list && notificationIndex !== undefined) {
169
+ list.domFocus();
170
+ try {
171
+ list.setFocus([notificationIndex]);
172
+ }
173
+ catch { }
174
+ }
175
+ }
176
+ const message = ( notification.message.original.toString());
177
+ if (!message) {
178
+ return false;
179
+ }
180
+ notification.onDidClose(() => accessibleViewService.next());
181
+ accessibleViewService.show({
182
+ provideContent: () => {
183
+ return notification.source ? ( localize(
184
+ 'notification.accessibleViewSrc',
185
+ '{0} Source: {1}',
186
+ message,
187
+ notification.source
188
+ )) : ( localize('notification.accessibleView', '{0}', message));
189
+ },
190
+ onClose() {
191
+ focusList();
192
+ },
193
+ next() {
194
+ if (!list) {
195
+ return;
196
+ }
197
+ focusList();
198
+ list.focusNext();
199
+ alertFocusChange(notificationIndex, length, 'next');
200
+ renderAccessibleView();
201
+ },
202
+ previous() {
203
+ if (!list) {
204
+ return;
205
+ }
206
+ focusList();
207
+ list.focusPrevious();
208
+ alertFocusChange(notificationIndex, length, 'previous');
209
+ renderAccessibleView();
210
+ },
211
+ verbositySettingKey: "accessibility.verbosity.notification" ,
212
+ options: { type: "view" },
213
+ actions: getActionsFromNotification(notification)
214
+ });
215
+ return true;
216
+ }
217
+ return renderAccessibleView();
218
+ }, NotificationFocusedContext));
219
+ }
220
+ }
221
+ function getActionsFromNotification(notification) {
222
+ let actions = undefined;
223
+ if (notification.actions) {
224
+ actions = [];
225
+ if (notification.actions.primary) {
226
+ actions.push(...notification.actions.primary);
227
+ }
228
+ if (notification.actions.secondary) {
229
+ actions.push(...notification.actions.secondary);
230
+ }
231
+ }
232
+ if (actions) {
233
+ for (const action of actions) {
234
+ action.class = ThemeIcon.asClassName(Codicon.bell);
235
+ const initialAction = action.run;
236
+ action.run = () => {
237
+ initialAction();
238
+ notification.close();
239
+ };
240
+ }
241
+ }
242
+ const manageExtension = actions?.find(a => a.label.includes('Manage Extension'));
243
+ if (manageExtension) {
244
+ manageExtension.class = ThemeIcon.asClassName(Codicon.gear);
245
+ }
246
+ if (actions) {
247
+ actions.push({ id: 'clearNotification', label: ( localize('clearNotification', "Clear Notification")), tooltip: ( localize('clearNotification', "Clear Notification")), run: () => notification.close(), enabled: true, class: ThemeIcon.asClassName(Codicon.clearAll) });
248
+ }
249
+ return actions;
250
+ }
251
+ function alertFocusChange(index, length, type) {
252
+ if (index === undefined || length === undefined) {
253
+ return;
254
+ }
255
+ const number = index + 1;
256
+ if (type === 'next' && number + 1 <= length) {
257
+ alert(`Focused ${number + 1} of ${length}`);
258
+ }
259
+ else if (type === 'previous' && number - 1 > 0) {
260
+ alert(`Focused ${number - 1} of ${length}`);
261
+ }
262
+ return;
263
+ }
264
+ class InlineCompletionsAccessibleViewContribution extends Disposable {
265
+ constructor() {
266
+ super();
267
+ this._options = { type: "view" };
268
+ this._register(AccessibleViewAction.addImplementation(95, 'inline-completions', accessor => {
269
+ const accessibleViewService = accessor.get(IAccessibleViewService);
270
+ const codeEditorService = accessor.get(ICodeEditorService);
271
+ const show = () => {
272
+ const editor = codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor();
273
+ if (!editor) {
274
+ return false;
275
+ }
276
+ const model = InlineCompletionsController.get(editor)?.model.get();
277
+ const state = model?.state.get();
278
+ if (!model || !state) {
279
+ return false;
280
+ }
281
+ const lineText = model.textModel.getLineContent(state.ghostText.lineNumber);
282
+ if (!lineText) {
283
+ return false;
284
+ }
285
+ const ghostText = state.ghostText.renderForScreenReader(lineText);
286
+ if (!ghostText) {
287
+ return false;
288
+ }
289
+ this._options.language = editor.getModel()?.getLanguageId() ?? undefined;
290
+ accessibleViewService.show({
291
+ verbositySettingKey: "accessibility.verbosity.inlineCompletions" ,
292
+ provideContent() { return lineText + ghostText; },
293
+ onClose() {
294
+ model.stop();
295
+ editor.focus();
296
+ },
297
+ next() {
298
+ model.next();
299
+ setTimeout(() => show(), 50);
300
+ },
301
+ previous() {
302
+ model.previous();
303
+ setTimeout(() => show(), 50);
304
+ },
305
+ options: this._options
306
+ });
307
+ return true;
308
+ };
309
+ return show();
310
+ }));
311
+ }
312
+ }
313
+
314
+ export { EditorAccessibilityHelpContribution, HoverAccessibleViewContribution, InlineCompletionsAccessibleViewContribution, NotificationAccessibleViewContribution, alertFocusChange };
@@ -0,0 +1,65 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
3
+ import { Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { clamp } from 'monaco-editor/esm/vs/base/common/numbers.js';
5
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
6
+
7
+ let UnfocusedViewDimmingContribution = class UnfocusedViewDimmingContribution extends Disposable {
8
+ constructor(configurationService) {
9
+ super();
10
+ this._register(toDisposable(() => this._removeStyleElement()));
11
+ this._register(Event.runAndSubscribe(configurationService.onDidChangeConfiguration, e => {
12
+ if (e && !e.affectsConfiguration("accessibility.dimUnfocused.enabled" ) && !e.affectsConfiguration("accessibility.dimUnfocused.opacity" )) {
13
+ return;
14
+ }
15
+ let cssTextContent = '';
16
+ const enabled = ensureBoolean(configurationService.getValue("accessibility.dimUnfocused.enabled" ), false);
17
+ if (enabled) {
18
+ const opacity = clamp(ensureNumber(configurationService.getValue("accessibility.dimUnfocused.opacity" ), 0.75 ), 0.2 , 1 );
19
+ if (opacity !== 1) {
20
+ const rules = ( new Set());
21
+ const filterRule = `filter: opacity(${opacity});`;
22
+ rules.add(`.monaco-workbench .pane-body.integrated-terminal:not(:focus-within) .tabs-container { ${filterRule} }`);
23
+ rules.add(`.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper:not(:focus-within) { ${filterRule} }`);
24
+ rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${filterRule} }`);
25
+ rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .tabs-breadcrumbs { ${filterRule} }`);
26
+ rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .terminal-wrapper { ${filterRule} }`);
27
+ rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .settings-editor { ${filterRule} }`);
28
+ rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .keybindings-editor { ${filterRule} }`);
29
+ rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor-pane-placeholder { ${filterRule} }`);
30
+ rules.add(`.monaco-workbench .editor-instance:not(:focus-within) .gettingStartedContainer { ${filterRule} }`);
31
+ cssTextContent = [...rules].join('\n');
32
+ }
33
+ }
34
+ if (cssTextContent.length === 0) {
35
+ this._removeStyleElement();
36
+ }
37
+ else {
38
+ this._getStyleElement().textContent = cssTextContent;
39
+ }
40
+ }));
41
+ }
42
+ _getStyleElement() {
43
+ if (!this._styleElement) {
44
+ this._styleElement = document.createElement('style');
45
+ this._styleElement.className = 'accessibilityUnfocusedViewOpacity';
46
+ document.head.appendChild(this._styleElement);
47
+ }
48
+ return this._styleElement;
49
+ }
50
+ _removeStyleElement() {
51
+ this._styleElement?.remove();
52
+ this._styleElement = undefined;
53
+ }
54
+ };
55
+ UnfocusedViewDimmingContribution = ( __decorate([
56
+ ( __param(0, IConfigurationService))
57
+ ], UnfocusedViewDimmingContribution));
58
+ function ensureBoolean(value, defaultValue) {
59
+ return typeof value === 'boolean' ? value : defaultValue;
60
+ }
61
+ function ensureNumber(value, defaultValue) {
62
+ return typeof value === 'number' ? value : defaultValue;
63
+ }
64
+
65
+ export { UnfocusedViewDimmingContribution };
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".accessible-view{background-color:var(--vscode-editorWidget-background);border:2px solid var(--vscode-focusBorder);border-radius:6px;box-shadow:0 2px 8px var(--vscode-widget-shadow);color:var(--vscode-editorWidget-foreground);margin-top:-1px;position:absolute;z-index:2550}.accessible-view-container .actions-container{display:flex;justify-content:flex-end;margin:0 auto;padding:0;width:100%}.accessible-view-title-bar{align-items:center;border-top-left-radius:5px;border-top-right-radius:5px;display:flex}.accessible-view-title{overflow:hidden;padding:3px 0;text-align:center;text-overflow:ellipsis;width:100%}.accessible-view-action-bar{flex:1;justify-content:flex-end;margin-right:4px}.accessible-view-action-bar>.actions-container{justify-content:flex-end}.accessible-view-title-bar .monaco-action-bar .action-label.codicon{background-position:50%;background-repeat:no-repeat;padding:2px}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,36 @@
1
+ import './accessibility.css.js';
2
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
3
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
4
+ import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
5
+ import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
6
+ import { accessibilityHelpIsShown } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
7
+ import { alert } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
8
+ import { AccessibilityHelpNLS } from 'monaco-editor/esm/vs/editor/common/standaloneStrings.js';
9
+
10
+ class ToggleScreenReaderMode extends Action2 {
11
+ constructor() {
12
+ super({
13
+ id: 'editor.action.toggleScreenReaderAccessibilityMode',
14
+ title: { value: ( nls.localize('toggleScreenReaderMode', "Toggle Screen Reader Accessibility Mode")), original: 'Toggle Screen Reader Accessibility Mode' },
15
+ f1: true,
16
+ keybinding: [{
17
+ primary: 2048 | 35 ,
18
+ weight: 200 + 10,
19
+ when: accessibilityHelpIsShown
20
+ },
21
+ {
22
+ primary: 512 | 59 | 1024 ,
23
+ linux: { primary: 512 | 62 | 1024 },
24
+ weight: 200 + 10,
25
+ }]
26
+ });
27
+ }
28
+ async run(accessor) {
29
+ const accessibiiltyService = accessor.get(IAccessibilityService);
30
+ const configurationService = accessor.get(IConfigurationService);
31
+ const isScreenReaderOptimized = accessibiiltyService.isScreenReaderOptimized();
32
+ configurationService.updateValue('editor.accessibilitySupport', isScreenReaderOptimized ? 'off' : 'on', 2 );
33
+ alert(isScreenReaderOptimized ? AccessibilityHelpNLS.screenReaderModeDisabled : AccessibilityHelpNLS.screenReaderModeEnabled);
34
+ }
35
+ }
36
+ registerAction2(ToggleScreenReaderMode);