@codingame/monaco-vscode-accessibility-service-override 2.0.3 → 2.1.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.
- package/accessibility.js +1 -4
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibility.contribution.js +5 -2
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityStatus.js +75 -37
- package/vscode/src/vs/workbench/contrib/accessibility/browser/saveAudioCue.js +21 -0
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleNotificationService.js +0 -83
package/accessibility.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
2
|
import { IAccessibleViewService, AccessibleViewService } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleView';
|
|
3
|
-
import { IAccessibleNotificationService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
4
|
-
import { AccessibleNotificationService } from './vscode/src/vs/workbench/contrib/accessibility/browser/accessibleNotificationService.js';
|
|
5
3
|
import './vscode/src/vs/workbench/contrib/accessibility/browser/accessibility.contribution.js';
|
|
6
4
|
import './vscode/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.js';
|
|
7
5
|
|
|
8
6
|
function getServiceOverride() {
|
|
9
7
|
return {
|
|
10
|
-
[( IAccessibleViewService.toString())]: new SyncDescriptor(AccessibleViewService, [], true)
|
|
11
|
-
[( IAccessibleNotificationService.toString())]: new SyncDescriptor(AccessibleNotificationService, [], true)
|
|
8
|
+
[( IAccessibleViewService.toString())]: new SyncDescriptor(AccessibleViewService, [], true)
|
|
12
9
|
};
|
|
13
10
|
}
|
|
14
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-accessibility-service-override",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.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@2.0
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.1.0",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { registerAccessibilityConfiguration } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
1
|
+
import { registerAccessibilityConfiguration, DynamicSpeechAccessibilityConfiguration } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
2
2
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
3
3
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
4
4
|
import { UnfocusedViewDimmingContribution } from './unfocusedViewDimmingContribution.js';
|
|
5
5
|
import { HoverAccessibleViewContribution, NotificationAccessibleViewContribution, InlineCompletionsAccessibleViewContribution } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityContributions';
|
|
6
6
|
import { AccessibilityStatus } from './accessibilityStatus.js';
|
|
7
|
-
import { CommentsAccessibilityHelpContribution } from 'vscode/vscode/vs/workbench/contrib/comments/browser/comments.contribution';
|
|
8
7
|
import { EditorAccessibilityHelpContribution } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/editorAccessibilityHelp';
|
|
8
|
+
import { SaveAudioCueContribution } from './saveAudioCue.js';
|
|
9
|
+
import { CommentsAccessibilityHelpContribution } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsAccessibility';
|
|
9
10
|
|
|
10
11
|
registerAccessibilityConfiguration();
|
|
11
12
|
const workbenchRegistry = ( Registry.as(Extensions.Workbench));
|
|
@@ -17,3 +18,5 @@ workbenchContributionsRegistry.registerWorkbenchContribution(HoverAccessibleView
|
|
|
17
18
|
workbenchContributionsRegistry.registerWorkbenchContribution(NotificationAccessibleViewContribution, 4 );
|
|
18
19
|
workbenchContributionsRegistry.registerWorkbenchContribution(InlineCompletionsAccessibleViewContribution, 4 );
|
|
19
20
|
workbenchContributionsRegistry.registerWorkbenchContribution(AccessibilityStatus, 2 );
|
|
21
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(SaveAudioCueContribution, 2 );
|
|
22
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(DynamicSpeechAccessibilityConfiguration, 2 );
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
2
|
+
import { Disposable, toDisposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
3
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
4
|
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
5
5
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
@@ -8,25 +8,81 @@ import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/comm
|
|
|
8
8
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
9
9
|
import { NotificationPriority, INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
10
10
|
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
11
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
12
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
13
|
|
|
14
|
+
let ScreenReaderModeStatusEntry = class ScreenReaderModeStatusEntry extends Disposable {
|
|
15
|
+
constructor(statusbarService) {
|
|
16
|
+
super();
|
|
17
|
+
this.statusbarService = statusbarService;
|
|
18
|
+
this.screenReaderModeElement = this._register(( new MutableDisposable()));
|
|
19
|
+
}
|
|
20
|
+
updateScreenReaderModeElement(visible) {
|
|
21
|
+
if (visible) {
|
|
22
|
+
if (!this.screenReaderModeElement.value) {
|
|
23
|
+
const text = ( localizeWithPath(
|
|
24
|
+
'vs/workbench/contrib/accessibility/browser/accessibilityStatus',
|
|
25
|
+
'screenReaderDetected',
|
|
26
|
+
"Screen Reader Optimized"
|
|
27
|
+
));
|
|
28
|
+
this.screenReaderModeElement.value = this.statusbarService.addEntry({
|
|
29
|
+
name: ( localizeWithPath(
|
|
30
|
+
'vs/workbench/contrib/accessibility/browser/accessibilityStatus',
|
|
31
|
+
'status.editor.screenReaderMode',
|
|
32
|
+
"Screen Reader Mode"
|
|
33
|
+
)),
|
|
34
|
+
text,
|
|
35
|
+
ariaLabel: text,
|
|
36
|
+
command: 'showEditorScreenReaderNotification',
|
|
37
|
+
kind: 'prominent'
|
|
38
|
+
}, 'status.editor.screenReaderMode', 1 , 100.6);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.screenReaderModeElement.clear();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
ScreenReaderModeStatusEntry = ( __decorate([
|
|
47
|
+
( __param(0, IStatusbarService))
|
|
48
|
+
], ScreenReaderModeStatusEntry));
|
|
12
49
|
let AccessibilityStatus = class AccessibilityStatus extends Disposable {
|
|
13
|
-
constructor(configurationService, notificationService,
|
|
50
|
+
constructor(configurationService, notificationService, accessibilityService, instantiationService, editorGroupService) {
|
|
14
51
|
super();
|
|
15
52
|
this.configurationService = configurationService;
|
|
16
53
|
this.notificationService = notificationService;
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
54
|
+
this.accessibilityService = accessibilityService;
|
|
55
|
+
this.editorGroupService = editorGroupService;
|
|
19
56
|
this.screenReaderNotification = null;
|
|
20
57
|
this.promptedScreenReader = false;
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
58
|
+
this.screenReaderModeElements = ( new Set());
|
|
59
|
+
this.createScreenReaderModeElement(instantiationService, this._store);
|
|
60
|
+
this.updateScreenReaderModeElements(accessibilityService.isScreenReaderOptimized());
|
|
61
|
+
CommandsRegistry.registerCommand({ id: 'showEditorScreenReaderNotification', handler: () => this.showScreenReaderNotification() });
|
|
62
|
+
this.registerListeners();
|
|
63
|
+
}
|
|
64
|
+
createScreenReaderModeElement(instantiationService, disposables) {
|
|
65
|
+
const entry = disposables.add(instantiationService.createInstance(ScreenReaderModeStatusEntry));
|
|
66
|
+
this.screenReaderModeElements.add(entry);
|
|
67
|
+
disposables.add(toDisposable(() => this.screenReaderModeElements.delete(entry)));
|
|
68
|
+
return entry;
|
|
69
|
+
}
|
|
70
|
+
updateScreenReaderModeElements(visible) {
|
|
71
|
+
for (const entry of this.screenReaderModeElements) {
|
|
72
|
+
entry.updateScreenReaderModeElement(visible);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
registerListeners() {
|
|
76
|
+
this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(() => this.onScreenReaderModeChange()));
|
|
77
|
+
this._register(this.configurationService.onDidChangeConfiguration(c => {
|
|
24
78
|
if (c.affectsConfiguration('editor.accessibilitySupport')) {
|
|
25
79
|
this.onScreenReaderModeChange();
|
|
26
80
|
}
|
|
27
81
|
}));
|
|
28
|
-
|
|
29
|
-
|
|
82
|
+
this._register(this.editorGroupService.onDidCreateAuxiliaryEditorPart(({ instantiationService, disposables }) => {
|
|
83
|
+
const entry = this.createScreenReaderModeElement(instantiationService, disposables);
|
|
84
|
+
entry.updateScreenReaderModeElement(this.accessibilityService.isScreenReaderOptimized());
|
|
85
|
+
}));
|
|
30
86
|
}
|
|
31
87
|
showScreenReaderNotification() {
|
|
32
88
|
this.screenReaderNotification = this.notificationService.prompt(Severity.Info, ( localizeWithPath(
|
|
@@ -57,33 +113,8 @@ let AccessibilityStatus = class AccessibilityStatus extends Disposable {
|
|
|
57
113
|
});
|
|
58
114
|
Event.once(this.screenReaderNotification.onDidClose)(() => this.screenReaderNotification = null);
|
|
59
115
|
}
|
|
60
|
-
updateScreenReaderModeElement(visible) {
|
|
61
|
-
if (visible) {
|
|
62
|
-
if (!this.screenReaderModeElement.value) {
|
|
63
|
-
const text = ( localizeWithPath(
|
|
64
|
-
'vs/workbench/contrib/accessibility/browser/accessibilityStatus',
|
|
65
|
-
'screenReaderDetected',
|
|
66
|
-
"Screen Reader Optimized"
|
|
67
|
-
));
|
|
68
|
-
this.screenReaderModeElement.value = this.statusbarService.addEntry({
|
|
69
|
-
name: ( localizeWithPath(
|
|
70
|
-
'vs/workbench/contrib/accessibility/browser/accessibilityStatus',
|
|
71
|
-
'status.editor.screenReaderMode',
|
|
72
|
-
"Screen Reader Mode"
|
|
73
|
-
)),
|
|
74
|
-
text,
|
|
75
|
-
ariaLabel: text,
|
|
76
|
-
command: 'showEditorScreenReaderNotification',
|
|
77
|
-
kind: 'prominent'
|
|
78
|
-
}, 'status.editor.screenReaderMode', 1 , 100.6);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.screenReaderModeElement.clear();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
116
|
onScreenReaderModeChange() {
|
|
86
|
-
const screenReaderDetected = this.
|
|
117
|
+
const screenReaderDetected = this.accessibilityService.isScreenReaderOptimized();
|
|
87
118
|
if (screenReaderDetected) {
|
|
88
119
|
const screenReaderConfiguration = this.configurationService.getValue('editor.accessibilitySupport');
|
|
89
120
|
if (screenReaderConfiguration === 'auto') {
|
|
@@ -96,14 +127,21 @@ let AccessibilityStatus = class AccessibilityStatus extends Disposable {
|
|
|
96
127
|
if (this.screenReaderNotification) {
|
|
97
128
|
this.screenReaderNotification.close();
|
|
98
129
|
}
|
|
99
|
-
this.
|
|
130
|
+
this.updateScreenReaderModeElements(this.accessibilityService.isScreenReaderOptimized());
|
|
131
|
+
}
|
|
132
|
+
dispose() {
|
|
133
|
+
super.dispose();
|
|
134
|
+
for (const entry of this.screenReaderModeElements) {
|
|
135
|
+
entry.dispose();
|
|
136
|
+
}
|
|
100
137
|
}
|
|
101
138
|
};
|
|
102
139
|
AccessibilityStatus = ( __decorate([
|
|
103
140
|
( __param(0, IConfigurationService)),
|
|
104
141
|
( __param(1, INotificationService)),
|
|
105
142
|
( __param(2, IAccessibilityService)),
|
|
106
|
-
( __param(3,
|
|
143
|
+
( __param(3, IInstantiationService)),
|
|
144
|
+
( __param(4, IEditorGroupsService))
|
|
107
145
|
], AccessibilityStatus));
|
|
108
146
|
|
|
109
147
|
export { AccessibilityStatus };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { AudioCue, IAudioCueService } from 'vscode/vscode/vs/platform/audioCues/browser/audioCueService';
|
|
4
|
+
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService';
|
|
5
|
+
|
|
6
|
+
let SaveAudioCueContribution = class SaveAudioCueContribution extends Disposable {
|
|
7
|
+
constructor(_audioCueService, _workingCopyService) {
|
|
8
|
+
super();
|
|
9
|
+
this._audioCueService = _audioCueService;
|
|
10
|
+
this._workingCopyService = _workingCopyService;
|
|
11
|
+
this._register(this._workingCopyService.onDidSave((e) => {
|
|
12
|
+
this._audioCueService.playAudioCue(AudioCue.save, { userGesture: e.reason === 1 });
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
SaveAudioCueContribution = ( __decorate([
|
|
17
|
+
( __param(0, IAudioCueService)),
|
|
18
|
+
( __param(1, IWorkingCopyService))
|
|
19
|
+
], SaveAudioCueContribution));
|
|
20
|
+
|
|
21
|
+
export { SaveAudioCueContribution };
|
package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleNotificationService.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
-
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
5
|
-
import { AudioCue, IAudioCueService } from 'vscode/vscode/vs/platform/audioCues/browser/audioCueService';
|
|
6
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
7
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
8
|
-
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService';
|
|
9
|
-
|
|
10
|
-
let AccessibleNotificationService = class AccessibleNotificationService extends Disposable {
|
|
11
|
-
constructor(_audioCueService, _configurationService, _accessibilityService, _workingCopyService, _logService) {
|
|
12
|
-
super();
|
|
13
|
-
this._audioCueService = _audioCueService;
|
|
14
|
-
this._configurationService = _configurationService;
|
|
15
|
-
this._accessibilityService = _accessibilityService;
|
|
16
|
-
this._workingCopyService = _workingCopyService;
|
|
17
|
-
this._logService = _logService;
|
|
18
|
-
this._events = ( new Map());
|
|
19
|
-
this._events.set("clear" , { audioCue: AudioCue.clear, alertMessage: ( localizeWithPath(
|
|
20
|
-
'vs/workbench/contrib/accessibility/browser/accessibleNotificationService',
|
|
21
|
-
'cleared',
|
|
22
|
-
"Cleared"
|
|
23
|
-
)) });
|
|
24
|
-
this._events.set("save" , { audioCue: AudioCue.save, alertMessage: ( localizeWithPath(
|
|
25
|
-
'vs/workbench/contrib/accessibility/browser/accessibleNotificationService',
|
|
26
|
-
'saved',
|
|
27
|
-
"Saved"
|
|
28
|
-
)), alertSetting: "accessibility.alert.save" });
|
|
29
|
-
this._events.set("format" , { audioCue: AudioCue.format, alertMessage: ( localizeWithPath(
|
|
30
|
-
'vs/workbench/contrib/accessibility/browser/accessibleNotificationService',
|
|
31
|
-
'formatted',
|
|
32
|
-
"Formatted"
|
|
33
|
-
)), alertSetting: "accessibility.alert.format" });
|
|
34
|
-
this._register(this._workingCopyService.onDidSave((e) => this._notify("save" , e.reason === 1 )));
|
|
35
|
-
}
|
|
36
|
-
notify(event, userGesture) {
|
|
37
|
-
if (event === "format" ) {
|
|
38
|
-
return this._notify(event, userGesture);
|
|
39
|
-
}
|
|
40
|
-
const { audioCue, alertMessage } = this._events.get(event);
|
|
41
|
-
const audioCueValue = this._configurationService.getValue(audioCue.settingsKey);
|
|
42
|
-
if (audioCueValue === 'on' || audioCueValue === 'auto' && this._accessibilityService.isScreenReaderOptimized()) {
|
|
43
|
-
this._logService.debug('AccessibleNotificationService playing sound: ', audioCue.name);
|
|
44
|
-
this._audioCueService.playAudioCue(audioCue);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
this._logService.debug('AccessibleNotificationService alerting: ', alertMessage);
|
|
48
|
-
this._accessibilityService.alert(alertMessage);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
_notify(event, userGesture) {
|
|
52
|
-
const { audioCue, alertMessage, alertSetting } = this._events.get(event);
|
|
53
|
-
if (!alertSetting) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const audioCueSetting = this._configurationService.getValue(audioCue.settingsKey);
|
|
57
|
-
if (this._shouldNotify(audioCueSetting, userGesture)) {
|
|
58
|
-
this._logService.debug('AccessibleNotificationService playing sound: ', audioCue.name);
|
|
59
|
-
this._audioCueService.playSound(audioCue.sound.getSound(), true);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (audioCueSetting !== 'never') {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const alertSettingValue = this._configurationService.getValue(alertSetting);
|
|
66
|
-
if (this._shouldNotify(alertSettingValue, userGesture)) {
|
|
67
|
-
this._logService.debug('AccessibleNotificationService alerting: ', alertMessage);
|
|
68
|
-
this._accessibilityService.alert(alertMessage);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
_shouldNotify(settingValue, userGesture) {
|
|
72
|
-
return settingValue === 'always' || settingValue === 'userGesture' && userGesture === true;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
AccessibleNotificationService = ( __decorate([
|
|
76
|
-
( __param(0, IAudioCueService)),
|
|
77
|
-
( __param(1, IConfigurationService)),
|
|
78
|
-
( __param(2, IAccessibilityService)),
|
|
79
|
-
( __param(3, IWorkingCopyService)),
|
|
80
|
-
( __param(4, ILogService))
|
|
81
|
-
], AccessibleNotificationService));
|
|
82
|
-
|
|
83
|
-
export { AccessibleNotificationService };
|