@codingame/monaco-vscode-notifications-service-override 11.1.2 → 12.0.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/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { default } from 'vscode/service-override/notifications';
1
+ import { type IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
2
+ export default function getServiceOverride(): IEditorOverrideServices;
package/index.js CHANGED
@@ -1 +1,44 @@
1
- export { default } from './notifications.js';
1
+
2
+ import { NotificationsToasts } from '@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/browser/parts/notifications/notificationsToasts';
3
+ import 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
4
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
5
+ import { NotificationService } from './vscode/src/vs/workbench/services/notification/common/notificationService.js';
6
+ import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
7
+ import { getClientArea } from 'vscode/vscode/vs/base/browser/dom';
8
+ import { registerNotificationCommands } from '@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/browser/parts/notifications/notificationsCommands';
9
+ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
10
+ import { NotificationsCenter } from '@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/browser/parts/notifications/notificationsCenter';
11
+ import { NotificationsAlerts } from '@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/browser/parts/notifications/notificationsAlerts';
12
+ import { NotificationsTelemetry } from '@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/browser/parts/notifications/notificationsTelemetry';
13
+ import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService.service';
14
+ import { NotificationsStatus } from '@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/browser/parts/notifications/notificationsStatus';
15
+ import { onRenderWorkbench } from 'vscode/lifecycle';
16
+
17
+ onRenderWorkbench(async (accessor) => {
18
+ const container = accessor.get(ILayoutService).mainContainer;
19
+ const model = accessor.get(INotificationService).model;
20
+ const instantiationService = accessor.get(IInstantiationService);
21
+ setTimeout(() => {
22
+ const notificationsCenter = instantiationService.createInstance(NotificationsCenter, container, model);
23
+ const notificationsToasts = instantiationService.createInstance(NotificationsToasts, container, model);
24
+ instantiationService.createInstance(NotificationsAlerts, model);
25
+ const notificationsStatus = instantiationService.createInstance(NotificationsStatus, model);
26
+ instantiationService.createInstance(NotificationsTelemetry);
27
+ notificationsCenter.onDidChangeVisibility(() => {
28
+ notificationsStatus.update(notificationsCenter.isVisible, notificationsToasts.isVisible);
29
+ notificationsToasts.update(notificationsCenter.isVisible);
30
+ });
31
+ notificationsToasts.onDidChangeVisibility(() => {
32
+ notificationsStatus.update(notificationsCenter.isVisible, notificationsToasts.isVisible);
33
+ });
34
+ registerNotificationCommands(notificationsCenter, notificationsToasts, model);
35
+ notificationsToasts.layout(getClientArea(container));
36
+ });
37
+ });
38
+ function getServiceOverride() {
39
+ return {
40
+ [INotificationService.toString()]: new SyncDescriptor(NotificationService, [], true)
41
+ };
42
+ }
43
+
44
+ export { getServiceOverride as default };
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-notifications-service-override",
3
- "version": "11.1.2",
3
+ "version": "12.0.0",
4
+ "private": false,
5
+ "description": "VSCode public API plugged on the monaco editor - notifications service-override",
4
6
  "keywords": [],
5
7
  "author": {
6
8
  "name": "CodinGame",
@@ -12,8 +14,12 @@
12
14
  "url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
13
15
  },
14
16
  "type": "module",
15
- "private": false,
16
- "description": "VSCode public API plugged on the monaco editor - notifications service-override",
17
+ "dependencies": {
18
+ "@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common": "12.0.0",
19
+ "vscode": "npm:@codingame/monaco-vscode-api@12.0.0"
20
+ },
21
+ "peerDependencies": {},
22
+ "peerDependenciesMeta": {},
17
23
  "main": "index.js",
18
24
  "module": "index.js",
19
25
  "types": "index.d.ts",
@@ -22,11 +28,12 @@
22
28
  "default": "./index.js"
23
29
  },
24
30
  "./vscode/*": {
25
- "default": "./vscode/src/*.js"
31
+ "default": "./vscode/src/*.js",
32
+ "types": "./vscode/src/*.d.ts"
33
+ },
34
+ "./*": {
35
+ "default": "./*.js",
36
+ "types": "./*.d.ts"
26
37
  }
27
- },
28
- "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@11.1.2",
30
- "@codingame/monaco-vscode-notifications-workbench-common": "11.1.2"
31
38
  }
32
39
  }
@@ -0,0 +1,37 @@
1
+ import { INotification, INotificationHandle, Severity, NotificationMessage, IPromptChoice, IPromptOptions, IStatusMessageOptions, NotificationsFilter, INotificationSource, INotificationSourceFilter } from "vscode/vscode/vs/platform/notification/common/notification";
2
+ import { INotificationService } from "vscode/vscode/vs/platform/notification/common/notification.service";
3
+ import { NotificationsModel } from "@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/common/notifications";
4
+ import { Disposable, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
5
+ import { Event } from "vscode/vscode/vs/base/common/event";
6
+ import { IStorageService } from "vscode/vscode/vs/platform/storage/common/storage.service";
7
+ export declare class NotificationService extends Disposable implements INotificationService {
8
+ private readonly storageService;
9
+ readonly _serviceBrand: undefined;
10
+ readonly model: NotificationsModel;
11
+ private readonly _onDidAddNotification;
12
+ readonly onDidAddNotification: Event<INotification>;
13
+ private readonly _onDidRemoveNotification;
14
+ readonly onDidRemoveNotification: Event<INotification>;
15
+ constructor(storageService: IStorageService);
16
+ private registerListeners;
17
+ private static readonly GLOBAL_FILTER_SETTINGS_KEY;
18
+ private static readonly PER_SOURCE_FILTER_SETTINGS_KEY;
19
+ private readonly _onDidChangeFilter;
20
+ readonly onDidChangeFilter: Event<void>;
21
+ private globalFilterEnabled;
22
+ private readonly mapSourceToFilter;
23
+ setFilter(filter: NotificationsFilter | INotificationSourceFilter): void;
24
+ getFilter(source?: INotificationSource): NotificationsFilter;
25
+ private updateSourceFilter;
26
+ private saveSourceFilters;
27
+ getFilters(): INotificationSourceFilter[];
28
+ private updateFilters;
29
+ removeFilter(sourceId: string): void;
30
+ info(message: NotificationMessage | NotificationMessage[]): void;
31
+ warn(message: NotificationMessage | NotificationMessage[]): void;
32
+ error(message: NotificationMessage | NotificationMessage[]): void;
33
+ notify(notification: INotification): INotificationHandle;
34
+ private toStorageScope;
35
+ prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions): INotificationHandle;
36
+ status(message: NotificationMessage, options?: IStatusMessageOptions): IDisposable;
37
+ }
@@ -1,13 +1,16 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { localize } from 'vscode/vscode/vs/nls';
3
4
  import { isNotificationSource, NotificationsFilter, NoOpNotification, NeverShowAgainScope } from 'vscode/vscode/vs/platform/notification/common/notification';
4
5
  import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
5
- import { NotificationsModel, ChoiceAction } from '@codingame/monaco-vscode-notifications-workbench-common/vscode/vs/workbench/common/notifications';
6
+ import { NotificationsModel, NotificationChangeType, ChoiceAction } from '@codingame/monaco-vscode-494be54c-bd37-5b3c-af70-02f086e28768-common/vscode/vs/workbench/common/notifications';
6
7
  import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
7
8
  import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
9
+ import 'vscode/vscode/vs/platform/instantiation/common/extensions';
8
10
  import { Action } from 'vscode/vscode/vs/base/common/actions';
11
+ import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
9
12
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
10
- import Severity$1 from 'vscode/vscode/vs/base/common/severity';
13
+ import Severity from 'vscode/vscode/vs/base/common/severity';
11
14
 
12
15
  var NotificationService_1;
13
16
  let NotificationService = class NotificationService extends Disposable {
@@ -15,17 +18,17 @@ let NotificationService = class NotificationService extends Disposable {
15
18
  constructor(storageService) {
16
19
  super();
17
20
  this.storageService = storageService;
18
- this.model = this._register(( (new NotificationsModel())));
19
- this._onDidAddNotification = this._register(( (new Emitter())));
21
+ this.model = this._register(( new NotificationsModel()));
22
+ this._onDidAddNotification = this._register(( new Emitter()));
20
23
  this.onDidAddNotification = this._onDidAddNotification.event;
21
- this._onDidRemoveNotification = this._register(( (new Emitter())));
24
+ this._onDidRemoveNotification = this._register(( new Emitter()));
22
25
  this.onDidRemoveNotification = this._onDidRemoveNotification.event;
23
- this._onDidChangeFilter = this._register(( (new Emitter())));
26
+ this._onDidChangeFilter = this._register(( new Emitter()));
24
27
  this.onDidChangeFilter = this._onDidChangeFilter.event;
25
- this.globalFilterEnabled = this.storageService.getBoolean(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY, -1 , false);
28
+ this.globalFilterEnabled = this.storageService.getBoolean(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY, StorageScope.APPLICATION, false);
26
29
  this.mapSourceToFilter = (() => {
27
- const map = ( (new Map()));
28
- for (const sourceFilter of this.storageService.getObject(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY, -1 , [])) {
30
+ const map = ( new Map());
31
+ for (const sourceFilter of this.storageService.getObject(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY, StorageScope.APPLICATION, [])) {
29
32
  map.set(sourceFilter.id, sourceFilter);
30
33
  }
31
34
  return map;
@@ -36,8 +39,8 @@ let NotificationService = class NotificationService extends Disposable {
36
39
  registerListeners() {
37
40
  this._register(this.model.onDidChangeNotification(e => {
38
41
  switch (e.kind) {
39
- case 0 :
40
- case 3 : {
42
+ case NotificationChangeType.ADD:
43
+ case NotificationChangeType.REMOVE: {
41
44
  const source = typeof e.item.sourceId === 'string' && typeof e.item.source === 'string' ? { id: e.item.sourceId, label: e.item.source } : e.item.source;
42
45
  const notification = {
43
46
  message: e.item.message.original,
@@ -45,9 +48,9 @@ let NotificationService = class NotificationService extends Disposable {
45
48
  source,
46
49
  priority: e.item.priority
47
50
  };
48
- if (e.kind === 0 ) {
51
+ if (e.kind === NotificationChangeType.ADD) {
49
52
  if (isNotificationSource(source)) {
50
- if (!( (this.mapSourceToFilter.has(source.id)))) {
53
+ if (!( this.mapSourceToFilter.has(source.id))) {
51
54
  this.setFilter({ ...source, filter: NotificationsFilter.OFF });
52
55
  }
53
56
  else {
@@ -56,7 +59,7 @@ let NotificationService = class NotificationService extends Disposable {
56
59
  }
57
60
  this._onDidAddNotification.fire(notification);
58
61
  }
59
- if (e.kind === 3 ) {
62
+ if (e.kind === NotificationChangeType.REMOVE) {
60
63
  this._onDidRemoveNotification.fire(notification);
61
64
  }
62
65
  break;
@@ -72,7 +75,7 @@ let NotificationService = class NotificationService extends Disposable {
72
75
  return;
73
76
  }
74
77
  this.globalFilterEnabled = filter === NotificationsFilter.ERROR;
75
- this.storageService.store(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY, this.globalFilterEnabled, -1 , 1 );
78
+ this.storageService.store(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY, this.globalFilterEnabled, StorageScope.APPLICATION, StorageTarget.MACHINE);
76
79
  this.updateFilters();
77
80
  this._onDidChangeFilter.fire();
78
81
  }
@@ -103,17 +106,15 @@ let NotificationService = class NotificationService extends Disposable {
103
106
  }
104
107
  }
105
108
  saveSourceFilters() {
106
- this.storageService.store(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY, JSON.stringify([...( (this.mapSourceToFilter.values()))]), -1 , 1 );
109
+ this.storageService.store(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY, JSON.stringify([...( this.mapSourceToFilter.values())]), StorageScope.APPLICATION, StorageTarget.MACHINE);
107
110
  }
108
111
  getFilters() {
109
- return [...( (this.mapSourceToFilter.values()))];
112
+ return [...( this.mapSourceToFilter.values())];
110
113
  }
111
114
  updateFilters() {
112
115
  this.model.setFilter({
113
116
  global: this.globalFilterEnabled ? NotificationsFilter.ERROR : NotificationsFilter.OFF,
114
- sources: ( (new Map(
115
- ([...( (this.mapSourceToFilter.values()))].map(source => [source.id, source.filter]))
116
- )))
117
+ sources: ( new Map(( [...( this.mapSourceToFilter.values())].map(source => [source.id, source.filter]))))
117
118
  });
118
119
  }
119
120
  removeFilter(sourceId) {
@@ -129,7 +130,7 @@ let NotificationService = class NotificationService extends Disposable {
129
130
  }
130
131
  return;
131
132
  }
132
- this.model.addNotification({ severity: Severity$1.Info, message });
133
+ this.model.addNotification({ severity: Severity.Info, message });
133
134
  }
134
135
  warn(message) {
135
136
  if (Array.isArray(message)) {
@@ -138,7 +139,7 @@ let NotificationService = class NotificationService extends Disposable {
138
139
  }
139
140
  return;
140
141
  }
141
- this.model.addNotification({ severity: Severity$1.Warning, message });
142
+ this.model.addNotification({ severity: Severity.Warning, message });
142
143
  }
143
144
  error(message) {
144
145
  if (Array.isArray(message)) {
@@ -147,22 +148,20 @@ let NotificationService = class NotificationService extends Disposable {
147
148
  }
148
149
  return;
149
150
  }
150
- this.model.addNotification({ severity: Severity$1.Error, message });
151
+ this.model.addNotification({ severity: Severity.Error, message });
151
152
  }
152
153
  notify(notification) {
153
- const toDispose = ( (new DisposableStore()));
154
+ const toDispose = ( new DisposableStore());
154
155
  if (notification.neverShowAgain) {
155
156
  const scope = this.toStorageScope(notification.neverShowAgain);
156
157
  const id = notification.neverShowAgain.id;
157
158
  if (this.storageService.getBoolean(id, scope)) {
158
- return (
159
- (new NoOpNotification())
160
- );
159
+ return ( new NoOpNotification());
161
160
  }
162
- const neverShowAgainAction = toDispose.add(( (new Action('workbench.notification.neverShowAgain', ( localize(3145, "Don't Show Again")), undefined, true, async () => {
161
+ const neverShowAgainAction = toDispose.add(( new Action('workbench.notification.neverShowAgain', ( localize(11662, "Don't Show Again")), undefined, true, async () => {
163
162
  handle.close();
164
- this.storageService.store(id, true, scope, 0 );
165
- }))));
163
+ this.storageService.store(id, true, scope, StorageTarget.USER);
164
+ })));
166
165
  const actions = {
167
166
  primary: notification.actions?.primary || [],
168
167
  secondary: notification.actions?.secondary || []
@@ -182,28 +181,26 @@ let NotificationService = class NotificationService extends Disposable {
182
181
  toStorageScope(options) {
183
182
  switch (options.scope) {
184
183
  case NeverShowAgainScope.APPLICATION:
185
- return -1 ;
184
+ return StorageScope.APPLICATION;
186
185
  case NeverShowAgainScope.PROFILE:
187
- return 0 ;
186
+ return StorageScope.PROFILE;
188
187
  case NeverShowAgainScope.WORKSPACE:
189
- return 1 ;
188
+ return StorageScope.WORKSPACE;
190
189
  default:
191
- return -1 ;
190
+ return StorageScope.APPLICATION;
192
191
  }
193
192
  }
194
193
  prompt(severity, message, choices, options) {
195
- const toDispose = ( (new DisposableStore()));
194
+ const toDispose = ( new DisposableStore());
196
195
  if (options?.neverShowAgain) {
197
196
  const scope = this.toStorageScope(options.neverShowAgain);
198
197
  const id = options.neverShowAgain.id;
199
198
  if (this.storageService.getBoolean(id, scope)) {
200
- return (
201
- (new NoOpNotification())
202
- );
199
+ return ( new NoOpNotification());
203
200
  }
204
201
  const neverShowAgainChoice = {
205
- label: ( localize(3145, "Don't Show Again")),
206
- run: () => this.storageService.store(id, true, scope, 0 ),
202
+ label: ( localize(11662, "Don't Show Again")),
203
+ run: () => this.storageService.store(id, true, scope, StorageTarget.USER),
207
204
  isSecondary: options.neverShowAgain.isSecondary
208
205
  };
209
206
  if (!options.neverShowAgain.isSecondary) {
@@ -217,7 +214,7 @@ let NotificationService = class NotificationService extends Disposable {
217
214
  const primaryActions = [];
218
215
  const secondaryActions = [];
219
216
  choices.forEach((choice, index) => {
220
- const action = ( (new ChoiceAction(`workbench.dialog.choice.${index}`, choice)));
217
+ const action = ( new ChoiceAction(`workbench.dialog.choice.${index}`, choice));
221
218
  if (!choice.isSecondary) {
222
219
  primaryActions.push(action);
223
220
  }
@@ -246,8 +243,8 @@ let NotificationService = class NotificationService extends Disposable {
246
243
  return this.model.showStatusMessage(message, options);
247
244
  }
248
245
  };
249
- NotificationService = NotificationService_1 = ( (__decorate([
250
- ( (__param(0, IStorageService)))
251
- ], NotificationService)));
246
+ NotificationService = NotificationService_1 = ( __decorate([
247
+ ( __param(0, IStorageService))
248
+ ], NotificationService));
252
249
 
253
250
  export { NotificationService };
package/notifications.js DELETED
@@ -1,42 +0,0 @@
1
- import { NotificationsToasts } from '@codingame/monaco-vscode-notifications-workbench-common/vscode/vs/workbench/browser/parts/notifications/notificationsToasts';
2
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
3
- import { NotificationService } from './vscode/src/vs/workbench/services/notification/common/notificationService.js';
4
- import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
5
- import { getClientArea } from 'vscode/vscode/vs/base/browser/dom';
6
- import { registerNotificationCommands } from '@codingame/monaco-vscode-notifications-workbench-common/vscode/vs/workbench/browser/parts/notifications/notificationsCommands';
7
- import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
8
- import { NotificationsCenter } from '@codingame/monaco-vscode-notifications-workbench-common/vscode/vs/workbench/browser/parts/notifications/notificationsCenter';
9
- import { NotificationsAlerts } from '@codingame/monaco-vscode-notifications-workbench-common/vscode/vs/workbench/browser/parts/notifications/notificationsAlerts';
10
- import { NotificationsTelemetry } from '@codingame/monaco-vscode-notifications-workbench-common/vscode/vs/workbench/browser/parts/notifications/notificationsTelemetry';
11
- import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService.service';
12
- import { NotificationsStatus } from '@codingame/monaco-vscode-notifications-workbench-common/vscode/vs/workbench/browser/parts/notifications/notificationsStatus';
13
- import { onRenderWorkbench } from 'vscode/lifecycle';
14
-
15
- onRenderWorkbench(async (accessor) => {
16
- const container = accessor.get(ILayoutService).mainContainer;
17
- const model = accessor.get(INotificationService).model;
18
- const instantiationService = accessor.get(IInstantiationService);
19
- setTimeout(() => {
20
- const notificationsCenter = instantiationService.createInstance(NotificationsCenter, container, model);
21
- const notificationsToasts = instantiationService.createInstance(NotificationsToasts, container, model);
22
- instantiationService.createInstance(NotificationsAlerts, model);
23
- const notificationsStatus = instantiationService.createInstance(NotificationsStatus, model);
24
- instantiationService.createInstance(NotificationsTelemetry);
25
- notificationsCenter.onDidChangeVisibility(() => {
26
- notificationsStatus.update(notificationsCenter.isVisible, notificationsToasts.isVisible);
27
- notificationsToasts.update(notificationsCenter.isVisible);
28
- });
29
- notificationsToasts.onDidChangeVisibility(() => {
30
- notificationsStatus.update(notificationsCenter.isVisible, notificationsToasts.isVisible);
31
- });
32
- registerNotificationCommands(notificationsCenter, notificationsToasts, model);
33
- notificationsToasts.layout(getClientArea(container));
34
- });
35
- });
36
- function getServiceOverride() {
37
- return {
38
- [( INotificationService.toString())]: new SyncDescriptor(NotificationService, [], true)
39
- };
40
- }
41
-
42
- export { getServiceOverride as default };