@codingame/monaco-vscode-api 19.0.1 → 19.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/README.md +26 -0
- package/css.js +15 -8
- package/package.json +8 -8
- package/services.js +3 -3
- package/vscode/src/vs/base/browser/dom.d.ts +11 -0
- package/vscode/src/vs/base/browser/dom.js +34 -21
- package/vscode/src/vs/base/browser/domStylesheets.js +12 -4
- package/vscode/src/vs/base/browser/formattedTextRenderer.js +7 -7
- package/vscode/src/vs/base/browser/keyboardEvent.js +8 -1
- package/vscode/src/vs/base/browser/pixelRatio.js +2 -2
- package/vscode/src/vs/base/browser/ui/actionbar/actionViewItems.js +3 -3
- package/vscode/src/vs/base/browser/ui/actionbar/actionbar.js +4 -4
- package/vscode/src/vs/base/browser/ui/aria/aria.js +4 -4
- package/vscode/src/vs/base/browser/ui/button/button.js +10 -10
- package/vscode/src/vs/base/browser/ui/contextview/contextview.js +2 -2
- package/vscode/src/vs/base/browser/ui/findinput/findInput.js +3 -3
- package/vscode/src/vs/base/browser/ui/findinput/replaceInput.js +3 -3
- package/vscode/src/vs/base/browser/ui/hover/hoverWidget.js +3 -3
- package/vscode/src/vs/base/browser/ui/list/listView.js +3 -3
- package/vscode/src/vs/base/browser/ui/menu/menu.js +2 -2
- package/vscode/src/vs/base/browser/ui/progressbar/progressbar.js +3 -3
- package/vscode/src/vs/base/browser/ui/resizable/resizable.js +2 -2
- package/vscode/src/vs/base/browser/ui/scrollbar/abstractScrollbar.js +4 -4
- package/vscode/src/vs/base/browser/ui/scrollbar/scrollableElement.js +5 -5
- package/vscode/src/vs/base/browser/ui/scrollbar/scrollbarArrow.js +4 -4
- package/vscode/src/vs/base/browser/ui/selectBox/selectBoxCustom.js +4 -4
- package/vscode/src/vs/base/browser/ui/selectBox/selectBoxNative.js +3 -3
- package/vscode/src/vs/base/browser/ui/splitview/splitview.js +2 -2
- package/vscode/src/vs/base/browser/ui/toggle/toggle.js +2 -2
- package/vscode/src/vs/base/browser/ui/toolbar/toolbar.js +2 -1
- package/vscode/src/vs/base/browser/ui/tree/abstractTree.js +2 -2
- package/vscode/src/vs/base/browser/window.d.ts +3 -0
- package/vscode/src/vs/base/browser/window.js +1 -1
- package/vscode/src/vs/editor/browser/config/charWidthReader.js +7 -6
- package/vscode/src/vs/editor/browser/controller/editContext/native/nativeEditContext.js +3 -3
- package/vscode/src/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +3 -2
- package/vscode/src/vs/editor/browser/controller/mouseTarget.js +2 -2
- package/vscode/src/vs/editor/browser/gpu/viewGpuContext.js +2 -2
- package/vscode/src/vs/editor/browser/observableCodeEditor.js +2 -1
- package/vscode/src/vs/editor/browser/view/domLineBreaksComputer.js +2 -1
- package/vscode/src/vs/editor/browser/view/viewLayer.js +3 -2
- package/vscode/src/vs/editor/browser/view.js +4 -4
- package/vscode/src/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js +3 -2
- package/vscode/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +3 -3
- package/vscode/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +3 -2
- package/vscode/src/vs/editor/browser/viewParts/margin/margin.js +3 -2
- package/vscode/src/vs/editor/browser/viewParts/minimap/minimap.js +8 -8
- package/vscode/src/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.js +2 -1
- package/vscode/src/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +3 -3
- package/vscode/src/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js +2 -1
- package/vscode/src/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js +2 -1
- package/vscode/src/vs/editor/browser/viewParts/rulers/rulers.js +3 -2
- package/vscode/src/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js +2 -1
- package/vscode/src/vs/editor/browser/viewParts/viewCursors/viewCursor.js +2 -2
- package/vscode/src/vs/editor/browser/viewParts/viewCursors/viewCursors.js +2 -2
- package/vscode/src/vs/editor/browser/viewParts/viewLines/viewLines.js +2 -1
- package/vscode/src/vs/editor/browser/viewParts/viewZones/viewZones.js +3 -2
- package/vscode/src/vs/editor/browser/widget/codeEditor/codeEditorWidget.d.ts +3 -1
- package/vscode/src/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +8 -2
- package/vscode/src/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget.d.ts +2 -1
- package/vscode/src/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget.js +5 -3
- package/vscode/src/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js +12 -12
- package/vscode/src/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +9 -9
- package/vscode/src/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js +2 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.d.ts +3 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +6 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/embeddedDiffEditorWidget.d.ts +2 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/embeddedDiffEditorWidget.js +5 -3
- package/vscode/src/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +6 -6
- package/vscode/src/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js +2 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/utils/editorGutter.js +2 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/utils.js +2 -1
- package/vscode/src/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer.js +3 -2
- package/vscode/src/vs/editor/contrib/codelens/browser/codelensWidget.js +3 -3
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +3 -3
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +2 -2
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerInsertButton.js +2 -2
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerSaturationBox.js +3 -3
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerStrip.js +2 -2
- package/vscode/src/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerWidget.js +2 -2
- package/vscode/src/vs/editor/contrib/find/browser/findOptionsWidget.js +2 -2
- package/vscode/src/vs/editor/contrib/find/browser/findWidget.js +9 -9
- package/vscode/src/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +13 -13
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +2 -2
- package/vscode/src/vs/editor/contrib/message/browser/messageController.js +5 -5
- package/vscode/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/vscode/src/vs/editor/contrib/rename/browser/renameWidget.js +10 -10
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +9 -9
- package/vscode/src/vs/editor/contrib/zoneWidget/browser/zoneWidget.js +4 -4
- package/vscode/src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js +2 -2
- package/vscode/src/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js +2 -1
- package/vscode/src/vs/editor/standalone/browser/standaloneCodeEditor.d.ts +1 -1
- package/vscode/src/vs/editor/standalone/browser/standaloneCodeEditor.js +5 -4
- package/vscode/src/vs/editor/standalone/browser/standaloneServices.d.ts +1 -0
- package/vscode/src/vs/editor/standalone/browser/standaloneServices.js +24 -48
- package/vscode/src/vs/platform/actionWidget/browser/actionList.js +6 -6
- package/vscode/src/vs/platform/actionWidget/browser/actionWidget.js +4 -4
- package/vscode/src/vs/platform/keybinding/common/abstractKeybindingService.d.ts +1 -0
- package/vscode/src/vs/platform/keybinding/common/abstractKeybindingService.js +3 -0
- package/vscode/src/vs/platform/keybinding/common/keybinding.service.d.ts +1 -0
- package/vscode/src/vs/platform/product/common/product.js +1 -1
- package/vscode/src/vs/platform/quickinput/browser/quickInputController.d.ts +3 -1
- package/vscode/src/vs/platform/quickinput/browser/quickInputController.js +6 -2
- package/vscode/src/vs/workbench/browser/actions/developerActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/dictation/editorDictation.js +2 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.js +5 -3
- package/vscode/src/vs/workbench/contrib/inlayHints/browser/inlayHintsAccessibilty.js +3 -3
package/README.md
CHANGED
|
@@ -397,6 +397,32 @@ Add this plugin in your configuration:
|
|
|
397
397
|
}
|
|
398
398
|
```
|
|
399
399
|
|
|
400
|
+
## Sandbox mode (⚠️ beta ⚠️)
|
|
401
|
+
|
|
402
|
+
One issue with VSCode is it's only designed to be initialized once. So the initialization options (workbench options, remote server authority...) can't be updated/reloaded. Also it's not possible to "unload" the services.
|
|
403
|
+
|
|
404
|
+
To still be able to do it, a possibility is to run all VSCode code inside an iframe instead of in the main page. But then VSCode will render in the iframe only and won't be well integrated in the page.
|
|
405
|
+
|
|
406
|
+
To better integrate it, it's also possible to run the code in the iframe, but make the code interact with the main page dom.
|
|
407
|
+
|
|
408
|
+
This library supports that mode. To enable that, you should
|
|
409
|
+
- have a secondary html entrypoint, that initialize the services
|
|
410
|
+
- load that secondary html in an iframe
|
|
411
|
+
- in the iframe, set `window.vscodeWindow` to the parent window, also initialize the service with a container mounted in that window
|
|
412
|
+
- do not import any monaco-vscode-library from the top window, but you can declare functions on the iframe window to get objects to the top window
|
|
413
|
+
|
|
414
|
+
To "unload" the workbench, you should:
|
|
415
|
+
- remove the iframe element from the top frame
|
|
416
|
+
- remove or empty the workbench container
|
|
417
|
+
- cleanup the elements that VSCode has injected in the page head: `document.querySelectorAll('[data-vscode]').forEach((el) => el.remove())`
|
|
418
|
+
|
|
419
|
+
⚠️ `window.vscodeWindow` should be set BEFORE any VSCode code is loaded
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
Note: it can be used in combination with shadow dom
|
|
423
|
+
|
|
424
|
+
It's demonstrated in the demo, by adding `?sandbox` query parameter to the demo url
|
|
425
|
+
|
|
400
426
|
## Troubleshooting
|
|
401
427
|
|
|
402
428
|
If something doesn't work, make sure to check out the [Troubleshooting](https://github.com/CodinGame/monaco-vscode-api/wiki/Troubleshooting) wiki page.
|
package/css.js
CHANGED
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
|
|
2
|
+
import { mainWindow } from './vscode/src/vs/base/browser/window.js';
|
|
2
3
|
|
|
3
4
|
const sheets = [];
|
|
4
5
|
function registerCss(module) {
|
|
5
6
|
const exportedValue = module.default;
|
|
6
7
|
let sheet = undefined;
|
|
7
8
|
if (typeof exportedValue === 'string') {
|
|
8
|
-
sheet = new CSSStyleSheet();
|
|
9
|
+
sheet = new mainWindow.CSSStyleSheet();
|
|
9
10
|
sheet.replaceSync(exportedValue);
|
|
10
11
|
}
|
|
11
12
|
else if (exportedValue instanceof CSSStyleSheet) {
|
|
12
|
-
sheet =
|
|
13
|
+
sheet = new mainWindow.CSSStyleSheet();
|
|
14
|
+
sheet.replaceSync(Array.from(exportedValue.cssRules)
|
|
15
|
+
.map((r) => r.cssText)
|
|
16
|
+
.join('\n'));
|
|
13
17
|
}
|
|
14
18
|
if (sheet != null) {
|
|
15
19
|
const fontFaces = Array.from(sheet.cssRules)
|
|
16
|
-
.filter((rule) => rule instanceof CSSFontFaceRule)
|
|
20
|
+
.filter((rule) => rule instanceof mainWindow.CSSFontFaceRule)
|
|
17
21
|
.map((r) => r.cssText);
|
|
18
22
|
if (fontFaces.length > 0) {
|
|
19
|
-
const fontFaceStyleSheet = new CSSStyleSheet();
|
|
23
|
+
const fontFaceStyleSheet = new mainWindow.CSSStyleSheet();
|
|
20
24
|
for (const fontFace of fontFaces) {
|
|
21
25
|
fontFaceStyleSheet.insertRule(fontFace);
|
|
22
26
|
}
|
|
23
|
-
document.adoptedStyleSheets = [
|
|
27
|
+
mainWindow.document.adoptedStyleSheets = [
|
|
28
|
+
...mainWindow.document.adoptedStyleSheets,
|
|
29
|
+
fontFaceStyleSheet
|
|
30
|
+
];
|
|
24
31
|
}
|
|
25
32
|
sheets.push(sheet);
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
function getInjectElement(target) {
|
|
29
36
|
const root = target.getRootNode();
|
|
30
|
-
if (root instanceof ShadowRoot) {
|
|
37
|
+
if (root instanceof mainWindow.ShadowRoot) {
|
|
31
38
|
return root;
|
|
32
39
|
}
|
|
33
|
-
return
|
|
40
|
+
return target.ownerDocument;
|
|
34
41
|
}
|
|
35
42
|
function injectCss(target) {
|
|
36
43
|
const root = getInjectElement(target);
|
|
37
|
-
if (root instanceof ShadowRoot && sheets.length === 0) {
|
|
44
|
+
if (root instanceof mainWindow.ShadowRoot && sheets.length === 0) {
|
|
38
45
|
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");
|
|
39
46
|
}
|
|
40
47
|
root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-api",
|
|
3
|
-
"version": "19.0
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-base-service-override": "19.0
|
|
19
|
-
"@codingame/monaco-vscode-environment-service-override": "19.0
|
|
20
|
-
"@codingame/monaco-vscode-extensions-service-override": "19.0
|
|
21
|
-
"@codingame/monaco-vscode-files-service-override": "19.0
|
|
22
|
-
"@codingame/monaco-vscode-host-service-override": "19.0
|
|
23
|
-
"@codingame/monaco-vscode-layout-service-override": "19.0
|
|
24
|
-
"@codingame/monaco-vscode-quickaccess-service-override": "19.0
|
|
18
|
+
"@codingame/monaco-vscode-base-service-override": "19.1.0",
|
|
19
|
+
"@codingame/monaco-vscode-environment-service-override": "19.1.0",
|
|
20
|
+
"@codingame/monaco-vscode-extensions-service-override": "19.1.0",
|
|
21
|
+
"@codingame/monaco-vscode-files-service-override": "19.1.0",
|
|
22
|
+
"@codingame/monaco-vscode-host-service-override": "19.1.0",
|
|
23
|
+
"@codingame/monaco-vscode-layout-service-override": "19.1.0",
|
|
24
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "19.1.0",
|
|
25
25
|
"@vscode/iconv-lite-umd": "0.7.0",
|
|
26
26
|
"dompurify": "3.2.6",
|
|
27
27
|
"jschardet": "3.1.4",
|
package/services.js
CHANGED
|
@@ -392,10 +392,10 @@ export { IAuthenticationQueryService } from './vscode/src/vs/workbench/services/
|
|
|
392
392
|
export { ICoreExperimentationService } from './vscode/src/vs/workbench/services/coreExperimentation/common/coreExperimentationService.service.js';
|
|
393
393
|
export { IWorkbenchMcpManagementService } from './vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.service.js';
|
|
394
394
|
|
|
395
|
-
if (window.monacoVscodeApiBuildId != null && window.monacoVscodeApiBuildId !== "1.102.3-
|
|
396
|
-
throw new Error(`Another version of monaco-vscode-api has already been loaded. Trying to load ${"1.102.3-
|
|
395
|
+
if (window.monacoVscodeApiBuildId != null && window.monacoVscodeApiBuildId !== "1.102.3-3cf9ce2a-676e-4066-93c4-6d5137cfca59") {
|
|
396
|
+
throw new Error(`Another version of monaco-vscode-api has already been loaded. Trying to load ${"1.102.3-3cf9ce2a-676e-4066-93c4-6d5137cfca59"}, ${window.monacoVscodeApiBuildId} is already loaded`);
|
|
397
397
|
}
|
|
398
|
-
window.monacoVscodeApiBuildId = "1.102.3-
|
|
398
|
+
window.monacoVscodeApiBuildId = "1.102.3-3cf9ce2a-676e-4066-93c4-6d5137cfca59";
|
|
399
399
|
async function initialize(overrides, container = document.body, configuration = {}, env) {
|
|
400
400
|
checkServicesNotInitialized();
|
|
401
401
|
injectCss(container);
|
|
@@ -118,6 +118,16 @@ export declare const sharedMutationObserver: {
|
|
|
118
118
|
};
|
|
119
119
|
export declare function createMetaElement(container?: HTMLElement): HTMLMetaElement;
|
|
120
120
|
export declare function createLinkElement(container?: HTMLElement): HTMLLinkElement;
|
|
121
|
+
export declare function createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K];
|
|
122
|
+
export declare function createElement(tagName: string, options?: ElementCreationOptions): HTMLElement;
|
|
123
|
+
export declare function createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement;
|
|
124
|
+
export declare function createElementNS<K extends keyof SVGElementTagNameMap>(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K];
|
|
125
|
+
export declare function createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement;
|
|
126
|
+
export declare function createElementNS<K extends keyof MathMLElementTagNameMap>(namespaceURI: "http://www.w3.org/1998/Math/MathML", qualifiedName: K): MathMLElementTagNameMap[K];
|
|
127
|
+
export declare function createElementNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", qualifiedName: string): MathMLElement;
|
|
128
|
+
export declare function createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element;
|
|
129
|
+
export declare function createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element;
|
|
130
|
+
export declare function isElement(e: unknown): e is Element;
|
|
121
131
|
export declare function isHTMLElement(e: unknown): e is HTMLElement;
|
|
122
132
|
export declare function isHTMLAnchorElement(e: unknown): e is HTMLAnchorElement;
|
|
123
133
|
export declare function isHTMLSpanElement(e: unknown): e is HTMLSpanElement;
|
|
@@ -125,6 +135,7 @@ export declare function isHTMLTextAreaElement(e: unknown): e is HTMLTextAreaElem
|
|
|
125
135
|
export declare function isHTMLInputElement(e: unknown): e is HTMLInputElement;
|
|
126
136
|
export declare function isHTMLButtonElement(e: unknown): e is HTMLButtonElement;
|
|
127
137
|
export declare function isHTMLDivElement(e: unknown): e is HTMLDivElement;
|
|
138
|
+
export declare function isHTMLIframeElement(e: unknown): e is HTMLDivElement;
|
|
128
139
|
export declare function isSVGElement(e: unknown): e is SVGElement;
|
|
129
140
|
export declare function isMouseEvent(e: unknown): e is MouseEvent;
|
|
130
141
|
export declare function isKeyboardEvent(e: unknown): e is KeyboardEvent;
|
|
@@ -665,42 +665,55 @@ function createLinkElement(container = mainWindow.document.head) {
|
|
|
665
665
|
return createHeadElement('link', container);
|
|
666
666
|
}
|
|
667
667
|
function createHeadElement(tagName, container = mainWindow.document.head) {
|
|
668
|
-
const element =
|
|
668
|
+
const element = createElement(tagName);
|
|
669
|
+
element.setAttribute('data-vscode', 'true');
|
|
669
670
|
container.appendChild(element);
|
|
670
671
|
return element;
|
|
671
672
|
}
|
|
673
|
+
function createElement(tagName, options) {
|
|
674
|
+
return mainWindow.document.createElement(tagName, options);
|
|
675
|
+
}
|
|
676
|
+
function createElementNS(namespace, qualifiedName, options) {
|
|
677
|
+
return mainWindow.document.createElementNS(namespace, qualifiedName, options);
|
|
678
|
+
}
|
|
679
|
+
function isElement(e) {
|
|
680
|
+
return e instanceof mainWindow.Element || e instanceof getWindow(e).Element;
|
|
681
|
+
}
|
|
672
682
|
function isHTMLElement(e) {
|
|
673
|
-
return e instanceof HTMLElement || e instanceof getWindow(e).HTMLElement;
|
|
683
|
+
return e instanceof mainWindow.HTMLElement || e instanceof getWindow(e).HTMLElement;
|
|
674
684
|
}
|
|
675
685
|
function isHTMLAnchorElement(e) {
|
|
676
|
-
return e instanceof HTMLAnchorElement || e instanceof getWindow(e).HTMLAnchorElement;
|
|
686
|
+
return e instanceof mainWindow.HTMLAnchorElement || e instanceof getWindow(e).HTMLAnchorElement;
|
|
677
687
|
}
|
|
678
688
|
function isHTMLTextAreaElement(e) {
|
|
679
|
-
return e instanceof HTMLTextAreaElement || e instanceof getWindow(e).HTMLTextAreaElement;
|
|
689
|
+
return e instanceof mainWindow.HTMLTextAreaElement || e instanceof getWindow(e).HTMLTextAreaElement;
|
|
680
690
|
}
|
|
681
691
|
function isHTMLInputElement(e) {
|
|
682
|
-
return e instanceof HTMLInputElement || e instanceof getWindow(e).HTMLInputElement;
|
|
692
|
+
return e instanceof mainWindow.HTMLInputElement || e instanceof getWindow(e).HTMLInputElement;
|
|
683
693
|
}
|
|
684
694
|
function isHTMLButtonElement(e) {
|
|
685
|
-
return e instanceof HTMLButtonElement || e instanceof getWindow(e).HTMLButtonElement;
|
|
695
|
+
return e instanceof mainWindow.HTMLButtonElement || e instanceof getWindow(e).HTMLButtonElement;
|
|
686
696
|
}
|
|
687
697
|
function isHTMLDivElement(e) {
|
|
688
|
-
return e instanceof HTMLDivElement || e instanceof getWindow(e).HTMLDivElement;
|
|
698
|
+
return e instanceof mainWindow.HTMLDivElement || e instanceof getWindow(e).HTMLDivElement;
|
|
699
|
+
}
|
|
700
|
+
function isHTMLIframeElement(e) {
|
|
701
|
+
return e instanceof mainWindow.HTMLIFrameElement || e instanceof getWindow(e).HTMLIFrameElement;
|
|
689
702
|
}
|
|
690
703
|
function isSVGElement(e) {
|
|
691
|
-
return e instanceof SVGElement || e instanceof getWindow(e).SVGElement;
|
|
704
|
+
return e instanceof mainWindow.SVGElement || e instanceof getWindow(e).SVGElement;
|
|
692
705
|
}
|
|
693
706
|
function isMouseEvent(e) {
|
|
694
|
-
return e instanceof MouseEvent || e instanceof getWindow(e).MouseEvent;
|
|
707
|
+
return e instanceof mainWindow.MouseEvent || e instanceof getWindow(e).MouseEvent;
|
|
695
708
|
}
|
|
696
709
|
function isKeyboardEvent(e) {
|
|
697
|
-
return e instanceof KeyboardEvent || e instanceof getWindow(e).KeyboardEvent;
|
|
710
|
+
return e instanceof mainWindow.KeyboardEvent || e instanceof getWindow(e).KeyboardEvent;
|
|
698
711
|
}
|
|
699
712
|
function isPointerEvent(e) {
|
|
700
|
-
return e instanceof PointerEvent || e instanceof getWindow(e).PointerEvent;
|
|
713
|
+
return e instanceof mainWindow.PointerEvent || e instanceof getWindow(e).PointerEvent;
|
|
701
714
|
}
|
|
702
715
|
function isDragEvent(e) {
|
|
703
|
-
return e instanceof DragEvent || e instanceof getWindow(e).DragEvent;
|
|
716
|
+
return e instanceof mainWindow.DragEvent || e instanceof getWindow(e).DragEvent;
|
|
704
717
|
}
|
|
705
718
|
const EventType = {
|
|
706
719
|
CLICK: 'click',
|
|
@@ -869,10 +882,10 @@ function _$(namespace, description, attrs, ...children) {
|
|
|
869
882
|
const tagName = match[1] || 'div';
|
|
870
883
|
let result;
|
|
871
884
|
if (namespace !== Namespace.HTML) {
|
|
872
|
-
result =
|
|
885
|
+
result = createElementNS(namespace, tagName);
|
|
873
886
|
}
|
|
874
887
|
else {
|
|
875
|
-
result =
|
|
888
|
+
result = createElement(tagName);
|
|
876
889
|
}
|
|
877
890
|
if (match[3]) {
|
|
878
891
|
result.id = match[3];
|
|
@@ -978,7 +991,7 @@ function triggerDownload(dataOrUri, name) {
|
|
|
978
991
|
setTimeout(() => URL.revokeObjectURL(url));
|
|
979
992
|
}
|
|
980
993
|
const activeWindow = getActiveWindow();
|
|
981
|
-
const anchor =
|
|
994
|
+
const anchor = createElement('a');
|
|
982
995
|
activeWindow.document.body.appendChild(anchor);
|
|
983
996
|
anchor.download = name;
|
|
984
997
|
anchor.href = url;
|
|
@@ -988,7 +1001,7 @@ function triggerDownload(dataOrUri, name) {
|
|
|
988
1001
|
function triggerUpload() {
|
|
989
1002
|
return ( new Promise(resolve => {
|
|
990
1003
|
const activeWindow = getActiveWindow();
|
|
991
|
-
const input =
|
|
1004
|
+
const input = createElement('input');
|
|
992
1005
|
activeWindow.document.body.appendChild(input);
|
|
993
1006
|
input.type = 'file';
|
|
994
1007
|
input.multiple = true;
|
|
@@ -1021,7 +1034,7 @@ function detectFullscreen(targetWindow, containerElement) {
|
|
|
1021
1034
|
return null;
|
|
1022
1035
|
}
|
|
1023
1036
|
function hookDomPurifyHrefAndSrcSanitizer(allowedProtocols, allowDataImages = false) {
|
|
1024
|
-
const anchor =
|
|
1037
|
+
const anchor = createElement('a');
|
|
1025
1038
|
dompurify.addHook('afterSanitizeAttributes', (node) => {
|
|
1026
1039
|
for (const attr of ['href', 'src']) {
|
|
1027
1040
|
if (node.hasAttribute(attr)) {
|
|
@@ -1343,7 +1356,7 @@ function h(tag, ...args) {
|
|
|
1343
1356
|
throw ( new Error('Bad use of h'));
|
|
1344
1357
|
}
|
|
1345
1358
|
const tagName = match.groups['tag'] || 'div';
|
|
1346
|
-
const el =
|
|
1359
|
+
const el = createElement(tagName);
|
|
1347
1360
|
if (match.groups['id']) {
|
|
1348
1361
|
el.id = match.groups['id'];
|
|
1349
1362
|
}
|
|
@@ -1418,7 +1431,7 @@ function svgElem(tag, ...args) {
|
|
|
1418
1431
|
throw ( new Error('Bad use of h'));
|
|
1419
1432
|
}
|
|
1420
1433
|
const tagName = match.groups['tag'] || 'div';
|
|
1421
|
-
const el =
|
|
1434
|
+
const el = createElementNS('http://www.w3.org/2000/svg', tagName);
|
|
1422
1435
|
if (match.groups['id']) {
|
|
1423
1436
|
el.id = match.groups['id'];
|
|
1424
1437
|
}
|
|
@@ -1585,7 +1598,7 @@ var n;
|
|
|
1585
1598
|
class ObserverNode {
|
|
1586
1599
|
constructor(tag, ref, obsRef, ns, className, attributes, children) {
|
|
1587
1600
|
this._deriveds = [];
|
|
1588
|
-
this._element = (ns ?
|
|
1601
|
+
this._element = (ns ? createElementNS(ns, tag) : createElement(tag));
|
|
1589
1602
|
if (ref) {
|
|
1590
1603
|
ref(this._element);
|
|
1591
1604
|
}
|
|
@@ -1811,4 +1824,4 @@ function isObservable(obj) {
|
|
|
1811
1824
|
return !!obj && obj.read !== undefined && obj.reportChanges !== undefined;
|
|
1812
1825
|
}
|
|
1813
1826
|
|
|
1814
|
-
export { $, DetectedFullscreenMode, Dimension, DragAndDropObserver, EventHelper, EventType, LiveElement, ModifierKeyEmitter, Namespace, ObserverNode, ObserverNodeWithElement, SafeTriangle, WindowIdleValue, WindowIntervalTimer, addDisposableGenericMouseDownListener, addDisposableGenericMouseMoveListener, addDisposableGenericMouseUpListener, addDisposableListener, addDisposableThrottledListener, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, addStandardDisposableListener, after, animate, append, basicMarkupHtmlTags, clearNode, computeScreenAwareSize, copyAttributes, createLinkElement, createMetaElement, detectFullscreen, disposableWindowInterval, finalHandler, findParentWithClass, getActiveDocument, getActiveElement, getActiveWindow, getClientArea, getComputedStyle, getContentHeight, getContentWidth, getDocument, getDomNodePagePosition, getDomNodeZoomLevel, getLargestChildWidth, getRootContainer, getShadowRoot, getTopLeftOffset, getTotalHeight, getTotalScrollWidth, getTotalWidth, getWindow, getWindowById, getWindowId, getWindows, getWindowsCount, h, hasParentWithClass, hide, hookDomPurifyHrefAndSrcSanitizer, isActiveDocument, isActiveElement, isAncestor, isAncestorOfActiveElement, isAncestorUsingFlowTo, isDragEvent, isEditableElement, isElementInBottomRightQuarter, isEventLike, isHTMLAnchorElement, isHTMLButtonElement, isHTMLDivElement, isHTMLElement, isHTMLInputElement, isHTMLTextAreaElement, isInShadowDOM, isKeyboardEvent, isMouseEvent, isPointerEvent, isSVGElement, isShadowRoot, measure, modify, multibyteAwareBtoa, n, onDidRegisterWindow, onDidUnregisterWindow, onWillUnregisterWindow, position, prepend, registerWindow, reset, restoreParentsScrollTop, runAtThisOrScheduleAtNextAnimationFrame, runWhenWindowIdle, safeInnerHtml, saveParentsScrollTop, scheduleAtNextAnimationFrame, setParentFlowTo, setVisibility, sharedMutationObserver, show, size, svgElem, trackAttributes, trackFocus, triggerDownload, triggerUpload, windowOpenNoOpener, windowOpenPopup, windowOpenWithSuccess };
|
|
1827
|
+
export { $, DetectedFullscreenMode, Dimension, DragAndDropObserver, EventHelper, EventType, LiveElement, ModifierKeyEmitter, Namespace, ObserverNode, ObserverNodeWithElement, SafeTriangle, WindowIdleValue, WindowIntervalTimer, addDisposableGenericMouseDownListener, addDisposableGenericMouseMoveListener, addDisposableGenericMouseUpListener, addDisposableListener, addDisposableThrottledListener, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, addStandardDisposableListener, after, animate, append, basicMarkupHtmlTags, clearNode, computeScreenAwareSize, copyAttributes, createElement, createElementNS, createLinkElement, createMetaElement, detectFullscreen, disposableWindowInterval, finalHandler, findParentWithClass, getActiveDocument, getActiveElement, getActiveWindow, getClientArea, getComputedStyle, getContentHeight, getContentWidth, getDocument, getDomNodePagePosition, getDomNodeZoomLevel, getLargestChildWidth, getRootContainer, getShadowRoot, getTopLeftOffset, getTotalHeight, getTotalScrollWidth, getTotalWidth, getWindow, getWindowById, getWindowId, getWindows, getWindowsCount, h, hasParentWithClass, hide, hookDomPurifyHrefAndSrcSanitizer, isActiveDocument, isActiveElement, isAncestor, isAncestorOfActiveElement, isAncestorUsingFlowTo, isDragEvent, isEditableElement, isElement, isElementInBottomRightQuarter, isEventLike, isHTMLAnchorElement, isHTMLButtonElement, isHTMLDivElement, isHTMLElement, isHTMLIframeElement, isHTMLInputElement, isHTMLTextAreaElement, isInShadowDOM, isKeyboardEvent, isMouseEvent, isPointerEvent, isSVGElement, isShadowRoot, measure, modify, multibyteAwareBtoa, n, onDidRegisterWindow, onDidUnregisterWindow, onWillUnregisterWindow, position, prepend, registerWindow, reset, restoreParentsScrollTop, runAtThisOrScheduleAtNextAnimationFrame, runWhenWindowIdle, safeInnerHtml, saveParentsScrollTop, scheduleAtNextAnimationFrame, setParentFlowTo, setVisibility, sharedMutationObserver, show, size, svgElem, trackAttributes, trackFocus, triggerDownload, triggerUpload, windowOpenNoOpener, windowOpenPopup, windowOpenWithSuccess };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { toDisposable, DisposableStore } from '../common/lifecycle.js';
|
|
3
3
|
import '../common/observableInternal/index.js';
|
|
4
|
-
import { getWindows, sharedMutationObserver } from './dom.js';
|
|
4
|
+
import { isShadowRoot, createElement, getWindows, sharedMutationObserver } from './dom.js';
|
|
5
|
+
import { isFirefox } from './browser.js';
|
|
5
6
|
import { mainWindow } from './window.js';
|
|
6
7
|
import { autorun } from '../common/observableInternal/reactions/autorun.js';
|
|
7
8
|
|
|
@@ -39,14 +40,15 @@ class WrappedStyleElement {
|
|
|
39
40
|
let shadowRootContainer;
|
|
40
41
|
function setContainerElement(container) {
|
|
41
42
|
const root = container.getRootNode();
|
|
42
|
-
if (root
|
|
43
|
+
if (isShadowRoot(root)) {
|
|
43
44
|
shadowRootContainer = root;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
function createStyleSheet(container = mainWindow.document.head, beforeAppend, disposableStore) {
|
|
47
|
-
const style =
|
|
48
|
+
const style = createElement('style');
|
|
48
49
|
style.type = 'text/css';
|
|
49
50
|
style.media = 'screen';
|
|
51
|
+
style.setAttribute('data-vscode', 'true');
|
|
50
52
|
beforeAppend?.(style);
|
|
51
53
|
container.appendChild(style);
|
|
52
54
|
if (disposableStore) {
|
|
@@ -84,7 +86,13 @@ function cloneGlobalStyleSheet(globalStylesheet, globalStylesheetClones, windowE
|
|
|
84
86
|
for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {
|
|
85
87
|
clone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);
|
|
86
88
|
}
|
|
87
|
-
|
|
89
|
+
let observeInit = {
|
|
90
|
+
childList: true
|
|
91
|
+
};
|
|
92
|
+
if (isFirefox) {
|
|
93
|
+
observeInit = { ...observeInit, attributes: true, attributeFilter: ['data-version'] };
|
|
94
|
+
}
|
|
95
|
+
disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, observeInit)(() => {
|
|
88
96
|
clone.textContent = globalStylesheet.textContent;
|
|
89
97
|
}));
|
|
90
98
|
globalStylesheetClones.add(clone);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { addStandardDisposableListener } from './dom.js';
|
|
2
|
+
import { createElement as createElement$1, addStandardDisposableListener } from './dom.js';
|
|
3
3
|
|
|
4
4
|
function renderText(text, options = {}) {
|
|
5
5
|
const element = createElement(options);
|
|
@@ -13,7 +13,7 @@ function renderFormattedText(formattedText, options = {}) {
|
|
|
13
13
|
}
|
|
14
14
|
function createElement(options) {
|
|
15
15
|
const tagName = options.inline ? 'span' : 'div';
|
|
16
|
-
const element =
|
|
16
|
+
const element = createElement$1(tagName);
|
|
17
17
|
if (options.className) {
|
|
18
18
|
element.className = options.className;
|
|
19
19
|
}
|
|
@@ -57,23 +57,23 @@ function _renderFormattedText(element, treeNode, actionHandler, renderCodeSegmen
|
|
|
57
57
|
child = document.createTextNode(treeNode.content || '');
|
|
58
58
|
}
|
|
59
59
|
else if (treeNode.type === FormatType.Bold) {
|
|
60
|
-
child =
|
|
60
|
+
child = createElement$1('b');
|
|
61
61
|
}
|
|
62
62
|
else if (treeNode.type === FormatType.Italics) {
|
|
63
|
-
child =
|
|
63
|
+
child = createElement$1('i');
|
|
64
64
|
}
|
|
65
65
|
else if (treeNode.type === FormatType.Code && renderCodeSegments) {
|
|
66
|
-
child =
|
|
66
|
+
child = createElement$1('code');
|
|
67
67
|
}
|
|
68
68
|
else if (treeNode.type === FormatType.Action && actionHandler) {
|
|
69
|
-
const a =
|
|
69
|
+
const a = createElement$1('a');
|
|
70
70
|
actionHandler.disposables.add(addStandardDisposableListener(a, 'click', (event) => {
|
|
71
71
|
actionHandler.callback(String(treeNode.index), event);
|
|
72
72
|
}));
|
|
73
73
|
child = a;
|
|
74
74
|
}
|
|
75
75
|
else if (treeNode.type === FormatType.NewLine) {
|
|
76
|
-
child =
|
|
76
|
+
child = createElement$1('br');
|
|
77
77
|
}
|
|
78
78
|
else if (treeNode.type === FormatType.Root) {
|
|
79
79
|
child = element;
|
|
@@ -3,6 +3,7 @@ import { isFirefox, isWebKit } from './browser.js';
|
|
|
3
3
|
import { KeyCodeUtils, KeyCode, EVENT_KEY_CODE_MAP, KeyMod as KeyMod$1 } from '../common/keyCodes.js';
|
|
4
4
|
import { KeyCodeChord } from '../common/keybindings.js';
|
|
5
5
|
import { isMacintosh, isLinux } from '../common/platform.js';
|
|
6
|
+
import { isHTMLIframeElement } from './dom.js';
|
|
6
7
|
|
|
7
8
|
function extractKeyCode(e) {
|
|
8
9
|
if (e.charCode) {
|
|
@@ -78,12 +79,18 @@ function printStandardKeyboardEvent(e) {
|
|
|
78
79
|
}
|
|
79
80
|
return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${( KeyCodeUtils.toString(e.keyCode))}')`;
|
|
80
81
|
}
|
|
82
|
+
function getTarget(source) {
|
|
83
|
+
if (isHTMLIframeElement(source.target)) {
|
|
84
|
+
return source.target;
|
|
85
|
+
}
|
|
86
|
+
return source.composedPath()[0] ?? source.target;
|
|
87
|
+
}
|
|
81
88
|
class StandardKeyboardEvent {
|
|
82
89
|
constructor(source) {
|
|
83
90
|
this._standardKeyboardEventBrand = true;
|
|
84
91
|
const e = source;
|
|
85
92
|
this.browserEvent = e;
|
|
86
|
-
this.target = e
|
|
93
|
+
this.target = getTarget(e);
|
|
87
94
|
this.ctrlKey = e.ctrlKey;
|
|
88
95
|
this.shiftKey = e.shiftKey;
|
|
89
96
|
this.altKey = e.altKey;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { getWindowId, onDidUnregisterWindow } from './dom.js';
|
|
2
|
+
import { createElement, getWindowId, onDidUnregisterWindow } from './dom.js';
|
|
3
3
|
import { Emitter, Event } from '../common/event.js';
|
|
4
4
|
import { Disposable, markAsSingleton } from '../common/lifecycle.js';
|
|
5
5
|
|
|
@@ -37,7 +37,7 @@ class PixelRatioMonitorImpl extends Disposable {
|
|
|
37
37
|
}));
|
|
38
38
|
}
|
|
39
39
|
_getPixelRatio(targetWindow) {
|
|
40
|
-
const ctx =
|
|
40
|
+
const ctx = createElement('canvas').getContext('2d');
|
|
41
41
|
const dpr = targetWindow.devicePixelRatio || 1;
|
|
42
42
|
const bsr = ctx.webkitBackingStorePixelRatio ||
|
|
43
43
|
ctx.mozBackingStorePixelRatio ||
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
3
|
import { isFirefox } from '../../browser.js';
|
|
4
4
|
import { DataTransfers } from '../../dnd.js';
|
|
5
|
-
import { addDisposableListener, EventType, EventHelper } from '../../dom.js';
|
|
5
|
+
import { addDisposableListener, EventType, EventHelper, createElement } from '../../dom.js';
|
|
6
6
|
import { Gesture, EventType as EventType$1 } from '../../touch.js';
|
|
7
7
|
import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
|
|
8
8
|
import { SelectBox } from '../selectBox/selectBox.js';
|
|
@@ -197,13 +197,13 @@ class ActionViewItem extends BaseActionViewItem {
|
|
|
197
197
|
render(container) {
|
|
198
198
|
super.render(container);
|
|
199
199
|
assertType(this.element);
|
|
200
|
-
const label =
|
|
200
|
+
const label = createElement('a');
|
|
201
201
|
label.classList.add('action-label');
|
|
202
202
|
label.setAttribute('role', this.getDefaultAriaRole());
|
|
203
203
|
this.label = label;
|
|
204
204
|
this.element.appendChild(label);
|
|
205
205
|
if (this.options.label && this.options.keybinding && !this.options.keybindingNotRenderedWithLabel) {
|
|
206
|
-
const kbLabel =
|
|
206
|
+
const kbLabel = createElement('span');
|
|
207
207
|
kbLabel.classList.add('keybinding');
|
|
208
208
|
kbLabel.textContent = this.options.keybinding;
|
|
209
209
|
this.element.appendChild(kbLabel);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
-
import { addDisposableListener, EventType, trackFocus, getActiveElement, isAncestor, isHTMLElement, EventHelper, clearNode } from '../../dom.js';
|
|
3
|
+
import { createElement, addDisposableListener, EventType, trackFocus, getActiveElement, isAncestor, isHTMLElement, EventHelper, clearNode } from '../../dom.js';
|
|
4
4
|
import { StandardKeyboardEvent } from '../../keyboardEvent.js';
|
|
5
5
|
import { BaseActionViewItem, ActionViewItem } from './actionViewItems.js';
|
|
6
6
|
import { createInstantHoverDelegate } from '../hover/hoverDelegateFactory.js';
|
|
@@ -52,7 +52,7 @@ class ActionBar extends Disposable {
|
|
|
52
52
|
this._actionRunnerDisposables.add(this._actionRunner.onWillRun(e => this._onWillRun.fire(e)));
|
|
53
53
|
this.viewItems = [];
|
|
54
54
|
this.focusedItem = undefined;
|
|
55
|
-
this.domNode =
|
|
55
|
+
this.domNode = createElement('div');
|
|
56
56
|
this.domNode.className = 'monaco-action-bar';
|
|
57
57
|
let previousKeys;
|
|
58
58
|
let nextKeys;
|
|
@@ -129,7 +129,7 @@ class ActionBar extends Disposable {
|
|
|
129
129
|
}
|
|
130
130
|
}));
|
|
131
131
|
this._register(this.focusTracker.onDidFocus(() => this.updateFocusedItem()));
|
|
132
|
-
this.actionsList =
|
|
132
|
+
this.actionsList = createElement('ul');
|
|
133
133
|
this.actionsList.className = 'actions-container';
|
|
134
134
|
if (this.options.highlightToggledItems) {
|
|
135
135
|
this.actionsList.classList.add('highlight-toggled');
|
|
@@ -236,7 +236,7 @@ class ActionBar extends Disposable {
|
|
|
236
236
|
const actions = Array.isArray(arg) ? arg : [arg];
|
|
237
237
|
let index = isNumber(options.index) ? options.index : null;
|
|
238
238
|
actions.forEach((action) => {
|
|
239
|
-
const actionViewItemElement =
|
|
239
|
+
const actionViewItemElement = createElement('li');
|
|
240
240
|
actionViewItemElement.className = 'action-item';
|
|
241
241
|
actionViewItemElement.setAttribute('role', 'presentation');
|
|
242
242
|
let item;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
-
import { clearNode } from '../../dom.js';
|
|
3
|
+
import { createElement, clearNode } from '../../dom.js';
|
|
4
4
|
import * as aria from './aria.css';
|
|
5
5
|
|
|
6
6
|
registerCss(aria);
|
|
@@ -11,10 +11,10 @@ let alertContainer2;
|
|
|
11
11
|
let statusContainer;
|
|
12
12
|
let statusContainer2;
|
|
13
13
|
function setARIAContainer(parent) {
|
|
14
|
-
ariaContainer =
|
|
14
|
+
ariaContainer = createElement('div');
|
|
15
15
|
ariaContainer.className = 'monaco-aria-container';
|
|
16
16
|
const createAlertContainer = () => {
|
|
17
|
-
const element =
|
|
17
|
+
const element = createElement('div');
|
|
18
18
|
element.className = 'monaco-alert';
|
|
19
19
|
element.setAttribute('role', 'alert');
|
|
20
20
|
element.setAttribute('aria-atomic', 'true');
|
|
@@ -24,7 +24,7 @@ function setARIAContainer(parent) {
|
|
|
24
24
|
alertContainer = createAlertContainer();
|
|
25
25
|
alertContainer2 = createAlertContainer();
|
|
26
26
|
const createStatusContainer = () => {
|
|
27
|
-
const element =
|
|
27
|
+
const element = createElement('div');
|
|
28
28
|
element.className = 'monaco-status';
|
|
29
29
|
element.setAttribute('aria-live', 'polite');
|
|
30
30
|
element.setAttribute('aria-atomic', 'true');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
-
import { EventType, addDisposableListener, EventHelper, trackFocus, reset, isActiveElement, $ } from '../../dom.js';
|
|
3
|
+
import { createElement, EventType, addDisposableListener, EventHelper, trackFocus, reset, isActiveElement, $ } from '../../dom.js';
|
|
4
4
|
import dompurify from 'dompurify';
|
|
5
5
|
import { StandardKeyboardEvent } from '../../keyboardEvent.js';
|
|
6
6
|
import { renderMarkdown, renderStringAsPlaintext } from '../../markdownRenderer.js';
|
|
@@ -39,7 +39,7 @@ class Button extends Disposable {
|
|
|
39
39
|
this._onDidClick = this._register(( new Emitter()));
|
|
40
40
|
this._onDidEscape = this._register(( new Emitter()));
|
|
41
41
|
this.options = options;
|
|
42
|
-
this._element =
|
|
42
|
+
this._element = createElement('a');
|
|
43
43
|
this._element.classList.add('monaco-button');
|
|
44
44
|
this._element.tabIndex = 0;
|
|
45
45
|
this._element.setAttribute('role', 'button');
|
|
@@ -49,10 +49,10 @@ class Button extends Disposable {
|
|
|
49
49
|
this._element.style.color = foreground || '';
|
|
50
50
|
this._element.style.backgroundColor = background || '';
|
|
51
51
|
if (options.supportShortLabel) {
|
|
52
|
-
this._labelShortElement =
|
|
52
|
+
this._labelShortElement = createElement('div');
|
|
53
53
|
this._labelShortElement.classList.add('monaco-button-label-short');
|
|
54
54
|
this._element.appendChild(this._labelShortElement);
|
|
55
|
-
this._labelElement =
|
|
55
|
+
this._labelElement = createElement('div');
|
|
56
56
|
this._labelElement.classList.add('monaco-button-label');
|
|
57
57
|
this._element.appendChild(this._labelElement);
|
|
58
58
|
this._element.classList.add('monaco-text-button-with-short-label');
|
|
@@ -119,7 +119,7 @@ class Button extends Disposable {
|
|
|
119
119
|
if (segment === '') {
|
|
120
120
|
continue;
|
|
121
121
|
}
|
|
122
|
-
const node =
|
|
122
|
+
const node = createElement('span');
|
|
123
123
|
node.textContent = segment;
|
|
124
124
|
elements.push(node);
|
|
125
125
|
}
|
|
@@ -262,7 +262,7 @@ class ButtonWithDropdown extends Disposable {
|
|
|
262
262
|
super();
|
|
263
263
|
this._onDidClick = this._register(( new Emitter()));
|
|
264
264
|
this.onDidClick = this._onDidClick.event;
|
|
265
|
-
this.element =
|
|
265
|
+
this.element = createElement('div');
|
|
266
266
|
this.element.classList.add('monaco-button-dropdown');
|
|
267
267
|
container.appendChild(this.element);
|
|
268
268
|
if (!options.hoverDelegate) {
|
|
@@ -277,9 +277,9 @@ class ButtonWithDropdown extends Disposable {
|
|
|
277
277
|
true,
|
|
278
278
|
async () => this._onDidClick.fire(undefined)
|
|
279
279
|
)));
|
|
280
|
-
this.separatorContainer =
|
|
280
|
+
this.separatorContainer = createElement('div');
|
|
281
281
|
this.separatorContainer.classList.add('monaco-button-dropdown-separator');
|
|
282
|
-
this.separator =
|
|
282
|
+
this.separator = createElement('div');
|
|
283
283
|
this.separatorContainer.appendChild(this.separator);
|
|
284
284
|
this.element.appendChild(this.separatorContainer);
|
|
285
285
|
const border = options.buttonBorder;
|
|
@@ -342,10 +342,10 @@ class ButtonWithDropdown extends Disposable {
|
|
|
342
342
|
class ButtonWithDescription {
|
|
343
343
|
constructor(container, options) {
|
|
344
344
|
this.options = options;
|
|
345
|
-
this._element =
|
|
345
|
+
this._element = createElement('div');
|
|
346
346
|
this._element.classList.add('monaco-description-button');
|
|
347
347
|
this._button = ( new Button(this._element, options));
|
|
348
|
-
this._descriptionElement =
|
|
348
|
+
this._descriptionElement = createElement('div');
|
|
349
349
|
this._descriptionElement.classList.add('monaco-button-description');
|
|
350
350
|
this._element.appendChild(this._descriptionElement);
|
|
351
351
|
container.appendChild(this._element);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
3
|
import { BrowserFeatures } from '../../canIUse.js';
|
|
4
|
-
import { $, hide, addStandardDisposableListener, clearNode, show, isHTMLElement, getDomNodePagePosition, getDomNodeZoomLevel, getTotalWidth, getTotalHeight, getActiveWindow, getWindow, isAncestor } from '../../dom.js';
|
|
4
|
+
import { $, hide, createElement, addStandardDisposableListener, clearNode, show, isHTMLElement, getDomNodePagePosition, getDomNodeZoomLevel, getTotalWidth, getTotalHeight, getActiveWindow, getWindow, isAncestor } from '../../dom.js';
|
|
5
5
|
import { Disposable, toDisposable, DisposableStore } from '../../../common/lifecycle.js';
|
|
6
6
|
import { isIOS } from '../../../common/platform.js';
|
|
7
7
|
import { Range } from '../../../common/range.js';
|
|
@@ -106,7 +106,7 @@ class ContextView extends Disposable {
|
|
|
106
106
|
this.shadowRootHostElement = $('.shadow-root-host');
|
|
107
107
|
this.container.appendChild(this.shadowRootHostElement);
|
|
108
108
|
this.shadowRoot = this.shadowRootHostElement.attachShadow({ mode: 'open' });
|
|
109
|
-
const style =
|
|
109
|
+
const style = createElement('style');
|
|
110
110
|
style.textContent = SHADOW_ROOT_CSS;
|
|
111
111
|
this.shadowRoot.appendChild(style);
|
|
112
112
|
this.shadowRoot.appendChild(this.view);
|