chrome-devtools-frontend 1.0.956060 → 1.0.956975
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/config/gni/devtools_grd_files.gni +0 -2
- package/front_end/Images/generate-css-vars.js +2 -2
- package/front_end/core/common/ParsedURL.ts +35 -2
- package/front_end/core/common/Settings.ts +1 -1
- package/front_end/core/host/InspectorFrontendHost.ts +2 -1
- package/front_end/core/i18n/i18nImpl.ts +2 -3
- package/front_end/core/i18n/locales/en-US.json +6 -3
- package/front_end/core/i18n/locales/en-XL.json +6 -3
- package/front_end/core/root/Runtime.ts +0 -72
- package/front_end/core/root/root-legacy.ts +0 -2
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +10 -0
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +3 -4
- package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +4 -7
- package/front_end/entrypoints/main/MainImpl.ts +21 -13
- package/front_end/entrypoints/main/main-meta.ts +1 -1
- package/front_end/models/extensions/ExtensionServer.ts +1 -22
- package/front_end/models/formatter/FormatterWorkerPool.ts +2 -12
- package/front_end/models/formatter/ScriptFormatter.ts +3 -3
- package/front_end/panels/application/AppManifestView.ts +41 -0
- package/front_end/panels/console/ConsoleSidebar.ts +9 -9
- package/front_end/panels/elements/ElementsPanel.ts +1 -1
- package/front_end/panels/elements/components/LayoutPane.ts +1 -1
- package/front_end/panels/emulation/AdvancedApp.ts +2 -2
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -1
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +19 -0
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +7 -1
- package/front_end/third_party/acorn/acorn.ts +1 -1
- package/front_end/ui/legacy/ResizerWidget.ts +4 -2
- package/front_end/ui/legacy/SoftDropDown.ts +2 -1
- package/front_end/ui/legacy/TextPrompt.ts +2 -2
- package/front_end/ui/legacy/Treeoutline.ts +2 -1
- package/front_end/ui/legacy/UIUtils.ts +1 -8
- package/front_end/ui/legacy/ViewManager.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +3 -2
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -0
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -1
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +1 -2
- package/front_end/ui/legacy/inspectorSyntaxHighlight.css +8 -11
- package/front_end/ui/legacy/softContextMenu.css +4 -1
- package/front_end/ui/legacy/themeColors.css +3 -1
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +29 -32
- package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +3 -2
- package/front_end/ui/legacy/utils/inject-core-styles.ts +3 -31
- package/front_end/ui/legacy/utils/utils.ts +1 -5
- package/front_end/ui/lit-html/lit-html.ts +1 -1
- package/package.json +1 -1
- package/scripts/build/generate_css_js_files.js +2 -2
- package/scripts/build/ninja/generate_css.gni +3 -0
- package/scripts/eslint_rules/lib/no_bound_component_methods.js +116 -0
- package/scripts/eslint_rules/tests/no_bound_component_methods_test.js +85 -0
- package/front_end/ui/legacy/inspectorSyntaxHighlightDark.css +0 -270
- package/front_end/ui/legacy/utils/append-style.ts +0 -9
|
@@ -243,6 +243,25 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
|
|
|
243
243
|
this.interactionsHeaderLevel2 = this.buildGroupStyle({padding: 2, nestingLevel: 1});
|
|
244
244
|
this.experienceHeader = this.buildGroupStyle({collapsible: false});
|
|
245
245
|
|
|
246
|
+
ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
|
|
247
|
+
const headers = [
|
|
248
|
+
this.headerLevel1,
|
|
249
|
+
this.headerLevel2,
|
|
250
|
+
this.staticHeader,
|
|
251
|
+
this.framesHeader,
|
|
252
|
+
this.collapsibleTimingsHeader,
|
|
253
|
+
this.timingsHeader,
|
|
254
|
+
this.screenshotsHeader,
|
|
255
|
+
this.interactionsHeaderLevel1,
|
|
256
|
+
this.interactionsHeaderLevel2,
|
|
257
|
+
this.experienceHeader,
|
|
258
|
+
];
|
|
259
|
+
for (const header of headers) {
|
|
260
|
+
header.color = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-primary');
|
|
261
|
+
header.backgroundColor = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
246
265
|
this.flowEventIndexById = new Map();
|
|
247
266
|
}
|
|
248
267
|
|
|
@@ -79,6 +79,12 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
|
79
79
|
this.timeSpan = 0;
|
|
80
80
|
this.requests = [];
|
|
81
81
|
this.maxLevel = 0;
|
|
82
|
+
|
|
83
|
+
// In the event of a theme change, these colors must be recalculated.
|
|
84
|
+
ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
|
|
85
|
+
this.style.color = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-text-primary');
|
|
86
|
+
this.style.backgroundColor = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
|
|
87
|
+
});
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
setModel(performanceModel: PerformanceModel|null): void {
|
|
@@ -194,7 +200,7 @@ export class TimelineFlameChartNetworkDataProvider implements PerfUI.FlameChart.
|
|
|
194
200
|
const end = Math.max(timeToPixel(endTime), finish);
|
|
195
201
|
|
|
196
202
|
// Draw waiting time.
|
|
197
|
-
context.fillStyle =
|
|
203
|
+
context.fillStyle = 'hsla(0, 100%, 100%, 0.8)';
|
|
198
204
|
context.fillRect(sendStart + 0.5, barY + 0.5, headersEnd - sendStart - 0.5, barHeight - 2);
|
|
199
205
|
// Clear portions of initial rect to prepare for the ticks.
|
|
200
206
|
context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background');
|
|
@@ -7,7 +7,7 @@ import * as acorn from './package/dist/acorn.mjs';
|
|
|
7
7
|
import type * as ESTree from './estree-legacy';
|
|
8
8
|
export {ESTree};
|
|
9
9
|
|
|
10
|
-
export { Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
|
|
10
|
+
export { type Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
|
|
11
11
|
|
|
12
12
|
export const Parser = acorn.Parser;
|
|
13
13
|
export const tokenizer = acorn.Parser.tokenizer.bind(acorn.Parser);
|
|
@@ -38,7 +38,7 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
38
38
|
addElement(element: HTMLElement): void {
|
|
39
39
|
if (!this.elementsInternal.has(element)) {
|
|
40
40
|
this.elementsInternal.add(element);
|
|
41
|
-
element.addEventListener('
|
|
41
|
+
element.addEventListener('pointerdown', this.installDragOnMouseDownBound, false);
|
|
42
42
|
this.updateElementCursor(element);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -46,7 +46,7 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
46
46
|
removeElement(element: HTMLElement): void {
|
|
47
47
|
if (this.elementsInternal.has(element)) {
|
|
48
48
|
this.elementsInternal.delete(element);
|
|
49
|
-
element.removeEventListener('
|
|
49
|
+
element.removeEventListener('pointerdown', this.installDragOnMouseDownBound, false);
|
|
50
50
|
element.style.removeProperty('cursor');
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -58,8 +58,10 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
58
58
|
private updateElementCursor(element: HTMLElement): void {
|
|
59
59
|
if (this.isEnabledInternal) {
|
|
60
60
|
element.style.setProperty('cursor', this.cursor());
|
|
61
|
+
element.style.setProperty('touch-action', 'none');
|
|
61
62
|
} else {
|
|
62
63
|
element.style.removeProperty('cursor');
|
|
64
|
+
element.style.removeProperty('touch-action');
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
7
8
|
import * as Utils from './utils/utils.js';
|
|
8
9
|
|
|
9
10
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
@@ -48,7 +49,7 @@ export class SoftDropDown<T> implements ListDelegate<T> {
|
|
|
48
49
|
|
|
49
50
|
this.element = document.createElement('button');
|
|
50
51
|
this.element.classList.add('soft-dropdown');
|
|
51
|
-
|
|
52
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.element, softDropDownButtonStyles);
|
|
52
53
|
this.titleElement = this.element.createChild('span', 'title');
|
|
53
54
|
const dropdownArrowIcon = Icon.create('smallicon-triangle-down');
|
|
54
55
|
this.element.appendChild(dropdownArrowIcon);
|
|
@@ -37,7 +37,7 @@ import * as Platform from '../../core/platform/platform.js';
|
|
|
37
37
|
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
38
38
|
|
|
39
39
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
40
|
-
import * as
|
|
40
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
41
41
|
|
|
42
42
|
import type {SuggestBoxDelegate, Suggestion} from './SuggestBox.js';
|
|
43
43
|
import {SuggestBox} from './SuggestBox.js';
|
|
@@ -136,7 +136,7 @@ export class TextPrompt extends Common.ObjectWrapper.ObjectWrapper<EventTypes> i
|
|
|
136
136
|
this.boundOnMouseWheel = this.onMouseWheel.bind(this);
|
|
137
137
|
this.boundClearAutocomplete = this.clearAutocomplete.bind(this);
|
|
138
138
|
this.proxyElement = element.ownerDocument.createElement('span');
|
|
139
|
-
|
|
139
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.proxyElement, textPromptStyles);
|
|
140
140
|
this.contentElement = this.proxyElement.createChild('div', 'text-prompt-root');
|
|
141
141
|
this.proxyElement.style.display = this.proxyElementDisplay;
|
|
142
142
|
if (element.parentElement) {
|
|
@@ -37,6 +37,7 @@ import * as Common from '../../core/common/common.js';
|
|
|
37
37
|
import * as Platform from '../../core/platform/platform.js';
|
|
38
38
|
|
|
39
39
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
40
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
40
41
|
import * as Utils from './utils/utils.js';
|
|
41
42
|
|
|
42
43
|
import type {Icon} from './Icon.js';
|
|
@@ -400,7 +401,7 @@ export class TreeOutlineInShadow extends TreeOutline {
|
|
|
400
401
|
}
|
|
401
402
|
|
|
402
403
|
registerRequiredCSS(cssFile: {cssContent: string}): void {
|
|
403
|
-
|
|
404
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.shadowRoot, cssFile);
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
registerCSSFiles(cssFiles: CSSStyleSheet[]): void {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
import type * as Common from '../../core/common/common.js';
|
|
37
36
|
import * as DOMExtension from '../../core/dom_extension/dom_extension.js';
|
|
38
37
|
import * as Host from '../../core/host/host.js';
|
|
39
38
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
@@ -46,7 +45,6 @@ import {Size} from './Geometry.js';
|
|
|
46
45
|
import {GlassPane, PointerEventsBehavior, SizeBehavior} from './GlassPane.js';
|
|
47
46
|
import {Icon} from './Icon.js';
|
|
48
47
|
import {KeyboardShortcut} from './KeyboardShortcut.js';
|
|
49
|
-
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
50
48
|
import * as Utils from './utils/utils.js';
|
|
51
49
|
|
|
52
50
|
import type {ToolbarButton} from './Toolbar.js';
|
|
@@ -1043,7 +1041,7 @@ export class LongClickController {
|
|
|
1043
1041
|
static readonly TIME_MS = 200;
|
|
1044
1042
|
}
|
|
1045
1043
|
|
|
1046
|
-
export function initializeUIUtils(document: Document
|
|
1044
|
+
export function initializeUIUtils(document: Document): void {
|
|
1047
1045
|
document.body.classList.toggle('inactive', !document.hasFocus());
|
|
1048
1046
|
if (document.defaultView) {
|
|
1049
1047
|
document.defaultView.addEventListener('focus', windowFocused.bind(undefined, document), false);
|
|
@@ -1051,11 +1049,6 @@ export function initializeUIUtils(document: Document, themeSetting: Common.Setti
|
|
|
1051
1049
|
}
|
|
1052
1050
|
document.addEventListener('focus', Utils.focusChanged.bind(undefined), true);
|
|
1053
1051
|
|
|
1054
|
-
if (!ThemeSupport.ThemeSupport.hasInstance()) {
|
|
1055
|
-
ThemeSupport.ThemeSupport.instance({forceNew: true, setting: themeSetting});
|
|
1056
|
-
}
|
|
1057
|
-
ThemeSupport.ThemeSupport.instance().applyTheme(document);
|
|
1058
|
-
|
|
1059
1052
|
const body = (document.body as Element);
|
|
1060
1053
|
GlassPane.setContainer(body);
|
|
1061
1054
|
}
|
|
@@ -15,7 +15,7 @@ import type {ToolbarItem} from './Toolbar.js';
|
|
|
15
15
|
import {Toolbar, ToolbarMenuButton} from './Toolbar.js';
|
|
16
16
|
import {createTextChild} from './UIUtils.js';
|
|
17
17
|
import type {TabbedViewLocation, View, ViewLocation, ViewLocationResolver} from './View.js';
|
|
18
|
-
import {getRegisteredLocationResolvers, getRegisteredViewExtensions, maybeRemoveViewExtension, registerLocationResolver, registerViewExtension, ViewLocationCategoryValues, ViewLocationValues, ViewPersistence, ViewRegistration} from './ViewRegistration.js';
|
|
18
|
+
import {getRegisteredLocationResolvers, getRegisteredViewExtensions, maybeRemoveViewExtension, registerLocationResolver, registerViewExtension, ViewLocationCategoryValues, ViewLocationValues, ViewPersistence, type ViewRegistration} from './ViewRegistration.js';
|
|
19
19
|
import type {Widget, WidgetElement} from './Widget.js';
|
|
20
20
|
import {VBox} from './Widget.js';
|
|
21
21
|
import viewContainersStyles from './viewContainers.css.legacy.js';
|
|
@@ -32,6 +32,7 @@ import * as DOMExtension from '../../core/dom_extension/dom_extension.js';
|
|
|
32
32
|
import * as Helpers from '../components/helpers/helpers.js';
|
|
33
33
|
|
|
34
34
|
import {Constraints, Size} from './Geometry.js';
|
|
35
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
35
36
|
import * as Utils from './utils/utils.js';
|
|
36
37
|
import {XWidget} from './XWidget.js';
|
|
37
38
|
|
|
@@ -460,9 +461,9 @@ export class Widget {
|
|
|
460
461
|
|
|
461
462
|
registerRequiredCSS(cssFile: {cssContent: string}): void {
|
|
462
463
|
if (this.isWebComponent) {
|
|
463
|
-
|
|
464
|
+
ThemeSupport.ThemeSupport.instance().appendStyle((this.shadowRoot as DocumentFragment), cssFile);
|
|
464
465
|
} else {
|
|
465
|
-
|
|
466
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.element, cssFile);
|
|
466
467
|
}
|
|
467
468
|
}
|
|
468
469
|
|
|
@@ -227,6 +227,10 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
|
227
227
|
|
|
228
228
|
// Keyboard focused group is used to navigate groups irrespective of whether they are selectable or not
|
|
229
229
|
this.keyboardFocusedGroup = -1;
|
|
230
|
+
|
|
231
|
+
ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
|
|
232
|
+
this.scheduleUpdate();
|
|
233
|
+
});
|
|
230
234
|
}
|
|
231
235
|
|
|
232
236
|
willHide(): void {
|
|
@@ -1134,7 +1138,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
|
1134
1138
|
this.forEachGroupInViewport((offset, index, group, isFirst, groupHeight) => {
|
|
1135
1139
|
if (this.isGroupFocused(index)) {
|
|
1136
1140
|
context.fillStyle =
|
|
1137
|
-
ThemeSupport.ThemeSupport.instance().getComputedValue('--
|
|
1141
|
+
ThemeSupport.ThemeSupport.instance().getComputedValue('--selected-group-background', this.contentElement);
|
|
1138
1142
|
context.fillRect(0, offset, width, groupHeight - group.style.padding);
|
|
1139
1143
|
}
|
|
1140
1144
|
});
|
|
@@ -32,6 +32,7 @@ import * as Common from '../../../../core/common/common.js';
|
|
|
32
32
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
33
33
|
import * as Platform from '../../../../core/platform/platform.js';
|
|
34
34
|
import * as UI from '../../legacy.js';
|
|
35
|
+
import * as ThemeSupport from '../../theme_support/theme_support.js';
|
|
35
36
|
|
|
36
37
|
import type {Calculator} from './TimelineGrid.js';
|
|
37
38
|
import {TimelineGrid} from './TimelineGrid.js';
|
|
@@ -162,7 +163,7 @@ export class Window extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
|
162
163
|
|
|
163
164
|
this.parentElement.addEventListener('wheel', this.onMouseWheel.bind(this), true);
|
|
164
165
|
this.parentElement.addEventListener('dblclick', this.resizeWindowMaximum.bind(this), true);
|
|
165
|
-
|
|
166
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.parentElement, overviewGridStyles);
|
|
166
167
|
|
|
167
168
|
this.leftResizeElement = parentElement.createChild('div', 'overview-grid-window-resizer') as HTMLElement;
|
|
168
169
|
UI.UIUtils.installDragHandle(
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
import * as Host from '../../../../core/host/host.js';
|
|
36
|
-
import * as UI from '../../legacy.js';
|
|
37
36
|
import * as ThemeSupport from '../../theme_support/theme_support.js';
|
|
38
37
|
|
|
39
38
|
import timelineGridStyles from './timelineGrid.css.legacy.js';
|
|
@@ -49,7 +48,7 @@ export class TimelineGrid {
|
|
|
49
48
|
|
|
50
49
|
constructor() {
|
|
51
50
|
this.element = document.createElement('div');
|
|
52
|
-
|
|
51
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.element, timelineGridStyles);
|
|
53
52
|
|
|
54
53
|
this.dividersElementInternal = this.element.createChild('div', 'resources-dividers');
|
|
55
54
|
|
|
@@ -27,18 +27,16 @@
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
.webkit-css-property {
|
|
30
|
-
color: var(--webkit-css-property-color,
|
|
30
|
+
color: var(--webkit-css-property-color, var(--color-syntax-1)); /* stylelint-disable-line plugin/use_theme_colors */ /* See: crbug.com/1152736 for color variable migration. */
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.webkit-html-comment {
|
|
34
34
|
/* Keep this in sync with view-source.css (.webkit-html-comment) */
|
|
35
|
-
color:
|
|
36
|
-
/* See: crbug.com/1152736 for color variable migration. */
|
|
35
|
+
color: var(--color-token-comment);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
.webkit-html-tag {
|
|
40
|
-
color:
|
|
41
|
-
/* See: crbug.com/1152736 for color variable migration. */
|
|
39
|
+
color: var(--color-token-tag);
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
.webkit-html-tag-name,
|
|
@@ -49,16 +47,17 @@
|
|
|
49
47
|
|
|
50
48
|
.webkit-html-pseudo-element {
|
|
51
49
|
/* This one is non-standard. */
|
|
52
|
-
color:
|
|
53
|
-
/* See: crbug.com/1152736 for color variable migration. */
|
|
50
|
+
color: var(--color-token-pseudo-element);
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
.webkit-html-js-node,
|
|
57
54
|
.webkit-html-css-node {
|
|
55
|
+
color: var(--color-text-primary);
|
|
58
56
|
white-space: pre-wrap;
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
.webkit-html-text-node {
|
|
60
|
+
color: var(--color-text-primary);
|
|
62
61
|
unicode-bidi: -webkit-isolate;
|
|
63
62
|
}
|
|
64
63
|
|
|
@@ -77,15 +76,13 @@
|
|
|
77
76
|
|
|
78
77
|
.webkit-html-attribute-name {
|
|
79
78
|
/* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
|
|
80
|
-
color: var(--color-token-attribute);
|
|
81
|
-
/* See: crbug.com/1152736 for color variable migration. */
|
|
79
|
+
color: var(--color-token-attribute);
|
|
82
80
|
unicode-bidi: -webkit-isolate;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
.webkit-html-attribute-value {
|
|
86
84
|
/* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
|
|
87
|
-
color:
|
|
88
|
-
/* See: crbug.com/1152736 for color variable migration. */
|
|
85
|
+
color: var(--color-token-attribute-value);
|
|
89
86
|
unicode-bidi: -webkit-isolate;
|
|
90
87
|
word-break: break-all;
|
|
91
88
|
}
|
|
@@ -35,12 +35,15 @@
|
|
|
35
35
|
box-shadow: var(--override-mac-specific-box-shadow);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
.dockside-title {
|
|
39
|
+
padding-right: 13px;
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
.soft-context-menu-item {
|
|
39
43
|
display: flex;
|
|
40
44
|
width: 100%;
|
|
41
45
|
font-size: 12px;
|
|
42
46
|
padding: 3px 7px 3px 8px;
|
|
43
|
-
margin: 0 13px 0 0;
|
|
44
47
|
white-space: nowrap;
|
|
45
48
|
align-items: center;
|
|
46
49
|
}
|
|
@@ -155,6 +155,7 @@
|
|
|
155
155
|
--color-token-meta: rgb(85 85 85);
|
|
156
156
|
--color-token-deleted: rgb(221 68 68);
|
|
157
157
|
--color-token-inserted: rgb(34 153 34);
|
|
158
|
+
--color-token-pseudo-element: rgb(17 85 204);
|
|
158
159
|
|
|
159
160
|
/* Colors used by the code editor */
|
|
160
161
|
--color-secondary-cursor: #c0c0c0;
|
|
@@ -295,8 +296,9 @@
|
|
|
295
296
|
--color-token-comment: rgb(137 137 137);
|
|
296
297
|
--color-token-tag: rgb(93 176 215);
|
|
297
298
|
--color-token-attribute: rgb(155 187 220);
|
|
298
|
-
--color-token-attribute-value: rgb(
|
|
299
|
+
--color-token-attribute-value: rgb(242 151 102);
|
|
299
300
|
--color-token-meta: rgb(221 251 85);
|
|
301
|
+
--color-token-pseudo-element: rgb(237 119 229);
|
|
300
302
|
|
|
301
303
|
/* Colors used by the code editor */
|
|
302
304
|
--color-secondary-cursor: rgb(63 63 63);
|
|
@@ -36,23 +36,18 @@
|
|
|
36
36
|
import * as Common from '../../../core/common/common.js';
|
|
37
37
|
|
|
38
38
|
import inspectorSyntaxHighlightStyles from '../inspectorSyntaxHighlight.css.legacy.js';
|
|
39
|
-
import inspectorSyntaxHighlightDarkStyles from '../inspectorSyntaxHighlightDark.css.legacy.js';
|
|
40
39
|
|
|
41
40
|
let themeSupportInstance: ThemeSupport;
|
|
42
41
|
|
|
43
42
|
const themeValuesCache = new Map<CSSStyleDeclaration, Map<string, string>>();
|
|
44
43
|
|
|
45
|
-
export class ThemeSupport {
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
private
|
|
44
|
+
export class ThemeSupport extends EventTarget {
|
|
45
|
+
private themeNameInternal = 'systemPreferred';
|
|
46
|
+
private customSheets: Set<string> = new Set();
|
|
47
|
+
private computedRoot = Common.Lazy.lazy(() => window.getComputedStyle(document.documentElement));
|
|
49
48
|
|
|
50
|
-
private constructor(setting: Common.Settings.Setting<string>) {
|
|
51
|
-
|
|
52
|
-
this.themeNameInternal = setting.get() === 'systemPreferred' ? systemPreferredTheme : setting.get();
|
|
53
|
-
|
|
54
|
-
this.customSheets = new Set();
|
|
55
|
-
this.computedRoot = Common.Lazy.lazy(() => window.getComputedStyle(document.documentElement));
|
|
49
|
+
private constructor(private setting: Common.Settings.Setting<string>) {
|
|
50
|
+
super();
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
static hasInstance(): boolean {
|
|
@@ -119,16 +114,9 @@ export class ThemeSupport {
|
|
|
119
114
|
|
|
120
115
|
injectHighlightStyleSheets(element: Element|ShadowRoot): void {
|
|
121
116
|
this.appendStyle(element, inspectorSyntaxHighlightStyles);
|
|
122
|
-
if (this.themeNameInternal === 'dark') {
|
|
123
|
-
this.appendStyle(element, inspectorSyntaxHighlightDarkStyles);
|
|
124
|
-
}
|
|
125
117
|
}
|
|
126
118
|
|
|
127
|
-
|
|
128
|
-
* Note: this is a duplicate of the function in ui/utils. It exists here
|
|
129
|
-
* so there is no circular dependency between ui/utils and theme_support.
|
|
130
|
-
*/
|
|
131
|
-
private appendStyle(node: Node, {cssContent}: {cssContent: string}): void {
|
|
119
|
+
appendStyle(node: Node, {cssContent}: {cssContent: string}): void {
|
|
132
120
|
const styleElement = document.createElement('style');
|
|
133
121
|
styleElement.textContent = cssContent;
|
|
134
122
|
node.appendChild(styleElement);
|
|
@@ -142,28 +130,37 @@ export class ThemeSupport {
|
|
|
142
130
|
}
|
|
143
131
|
}
|
|
144
132
|
|
|
145
|
-
isForcedColorsMode(): boolean {
|
|
146
|
-
return window.matchMedia('(forced-colors: active)').matches;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
133
|
addCustomStylesheet(sheetText: string): void {
|
|
150
134
|
this.customSheets.add(sheetText);
|
|
151
135
|
}
|
|
152
136
|
|
|
153
137
|
applyTheme(document: Document): void {
|
|
154
|
-
|
|
138
|
+
const isForcedColorsMode = window.matchMedia('(forced-colors: active)').matches;
|
|
139
|
+
if (isForcedColorsMode) {
|
|
155
140
|
return;
|
|
156
141
|
}
|
|
157
142
|
|
|
158
|
-
|
|
143
|
+
const systemPreferredTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'default';
|
|
144
|
+
this.themeNameInternal = this.setting.get() === 'systemPreferred' ? systemPreferredTheme : this.setting.get();
|
|
145
|
+
|
|
146
|
+
const wasDarkThemed = document.documentElement.classList.contains('-theme-with-dark-background');
|
|
147
|
+
document.documentElement.classList.toggle('-theme-with-dark-background', this.themeNameInternal === 'dark');
|
|
148
|
+
|
|
149
|
+
const isDarkThemed = document.documentElement.classList.contains('-theme-with-dark-background');
|
|
150
|
+
|
|
151
|
+
// In the event the theme changes we need to clear caches and notify subscribers.
|
|
152
|
+
if (wasDarkThemed !== isDarkThemed) {
|
|
153
|
+
themeValuesCache.clear();
|
|
154
|
+
this.customSheets.clear();
|
|
155
|
+
this.dispatchEvent(new ThemeChangeEvent());
|
|
156
|
+
}
|
|
159
157
|
}
|
|
160
158
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
Background = 2,
|
|
159
|
+
|
|
160
|
+
export class ThemeChangeEvent extends Event {
|
|
161
|
+
static readonly eventName = 'themechange';
|
|
162
|
+
|
|
163
|
+
constructor() {
|
|
164
|
+
super(ThemeChangeEvent.eventName, {bubbles: true, composed: true});
|
|
168
165
|
}
|
|
169
166
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as ThemeSupport from '../theme_support/theme_support.js';
|
|
6
|
+
|
|
6
7
|
import {focusChanged} from './focus-changed.js';
|
|
7
8
|
import {injectCoreStyles} from './inject-core-styles.js';
|
|
8
9
|
|
|
@@ -24,7 +25,7 @@ export function createShadowRootWithCoreStyles(element: Element, options: Option
|
|
|
24
25
|
injectCoreStyles(shadowRoot);
|
|
25
26
|
if (cssFile) {
|
|
26
27
|
if ('cssContent' in cssFile) {
|
|
27
|
-
appendStyle(shadowRoot, cssFile);
|
|
28
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(shadowRoot, cssFile);
|
|
28
29
|
} else {
|
|
29
30
|
shadowRoot.adoptedStyleSheets = cssFile;
|
|
30
31
|
}
|
|
@@ -7,39 +7,11 @@ import textButtonStyles from '../textButton.css.legacy.js';
|
|
|
7
7
|
import * as ThemeSupport from '../theme_support/theme_support.js';
|
|
8
8
|
import themeColorsStyles from '../themeColors.css.legacy.js';
|
|
9
9
|
|
|
10
|
-
import {appendStyle} from './append-style.js';
|
|
11
|
-
|
|
12
10
|
export function injectCoreStyles(root: Element|ShadowRoot): void {
|
|
13
|
-
appendStyle(root, inspectorCommonStyles);
|
|
14
|
-
appendStyle(root, textButtonStyles);
|
|
15
|
-
appendStyle(root, themeColorsStyles);
|
|
11
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(root, inspectorCommonStyles);
|
|
12
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(root, textButtonStyles);
|
|
13
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(root, themeColorsStyles);
|
|
16
14
|
|
|
17
15
|
ThemeSupport.ThemeSupport.instance().injectHighlightStyleSheets(root);
|
|
18
16
|
ThemeSupport.ThemeSupport.instance().injectCustomStyleSheets(root);
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
let bodyComputedStylesCached: CSSStyleDeclaration|null = null;
|
|
22
|
-
export function getThemeColorValue(variableName: string): string {
|
|
23
|
-
if (!bodyComputedStylesCached) {
|
|
24
|
-
/**
|
|
25
|
-
* We are safe to cache this value as we're only using this code to look up
|
|
26
|
-
* theme variables, and they do not change during runtime. And if the user
|
|
27
|
-
* swaps from light => dark theme, or vice-versa, DevTools is entirely
|
|
28
|
-
* reloaded, removing this cache.
|
|
29
|
-
*/
|
|
30
|
-
bodyComputedStylesCached = window.getComputedStyle(document.body);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const colorValue = bodyComputedStylesCached.getPropertyValue(variableName);
|
|
34
|
-
if (!colorValue) {
|
|
35
|
-
throw new Error(`Could not find theme color for variable ${variableName}.`);
|
|
36
|
-
}
|
|
37
|
-
return colorValue;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function getCurrentTheme(): 'light'|'dark' {
|
|
41
|
-
if (document.documentElement.classList.contains('-theme-with-dark-background')) {
|
|
42
|
-
return 'dark';
|
|
43
|
-
}
|
|
44
|
-
return 'light';
|
|
45
|
-
}
|
|
@@ -4,19 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable rulesdir/es_modules_import */
|
|
6
6
|
|
|
7
|
-
import {appendStyle} from './append-style.js';
|
|
8
7
|
import {createShadowRootWithCoreStyles} from './create-shadow-root-with-core-styles.js';
|
|
9
8
|
import {focusChanged} from './focus-changed.js';
|
|
10
|
-
import {
|
|
9
|
+
import {injectCoreStyles} from './inject-core-styles.js';
|
|
11
10
|
import {measuredScrollbarWidth, resetMeasuredScrollbarWidthForTest} from './measured-scrollbar-width.js';
|
|
12
11
|
import {registerCustomElement} from './register-custom-element.js';
|
|
13
12
|
|
|
14
13
|
export {
|
|
15
|
-
appendStyle,
|
|
16
14
|
createShadowRootWithCoreStyles,
|
|
17
15
|
focusChanged,
|
|
18
|
-
getCurrentTheme,
|
|
19
|
-
getThemeColorValue,
|
|
20
16
|
injectCoreStyles,
|
|
21
17
|
measuredScrollbarWidth,
|
|
22
18
|
registerCustomElement,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as LitHtml from '../../third_party/lit-html/lit-html.js';
|
|
6
6
|
import * as Static from './static.js';
|
|
7
|
-
export {Directive, TemplateResult} from '../../third_party/lit-html/lit-html.js';
|
|
7
|
+
export {Directive, type TemplateResult} from '../../third_party/lit-html/lit-html.js';
|
|
8
8
|
|
|
9
9
|
const {render, svg, Directives, nothing, noChange} = LitHtml;
|
|
10
10
|
const {html, literal, flattenTemplate} = Static;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const CleanCSS = require('clean-css');
|
|
7
|
-
const [, , isDebugString, legacyString, targetName, srcDir, targetGenDir, files] = process.argv;
|
|
7
|
+
const [, , buildTimestamp, isDebugString, legacyString, targetName, srcDir, targetGenDir, files] = process.argv;
|
|
8
8
|
|
|
9
9
|
const filenames = files.split(',');
|
|
10
10
|
const configFiles = [];
|
|
@@ -37,7 +37,7 @@ export default styles;`;
|
|
|
37
37
|
|
|
38
38
|
fs.writeFileSync(
|
|
39
39
|
path.join(targetGenDir, generatedFileName),
|
|
40
|
-
`// Copyright ${new Date().getFullYear()} The Chromium Authors. All rights reserved.
|
|
40
|
+
`// Copyright ${new Date(Number(buildTimestamp) * 1000).getFullYear()} The Chromium Authors. All rights reserved.
|
|
41
41
|
// Use of this source code is governed by a BSD-style license that can be
|
|
42
42
|
// found in the LICENSE file.
|
|
43
43
|
// IMPORTANT: this file is auto generated. Please do not edit this file.
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
# Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
# found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
import("//build/timestamp.gni")
|
|
5
6
|
import("./node.gni")
|
|
6
7
|
import("./vars.gni")
|
|
8
|
+
|
|
7
9
|
template("generate_css") {
|
|
8
10
|
node_action(target_name) {
|
|
9
11
|
forward_variables_from(invoker, [ "sources" ])
|
|
@@ -17,6 +19,7 @@ template("generate_css") {
|
|
|
17
19
|
[ devtools_location_prepend + "node_modules/clean-css/package.json" ]
|
|
18
20
|
|
|
19
21
|
args = [
|
|
22
|
+
build_timestamp,
|
|
20
23
|
"$is_debug",
|
|
21
24
|
"${invoker.legacy}",
|
|
22
25
|
target_name,
|