@codingame/monaco-vscode-api 16.1.0-shadow-root.1 → 16.1.1

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/README.md CHANGED
@@ -327,7 +327,7 @@ See the [VSCode Server](https://github.com/CodinGame/monaco-vscode-api/wiki/How-
327
327
 
328
328
  The library supports shadow-dom.
329
329
 
330
- ⚠️ VSCode itself does support shadow dom, and there are multiple parts that needed to be patched in order for it to work.
330
+ ⚠️ VSCode itself doesn't support shadow dom, and there are multiple parts that needed to be patched in order for it to work.
331
331
 
332
332
  There are multiple benefits of using it:
333
333
  - Your custom global style won't impact the VSCode workbench style (for instance if you did override the default [box-sizing](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing))
@@ -338,21 +338,44 @@ There are multiple benefits of using it:
338
338
 
339
339
  If the provided container element is a child of a shadow dom element, the styles will be injected in both the main page and the shadow root. That's it.
340
340
 
341
+ ### ⚠️ Xterm notice ⚠️
342
+
343
+ The webgl renderer of xterm, which VSCode is using, doesn't support being used inside a shadom dom (see https://github.com/xtermjs/xterm.js/pull/5334).
344
+ Until it's fixed and deployed, either do not use the terminal service override, or apply the patch on your side (using [patch-package](https://www.npmjs.com/package/patch-package) for instance).
345
+
341
346
  ### Prerequisites
342
347
 
343
- In order to be able to load the static css files in the shadow dom as well. Your bundler configuration needs to be adapted so that importing css files doesn't load their content in the page head, but instead just returns the file content as default. It can be achieved with most bundlers with some configurations.
348
+ In order to be able to load the static css files in the shadow dom as well. Your bundler configuration needs to be adapted so that importing css files doesn't load their content in the page head, but instead just returns the file content as default (either as a string or a `CSSStyleSheet`). It can be achieved with most bundlers with some configurations.
349
+
350
+ Note that the bundler should still resolve referenced assets in the css files, so you can't just use the `raw` loader, or the `assets/source` webpack module type.
344
351
 
345
352
  #### Webpack
353
+
346
354
  Add this rule in your configuration:
355
+
347
356
  ```typescript
348
357
  {
349
358
  test: /node_modules\/(@codingame\/monaco-vscode|vscode|monaco-editor).*\.css$/,
350
- type: 'asset/source'
359
+ use: [
360
+ {
361
+ loader: 'css-loader',
362
+ options: {
363
+ esModule: false,
364
+ exportType: 'css-style-sheet', // or 'string', both are working
365
+ url: true,
366
+ import: true
367
+ }
368
+ }
369
+ ]
351
370
  }
352
371
  ```
353
372
 
373
+ You should also make sure that no other loader is interfering with it, by either use a `oneOf` or exclusing those files in the other css loaders.
374
+
354
375
  #### Vite
376
+
355
377
  Add this plugin in your configuration:
378
+
356
379
  ```typescript
357
380
  {
358
381
  name: 'load-vscode-css-as-string',
package/css.js CHANGED
@@ -1,21 +1,28 @@
1
1
 
2
2
 
3
- const styles = [];
3
+ const sheets = [];
4
4
  function registerCss(module) {
5
- const cssContent = module.default;
6
- if (typeof cssContent === 'string') {
7
- const sheet = new CSSStyleSheet();
8
- sheet.replaceSync(cssContent);
5
+ const exportedValue = module.default;
6
+ let sheet = undefined;
7
+ if (typeof exportedValue === 'string') {
8
+ sheet = new CSSStyleSheet();
9
+ sheet.replaceSync(exportedValue);
10
+ }
11
+ else if (exportedValue instanceof CSSStyleSheet) {
12
+ sheet = exportedValue;
13
+ }
14
+ if (sheet != null) {
9
15
  const fontFaces = Array.from(sheet.cssRules)
10
16
  .filter((rule) => rule instanceof CSSFontFaceRule)
11
17
  .map((r) => r.cssText);
12
18
  if (fontFaces.length > 0) {
13
- const fontFaceStyle = document.createElement('style');
14
- fontFaceStyle.setAttribute('type', 'text/css');
15
- fontFaceStyle.appendChild(document.createTextNode(fontFaces.join('\n')));
16
- document.head.insertBefore(fontFaceStyle, document.head.firstChild);
19
+ const fontFaceStyleSheet = new CSSStyleSheet();
20
+ for (const fontFace of fontFaces) {
21
+ fontFaceStyleSheet.insertRule(fontFace);
22
+ }
23
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceStyleSheet];
17
24
  }
18
- styles.push(cssContent);
25
+ sheets.push(sheet);
19
26
  }
20
27
  }
21
28
  function getInjectElement(target) {
@@ -23,18 +30,14 @@ function getInjectElement(target) {
23
30
  if (root instanceof ShadowRoot) {
24
31
  return root;
25
32
  }
26
- return document.head;
33
+ return document;
27
34
  }
28
35
  function injectCss(target) {
29
36
  const root = getInjectElement(target);
30
- if (root instanceof ShadowRoot && styles.length === 0) {
37
+ if (root instanceof ShadowRoot && sheets.length === 0) {
31
38
  console.error("@codingame/monaco-vscode-api was loaded inside a shadow dom, but it's unable to load the css into it because the bundler configuration wasn't applied properly: imported css files should export their content as default");
32
39
  }
33
- for (const style of styles) {
34
- const styleEl = document.createElement('style');
35
- styleEl.appendChild(document.createTextNode(style));
36
- root.appendChild(styleEl);
37
- }
40
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];
38
41
  }
39
42
 
40
43
  export { injectCss, registerCss };
@@ -1304,8 +1304,8 @@ registerSingleton(IPathService, PathService, InstantiationType.Delayed);
1304
1304
  class ProductService {
1305
1305
  constructor() {
1306
1306
  this._serviceBrand = undefined;
1307
- this.version = "1.99.3";
1308
- this.commit = "17baf841131aa23349f217ca7c570c76ee87b957";
1307
+ this.version = 'unknown';
1308
+ this.commit = 'unknown';
1309
1309
  this.quality = 'oss';
1310
1310
  this.nameShort = 'Code - OSS Dev';
1311
1311
  this.nameLong = 'Code - OSS Dev';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "16.1.0-shadow-root.1",
3
+ "version": "16.1.1",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],
@@ -16,13 +16,13 @@
16
16
  "type": "module",
17
17
  "dependencies": {
18
18
  "@c4312/eventsource-umd": "3.0.5",
19
- "@codingame/monaco-vscode-base-service-override": "16.1.0-shadow-root.1",
20
- "@codingame/monaco-vscode-environment-service-override": "16.1.0-shadow-root.1",
21
- "@codingame/monaco-vscode-extensions-service-override": "16.1.0-shadow-root.1",
22
- "@codingame/monaco-vscode-files-service-override": "16.1.0-shadow-root.1",
23
- "@codingame/monaco-vscode-host-service-override": "16.1.0-shadow-root.1",
24
- "@codingame/monaco-vscode-layout-service-override": "16.1.0-shadow-root.1",
25
- "@codingame/monaco-vscode-quickaccess-service-override": "16.1.0-shadow-root.1",
19
+ "@codingame/monaco-vscode-base-service-override": "16.1.1",
20
+ "@codingame/monaco-vscode-environment-service-override": "16.1.1",
21
+ "@codingame/monaco-vscode-extensions-service-override": "16.1.1",
22
+ "@codingame/monaco-vscode-files-service-override": "16.1.1",
23
+ "@codingame/monaco-vscode-host-service-override": "16.1.1",
24
+ "@codingame/monaco-vscode-layout-service-override": "16.1.1",
25
+ "@codingame/monaco-vscode-quickaccess-service-override": "16.1.1",
26
26
  "marked": "14.0.0"
27
27
  },
28
28
  "main": "services.js",
package/services.js CHANGED
@@ -92,7 +92,6 @@ import './vscode/src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeybo
92
92
  export { default as Severity } from './vscode/src/vs/base/common/severity.js';
93
93
  export { StorageScope, StorageTarget } from './vscode/src/vs/platform/storage/common/storage.js';
94
94
  import { StandaloneServices } from './vscode/src/vs/editor/standalone/browser/standaloneServices.js';
95
- import { mixin } from './vscode/src/vs/base/common/objects.js';
96
95
  import { IInstantiationService } from './vscode/src/vs/platform/instantiation/common/instantiation.js';
97
96
  import { DisposableStore } from './vscode/src/vs/base/common/lifecycle.js';
98
97
  import { registerWorkbenchContribution2 } from './vscode/src/vs/workbench/common/contributions.js';
@@ -108,6 +107,8 @@ import getServiceOverride$6 from '@codingame/monaco-vscode-layout-service-overri
108
107
  import getServiceOverride$1 from '@codingame/monaco-vscode-host-service-override';
109
108
  import getServiceOverride from '@codingame/monaco-vscode-base-service-override';
110
109
  import { injectCss } from './css.js';
110
+ import product from './vscode/src/vs/platform/product/common/product.js';
111
+ import { mixin } from './vscode/src/vs/base/common/objects.js';
111
112
  export { SyncDescriptor } from './vscode/src/vs/platform/instantiation/common/descriptors.js';
112
113
  export { ICommandService } from './vscode/src/vs/platform/commands/common/commands.service.js';
113
114
  export { INotificationService } from './vscode/src/vs/platform/notification/common/notification.service.js';
@@ -181,29 +182,17 @@ export { IKeybindingService } from './vscode/src/vs/platform/keybinding/common/k
181
182
  export { ISecretStorageService } from './vscode/src/vs/platform/secrets/common/secrets.service.js';
182
183
  export { ConfigurationTarget } from './vscode/src/vs/platform/configuration/common/configuration.js';
183
184
 
184
- if (window.monacoVscodeApiBuildId != null && window.monacoVscodeApiBuildId !== "1.99.3-ec076fb0-304a-415b-949c-094574542c4f") {
185
- throw new Error(`Another version of monaco-vscode-api has already been loaded. Trying to load ${"1.99.3-ec076fb0-304a-415b-949c-094574542c4f"}, ${window.monacoVscodeApiBuildId} is already loaded`);
185
+ if (window.monacoVscodeApiBuildId != null && window.monacoVscodeApiBuildId !== "1.99.3-59638f9d-7b5b-43f5-9845-d54519415b39") {
186
+ throw new Error(`Another version of monaco-vscode-api has already been loaded. Trying to load ${"1.99.3-59638f9d-7b5b-43f5-9845-d54519415b39"}, ${window.monacoVscodeApiBuildId} is already loaded`);
186
187
  }
187
- window.monacoVscodeApiBuildId = "1.99.3-ec076fb0-304a-415b-949c-094574542c4f";
188
+ window.monacoVscodeApiBuildId = "1.99.3-59638f9d-7b5b-43f5-9845-d54519415b39";
188
189
  async function initialize(overrides, container = document.body, configuration = {}, env) {
189
190
  checkServicesNotInitialized();
190
191
  injectCss(container);
191
192
  initialize$1(container, configuration, env);
193
+ const productService = mixin({ _serviceBrand: undefined, ...product }, configuration.productConfiguration);
192
194
  const instantiationService = StandaloneServices.initialize({
193
- [IProductService.toString()]: mixin({
194
- version: "1.99.3",
195
- quality: 'stable',
196
- commit: "17baf841131aa23349f217ca7c570c76ee87b957",
197
- nameShort: 'Code - OSS',
198
- nameLong: 'Code - OSS',
199
- applicationName: 'code-oss',
200
- dataFolderName: '.vscode-oss',
201
- urlProtocol: 'code-oss',
202
- reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new',
203
- licenseName: 'MIT',
204
- licenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt',
205
- serverApplicationName: 'code-server-oss'
206
- }, configuration.productConfiguration ?? {}),
195
+ [IProductService.toString()]: productService,
207
196
  ...getServiceOverride$6(),
208
197
  ...getServiceOverride$5(),
209
198
  ...getServiceOverride$4(),
@@ -8,7 +8,7 @@ import { EDITOR_MODEL_DEFAULTS } from '../core/textModelDefaults.js';
8
8
  import { USUAL_WORD_SEPARATORS } from '../core/wordHelper.js';
9
9
  import { localize } from '../../../nls.js';
10
10
  import { AccessibilitySupport } from '../../../platform/accessibility/common/accessibility.js';
11
- import product$1 from '../../../platform/product/common/product.js';
11
+ import product from '../../../platform/product/common/product.js';
12
12
 
13
13
  var EditorAutoIndentStrategy;
14
14
  (function (EditorAutoIndentStrategy) {
@@ -3560,7 +3560,7 @@ const EditorOptions = {
3560
3560
  experimentalEditContextEnabled: register(( new EditorBooleanOption(
3561
3561
  EditorOption.experimentalEditContextEnabled,
3562
3562
  'experimentalEditContextEnabled',
3563
- product$1.quality !== 'stable',
3563
+ product.quality !== 'stable',
3564
3564
  {
3565
3565
  description: ( localize(
3566
3566
  537,
@@ -1,51 +1,96 @@
1
1
 
2
- import { env } from '../../../base/common/process.js';
3
2
 
4
- let product;
5
- const vscodeGlobal = globalThis.vscode;
6
- if (typeof vscodeGlobal !== 'undefined' && typeof vscodeGlobal.context !== 'undefined') {
7
- const configuration = vscodeGlobal.context.configuration();
8
- if (configuration) {
9
- product = configuration.product;
10
- }
11
- else {
12
- throw ( new Error('Sandbox: unable to resolve product configuration from preload script.'));
13
- }
14
- }
15
- else if (globalThis._VSCODE_PRODUCT_JSON && globalThis._VSCODE_PACKAGE_JSON) {
16
- product = globalThis._VSCODE_PRODUCT_JSON;
17
- if (env['VSCODE_DEV']) {
18
- Object.assign(product, {
19
- nameShort: `${product.nameShort} Dev`,
20
- nameLong: `${product.nameLong} Dev`,
21
- dataFolderName: `${product.dataFolderName}-dev`,
22
- serverDataFolderName: product.serverDataFolderName ? `${product.serverDataFolderName}-dev` : undefined
23
- });
24
- }
25
- if (!product.version) {
26
- const pkg = globalThis._VSCODE_PACKAGE_JSON;
27
- Object.assign(product, {
28
- version: pkg.version
29
- });
30
- }
31
- }
32
- else {
33
- product = { };
34
- if (( Object.keys(product)).length === 0) {
35
- Object.assign(product, {
36
- version: '1.95.0-dev',
37
- nameShort: 'Code - OSS Dev',
38
- nameLong: 'Code - OSS Dev',
39
- applicationName: 'code-oss',
40
- dataFolderName: '.vscode-oss',
41
- urlProtocol: 'code-oss',
42
- reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new',
43
- licenseName: 'MIT',
44
- licenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt',
45
- serverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt'
46
- });
47
- }
48
- }
49
- var product$1 = product;
3
+ var product = {
4
+ nameShort: "Code - OSS",
5
+ nameLong: "Code - OSS",
6
+ applicationName: "code-oss",
7
+ dataFolderName: ".vscode-oss",
8
+ win32MutexName: "vscodeoss",
9
+ licenseName: "MIT",
10
+ licenseUrl: "https://github.com/microsoft/vscode/blob/main/LICENSE.txt",
11
+ serverLicenseUrl: "https://github.com/microsoft/vscode/blob/main/LICENSE.txt",
12
+ serverGreeting: [
13
+ ],
14
+ serverLicense: [
15
+ ],
16
+ serverLicensePrompt: "",
17
+ serverApplicationName: "code-server-oss",
18
+ serverDataFolderName: ".vscode-server-oss",
19
+ tunnelApplicationName: "code-tunnel-oss",
20
+ win32DirName: "Microsoft Code OSS",
21
+ win32NameVersion: "Microsoft Code OSS",
22
+ win32RegValueName: "CodeOSS",
23
+ win32x64AppId: "{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",
24
+ win32arm64AppId: "{{D1ACE434-89C5-48D1-88D3-E2991DF85475}",
25
+ win32x64UserAppId: "{{CC6B787D-37A0-49E8-AE24-8559A032BE0C}",
26
+ win32arm64UserAppId: "{{3AEBF0C8-F733-4AD4-BADE-FDB816D53D7B}",
27
+ win32AppUserModelId: "Microsoft.CodeOSS",
28
+ win32ShellNameShort: "C&ode - OSS",
29
+ win32TunnelServiceMutex: "vscodeoss-tunnelservice",
30
+ win32TunnelMutex: "vscodeoss-tunnel",
31
+ darwinBundleIdentifier: "com.visualstudio.code.oss",
32
+ darwinProfileUUID: "47827DD9-4734-49A0-AF80-7E19B11495CC",
33
+ darwinProfilePayloadUUID: "CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",
34
+ linuxIconName: "code-oss",
35
+ licenseFileName: "LICENSE.txt",
36
+ reportIssueUrl: "https://github.com/microsoft/vscode/issues/new",
37
+ nodejsRepository: "https://nodejs.org",
38
+ urlProtocol: "code-oss",
39
+ webviewContentExternalBaseUrlTemplate: "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",
40
+ builtInExtensions: [
41
+ {
42
+ name: "ms-vscode.js-debug-companion",
43
+ version: "1.1.3",
44
+ sha256: "7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93",
45
+ repo: "https://github.com/microsoft/vscode-js-debug-companion",
46
+ metadata: {
47
+ id: "99cb0b7f-7354-4278-b8da-6cc79972169d",
48
+ publisherId: {
49
+ publisherId: "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
50
+ publisherName: "ms-vscode",
51
+ displayName: "Microsoft",
52
+ flags: "verified"
53
+ },
54
+ publisherDisplayName: "Microsoft"
55
+ }
56
+ },
57
+ {
58
+ name: "ms-vscode.js-debug",
59
+ version: "1.97.1",
60
+ sha256: "977dd854805547702e312e176f68a1b142fa123f228258f47f0964560ad32496",
61
+ repo: "https://github.com/microsoft/vscode-js-debug",
62
+ metadata: {
63
+ id: "25629058-ddac-4e17-abba-74678e126c5d",
64
+ publisherId: {
65
+ publisherId: "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
66
+ publisherName: "ms-vscode",
67
+ displayName: "Microsoft",
68
+ flags: "verified"
69
+ },
70
+ publisherDisplayName: "Microsoft"
71
+ }
72
+ },
73
+ {
74
+ name: "ms-vscode.vscode-js-profile-table",
75
+ version: "1.0.10",
76
+ sha256: "7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",
77
+ repo: "https://github.com/microsoft/vscode-js-profile-visualizer",
78
+ metadata: {
79
+ id: "7e52b41b-71ad-457b-ab7e-0620f1fc4feb",
80
+ publisherId: {
81
+ publisherId: "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",
82
+ publisherName: "ms-vscode",
83
+ displayName: "Microsoft",
84
+ flags: "verified"
85
+ },
86
+ publisherDisplayName: "Microsoft"
87
+ }
88
+ }
89
+ ],
90
+ quality: "stable",
91
+ version: "1.99.3",
92
+ commit: "17baf841131aa23349f217ca7c570c76ee87b957",
93
+ date: "2025-05-06T06:44:57.742Z"
94
+ };
50
95
 
51
- export { product$1 as default };
96
+ export { product as default };
@@ -34,7 +34,7 @@ import { ByteSize } from '../../../platform/files/common/files.js';
34
34
  import { IQuickInputService } from '../../../platform/quickinput/common/quickInput.service.js';
35
35
  import { IUserDataProfileService } from '../../services/userDataProfile/common/userDataProfile.service.js';
36
36
  import { IEditorService } from '../../services/editor/common/editorService.service.js';
37
- import product$1 from '../../../platform/product/common/product.js';
37
+ import product from '../../../platform/product/common/product.js';
38
38
  import { CommandsRegistry } from '../../../platform/commands/common/commands.js';
39
39
  import { IEnvironmentService } from '../../../platform/environment/common/environment.service.js';
40
40
 
@@ -518,7 +518,7 @@ registerAction2(ToggleScreencastModeAction);
518
518
  registerAction2(LogStorageAction);
519
519
  registerAction2(LogWorkingCopiesAction);
520
520
  registerAction2(RemoveLargeStorageEntriesAction);
521
- if (!product$1.commit) {
521
+ if (!product.commit) {
522
522
  registerAction2(StartTrackDisposables);
523
523
  registerAction2(SnapshotTrackedDisposables);
524
524
  registerAction2(StopTrackDisposables);