mirror of https://github.com/microsoft/vscode.git
Split stylesheet specific functions out of dom (#233873)
The dom file is getting pretty big. This splits out the parts that are specific to stylesheets as these are intendant of the other parts
This commit is contained in:
parent
b5f27d84a3
commit
c7baced0af
|
@ -922,105 +922,6 @@ export function getActiveWindow(): CodeWindow {
|
|||
return (document.defaultView?.window ?? mainWindow) as CodeWindow;
|
||||
}
|
||||
|
||||
const globalStylesheets = new Map<HTMLStyleElement /* main stylesheet */, Set<HTMLStyleElement /* aux window clones that track the main stylesheet */>>();
|
||||
|
||||
export function isGlobalStylesheet(node: Node): boolean {
|
||||
return globalStylesheets.has(node as HTMLStyleElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of createStyleSheet which has a unified API to initialize/set the style content.
|
||||
*/
|
||||
export function createStyleSheet2(): WrappedStyleElement {
|
||||
return new WrappedStyleElement();
|
||||
}
|
||||
|
||||
class WrappedStyleElement {
|
||||
private _currentCssStyle = '';
|
||||
private _styleSheet: HTMLStyleElement | undefined = undefined;
|
||||
|
||||
public setStyle(cssStyle: string): void {
|
||||
if (cssStyle === this._currentCssStyle) {
|
||||
return;
|
||||
}
|
||||
this._currentCssStyle = cssStyle;
|
||||
|
||||
if (!this._styleSheet) {
|
||||
this._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);
|
||||
} else {
|
||||
this._styleSheet.innerText = cssStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
if (this._styleSheet) {
|
||||
this._styleSheet.remove();
|
||||
this._styleSheet = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createStyleSheet(container: HTMLElement = mainWindow.document.head, beforeAppend?: (style: HTMLStyleElement) => void, disposableStore?: DisposableStore): HTMLStyleElement {
|
||||
const style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
style.media = 'screen';
|
||||
beforeAppend?.(style);
|
||||
container.appendChild(style);
|
||||
|
||||
if (disposableStore) {
|
||||
disposableStore.add(toDisposable(() => style.remove()));
|
||||
}
|
||||
|
||||
// With <head> as container, the stylesheet becomes global and is tracked
|
||||
// to support auxiliary windows to clone the stylesheet.
|
||||
if (container === mainWindow.document.head) {
|
||||
const globalStylesheetClones = new Set<HTMLStyleElement>();
|
||||
globalStylesheets.set(style, globalStylesheetClones);
|
||||
|
||||
for (const { window: targetWindow, disposables } of getWindows()) {
|
||||
if (targetWindow === mainWindow) {
|
||||
continue; // main window is already tracked
|
||||
}
|
||||
|
||||
const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));
|
||||
disposableStore?.add(cloneDisposable);
|
||||
}
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
export function cloneGlobalStylesheets(targetWindow: Window): IDisposable {
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
for (const [globalStylesheet, clonedGlobalStylesheets] of globalStylesheets) {
|
||||
disposables.add(cloneGlobalStyleSheet(globalStylesheet, clonedGlobalStylesheets, targetWindow));
|
||||
}
|
||||
|
||||
return disposables;
|
||||
}
|
||||
|
||||
function cloneGlobalStyleSheet(globalStylesheet: HTMLStyleElement, globalStylesheetClones: Set<HTMLStyleElement>, targetWindow: Window): IDisposable {
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
const clone = globalStylesheet.cloneNode(true) as HTMLStyleElement;
|
||||
targetWindow.document.head.appendChild(clone);
|
||||
disposables.add(toDisposable(() => clone.remove()));
|
||||
|
||||
for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {
|
||||
clone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);
|
||||
}
|
||||
|
||||
disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {
|
||||
clone.textContent = globalStylesheet.textContent;
|
||||
}));
|
||||
|
||||
globalStylesheetClones.add(clone);
|
||||
disposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));
|
||||
|
||||
return disposables;
|
||||
}
|
||||
|
||||
interface IMutationObserver {
|
||||
users: number;
|
||||
readonly observer: MutationObserver;
|
||||
|
@ -1088,67 +989,6 @@ function createHeadElement(tagName: string, container: HTMLElement = mainWindow.
|
|||
return element;
|
||||
}
|
||||
|
||||
let _sharedStyleSheet: HTMLStyleElement | null = null;
|
||||
function getSharedStyleSheet(): HTMLStyleElement {
|
||||
if (!_sharedStyleSheet) {
|
||||
_sharedStyleSheet = createStyleSheet();
|
||||
}
|
||||
return _sharedStyleSheet;
|
||||
}
|
||||
|
||||
function getDynamicStyleSheetRules(style: HTMLStyleElement) {
|
||||
if (style?.sheet?.rules) {
|
||||
// Chrome, IE
|
||||
return style.sheet.rules;
|
||||
}
|
||||
if (style?.sheet?.cssRules) {
|
||||
// FF
|
||||
return style.sheet.cssRules;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function createCSSRule(selector: string, cssText: string, style = getSharedStyleSheet()): void {
|
||||
if (!style || !cssText) {
|
||||
return;
|
||||
}
|
||||
|
||||
style.sheet?.insertRule(`${selector} {${cssText}}`, 0);
|
||||
|
||||
// Apply rule also to all cloned global stylesheets
|
||||
for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {
|
||||
createCSSRule(selector, cssText, clonedGlobalStylesheet);
|
||||
}
|
||||
}
|
||||
|
||||
export function removeCSSRulesContainingSelector(ruleName: string, style = getSharedStyleSheet()): void {
|
||||
if (!style) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rules = getDynamicStyleSheetRules(style);
|
||||
const toDelete: number[] = [];
|
||||
for (let i = 0; i < rules.length; i++) {
|
||||
const rule = rules[i];
|
||||
if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {
|
||||
toDelete.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = toDelete.length - 1; i >= 0; i--) {
|
||||
style.sheet?.deleteRule(toDelete[i]);
|
||||
}
|
||||
|
||||
// Remove rules also from all cloned global stylesheets
|
||||
for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {
|
||||
removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);
|
||||
}
|
||||
}
|
||||
|
||||
function isCSSStyleRule(rule: CSSRule): rule is CSSStyleRule {
|
||||
return typeof (rule as CSSStyleRule).selectorText === 'string';
|
||||
}
|
||||
|
||||
export function isHTMLElement(e: unknown): e is HTMLElement {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
return e instanceof HTMLElement || e instanceof getWindow(e as Node).HTMLElement;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createStyleSheet2 } from './dom.js';
|
||||
import { createStyleSheet2 } from './domStylesheets.js';
|
||||
import { DisposableStore, IDisposable } from '../common/lifecycle.js';
|
||||
import { autorun, IObservable } from '../common/observable.js';
|
||||
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { DisposableStore, toDisposable, IDisposable } from '../common/lifecycle.js';
|
||||
import { getWindows, sharedMutationObserver } from './dom.js';
|
||||
import { mainWindow } from './window.js';
|
||||
|
||||
const globalStylesheets = new Map<HTMLStyleElement /* main stylesheet */, Set<HTMLStyleElement /* aux window clones that track the main stylesheet */>>();
|
||||
|
||||
export function isGlobalStylesheet(node: Node): boolean {
|
||||
return globalStylesheets.has(node as HTMLStyleElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of createStyleSheet which has a unified API to initialize/set the style content.
|
||||
*/
|
||||
export function createStyleSheet2(): WrappedStyleElement {
|
||||
return new WrappedStyleElement();
|
||||
}
|
||||
|
||||
class WrappedStyleElement {
|
||||
private _currentCssStyle = '';
|
||||
private _styleSheet: HTMLStyleElement | undefined = undefined;
|
||||
|
||||
public setStyle(cssStyle: string): void {
|
||||
if (cssStyle === this._currentCssStyle) {
|
||||
return;
|
||||
}
|
||||
this._currentCssStyle = cssStyle;
|
||||
|
||||
if (!this._styleSheet) {
|
||||
this._styleSheet = createStyleSheet(mainWindow.document.head, (s) => s.innerText = cssStyle);
|
||||
} else {
|
||||
this._styleSheet.innerText = cssStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
if (this._styleSheet) {
|
||||
this._styleSheet.remove();
|
||||
this._styleSheet = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createStyleSheet(container: HTMLElement = mainWindow.document.head, beforeAppend?: (style: HTMLStyleElement) => void, disposableStore?: DisposableStore): HTMLStyleElement {
|
||||
const style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
style.media = 'screen';
|
||||
beforeAppend?.(style);
|
||||
container.appendChild(style);
|
||||
|
||||
if (disposableStore) {
|
||||
disposableStore.add(toDisposable(() => style.remove()));
|
||||
}
|
||||
|
||||
// With <head> as container, the stylesheet becomes global and is tracked
|
||||
// to support auxiliary windows to clone the stylesheet.
|
||||
if (container === mainWindow.document.head) {
|
||||
const globalStylesheetClones = new Set<HTMLStyleElement>();
|
||||
globalStylesheets.set(style, globalStylesheetClones);
|
||||
|
||||
for (const { window: targetWindow, disposables } of getWindows()) {
|
||||
if (targetWindow === mainWindow) {
|
||||
continue; // main window is already tracked
|
||||
}
|
||||
|
||||
const cloneDisposable = disposables.add(cloneGlobalStyleSheet(style, globalStylesheetClones, targetWindow));
|
||||
disposableStore?.add(cloneDisposable);
|
||||
}
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
export function cloneGlobalStylesheets(targetWindow: Window): IDisposable {
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
for (const [globalStylesheet, clonedGlobalStylesheets] of globalStylesheets) {
|
||||
disposables.add(cloneGlobalStyleSheet(globalStylesheet, clonedGlobalStylesheets, targetWindow));
|
||||
}
|
||||
|
||||
return disposables;
|
||||
}
|
||||
|
||||
function cloneGlobalStyleSheet(globalStylesheet: HTMLStyleElement, globalStylesheetClones: Set<HTMLStyleElement>, targetWindow: Window): IDisposable {
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
const clone = globalStylesheet.cloneNode(true) as HTMLStyleElement;
|
||||
targetWindow.document.head.appendChild(clone);
|
||||
disposables.add(toDisposable(() => clone.remove()));
|
||||
|
||||
for (const rule of getDynamicStyleSheetRules(globalStylesheet)) {
|
||||
clone.sheet?.insertRule(rule.cssText, clone.sheet?.cssRules.length);
|
||||
}
|
||||
|
||||
disposables.add(sharedMutationObserver.observe(globalStylesheet, disposables, { childList: true })(() => {
|
||||
clone.textContent = globalStylesheet.textContent;
|
||||
}));
|
||||
|
||||
globalStylesheetClones.add(clone);
|
||||
disposables.add(toDisposable(() => globalStylesheetClones.delete(clone)));
|
||||
|
||||
return disposables;
|
||||
}
|
||||
|
||||
let _sharedStyleSheet: HTMLStyleElement | null = null;
|
||||
function getSharedStyleSheet(): HTMLStyleElement {
|
||||
if (!_sharedStyleSheet) {
|
||||
_sharedStyleSheet = createStyleSheet();
|
||||
}
|
||||
return _sharedStyleSheet;
|
||||
}
|
||||
|
||||
function getDynamicStyleSheetRules(style: HTMLStyleElement) {
|
||||
if (style?.sheet?.rules) {
|
||||
// Chrome, IE
|
||||
return style.sheet.rules;
|
||||
}
|
||||
if (style?.sheet?.cssRules) {
|
||||
// FF
|
||||
return style.sheet.cssRules;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function createCSSRule(selector: string, cssText: string, style = getSharedStyleSheet()): void {
|
||||
if (!style || !cssText) {
|
||||
return;
|
||||
}
|
||||
|
||||
style.sheet?.insertRule(`${selector} {${cssText}}`, 0);
|
||||
|
||||
// Apply rule also to all cloned global stylesheets
|
||||
for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {
|
||||
createCSSRule(selector, cssText, clonedGlobalStylesheet);
|
||||
}
|
||||
}
|
||||
|
||||
export function removeCSSRulesContainingSelector(ruleName: string, style = getSharedStyleSheet()): void {
|
||||
if (!style) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rules = getDynamicStyleSheetRules(style);
|
||||
const toDelete: number[] = [];
|
||||
for (let i = 0; i < rules.length; i++) {
|
||||
const rule = rules[i];
|
||||
if (isCSSStyleRule(rule) && rule.selectorText.indexOf(ruleName) !== -1) {
|
||||
toDelete.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = toDelete.length - 1; i >= 0; i--) {
|
||||
style.sheet?.deleteRule(toDelete[i]);
|
||||
}
|
||||
|
||||
// Remove rules also from all cloned global stylesheets
|
||||
for (const clonedGlobalStylesheet of globalStylesheets.get(style) ?? []) {
|
||||
removeCSSRulesContainingSelector(ruleName, clonedGlobalStylesheet);
|
||||
}
|
||||
}
|
||||
|
||||
function isCSSStyleRule(rule: CSSRule): rule is CSSStyleRule {
|
||||
return typeof (rule as CSSStyleRule).selectorText === 'string';
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../dom.js';
|
||||
import * as domStylesheetsJs from '../../domStylesheets.js';
|
||||
import { IMouseEvent } from '../../mouseEvent.js';
|
||||
import { DomScrollableElement } from '../scrollbar/scrollableElement.js';
|
||||
import { commonPrefixLength } from '../../../common/arrays.js';
|
||||
|
@ -83,7 +84,7 @@ export class BreadcrumbsWidget {
|
|||
this._disposables.add(dom.addStandardDisposableListener(this._domNode, 'click', e => this._onClick(e)));
|
||||
container.appendChild(this._scrollable.getDomNode());
|
||||
|
||||
const styleElement = dom.createStyleSheet(this._domNode);
|
||||
const styleElement = domStylesheetsJs.createStyleSheet(this._domNode);
|
||||
this._style(styleElement, styles);
|
||||
|
||||
const focusTracker = dom.trackFocus(this._domNode);
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IDragAndDropData } from '../../dnd.js';
|
||||
import { createStyleSheet, Dimension, EventHelper, getActiveElement, getWindow, isActiveElement, isEditableElement, isHTMLElement, isMouseEvent } from '../../dom.js';
|
||||
import { Dimension, EventHelper, getActiveElement, getWindow, isActiveElement, isEditableElement, isHTMLElement, isMouseEvent } from '../../dom.js';
|
||||
import { createStyleSheet } from '../../domStylesheets.js';
|
||||
import { asCssValueWithDefault } from '../../cssValue.js';
|
||||
import { DomEmitter } from '../../event.js';
|
||||
import { IKeyboardEvent, StandardKeyboardEvent } from '../../keyboardEvent.js';
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
import { isFirefox } from '../../browser.js';
|
||||
import { EventType as TouchEventType, Gesture } from '../../touch.js';
|
||||
import { $, addDisposableListener, append, clearNode, createStyleSheet, Dimension, EventHelper, EventLike, EventType, getActiveElement, getWindow, IDomNodePagePosition, isAncestor, isInShadowDOM } from '../../dom.js';
|
||||
import { $, addDisposableListener, append, clearNode, Dimension, EventHelper, EventLike, EventType, getActiveElement, getWindow, IDomNodePagePosition, isAncestor, isInShadowDOM } from '../../dom.js';
|
||||
import { createStyleSheet } from '../../domStylesheets.js';
|
||||
import { StandardKeyboardEvent } from '../../keyboardEvent.js';
|
||||
import { StandardMouseEvent } from '../../mouseEvent.js';
|
||||
import { ActionBar, ActionsOrientation, IActionViewItemProvider } from '../actionbar/actionbar.js';
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { $, append, createStyleSheet, EventHelper, EventLike, getWindow, isHTMLElement } from '../../dom.js';
|
||||
import { $, append, EventHelper, EventLike, getWindow, isHTMLElement } from '../../dom.js';
|
||||
import { createStyleSheet } from '../../domStylesheets.js';
|
||||
import { DomEmitter } from '../../event.js';
|
||||
import { EventType, Gesture } from '../../touch.js';
|
||||
import { Delayer } from '../../../common/async.js';
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../dom.js';
|
||||
import * as domStylesheetsJs from '../../domStylesheets.js';
|
||||
import * as cssJs from '../../cssValue.js';
|
||||
import { DomEmitter } from '../../event.js';
|
||||
import { IContentActionHandler } from '../../formattedTextRenderer.js';
|
||||
|
@ -192,7 +193,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
|
|||
this._dropDownPosition = AnchorPosition.BELOW;
|
||||
|
||||
// Inline stylesheet for themes
|
||||
this.styleElement = dom.createStyleSheet(this.selectDropDownContainer);
|
||||
this.styleElement = domStylesheetsJs.createStyleSheet(this.selectDropDownContainer);
|
||||
|
||||
// Prevent dragging of dropdown #114329
|
||||
this.selectDropDownContainer.setAttribute('draggable', 'true');
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { $, append, clearNode, createStyleSheet, getContentHeight, getContentWidth } from '../../dom.js';
|
||||
import { $, append, clearNode, getContentHeight, getContentWidth } from '../../dom.js';
|
||||
import { createStyleSheet } from '../../domStylesheets.js';
|
||||
import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';
|
||||
import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';
|
||||
import { IListRenderer, IListVirtualDelegate } from '../list/list.js';
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IDragAndDropData } from '../../dnd.js';
|
||||
import { $, append, clearNode, createStyleSheet, h, hasParentWithClass, isActiveElement, isKeyboardEvent, addDisposableListener, isEditableElement } from '../../dom.js';
|
||||
import { $, append, clearNode, h, hasParentWithClass, isActiveElement, isKeyboardEvent, addDisposableListener, isEditableElement } from '../../dom.js';
|
||||
import { createStyleSheet } from '../../domStylesheets.js';
|
||||
import { asCssValueWithDefault } from '../../cssValue.js';
|
||||
import { DomEmitter } from '../../event.js';
|
||||
import { StandardKeyboardEvent } from '../../keyboardEvent.js';
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
import './media/processExplorer.css';
|
||||
import '../../../base/browser/ui/codicons/codiconStyles.js'; // make sure codicon css is loaded
|
||||
import { localize } from '../../../nls.js';
|
||||
import { $, append, createStyleSheet } from '../../../base/browser/dom.js';
|
||||
import { $, append } from '../../../base/browser/dom.js';
|
||||
import { createStyleSheet } from '../../../base/browser/domStylesheets.js';
|
||||
import { IListVirtualDelegate } from '../../../base/browser/ui/list/list.js';
|
||||
import { DataTree } from '../../../base/browser/ui/tree/dataTree.js';
|
||||
import { IDataSource, ITreeNode, ITreeRenderer } from '../../../base/browser/ui/tree/tree.js';
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../base/browser/domStylesheets.js';
|
||||
import { GlobalPointerMoveMonitor } from '../../base/browser/globalPointerMoveMonitor.js';
|
||||
import { StandardMouseEvent } from '../../base/browser/mouseEvent.js';
|
||||
import { RunOnceScheduler } from '../../base/common/async.js';
|
||||
|
@ -368,7 +369,7 @@ class RefCountedCssRule {
|
|||
public readonly properties: CssProperties,
|
||||
) {
|
||||
this._styleElementDisposables = new DisposableStore();
|
||||
this._styleElement = dom.createStyleSheet(_containerElement, undefined, this._styleElementDisposables);
|
||||
this._styleElement = domStylesheetsJs.createStyleSheet(_containerElement, undefined, this._styleElementDisposables);
|
||||
this._styleElement.textContent = this.getCssText(this.className, this.properties);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../base/browser/domStylesheets.js';
|
||||
import * as cssJs from '../../../base/browser/cssValue.js';
|
||||
import { Emitter, Event } from '../../../base/common/event.js';
|
||||
import { IDisposable, DisposableStore, Disposable, toDisposable } from '../../../base/common/lifecycle.js';
|
||||
|
@ -128,7 +129,7 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC
|
|||
}
|
||||
|
||||
protected _createGlobalStyleSheet(): GlobalStyleSheet {
|
||||
return new GlobalStyleSheet(dom.createStyleSheet());
|
||||
return new GlobalStyleSheet(domStylesheets.createStyleSheet());
|
||||
}
|
||||
|
||||
private _getOrCreateStyleSheet(editor: ICodeEditor | undefined): GlobalStyleSheet | RefCountedStyleSheet {
|
||||
|
@ -141,7 +142,7 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC
|
|||
}
|
||||
const editorId = editor.getId();
|
||||
if (!this._editorStyleSheets.has(editorId)) {
|
||||
const refCountedStyleSheet = new RefCountedStyleSheet(this, editorId, dom.createStyleSheet(domNode));
|
||||
const refCountedStyleSheet = new RefCountedStyleSheet(this, editorId, domStylesheets.createStyleSheet(domNode));
|
||||
this._editorStyleSheets.set(editorId, refCountedStyleSheet);
|
||||
}
|
||||
return this._editorStyleSheets.get(editorId)!;
|
||||
|
@ -348,11 +349,11 @@ class RefCountedStyleSheet {
|
|||
}
|
||||
|
||||
public insertRule(selector: string, rule: string): void {
|
||||
dom.createCSSRule(selector, rule, this._styleSheet);
|
||||
domStylesheets.createCSSRule(selector, rule, this._styleSheet);
|
||||
}
|
||||
|
||||
public removeRulesContainingSelector(ruleName: string): void {
|
||||
dom.removeCSSRulesContainingSelector(ruleName, this._styleSheet);
|
||||
domStylesheets.removeCSSRulesContainingSelector(ruleName, this._styleSheet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,11 +375,11 @@ export class GlobalStyleSheet {
|
|||
}
|
||||
|
||||
public insertRule(selector: string, rule: string): void {
|
||||
dom.createCSSRule(selector, rule, this._styleSheet);
|
||||
domStylesheets.createCSSRule(selector, rule, this._styleSheet);
|
||||
}
|
||||
|
||||
public removeRulesContainingSelector(ruleName: string): void {
|
||||
dom.removeCSSRulesContainingSelector(ruleName, this._styleSheet);
|
||||
domStylesheets.removeCSSRulesContainingSelector(ruleName, this._styleSheet);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../../base/browser/domStylesheets.js';
|
||||
import { IHorizontalSashLayoutProvider, ISashEvent, Orientation, Sash, SashState } from '../../../../base/browser/ui/sash/sash.js';
|
||||
import { Color, RGBA } from '../../../../base/common/color.js';
|
||||
import { IdGenerator } from '../../../../base/common/idGenerator.js';
|
||||
|
@ -127,7 +128,7 @@ class Arrow {
|
|||
|
||||
dispose(): void {
|
||||
this.hide();
|
||||
dom.removeCSSRulesContainingSelector(this._ruleName);
|
||||
domStylesheetsJs.removeCSSRulesContainingSelector(this._ruleName);
|
||||
}
|
||||
|
||||
set color(value: string) {
|
||||
|
@ -145,8 +146,8 @@ class Arrow {
|
|||
}
|
||||
|
||||
private _updateStyle(): void {
|
||||
dom.removeCSSRulesContainingSelector(this._ruleName);
|
||||
dom.createCSSRule(
|
||||
domStylesheetsJs.removeCSSRulesContainingSelector(this._ruleName);
|
||||
domStylesheetsJs.createCSSRule(
|
||||
`.monaco-editor ${this._ruleName}`,
|
||||
`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `
|
||||
);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../base/browser/domStylesheets.js';
|
||||
import { addMatchMediaChangeListener } from '../../../base/browser/browser.js';
|
||||
import { Color } from '../../../base/common/color.js';
|
||||
import { Emitter } from '../../../base/common/event.js';
|
||||
|
@ -275,7 +276,7 @@ export class StandaloneThemeService extends Disposable implements IStandaloneThe
|
|||
|
||||
private _registerRegularEditorContainer(): IDisposable {
|
||||
if (!this._globalStyleElement) {
|
||||
this._globalStyleElement = dom.createStyleSheet(undefined, style => {
|
||||
this._globalStyleElement = domStylesheetsJs.createStyleSheet(undefined, style => {
|
||||
style.className = 'monaco-colors';
|
||||
style.textContent = this._allCSS;
|
||||
});
|
||||
|
@ -285,7 +286,7 @@ export class StandaloneThemeService extends Disposable implements IStandaloneThe
|
|||
}
|
||||
|
||||
private _registerShadowDomContainer(domNode: HTMLElement): IDisposable {
|
||||
const styleElement = dom.createStyleSheet(domNode, style => {
|
||||
const styleElement = domStylesheetsJs.createStyleSheet(domNode, style => {
|
||||
style.className = 'monaco-colors';
|
||||
style.textContent = this._allCSS;
|
||||
});
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { clearNode, createCSSRule, createStyleSheet } from '../../../base/browser/dom.js';
|
||||
import { clearNode } from '../../../base/browser/dom.js';
|
||||
import { createCSSRule, createStyleSheet } from '../../../base/browser/domStylesheets.js';
|
||||
import { RunOnceScheduler } from '../../../base/common/async.js';
|
||||
|
||||
export enum ZIndex {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../base/browser/domStylesheets.js';
|
||||
import { ActionBar } from '../../../base/browser/ui/actionbar/actionbar.js';
|
||||
import { ActionViewItem } from '../../../base/browser/ui/actionbar/actionViewItems.js';
|
||||
import { Button } from '../../../base/browser/ui/button/button.js';
|
||||
|
@ -113,7 +114,7 @@ export class QuickInputController extends Disposable {
|
|||
container.tabIndex = -1;
|
||||
container.style.display = 'none';
|
||||
|
||||
const styleSheet = dom.createStyleSheet(container);
|
||||
const styleSheet = domStylesheetsJs.createStyleSheet(container);
|
||||
|
||||
const titleBar = dom.append(container, $('.quick-input-titlebar'));
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../base/browser/domStylesheets.js';
|
||||
import * as cssJs from '../../../base/browser/cssValue.js';
|
||||
import { DomEmitter } from '../../../base/browser/event.js';
|
||||
import { Event } from '../../../base/common/event.js';
|
||||
|
@ -34,8 +35,8 @@ function getIconClass(iconPath: { dark: URI; light?: URI } | undefined): string
|
|||
iconClass = iconPathToClass[key];
|
||||
} else {
|
||||
iconClass = iconClassGenerator.nextId();
|
||||
dom.createCSSRule(`.${iconClass}, .hc-light .${iconClass}`, `background-image: ${cssJs.asCSSUrl(iconPath.light || iconPath.dark)}`);
|
||||
dom.createCSSRule(`.vs-dark .${iconClass}, .hc-black .${iconClass}`, `background-image: ${cssJs.asCSSUrl(iconPath.dark)}`);
|
||||
domStylesheetsJs.createCSSRule(`.${iconClass}, .hc-light .${iconClass}`, `background-image: ${cssJs.asCSSUrl(iconPath.light || iconPath.dark)}`);
|
||||
domStylesheetsJs.createCSSRule(`.vs-dark .${iconClass}, .hc-black .${iconClass}`, `background-image: ${cssJs.asCSSUrl(iconPath.dark)}`);
|
||||
iconPathToClass[key] = iconClass;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ import { DomEmitter } from '../../../base/browser/event.js';
|
|||
import { Color } from '../../../base/common/color.js';
|
||||
import { Emitter, Event } from '../../../base/common/event.js';
|
||||
import { IDisposable, toDisposable, dispose, DisposableStore, setDisposableTracker, DisposableTracker, DisposableInfo } from '../../../base/common/lifecycle.js';
|
||||
import { getDomNodePagePosition, createStyleSheet, createCSSRule, append, $, getActiveDocument, onDidRegisterWindow, getWindows } from '../../../base/browser/dom.js';
|
||||
import { getDomNodePagePosition, append, $, getActiveDocument, onDidRegisterWindow, getWindows } from '../../../base/browser/dom.js';
|
||||
import { createCSSRule, createStyleSheet } from '../../../base/browser/domStylesheets.js';
|
||||
import { IConfigurationService } from '../../../platform/configuration/common/configuration.js';
|
||||
import { ContextKeyExpr, IContextKeyService, RawContextKey } from '../../../platform/contextkey/common/contextkey.js';
|
||||
import { Context } from '../../../platform/contextkey/browser/contextKeyService.js';
|
||||
|
|
|
@ -11,7 +11,8 @@ import { IInstantiationService } from '../../../platform/instantiation/common/in
|
|||
import { IDisposable, DisposableStore, Disposable, DisposableMap } from '../../../base/common/lifecycle.js';
|
||||
import { IColorTheme } from '../../../platform/theme/common/themeService.js';
|
||||
import { CompositeBar, ICompositeBarItem, CompositeDragAndDrop } from './compositeBar.js';
|
||||
import { Dimension, createCSSRule, isMouseEvent } from '../../../base/browser/dom.js';
|
||||
import { Dimension, isMouseEvent } from '../../../base/browser/dom.js';
|
||||
import { createCSSRule } from '../../../base/browser/domStylesheets.js';
|
||||
import { asCSSUrl } from '../../../base/browser/cssValue.js';
|
||||
import { IStorageService, StorageScope, StorageTarget } from '../../../platform/storage/common/storage.js';
|
||||
import { IExtensionService } from '../../services/extensions/common/extensions.js';
|
||||
|
|
|
@ -16,7 +16,8 @@ import { IThemeService } from '../../../../platform/theme/common/themeService.js
|
|||
import { STATUS_BAR_BACKGROUND, STATUS_BAR_FOREGROUND, STATUS_BAR_NO_FOLDER_BACKGROUND, STATUS_BAR_ITEM_HOVER_BACKGROUND, STATUS_BAR_BORDER, STATUS_BAR_NO_FOLDER_FOREGROUND, STATUS_BAR_NO_FOLDER_BORDER, STATUS_BAR_ITEM_COMPACT_HOVER_BACKGROUND, STATUS_BAR_ITEM_FOCUS_BORDER, STATUS_BAR_FOCUS_BORDER } from '../../../common/theme.js';
|
||||
import { IWorkspaceContextService, WorkbenchState } from '../../../../platform/workspace/common/workspace.js';
|
||||
import { contrastBorder, activeContrastBorder } from '../../../../platform/theme/common/colorRegistry.js';
|
||||
import { EventHelper, createStyleSheet, addDisposableListener, EventType, clearNode, getWindow } from '../../../../base/browser/dom.js';
|
||||
import { EventHelper, addDisposableListener, EventType, clearNode, getWindow } from '../../../../base/browser/dom.js';
|
||||
import { createStyleSheet } from '../../../../base/browser/domStylesheets.js';
|
||||
import { IStorageService } from '../../../../platform/storage/common/storage.js';
|
||||
import { Parts, IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.js';
|
||||
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
|
||||
|
|
|
@ -7,7 +7,8 @@ import './media/paneviewlet.css';
|
|||
import * as nls from '../../../../nls.js';
|
||||
import { Event, Emitter } from '../../../../base/common/event.js';
|
||||
import { asCssVariable, foreground } from '../../../../platform/theme/common/colorRegistry.js';
|
||||
import { after, append, $, trackFocus, EventType, addDisposableListener, createCSSRule, Dimension, reset, isAncestorOfActiveElement, isActiveElement } from '../../../../base/browser/dom.js';
|
||||
import { after, append, $, trackFocus, EventType, addDisposableListener, Dimension, reset, isAncestorOfActiveElement, isActiveElement } from '../../../../base/browser/dom.js';
|
||||
import { createCSSRule } from '../../../../base/browser/domStylesheets.js';
|
||||
import { asCssValueWithDefault, asCSSUrl } from '../../../../base/browser/cssValue.js';
|
||||
import { DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';
|
||||
import { Action, IAction, IActionRunner } from '../../../../base/common/actions.js';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { createStyleSheet } from '../../../../base/browser/dom.js';
|
||||
import { createStyleSheet } from '../../../../base/browser/domStylesheets.js';
|
||||
import { Event } from '../../../../base/common/event.js';
|
||||
import { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';
|
||||
import { clamp } from '../../../../base/common/numbers.js';
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import './media/review.css';
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
|
||||
import { Emitter } from '../../../../base/common/event.js';
|
||||
import { Disposable, dispose, IDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
|
||||
import { URI } from '../../../../base/common/uri.js';
|
||||
|
@ -142,7 +143,7 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
|
|||
) as unknown as CommentThreadBody<T>;
|
||||
this._register(this._body);
|
||||
this._setAriaLabel();
|
||||
this._styleElement = dom.createStyleSheet(this.container);
|
||||
this._styleElement = domStylesheets.createStyleSheet(this.container);
|
||||
|
||||
|
||||
this._commentThreadContextValue = CommentContextKeys.commentThreadContext.bindTo(this._contextKeyService);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../../base/browser/domStylesheets.js';
|
||||
import { IHistoryNavigationWidget } from '../../../../base/browser/history.js';
|
||||
import { IActionViewItem } from '../../../../base/browser/ui/actionbar/actionbar.js';
|
||||
import * as aria from '../../../../base/browser/ui/aria/aria.js';
|
||||
|
@ -708,7 +709,7 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
|
|||
}));
|
||||
// Make sure to select the session if debugging is already active
|
||||
this.selectSession();
|
||||
this.styleElement = dom.createStyleSheet(this.container);
|
||||
this.styleElement = domStylesheetsJs.createStyleSheet(this.container);
|
||||
this.onDidStyleChange();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import './media/interactive.css';
|
||||
import * as DOM from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
|
||||
import { CancellationToken } from '../../../../base/common/cancellation.js';
|
||||
import { Emitter, Event } from '../../../../base/common/event.js';
|
||||
import { DisposableStore, MutableDisposable } from '../../../../base/common/lifecycle.js';
|
||||
|
@ -222,7 +223,7 @@ export class InteractiveEditor extends EditorPane implements IEditorPaneWithScro
|
|||
}
|
||||
|
||||
private _createLayoutStyles(): void {
|
||||
this._styleElement = DOM.createStyleSheet(this._rootElement);
|
||||
this._styleElement = domStylesheets.createStyleSheet(this._rootElement);
|
||||
const styleSheets: string[] = [];
|
||||
|
||||
const {
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { $, createStyleSheet, isHTMLInputElement, isHTMLTextAreaElement, reset, windowOpenNoOpener } from '../../../../base/browser/dom.js';
|
||||
import { $, isHTMLInputElement, isHTMLTextAreaElement, reset, windowOpenNoOpener } from '../../../../base/browser/dom.js';
|
||||
import { createStyleSheet } from '../../../../base/browser/domStylesheets.js';
|
||||
import { Button, unthemedButtonStyles } from '../../../../base/browser/ui/button/button.js';
|
||||
import { renderIcon } from '../../../../base/browser/ui/iconLabel/iconLabels.js';
|
||||
import { mainWindow } from '../../../../base/browser/window.js';
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { $, createStyleSheet, h, isInShadowDOM, reset } from '../../../../../base/browser/dom.js';
|
||||
import { $, h, isInShadowDOM, reset } from '../../../../../base/browser/dom.js';
|
||||
import { createStyleSheet } from '../../../../../base/browser/domStylesheets.js';
|
||||
import { renderLabelWithIcons } from '../../../../../base/browser/ui/iconLabel/iconLabels.js';
|
||||
import { hash } from '../../../../../base/common/hash.js';
|
||||
import { Disposable, IDisposable } from '../../../../../base/common/lifecycle.js';
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
import './notebookDiff.css';
|
||||
import { IListMouseEvent, IListRenderer, IListVirtualDelegate } from '../../../../../base/browser/ui/list/list.js';
|
||||
import * as DOM from '../../../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../../../base/browser/domStylesheets.js';
|
||||
import { IListOptions, IListStyles, isMonacoEditor, IStyleController, MouseController } from '../../../../../base/browser/ui/list/listWidget.js';
|
||||
import { DisposableStore, IDisposable } from '../../../../../base/common/lifecycle.js';
|
||||
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
|
||||
|
@ -481,7 +482,7 @@ export class NotebookTextDiffList extends WorkbenchList<IDiffElementViewModelBas
|
|||
override style(styles: IListStyles) {
|
||||
const selectorSuffix = this.view.domId;
|
||||
if (!this.styleElement) {
|
||||
this.styleElement = DOM.createStyleSheet(this.view.domNode);
|
||||
this.styleElement = domStylesheets.createStyleSheet(this.view.domNode);
|
||||
}
|
||||
const suffix = selectorSuffix && `.${selectorSuffix}`;
|
||||
const content: string[] = [];
|
||||
|
|
|
@ -20,6 +20,7 @@ import './media/notebookOutline.css';
|
|||
import './media/notebookChatEditController.css';
|
||||
import './media/notebookChatEditorOverlay.css';
|
||||
import * as DOM from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
|
||||
import { IMouseWheelEvent, StandardMouseEvent } from '../../../../base/browser/mouseEvent.js';
|
||||
import { IListContextMenuEvent } from '../../../../base/browser/ui/list/list.js';
|
||||
import { mainWindow } from '../../../../base/browser/window.js';
|
||||
|
@ -638,7 +639,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
|
|||
}
|
||||
|
||||
private _createLayoutStyles(): void {
|
||||
this._styleElement = DOM.createStyleSheet(this._body);
|
||||
this._styleElement = domStylesheets.createStyleSheet(this._body);
|
||||
const {
|
||||
cellRightMargin,
|
||||
cellTopMargin,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as DOM from '../../../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../../../base/browser/domStylesheets.js';
|
||||
import { IMouseWheelEvent } from '../../../../../base/browser/mouseEvent.js';
|
||||
import { IListRenderer, IListVirtualDelegate, ListError } from '../../../../../base/browser/ui/list/list.js';
|
||||
import { IListStyles, IStyleController } from '../../../../../base/browser/ui/list/listWidget.js';
|
||||
|
@ -1316,7 +1317,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
override style(styles: IListStyles) {
|
||||
const selectorSuffix = this.view.domId;
|
||||
if (!this.styleElement) {
|
||||
this.styleElement = DOM.createStyleSheet(this.view.domNode);
|
||||
this.styleElement = domStylesheetsJs.createStyleSheet(this.view.domNode);
|
||||
}
|
||||
const suffix = selectorSuffix && `.${selectorSuffix}`;
|
||||
const content: string[] = [];
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { BrowserFeatures } from '../../../../base/browser/canIUse.js';
|
||||
import * as DOM from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../../base/browser/domStylesheets.js';
|
||||
import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js';
|
||||
import { renderMarkdownAsPlaintext } from '../../../../base/browser/markdownRenderer.js';
|
||||
import { IMouseEvent } from '../../../../base/browser/mouseEvent.js';
|
||||
|
@ -2513,7 +2514,7 @@ export class SettingsTree extends WorkbenchObjectTree<SettingsTreeElement> {
|
|||
}
|
||||
},
|
||||
accessibilityProvider: new SettingsTreeAccessibilityProvider(configurationService, languageService, userDataProfilesService),
|
||||
styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id),
|
||||
styleController: id => new DefaultStyleController(domStylesheetsJs.createStyleSheet(container), id),
|
||||
filter: instantiationService.createInstance(SettingsTreeFilter, viewState),
|
||||
smoothScrolling: configurationService.getValue<boolean>('workbench.list.smoothScrolling'),
|
||||
multipleSelectionSupport: false,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as DOM from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../../base/browser/domStylesheets.js';
|
||||
import { getDefaultHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegateFactory.js';
|
||||
import { IListVirtualDelegate } from '../../../../base/browser/ui/list/list.js';
|
||||
import { DefaultStyleController, IListAccessibilityProvider } from '../../../../base/browser/ui/list/listWidget.js';
|
||||
|
@ -225,7 +226,7 @@ export class TOCTree extends WorkbenchObjectTree<SettingsTreeGroupElement> {
|
|||
return e.id;
|
||||
}
|
||||
},
|
||||
styleController: id => new DefaultStyleController(DOM.createStyleSheet(container), id),
|
||||
styleController: id => new DefaultStyleController(domStylesheetsJs.createStyleSheet(container), id),
|
||||
accessibilityProvider: instantiationService.createInstance(SettingsAccessibilityProvider),
|
||||
collapseByDefault: true,
|
||||
horizontalScrolling: false,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import './media/interactive.css';
|
||||
import * as DOM from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
|
||||
import { CancellationToken } from '../../../../base/common/cancellation.js';
|
||||
import { Emitter, Event } from '../../../../base/common/event.js';
|
||||
import { DisposableStore, MutableDisposable } from '../../../../base/common/lifecycle.js';
|
||||
|
@ -213,7 +214,7 @@ export class ReplEditor extends EditorPane implements IEditorPaneWithScrolling {
|
|||
}
|
||||
|
||||
private _createLayoutStyles(): void {
|
||||
this._styleElement = DOM.createStyleSheet(this._rootElement);
|
||||
this._styleElement = domStylesheets.createStyleSheet(this._rootElement);
|
||||
const styleSheets: string[] = [];
|
||||
|
||||
const {
|
||||
|
|
|
@ -43,6 +43,7 @@ import { equals, sortedDiff } from '../../../../base/common/arrays.js';
|
|||
import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js';
|
||||
import { ISplice } from '../../../../base/common/sequence.js';
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../../base/browser/domStylesheets.js';
|
||||
import { EncodingMode, ITextFileEditorModel, IResolvedTextFileEditorModel, ITextFileService, isTextFileEditorModel } from '../../../services/textfile/common/textfiles.js';
|
||||
import { gotoNextLocation, gotoPreviousLocation } from '../../../../platform/theme/common/iconRegistry.js';
|
||||
import { Codicon } from '../../../../base/common/codicons.js';
|
||||
|
@ -721,7 +722,7 @@ export class DirtyDiffController extends Disposable implements DirtyDiffContribu
|
|||
) {
|
||||
super();
|
||||
this.enabled = !contextKeyService.getContextKeyValue('isInDiffEditor');
|
||||
this.stylesheet = dom.createStyleSheet(undefined, undefined, this._store);
|
||||
this.stylesheet = domStylesheetsJs.createStyleSheet(undefined, undefined, this._store);
|
||||
|
||||
if (this.enabled) {
|
||||
this.isDirtyDiffVisible = isDirtyDiffVisible.bindTo(contextKeyService);
|
||||
|
@ -1545,7 +1546,7 @@ export class DirtyDiffWorkbenchController extends Disposable implements ext.IWor
|
|||
@ITextFileService private readonly textFileService: ITextFileService
|
||||
) {
|
||||
super();
|
||||
this.stylesheet = dom.createStyleSheet(undefined, undefined, this._store);
|
||||
this.stylesheet = domStylesheetsJs.createStyleSheet(undefined, undefined, this._store);
|
||||
|
||||
const onDidChangeConfiguration = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.diffDecorations'));
|
||||
this._register(onDidChangeConfiguration(this.onDidChangeConfiguration, this));
|
||||
|
|
|
@ -14,7 +14,7 @@ import { ThemeIcon } from '../../../../base/common/themables.js';
|
|||
import { ITerminalInstance } from './terminal.js';
|
||||
import { ITerminalProfileResolverService } from '../common/terminal.js';
|
||||
import { ansiColorMap } from '../common/terminalColorRegistry.js';
|
||||
import { createStyleSheet } from '../../../../base/browser/dom.js';
|
||||
import { createStyleSheet } from '../../../../base/browser/domStylesheets.js';
|
||||
import { DisposableStore, IDisposable } from '../../../../base/common/lifecycle.js';
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
|
||||
import * as cssValue from '../../../../base/browser/cssValue.js';
|
||||
import { DeferredPromise, timeout } from '../../../../base/common/async.js';
|
||||
import { debounce, memoize } from '../../../../base/common/decorators.js';
|
||||
|
@ -1213,7 +1213,7 @@ class TerminalEditorStyle extends Themable {
|
|||
) {
|
||||
super(_themeService);
|
||||
this._registerListeners();
|
||||
this._styleElement = dom.createStyleSheet(container);
|
||||
this._styleElement = domStylesheets.createStyleSheet(container);
|
||||
this._register(toDisposable(() => this._styleElement.remove()));
|
||||
this.updateStyles();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import * as nls from '../../../../nls.js';
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheetsJs from '../../../../base/browser/domStylesheets.js';
|
||||
import * as cssJs from '../../../../base/browser/cssValue.js';
|
||||
import { Action, IAction } from '../../../../base/common/actions.js';
|
||||
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
||||
|
@ -187,7 +188,7 @@ export class TerminalViewPane extends ViewPane {
|
|||
}
|
||||
this._parentDomElement = container;
|
||||
this._parentDomElement.classList.add('integrated-terminal');
|
||||
dom.createStyleSheet(this._parentDomElement);
|
||||
domStylesheetsJs.createStyleSheet(this._parentDomElement);
|
||||
this._instantiationService.createInstance(TerminalThemeIconStyle, this._parentDomElement);
|
||||
|
||||
if (!this.shouldShowWelcome()) {
|
||||
|
@ -584,7 +585,7 @@ class TerminalThemeIconStyle extends Themable {
|
|||
) {
|
||||
super(_themeService);
|
||||
this._registerListeners();
|
||||
this._styleElement = dom.createStyleSheet(container);
|
||||
this._styleElement = domStylesheetsJs.createStyleSheet(container);
|
||||
this._register(toDisposable(() => this._styleElement.remove()));
|
||||
this.updateStyles();
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as cssJs from '../../../../base/browser/cssValue.js';
|
||||
import * as cssValue from '../../../../base/browser/cssValue.js';
|
||||
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
|
||||
import { Disposable } from '../../../../base/common/lifecycle.js';
|
||||
import { URI } from '../../../../base/common/uri.js';
|
||||
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
||||
|
@ -39,7 +39,7 @@ export class WebviewIconManager extends Disposable {
|
|||
|
||||
private get styleElement(): HTMLStyleElement {
|
||||
if (!this._styleElement) {
|
||||
this._styleElement = dom.createStyleSheet(undefined, undefined, this._store);
|
||||
this._styleElement = domStylesheets.createStyleSheet(undefined, undefined, this._store);
|
||||
this._styleElement.className = 'webview-icons';
|
||||
}
|
||||
return this._styleElement;
|
||||
|
@ -67,8 +67,8 @@ export class WebviewIconManager extends Disposable {
|
|||
const webviewSelector = `.show-file-icons .webview-${key}-name-file-icon::before`;
|
||||
try {
|
||||
cssRules.push(
|
||||
`.monaco-workbench.vs ${webviewSelector}, .monaco-workbench.hc-light ${webviewSelector} { content: ""; background-image: ${cssJs.asCSSUrl(value.light)}; }`,
|
||||
`.monaco-workbench.vs-dark ${webviewSelector}, .monaco-workbench.hc-black ${webviewSelector} { content: ""; background-image: ${cssJs.asCSSUrl(value.dark)}; }`
|
||||
`.monaco-workbench.vs ${webviewSelector}, .monaco-workbench.hc-light ${webviewSelector} { content: ""; background-image: ${cssValue.asCSSUrl(value.light)}; }`,
|
||||
`.monaco-workbench.vs-dark ${webviewSelector}, .monaco-workbench.hc-black ${webviewSelector} { content: ""; background-image: ${cssValue.asCSSUrl(value.dark)}; }`
|
||||
);
|
||||
} catch {
|
||||
// noop
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getZoomLevel } from '../../../../base/browser/browser.js';
|
||||
import { Dimension, EventHelper, EventType, ModifierKeyEmitter, addDisposableListener, cloneGlobalStylesheets, copyAttributes, createLinkElement, createMetaElement, getActiveWindow, getClientArea, getWindowId, isGlobalStylesheet, isHTMLElement, position, registerWindow, sharedMutationObserver, trackAttributes } from '../../../../base/browser/dom.js';
|
||||
import { Dimension, EventHelper, EventType, ModifierKeyEmitter, addDisposableListener, copyAttributes, createLinkElement, createMetaElement, getActiveWindow, getClientArea, getWindowId, isHTMLElement, position, registerWindow, sharedMutationObserver, trackAttributes } from '../../../../base/browser/dom.js';
|
||||
import { cloneGlobalStylesheets, isGlobalStylesheet } from '../../../../base/browser/domStylesheets.js';
|
||||
import { CodeWindow, ensureCodeWindow, mainWindow } from '../../../../base/browser/window.js';
|
||||
import { coalesce } from '../../../../base/common/arrays.js';
|
||||
import { Barrier } from '../../../../base/common/async.js';
|
||||
|
|
|
@ -10,7 +10,7 @@ import { TernarySearchTree } from '../../../../base/common/ternarySearchTree.js'
|
|||
import { IDisposable, toDisposable, DisposableStore } from '../../../../base/common/lifecycle.js';
|
||||
import { isThenable } from '../../../../base/common/async.js';
|
||||
import { LinkedList } from '../../../../base/common/linkedList.js';
|
||||
import { createStyleSheet, createCSSRule, removeCSSRulesContainingSelector } from '../../../../base/browser/dom.js';
|
||||
import { createStyleSheet, createCSSRule, removeCSSRulesContainingSelector } from '../../../../base/browser/domStylesheets.js';
|
||||
import * as cssValue from '../../../../base/browser/cssValue.js';
|
||||
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
|
||||
import { ThemeIcon } from '../../../../base/common/themables.js';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { canASAR, importAMDNodeModule, resolveAmdNodeModulePath } from '../../../../amdX.js';
|
||||
import * as dom from '../../../../base/browser/dom.js';
|
||||
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
|
||||
import { equals as equalArray } from '../../../../base/common/arrays.js';
|
||||
import { Color } from '../../../../base/common/color.js';
|
||||
import { onUnexpectedError } from '../../../../base/common/errors.js';
|
||||
|
@ -75,7 +75,7 @@ export class TextMateTokenizationFeature extends Disposable implements ITextMate
|
|||
) {
|
||||
super();
|
||||
|
||||
this._styleElement = dom.createStyleSheet();
|
||||
this._styleElement = domStylesheets.createStyleSheet();
|
||||
this._styleElement.className = 'vscode-tokens-styles';
|
||||
|
||||
grammarsExtPoint.setHandler((extensions) => this._handleGrammarsExtPoint(extensions));
|
||||
|
|
|
@ -18,7 +18,7 @@ import { Event, Emitter } from '../../../../base/common/event.js';
|
|||
import { registerFileIconThemeSchemas } from '../common/fileIconThemeSchema.js';
|
||||
import { IDisposable, dispose, Disposable } from '../../../../base/common/lifecycle.js';
|
||||
import { FileIconThemeData, FileIconThemeLoader } from './fileIconThemeData.js';
|
||||
import { createStyleSheet } from '../../../../base/browser/dom.js';
|
||||
import { createStyleSheet } from '../../../../base/browser/domStylesheets.js';
|
||||
import { IBrowserWorkbenchEnvironmentService } from '../../environment/browser/environmentService.js';
|
||||
import { IFileService, FileChangeType } from '../../../../platform/files/common/files.js';
|
||||
import { URI } from '../../../../base/common/uri.js';
|
||||
|
|
Loading…
Reference in New Issue