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.
Files changed (53) hide show
  1. package/config/gni/devtools_grd_files.gni +0 -2
  2. package/front_end/Images/generate-css-vars.js +2 -2
  3. package/front_end/core/common/ParsedURL.ts +35 -2
  4. package/front_end/core/common/Settings.ts +1 -1
  5. package/front_end/core/host/InspectorFrontendHost.ts +2 -1
  6. package/front_end/core/i18n/i18nImpl.ts +2 -3
  7. package/front_end/core/i18n/locales/en-US.json +6 -3
  8. package/front_end/core/i18n/locales/en-XL.json +6 -3
  9. package/front_end/core/root/Runtime.ts +0 -72
  10. package/front_end/core/root/root-legacy.ts +0 -2
  11. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +10 -0
  12. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +3 -4
  13. package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +4 -7
  14. package/front_end/entrypoints/main/MainImpl.ts +21 -13
  15. package/front_end/entrypoints/main/main-meta.ts +1 -1
  16. package/front_end/models/extensions/ExtensionServer.ts +1 -22
  17. package/front_end/models/formatter/FormatterWorkerPool.ts +2 -12
  18. package/front_end/models/formatter/ScriptFormatter.ts +3 -3
  19. package/front_end/panels/application/AppManifestView.ts +41 -0
  20. package/front_end/panels/console/ConsoleSidebar.ts +9 -9
  21. package/front_end/panels/elements/ElementsPanel.ts +1 -1
  22. package/front_end/panels/elements/components/LayoutPane.ts +1 -1
  23. package/front_end/panels/emulation/AdvancedApp.ts +2 -2
  24. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -1
  25. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +19 -0
  26. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +7 -1
  27. package/front_end/third_party/acorn/acorn.ts +1 -1
  28. package/front_end/ui/legacy/ResizerWidget.ts +4 -2
  29. package/front_end/ui/legacy/SoftDropDown.ts +2 -1
  30. package/front_end/ui/legacy/TextPrompt.ts +2 -2
  31. package/front_end/ui/legacy/Treeoutline.ts +2 -1
  32. package/front_end/ui/legacy/UIUtils.ts +1 -8
  33. package/front_end/ui/legacy/ViewManager.ts +1 -1
  34. package/front_end/ui/legacy/Widget.ts +3 -2
  35. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -0
  36. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -1
  37. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
  38. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +1 -2
  39. package/front_end/ui/legacy/inspectorSyntaxHighlight.css +8 -11
  40. package/front_end/ui/legacy/softContextMenu.css +4 -1
  41. package/front_end/ui/legacy/themeColors.css +3 -1
  42. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +29 -32
  43. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +3 -2
  44. package/front_end/ui/legacy/utils/inject-core-styles.ts +3 -31
  45. package/front_end/ui/legacy/utils/utils.ts +1 -5
  46. package/front_end/ui/lit-html/lit-html.ts +1 -1
  47. package/package.json +1 -1
  48. package/scripts/build/generate_css_js_files.js +2 -2
  49. package/scripts/build/ninja/generate_css.gni +3 -0
  50. package/scripts/eslint_rules/lib/no_bound_component_methods.js +116 -0
  51. package/scripts/eslint_rules/tests/no_bound_component_methods_test.js +85 -0
  52. package/front_end/ui/legacy/inspectorSyntaxHighlightDark.css +0 -270
  53. package/front_end/ui/legacy/utils/append-style.ts +0 -9
@@ -1553,7 +1553,6 @@ grd_files_debug_sources = [
1553
1553
  "front_end/ui/legacy/inspectorCommon.css.js",
1554
1554
  "front_end/ui/legacy/inspectorCommon.css.legacy.js",
1555
1555
  "front_end/ui/legacy/inspectorSyntaxHighlight.css.legacy.js",
1556
- "front_end/ui/legacy/inspectorSyntaxHighlightDark.css.legacy.js",
1557
1556
  "front_end/ui/legacy/inspectorViewTabbedPane.css.legacy.js",
1558
1557
  "front_end/ui/legacy/listWidget.css.legacy.js",
1559
1558
  "front_end/ui/legacy/popover.css.legacy.js",
@@ -1578,7 +1577,6 @@ grd_files_debug_sources = [
1578
1577
  "front_end/ui/legacy/theme_support/theme_support_impl.js",
1579
1578
  "front_end/ui/legacy/toolbar.css.legacy.js",
1580
1579
  "front_end/ui/legacy/treeoutline.css.legacy.js",
1581
- "front_end/ui/legacy/utils/append-style.js",
1582
1580
  "front_end/ui/legacy/utils/create-shadow-root-with-core-styles.js",
1583
1581
  "front_end/ui/legacy/utils/focus-changed.js",
1584
1582
  "front_end/ui/legacy/utils/inject-core-styles.js",
@@ -3,7 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
- const [, , targetGenDir, targetName, ...imageSources] = process.argv;
6
+ const [, , buildTimestamp, targetGenDir, targetName, ...imageSources] = process.argv;
7
7
 
8
8
  /**
9
9
  * @param {string} fileName
@@ -18,7 +18,7 @@ function generateCSSVariableDefinition(fileName) {
18
18
  fileName}', import.meta.url).toString() + '\\")');`;
19
19
  }
20
20
 
21
- const CURRENT_YEAR = new Date().getFullYear();
21
+ const CURRENT_YEAR = new Date(Number(buildTimestamp) * 1000).getFullYear();
22
22
  const fileContent = `
23
23
  // Copyright ${CURRENT_YEAR} The Chromium Authors. All rights reserved.
24
24
  // Use of this source code is governed by a BSD-style license that can be
@@ -29,7 +29,40 @@
29
29
  */
30
30
 
31
31
  import * as Platform from '../platform/platform.js';
32
- import * as Root from '../root/root.js';
32
+
33
+ /**
34
+ * http://tools.ietf.org/html/rfc3986#section-5.2.4
35
+ */
36
+ export function normalizePath(path: string): string {
37
+ if (path.indexOf('..') === -1 && path.indexOf('.') === -1) {
38
+ return path;
39
+ }
40
+
41
+ const normalizedSegments = [];
42
+ const segments = path.split('/');
43
+ for (const segment of segments) {
44
+ if (segment === '.') {
45
+ continue;
46
+ } else if (segment === '..') {
47
+ normalizedSegments.pop();
48
+ } else if (segment) {
49
+ normalizedSegments.push(segment);
50
+ }
51
+ }
52
+ let normalizedPath = normalizedSegments.join('/');
53
+ if (normalizedPath[normalizedPath.length - 1] === '/') {
54
+ return normalizedPath;
55
+ }
56
+ if (path[0] === '/' && normalizedPath) {
57
+ normalizedPath = '/' + normalizedPath;
58
+ }
59
+ if ((path[path.length - 1] === '/') || (segments[segments.length - 1] === '.') ||
60
+ (segments[segments.length - 1] === '..')) {
61
+ normalizedPath = normalizedPath + '/';
62
+ }
63
+
64
+ return normalizedPath;
65
+ }
33
66
 
34
67
  export class ParsedURL {
35
68
  isValid: boolean;
@@ -291,7 +324,7 @@ export class ParsedURL {
291
324
  if (hrefPath.charAt(0) !== '/') {
292
325
  hrefPath = parsedURL.folderPathComponents + '/' + hrefPath;
293
326
  }
294
- return securityOrigin + Root.Runtime.Runtime.normalizePath(hrefPath) + hrefSuffix;
327
+ return securityOrigin + normalizePath(hrefPath) + hrefSuffix;
295
328
  }
296
329
 
297
330
  static splitLineAndColumn(string: string): {
@@ -36,7 +36,7 @@ import {Format} from './Color.js';
36
36
  import {Console} from './Console.js';
37
37
  import type {GenericEvents, EventDescriptor, EventTargetEvent} from './EventTarget.js';
38
38
  import {ObjectWrapper} from './Object.js';
39
- import {getLocalizedSettingsCategory, getRegisteredSettings, maybeRemoveSettingExtension, RegExpSettingItem, registerSettingExtension, registerSettingsForTest, resetSettings, SettingCategory, SettingExtensionOption, SettingRegistration, SettingType} from './SettingRegistration.js';
39
+ import {getLocalizedSettingsCategory, getRegisteredSettings, maybeRemoveSettingExtension, type RegExpSettingItem, registerSettingExtension, registerSettingsForTest, resetSettings, SettingCategory, type SettingExtensionOption, type SettingRegistration, SettingType} from './SettingRegistration.js';
40
40
 
41
41
  let settingsInstance: Settings|undefined;
42
42
 
@@ -220,7 +220,8 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
220
220
 
221
221
  loadNetworkResource(
222
222
  url: string, headers: string, streamId: number, callback: (arg0: LoadNetworkResourceResult) => void): void {
223
- Root.Runtime.loadResourcePromise(url)
223
+ fetch(url)
224
+ .then(result => result.text())
224
225
  .then(function(text) {
225
226
  resourceLoaderStreamWrite(streamId, text);
226
227
  callback({
@@ -56,11 +56,10 @@ function getLocaleFetchUrl(locale: Intl.UnicodeBCP47LocaleIdentifier): string {
56
56
  * fetched locally or remotely.
57
57
  */
58
58
  export async function fetchAndRegisterLocaleData(locale: Intl.UnicodeBCP47LocaleIdentifier): Promise<void> {
59
- const localeDataTextPromise = Root.Runtime.loadResourcePromise(getLocaleFetchUrl(locale));
59
+ const localeDataTextPromise = fetch(getLocaleFetchUrl(locale)).then(result => result.json());
60
60
  const timeoutPromise =
61
61
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('timed out fetching locale')), 5000));
62
- const localeDataText = await Promise.race([timeoutPromise, localeDataTextPromise]);
63
- const localeData = JSON.parse(localeDataText as string);
62
+ const localeData = await Promise.race([timeoutPromise, localeDataTextPromise]);
64
63
  i18nInstance.registerLocaleData(locale, localeData);
65
64
  }
66
65
 
@@ -1190,9 +1190,6 @@
1190
1190
  "entrypoints/main/MainImpl.ts | showConsoleDrawer": {
1191
1191
  "message": "Show console drawer"
1192
1192
  },
1193
- "entrypoints/main/MainImpl.ts | theSystempreferredColorSchemeHas": {
1194
- "message": "The system-preferred color scheme has changed. To apply this change to DevTools, reload."
1195
- },
1196
1193
  "entrypoints/main/MainImpl.ts | undockIntoSeparateWindow": {
1197
1194
  "message": "Undock into separate window"
1198
1195
  },
@@ -2174,6 +2171,12 @@
2174
2171
  "panels/application/AppManifestView.ts | couldNotDownloadARequiredIcon": {
2175
2172
  "message": "Could not download a required icon from the manifest"
2176
2173
  },
2174
+ "panels/application/AppManifestView.ts | darkBackgroundColor": {
2175
+ "message": "Dark background color"
2176
+ },
2177
+ "panels/application/AppManifestView.ts | darkThemeColor": {
2178
+ "message": "Dark theme color"
2179
+ },
2177
2180
  "panels/application/AppManifestView.ts | description": {
2178
2181
  "message": "Description"
2179
2182
  },
@@ -1190,9 +1190,6 @@
1190
1190
  "entrypoints/main/MainImpl.ts | showConsoleDrawer": {
1191
1191
  "message": "Ŝh́ôẃ ĉón̂śôĺê d́r̂áŵér̂"
1192
1192
  },
1193
- "entrypoints/main/MainImpl.ts | theSystempreferredColorSchemeHas": {
1194
- "message": "T̂h́ê śŷśt̂ém̂-ṕr̂éf̂ér̂ŕêd́ ĉól̂ór̂ śĉh́êḿê h́âś ĉh́âńĝéd̂. T́ô áp̂ṕl̂ý t̂h́îś ĉh́âńĝé t̂ó D̂év̂T́ôól̂ś, r̂él̂óâd́."
1195
- },
1196
1193
  "entrypoints/main/MainImpl.ts | undockIntoSeparateWindow": {
1197
1194
  "message": "Ûńd̂óĉḱ îńt̂ó ŝép̂ár̂át̂é ŵín̂d́ôẃ"
1198
1195
  },
@@ -2174,6 +2171,12 @@
2174
2171
  "panels/application/AppManifestView.ts | couldNotDownloadARequiredIcon": {
2175
2172
  "message": "Ĉóûĺd̂ ńôt́ d̂óŵńl̂óâd́ â ŕêq́ûír̂éd̂ íĉón̂ f́r̂óm̂ t́ĥé m̂án̂íf̂éŝt́"
2176
2173
  },
2174
+ "panels/application/AppManifestView.ts | darkBackgroundColor": {
2175
+ "message": "D̂ár̂ḱ b̂áĉḱĝŕôún̂d́ ĉól̂ór̂"
2176
+ },
2177
+ "panels/application/AppManifestView.ts | darkThemeColor": {
2178
+ "message": "D̂ár̂ḱ t̂h́êḿê ćôĺôŕ"
2179
+ },
2177
2180
  "panels/application/AppManifestView.ts | description": {
2178
2181
  "message": "D̂éŝćr̂íp̂t́îón̂"
2179
2182
  },
@@ -47,40 +47,6 @@ export class Runtime {
47
47
  runtimeInstance = undefined;
48
48
  }
49
49
 
50
- /**
51
- * http://tools.ietf.org/html/rfc3986#section-5.2.4
52
- */
53
- static normalizePath(path: string): string {
54
- if (path.indexOf('..') === -1 && path.indexOf('.') === -1) {
55
- return path;
56
- }
57
-
58
- const normalizedSegments = [];
59
- const segments = path.split('/');
60
- for (const segment of segments) {
61
- if (segment === '.') {
62
- continue;
63
- } else if (segment === '..') {
64
- normalizedSegments.pop();
65
- } else if (segment) {
66
- normalizedSegments.push(segment);
67
- }
68
- }
69
- let normalizedPath = normalizedSegments.join('/');
70
- if (normalizedPath[normalizedPath.length - 1] === '/') {
71
- return normalizedPath;
72
- }
73
- if (path[0] === '/' && normalizedPath) {
74
- normalizedPath = '/' + normalizedPath;
75
- }
76
- if ((path[path.length - 1] === '/') || (segments[segments.length - 1] === '.') ||
77
- (segments[segments.length - 1] === '..')) {
78
- normalizedPath = normalizedPath + '/';
79
- }
80
-
81
- return normalizedPath;
82
- }
83
-
84
50
  static queryParam(name: string): string|null {
85
51
  return queryParamsObject.get(name);
86
52
  }
@@ -132,15 +98,6 @@ export class Runtime {
132
98
  return true;
133
99
  }
134
100
 
135
- static resolveSourceURL(path: string): string {
136
- let sourceURL: string = self.location.href;
137
- if (self.location.search) {
138
- sourceURL = sourceURL.replace(self.location.search, '');
139
- }
140
- sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf('/') + 1) + path;
141
- return '\n/*# sourceURL=' + sourceURL + ' */';
142
- }
143
-
144
101
  loadLegacyModule(modulePath: string): Promise<void> {
145
102
  return import(`../../${modulePath}`);
146
103
  }
@@ -297,35 +254,6 @@ export class Experiment {
297
254
  }
298
255
  }
299
256
 
300
- export function loadResourcePromise(url: string): Promise<string> {
301
- return new Promise<string>(load);
302
-
303
- function load(fulfill: (arg0: string) => void, reject: (arg0: Error) => void): void {
304
- const xhr = new XMLHttpRequest();
305
- xhr.open('GET', url, true);
306
- xhr.onreadystatechange = onreadystatechange;
307
-
308
- function onreadystatechange(this: XMLHttpRequest, _e: Event): void {
309
- if (xhr.readyState !== XMLHttpRequest.DONE) {
310
- return;
311
- }
312
-
313
- const response: string = this.response;
314
-
315
- // DevTools Proxy server can mask 404s as 200s, check the body to be sure
316
- const status = /^HTTP\/1.1 404/.test(response) ? 404 : xhr.status;
317
-
318
- if ([0, 200, 304].indexOf(status) === -1) // Testing harness file:/// results in 0.
319
- {
320
- reject(new Error('While loading from url ' + url + ' server responded with a status of ' + status));
321
- } else {
322
- fulfill(response);
323
- }
324
- }
325
- xhr.send(null);
326
- }
327
- }
328
-
329
257
  // This must be constructed after the query parameters have been parsed.
330
258
  export const experiments = new ExperimentsSupport();
331
259
 
@@ -20,8 +20,6 @@ Root.Runtime.queryParam = RootModule.Runtime.Runtime.queryParam;
20
20
  /** @type {!RootModule.Runtime.Runtime} */
21
21
  Root.runtime;
22
22
 
23
- Root.Runtime.loadResourcePromise = RootModule.Runtime.loadResourcePromise;
24
-
25
23
  /** @constructor */
26
24
  Root.Runtime.Extension = RootModule.Runtime.Extension;
27
25
 
@@ -11,3 +11,13 @@ export const enum FormatterActions {
11
11
  EVALUATE_JAVASCRIPT_SUBSTRING = 'evaluatableJavaScriptSubstring',
12
12
  ARGUMENTS_LIST = 'argumentsList',
13
13
  }
14
+
15
+ export interface FormatMapping {
16
+ original: number[];
17
+ formatted: number[];
18
+ }
19
+
20
+ export interface FormatResult {
21
+ content: string;
22
+ mapping: FormatMapping;
23
+ }
@@ -30,7 +30,6 @@
30
30
 
31
31
  import * as Platform from '../../core/platform/platform.js';
32
32
  import * as Root from '../../core/root/root.js';
33
- import type * as Formatter from '../../models/formatter/formatter.js';
34
33
  import * as Acorn from '../../third_party/acorn/acorn.js';
35
34
  import type * as CodeMirrorModule from '../../third_party/codemirror/codemirror-legacy.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
36
35
 
@@ -38,6 +37,7 @@ import {AcornTokenizer, ECMA_VERSION} from './AcornTokenizer.js';
38
37
  import {CSSFormatter} from './CSSFormatter.js';
39
38
  import {ESTreeWalker} from './ESTreeWalker.js';
40
39
  import {FormattedContentBuilder} from './FormattedContentBuilder.js';
40
+ import type {FormatResult} from './FormatterActions.js';
41
41
  import {HTMLFormatter} from './HTMLFormatter.js';
42
42
  import {IdentityFormatter} from './IdentityFormatter.js';
43
43
  import {JavaScriptFormatter} from './JavaScriptFormatter.js';
@@ -179,12 +179,11 @@ export function javaScriptIdentifiers(content: string): {
179
179
  return identifiers.map(id => ({name: 'name' in id && id.name || undefined, offset: id.start}));
180
180
  }
181
181
 
182
- export function format(
183
- mimeType: string, text: string, indentString?: string): Formatter.FormatterWorkerPool.FormatResult {
182
+ export function format(mimeType: string, text: string, indentString?: string): FormatResult {
184
183
  // Default to a 4-space indent.
185
184
  indentString = indentString || ' ';
186
185
 
187
- let result: Formatter.FormatterWorkerPool.FormatResult;
186
+ let result: FormatResult;
188
187
  const builder = new FormattedContentBuilder(indentString);
189
188
  const lineEndings = Platform.StringUtilities.findLineEndingIndexes(text);
190
189
  try {
@@ -87,20 +87,17 @@ async function fetchLocaleData(locales: string[]): Promise<string|void> {
87
87
 
88
88
  // Try to load the locale data.
89
89
  try {
90
- let localeDataTextPromise;
91
90
  const remoteBase = Root.Runtime.getRemoteBase();
91
+ let localeUrl: string;
92
92
  if (remoteBase && remoteBase.base) {
93
- const localeUrl = `${remoteBase.base}third_party/lighthouse/locales/${locale}.json`;
94
- localeDataTextPromise = Root.Runtime.loadResourcePromise(localeUrl);
93
+ localeUrl = `${remoteBase.base}third_party/lighthouse/locales/${locale}.json`;
95
94
  } else {
96
- const localeUrl = new URL(`../../third_party/lighthouse/locales/${locale}.json`, import.meta.url);
97
- localeDataTextPromise = Root.Runtime.loadResourcePromise(localeUrl.toString());
95
+ localeUrl = new URL(`../../third_party/lighthouse/locales/${locale}.json`, import.meta.url).toString();
98
96
  }
99
97
 
100
98
  const timeoutPromise = new Promise<string>(
101
99
  (resolve, reject) => setTimeout(() => reject(new Error('timed out fetching locale')), 5000));
102
- const localeDataText = await Promise.race([timeoutPromise, localeDataTextPromise]);
103
- const localeData = JSON.parse(localeDataText);
100
+ const localeData = await Promise.race([timeoutPromise, fetch(localeUrl).then(result => result.json())]);
104
101
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
105
102
  self.registerLocaleData(locale, localeData);
106
103
  return locale;
@@ -51,16 +51,12 @@ import * as IconButton from '../../ui/components/icon_button/icon_button.js';
51
51
  import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
52
52
  import * as Components from '../../ui/legacy/components/utils/utils.js';
53
53
  import * as UI from '../../ui/legacy/legacy.js';
54
+ import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
54
55
 
55
56
  import {ExecutionContextSelector} from './ExecutionContextSelector.js';
56
57
 
57
58
  const UIStrings = {
58
59
  /**
59
- *@description A message to display prompting the user to reload DevTools if the OS color scheme changes.
60
- */
61
- theSystempreferredColorSchemeHas:
62
- 'The system-preferred color scheme has changed. To apply this change to DevTools, reload.',
63
- /**
64
60
  *@description Title of item in main
65
61
  */
66
62
  customizeAndControlDevtools: 'Customize and control DevTools',
@@ -408,14 +404,26 @@ export class MainImpl {
408
404
 
409
405
  const defaultThemeSetting = 'systemPreferred';
410
406
  const themeSetting = Common.Settings.Settings.instance().createSetting('uiTheme', defaultThemeSetting);
411
- UI.UIUtils.initializeUIUtils(document, themeSetting);
412
- if (themeSetting.get() === defaultThemeSetting) {
413
- const darkThemeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
414
- darkThemeMediaQuery.addEventListener('change', () => {
415
- UI.InspectorView.InspectorView.instance().displayReloadRequiredWarning(
416
- i18nString(UIStrings.theSystempreferredColorSchemeHas));
417
- });
407
+ UI.UIUtils.initializeUIUtils(document);
408
+
409
+ // Initialize theme support and apply it.
410
+ if (!ThemeSupport.ThemeSupport.hasInstance()) {
411
+ ThemeSupport.ThemeSupport.instance({forceNew: true, setting: themeSetting});
418
412
  }
413
+
414
+ ThemeSupport.ThemeSupport.instance().applyTheme(document);
415
+
416
+ const onThemeChange = (): void => {
417
+ ThemeSupport.ThemeSupport.instance().applyTheme(document);
418
+ };
419
+
420
+ // When the theme changes we instantiate a new theme support and reapply.
421
+ // Equally if the user has set to match the system and the OS preference changes
422
+ // we perform the same change.
423
+ const darkThemeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
424
+ darkThemeMediaQuery.addEventListener('change', onThemeChange);
425
+ themeSetting.addChangeListener(onThemeChange);
426
+
419
427
  UI.UIUtils.installComponentRootStyles((document.body as Element));
420
428
 
421
429
  this.#addMainEventListeners(document);
@@ -798,7 +806,7 @@ export class MainMenuItem implements UI.Toolbar.Provider {
798
806
  dockItemElement.classList.add('flex-auto');
799
807
  dockItemElement.tabIndex = -1;
800
808
  UI.ARIAUtils.setAccessibleName(dockItemElement, UIStrings.dockSide);
801
- const titleElement = dockItemElement.createChild('span', 'flex-auto');
809
+ const titleElement = dockItemElement.createChild('span', 'dockside-title');
802
810
  titleElement.textContent = i18nString(UIStrings.dockSide);
803
811
  const toggleDockSideShorcuts =
804
812
  UI.ShortcutRegistry.ShortcutRegistry.instance().shortcutsForAction('main.toggle-dock');
@@ -588,7 +588,7 @@ Common.Settings.registerSettingExtension({
588
588
  settingName: 'uiTheme',
589
589
  settingType: Common.Settings.SettingType.ENUM,
590
590
  defaultValue: 'systemPreferred',
591
- reloadRequired: true,
591
+ reloadRequired: false,
592
592
  options: [
593
593
  {
594
594
  title: i18nLazyString(UIStrings.switchToSystemPreferredColor),
@@ -952,28 +952,7 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
952
952
  }
953
953
 
954
954
  private expandResourcePath(extensionPath: string, resourcePath: string): string {
955
- return extensionPath + this.normalizePath(resourcePath);
956
- }
957
-
958
- private normalizePath(path: string): string {
959
- const source = path.split('/');
960
- const result = [];
961
-
962
- for (let i = 0; i < source.length; ++i) {
963
- if (source[i] === '.') {
964
- continue;
965
- }
966
- // Ignore empty path components resulting from //, as well as a leading and traling slashes.
967
- if (source[i] === '') {
968
- continue;
969
- }
970
- if (source[i] === '..') {
971
- result.pop();
972
- } else {
973
- result.push(source[i]);
974
- }
975
- }
976
- return '/' + result.join('/');
955
+ return extensionPath + '/' + Common.ParsedURL.normalizePath(resourcePath);
977
956
  }
978
957
 
979
958
  evaluate(
@@ -119,9 +119,9 @@ export class FormatterWorkerPool {
119
119
  });
120
120
  }
121
121
 
122
- format(mimeType: string, content: string, indentString: string): Promise<FormatResult> {
122
+ format(mimeType: string, content: string, indentString: string): Promise<FormatterActions.FormatResult> {
123
123
  const parameters = {mimeType: mimeType, content: content, indentString: indentString};
124
- return this.runTask(FormatterActions.FormatterActions.FORMAT, parameters) as Promise<FormatResult>;
124
+ return this.runTask(FormatterActions.FormatterActions.FORMAT, parameters) as Promise<FormatterActions.FormatResult>;
125
125
  }
126
126
 
127
127
  javaScriptIdentifiers(content: string): Promise<{
@@ -195,11 +195,6 @@ class Task {
195
195
  }
196
196
  }
197
197
 
198
- export interface FormatResult {
199
- content: string;
200
- mapping: FormatMapping;
201
- }
202
-
203
198
  interface CSSProperty {
204
199
  name: string;
205
200
  nameRange: TextRange;
@@ -220,11 +215,6 @@ export interface OutlineItem {
220
215
  subtitle?: string;
221
216
  }
222
217
 
223
- export interface FormatMapping {
224
- original: number[];
225
- formatted: number[];
226
- }
227
-
228
218
  export interface CSSStyleRule {
229
219
  selectorText: string;
230
220
  styleRange: TextRange;
@@ -30,8 +30,8 @@
30
30
 
31
31
  import * as Common from '../../core/common/common.js';
32
32
  import * as Platform from '../../core/platform/platform.js';
33
+ import type * as FormatterActions from '../../entrypoints/formatter_worker/FormatterActions.js'; // eslint-disable-line rulesdir/es_modules_import
33
34
 
34
- import type {FormatMapping} from './FormatterWorkerPool.js';
35
35
  import {formatterWorkerPool} from './FormatterWorkerPool.js';
36
36
 
37
37
  function locationToPosition(lineEndings: number[], lineNumber: number, columnNumber: number): number {
@@ -102,9 +102,9 @@ class IdentityFormatterSourceMapping implements FormatterSourceMapping {
102
102
  class FormatterSourceMappingImpl implements FormatterSourceMapping {
103
103
  private readonly originalLineEndings: number[];
104
104
  private readonly formattedLineEndings: number[];
105
- private readonly mapping: FormatMapping;
105
+ private readonly mapping: FormatterActions.FormatMapping;
106
106
 
107
- constructor(originalLineEndings: number[], formattedLineEndings: number[], mapping: FormatMapping) {
107
+ constructor(originalLineEndings: number[], formattedLineEndings: number[], mapping: FormatterActions.FormatMapping) {
108
108
  this.originalLineEndings = originalLineEndings;
109
109
  this.formattedLineEndings = formattedLineEndings;
110
110
  this.mapping = mapping;
@@ -102,6 +102,14 @@ const UIStrings = {
102
102
  */
103
103
  backgroundColor: 'Background color',
104
104
  /**
105
+ *@description Text in App Manifest View of the Application panel
106
+ */
107
+ darkThemeColor: 'Dark theme color',
108
+ /**
109
+ *@description Text in App Manifest View of the Application panel
110
+ */
111
+ darkBackgroundColor: 'Dark background color',
112
+ /**
105
113
  *@description Text for the orientation of something
106
114
  */
107
115
  orientation: 'Orientation',
@@ -403,6 +411,10 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
403
411
  private readonly startURLField: HTMLElement;
404
412
  private readonly themeColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
405
413
  private readonly backgroundColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
414
+ private readonly darkThemeColorField: HTMLElement;
415
+ private readonly darkThemeColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
416
+ private readonly darkBackgroundColorField: HTMLElement;
417
+ private readonly darkBackgroundColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
406
418
  private orientationField: HTMLElement;
407
419
  private displayField: HTMLElement;
408
420
  private readonly newNoteUrlField: HTMLElement;
@@ -456,6 +468,14 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
456
468
  this.backgroundColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
457
469
  backgroundColorField.appendChild(this.backgroundColorSwatch);
458
470
 
471
+ this.darkThemeColorField = this.presentationSection.appendField(i18nString(UIStrings.darkThemeColor));
472
+ this.darkThemeColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
473
+ this.darkThemeColorField.appendChild(this.darkThemeColorSwatch);
474
+
475
+ this.darkBackgroundColorField = this.presentationSection.appendField(i18nString(UIStrings.darkBackgroundColor));
476
+ this.darkBackgroundColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
477
+ this.darkBackgroundColorField.appendChild(this.darkBackgroundColorSwatch);
478
+
459
479
  this.orientationField = this.presentationSection.appendField(i18nString(UIStrings.orientation));
460
480
  this.displayField = this.presentationSection.appendField(i18nString(UIStrings.display));
461
481
 
@@ -634,6 +654,27 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
634
654
  this.backgroundColorSwatch.renderColor(backgroundColor, true);
635
655
  }
636
656
 
657
+ const userPreferences = parsedManifest['user_preferences'] || {};
658
+ const colorSchemeDark = userPreferences['color_scheme_dark'] || {};
659
+ const darkThemeColorString = colorSchemeDark['theme_color'];
660
+ const hasDarkThemeColor = typeof darkThemeColorString === 'string';
661
+ this.darkThemeColorField.parentElement?.classList.toggle('hidden', !hasDarkThemeColor);
662
+ if (hasDarkThemeColor) {
663
+ const darkThemeColor = Common.Color.Color.parse(darkThemeColorString);
664
+ if (darkThemeColor) {
665
+ this.darkThemeColorSwatch.renderColor(darkThemeColor, true);
666
+ }
667
+ }
668
+ const darkBackgroundColorString = colorSchemeDark['background_color'];
669
+ const hasDarkBackgroundColor = typeof darkBackgroundColorString === 'string';
670
+ this.darkBackgroundColorField.parentElement?.classList.toggle('hidden', !hasDarkBackgroundColor);
671
+ if (hasDarkBackgroundColor) {
672
+ const darkBackgroundColor = Common.Color.Color.parse(darkBackgroundColorString);
673
+ if (darkBackgroundColor) {
674
+ this.darkBackgroundColorSwatch.renderColor(darkBackgroundColor, true);
675
+ }
676
+ }
677
+
637
678
  this.orientationField.textContent = stringProperty('orientation');
638
679
  const displayType = stringProperty('display');
639
680
  this.displayField.textContent = displayType;
@@ -178,6 +178,15 @@ export class URLGroupTreeElement extends ConsoleSidebarTreeElement {
178
178
  }
179
179
  }
180
180
 
181
+ const enum GroupName {
182
+ ConsoleAPI = 'user message',
183
+ All = 'message',
184
+ Error = 'error',
185
+ Warning = 'warning',
186
+ Info = 'info',
187
+ Verbose = 'verbose',
188
+ }
189
+
181
190
  /**
182
191
  * Maps the GroupName for a filter to the UIString used to render messages.
183
192
  * Stored here so we only construct it once at runtime, rather than everytime we
@@ -274,12 +283,3 @@ export class FilterTreeElement extends ConsoleSidebarTreeElement {
274
283
  return child;
275
284
  }
276
285
  }
277
-
278
- const enum GroupName {
279
- ConsoleAPI = 'user message',
280
- All = 'message',
281
- Error = 'error',
282
- Warning = 'warning',
283
- Info = 'info',
284
- Verbose = 'verbose',
285
- }
@@ -1369,7 +1369,7 @@ export class ElementsActionDelegate implements UI.ActionRegistration.ActionDeleg
1369
1369
  treeOutline.duplicateNode(node);
1370
1370
  return true;
1371
1371
  case 'elements.copy-styles':
1372
- treeOutline.findTreeElement(node)?.copyStyles();
1372
+ void treeOutline.findTreeElement(node)?.copyStyles();
1373
1373
  return true;
1374
1374
  case 'elements.undo':
1375
1375
  void SDK.DOMModel.DOMModelUndoStack.instance().undo();
@@ -8,7 +8,7 @@ import * as UI from '../../../ui/legacy/legacy.js';
8
8
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
9
9
 
10
10
  import type {BooleanSetting, EnumSetting, Setting} from './LayoutPaneUtils.js';
11
- import {LayoutElement} from './LayoutPaneUtils.js';
11
+ import type {LayoutElement} from './LayoutPaneUtils.js';
12
12
 
13
13
  import type {NodeTextData} from './NodeText.js';
14
14
  import {NodeText} from './NodeText.js';
@@ -77,8 +77,8 @@ export class AdvancedApp implements Common.App.App {
77
77
  }
78
78
 
79
79
  deviceModeEmulationFrameLoaded(toolboxDocument: Document): void {
80
- UI.UIUtils.initializeUIUtils(
81
- toolboxDocument, Common.Settings.Settings.instance().createSetting('uiTheme', 'default'));
80
+ Common.Settings.Settings.instance().createSetting('uiTheme', 'default');
81
+ UI.UIUtils.initializeUIUtils(toolboxDocument);
82
82
  UI.UIUtils.installComponentRootStyles((toolboxDocument.body as Element));
83
83
  UI.ContextMenu.ContextMenu.installHandler(toolboxDocument);
84
84
 
@@ -257,7 +257,8 @@ export class PerformanceMonitorImpl extends UI.Widget.HBox implements
257
257
  color: metricInfo.color,
258
258
  });
259
259
  }
260
- const backgroundColor = Common.Color.Color.parse(UI.Utils.getThemeColorValue('--color-background'));
260
+ const backgroundColor =
261
+ Common.Color.Color.parse(ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background'));
261
262
 
262
263
  if (backgroundColor) {
263
264
  for (const path of paths.reverse()) {