chrome-devtools-frontend 1.0.1609381 → 1.0.1611390

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 (29) hide show
  1. package/eslint.config.mjs +3 -1
  2. package/front_end/core/host/AidaGcaTranslation.ts +1 -1
  3. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +0 -10
  4. package/front_end/generated/SupportedCSSProperties.js +23 -4
  5. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +8 -1
  6. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +10 -5
  7. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -12
  8. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +7 -9
  9. package/front_end/panels/ai_assistance/components/ChatMessage.ts +35 -19
  10. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +1 -1
  11. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -0
  12. package/front_end/panels/ai_assistance/components/chatMessage.css +2 -0
  13. package/front_end/panels/ai_assistance/components/walkthroughView.css +5 -4
  14. package/front_end/panels/console/ConsolePinPane.ts +6 -2
  15. package/front_end/panels/lighthouse/LighthousePanel.ts +3 -1
  16. package/front_end/third_party/chromium/README.chromium +1 -1
  17. package/front_end/third_party/lighthouse/README.chromium +2 -2
  18. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +5635 -1498
  19. package/front_end/third_party/lighthouse/locales/en-GB.json +2 -2
  20. package/front_end/third_party/lighthouse/locales/en-US.json +14 -2
  21. package/front_end/third_party/lighthouse/locales/en-XL.json +12 -0
  22. package/front_end/third_party/lighthouse/report/bundle.d.ts +4 -4
  23. package/front_end/third_party/lighthouse/report/bundle.js +30 -3
  24. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +2 -2
  25. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +83 -68
  26. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  27. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -3
  28. package/mcp/mcp.ts +2 -0
  29. package/package.json +4 -5
@@ -4,13 +4,18 @@
4
4
 
5
5
  /* eslint-disable @devtools/no-imperative-dom-api */
6
6
 
7
+ import '../../../components/settings/settings.js';
8
+
7
9
  import * as Common from '../../../../core/common/common.js';
8
10
  import * as i18n from '../../../../core/i18n/i18n.js';
9
11
  import * as Platform from '../../../../core/platform/platform.js';
10
- import * as Settings from '../../../components/settings/settings.js';
12
+ import {Directives, html, nothing, render, type TemplateResult} from '../../../../ui/lit/lit.js';
13
+ import type * as Settings from '../../../components/settings/settings.js';
11
14
  import * as VisualLogging from '../../../visual_logging/visual_logging.js';
12
15
  import * as UI from '../../legacy.js';
13
16
 
17
+ const {createRef, ref} = Directives;
18
+
14
19
  const UIStrings = {
15
20
  /**
16
21
  * @description Note when a setting change will require the user to reload DevTools
@@ -36,90 +41,100 @@ export function createSettingCheckbox(
36
41
  return label;
37
42
  }
38
43
 
39
- const createSettingSelect = function(
40
- name: string, options: Common.Settings.SimpleSettingOption[], requiresReload: boolean|null,
41
- setting: Common.Settings.Setting<unknown>, subtitle?: string): HTMLElement {
42
- const container = document.createElement('div');
43
- const settingSelectElement = container.createChild('p');
44
- settingSelectElement.classList.add('settings-select');
45
- const label = settingSelectElement.createChild('label');
46
- const select = settingSelectElement.createChild('select');
47
- label.textContent = name;
48
- if (subtitle) {
49
- container.classList.add('chrome-select-label');
50
- label.createChild('p').textContent = subtitle;
51
- }
52
- select.setAttribute('jslog', `${VisualLogging.dropDown().track({change: true}).context(setting.name)}`);
53
- UI.ARIAUtils.bindLabelToControl(label, select);
54
-
55
- for (const option of options) {
56
- if (option.text && typeof option.value === 'string') {
57
- select.add(
58
- UI.UIUtils.createOption(option.text, option.value, Platform.StringUtilities.toKebabCase(option.value)));
59
- }
60
- }
61
-
62
- let reloadWarning: HTMLElement|(Element | null) = (null as Element | null);
63
- if (requiresReload) {
64
- reloadWarning = container.createChild('p', 'reload-warning hidden');
65
- reloadWarning.textContent = i18nString(UIStrings.srequiresReload);
66
- UI.ARIAUtils.markAsAlert(reloadWarning);
67
- }
68
-
44
+ export function renderSettingSelect(setting: Common.Settings.Setting<unknown>, subtitle?: string): TemplateResult {
45
+ const name = setting.title();
46
+ const options = setting.options();
47
+ const requiresReload = setting.reloadRequired();
69
48
  const {deprecation} = setting;
70
- if (deprecation) {
71
- const warning = new Settings.SettingDeprecationWarning.SettingDeprecationWarning();
72
- warning.data = deprecation;
73
- label.appendChild(warning);
74
- }
75
-
76
- setting.addChangeListener(settingChanged);
77
- settingChanged();
78
- select.addEventListener('change', selectChanged, false);
79
- return container;
80
-
81
- function settingChanged(): void {
82
- const newValue = setting.get();
83
- for (let i = 0; i < options.length; i++) {
84
- if (options[i].value === newValue) {
85
- select.selectedIndex = i;
86
- }
87
- }
88
- select.disabled = setting.disabled();
89
- }
49
+ const controlId = UI.ARIAUtils.nextId('labelledControl');
50
+ const reloadWarningRef = createRef<HTMLParagraphElement>();
90
51
 
91
- function selectChanged(): void {
92
- // Don't use event.target.value to avoid conversion of the value to string.
52
+ const onSelectChange = (e: Event): void => {
53
+ const select = e.target as HTMLSelectElement;
93
54
  setting.set(options[select.selectedIndex].value);
94
- if (reloadWarning) {
95
- reloadWarning.classList.remove('hidden');
55
+ if (requiresReload) {
96
56
  UI.InspectorView.InspectorView.instance().displayReloadRequiredWarning(
97
57
  i18nString(UIStrings.settingsChangedReloadDevTools));
58
+ if (reloadWarningRef.value) {
59
+ reloadWarningRef.value.classList.remove('hidden');
60
+ }
98
61
  }
99
- }
100
- };
62
+ };
101
63
 
102
- export const createControlForSetting = function(
103
- setting: Common.Settings.Setting<unknown>, subtitle?: string): HTMLElement|null {
104
- const uiTitle = setting.title();
64
+ // clang-format off
65
+ return html`
66
+ <div class=${Directives.classMap({'chrome-select-label': Boolean(subtitle)})}>
67
+ <p class="settings-select">
68
+ <label for=${controlId}>
69
+ ${name}
70
+ ${subtitle ? html`<p>${subtitle}</p>` : nothing}
71
+ ${deprecation ? html`<devtools-setting-deprecation-warning .data=${
72
+ deprecation as Common.Settings.Deprecation}></devtools-setting-deprecation-warning>` :
73
+ nothing}
74
+ </label>
75
+ <select
76
+ id=${controlId}
77
+ aria-label=${name}
78
+ .disabled=${setting.disabled()}
79
+ @change=${onSelectChange}
80
+ jslog=${VisualLogging.dropDown().track({change: true}).context(setting.name)}
81
+ >
82
+ ${options.map(option => {
83
+ if (option.text && typeof option.value === 'string') {
84
+ return html`
85
+ <option
86
+ value=${option.value}
87
+ ?selected=${setting.get() === option.value}
88
+ jslog=${VisualLogging.item(Platform.StringUtilities.toKebabCase(option.value)).track({click: true})}
89
+ >
90
+ ${option.text}
91
+ </option>
92
+ `;
93
+ }
94
+ return nothing;
95
+ })}
96
+ </select>
97
+ </p>
98
+ ${requiresReload ? html`
99
+ <p ${ref(reloadWarningRef)} class="reload-warning hidden" role="alert" aria-live="polite">
100
+ ${i18nString(UIStrings.srequiresReload)}
101
+ </p>` : nothing}
102
+ </div>
103
+ `;
104
+ // clang-format on
105
+ }
106
+
107
+ export const renderControlForSetting = function(
108
+ setting: Common.Settings.Setting<unknown>, subtitle?: string): TemplateResult|null {
105
109
  switch (setting.type()) {
106
110
  case Common.Settings.SettingType.BOOLEAN: {
107
- const component = new Settings.SettingCheckbox.SettingCheckbox();
108
- component.data = {
109
- setting: setting as Common.Settings.Setting<boolean>,
110
- };
111
- component.onchange = () => {
111
+ const onchange = (): void => {
112
112
  if (setting.reloadRequired()) {
113
113
  UI.InspectorView.InspectorView.instance().displayReloadRequiredWarning(
114
114
  i18nString(UIStrings.settingsChangedReloadDevTools));
115
115
  }
116
116
  };
117
- return component;
117
+ return html`<setting-checkbox .data=${{
118
+ setting: setting as Common.Settings.Setting<boolean>
119
+ } as Settings.SettingCheckbox.SettingCheckboxData} @change=${onchange}></setting-checkbox>`;
120
+ }
121
+ case Common.Settings.SettingType.ENUM: {
122
+ return renderSettingSelect(setting, subtitle);
118
123
  }
119
- case Common.Settings.SettingType.ENUM:
120
- return createSettingSelect(uiTitle, setting.options(), setting.reloadRequired(), setting, subtitle);
121
124
  default:
122
125
  console.error('Invalid setting type: ' + setting.type());
123
126
  return null;
124
127
  }
125
128
  };
129
+
130
+ export const createControlForSetting = function(
131
+ setting: Common.Settings.Setting<unknown>, subtitle?: string): HTMLElement|null {
132
+ const template = renderControlForSetting(setting, subtitle);
133
+ if (template === null) {
134
+ return null;
135
+ }
136
+ const fragment = document.createDocumentFragment();
137
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
138
+ render(template, fragment);
139
+ return fragment.firstElementChild as HTMLElement;
140
+ };
@@ -1850,6 +1850,7 @@ export const knownContextValues = new Set([
1850
1850
  'gu',
1851
1851
  'gutter',
1852
1852
  'gzip',
1853
+ 'hanging-punctuation',
1853
1854
  'hardware-concurrency',
1854
1855
  'hardware-concurrency-reset',
1855
1856
  'hardware-concurrency-selector',
@@ -2293,6 +2294,7 @@ export const knownContextValues = new Set([
2293
2294
  'lighthouse.audit.aria-treeitem-name',
2294
2295
  'lighthouse.audit.aria-valid-attr',
2295
2296
  'lighthouse.audit.aria-valid-attr-value',
2297
+ 'lighthouse.audit.baseline',
2296
2298
  'lighthouse.audit.bf-cache',
2297
2299
  'lighthouse.audit.bootup-time',
2298
2300
  'lighthouse.audit.button-name',
@@ -76,7 +76,7 @@ export async function startLogging(options?: {
76
76
  export async function addDocument(document: Document): Promise<void> {
77
77
  documents.push(document);
78
78
  if (['interactive', 'complete'].includes(document.readyState)) {
79
- await RenderCoordinator.read('processForLogging', process);
79
+ await process();
80
80
  }
81
81
  document.addEventListener('visibilitychange', scheduleProcessing);
82
82
  document.addEventListener('scroll', scheduleProcessing);
@@ -84,8 +84,8 @@ export async function addDocument(document: Document): Promise<void> {
84
84
  }
85
85
 
86
86
  export async function stopLogging(): Promise<void> {
87
- logging = false;
88
87
  await keyboardLogThrottler.schedule(async () => {}, Common.Throttler.Scheduling.AS_SOON_AS_POSSIBLE);
88
+ logging = false;
89
89
  unregisterAllLoggables();
90
90
  for (const document of documents) {
91
91
  document.removeEventListener('visibilitychange', scheduleProcessing);
@@ -139,7 +139,7 @@ const viewportRectFor = (element: Element): DOMRect => {
139
139
  };
140
140
 
141
141
  export async function process(): Promise<void> {
142
- if (!logging || document.hidden) {
142
+ if (document.hidden) {
143
143
  return;
144
144
  }
145
145
  const startTime = performance.now();
package/mcp/mcp.ts CHANGED
@@ -28,6 +28,7 @@ export {Target} from '../front_end/core/sdk/Target.js';
28
28
  export {TargetManager} from '../front_end/core/sdk/TargetManager.js';
29
29
  export * as Foundation from '../front_end/foundation/foundation.js';
30
30
  export * as Protocol from '../front_end/generated/protocol.js';
31
+ export {NetworkRequestFormatter} from '../front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js';
31
32
  export {
32
33
  PerformanceInsightFormatter
33
34
  } from '../front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js';
@@ -54,6 +55,7 @@ export {
54
55
  export * as MarkdownIssueDescription from '../front_end/models/issues_manager/MarkdownIssueDescription.js';
55
56
  export * as StackTrace from '../front_end/models/stack_trace/stack_trace.js';
56
57
  export * as TraceEngine from '../front_end/models/trace/trace.js';
58
+ export {IgnoreListManager} from '../front_end/models/workspace/IgnoreListManager.js';
57
59
  export * as Marked from '../front_end/third_party/marked/marked.js';
58
60
 
59
61
  installInspectorFrontendHost(new McpHostBindings());
package/package.json CHANGED
@@ -49,8 +49,8 @@
49
49
  "@types/webidl2": "24.4.3",
50
50
  "@types/yargs": "17.0.35",
51
51
  "@types/yargs-unparser": "2.0.3",
52
- "@typescript-eslint/rule-tester": "8.47.0",
53
- "@typescript-eslint/utils": "8.47.0",
52
+ "@typescript-eslint/rule-tester": "8.58.0",
53
+ "@typescript-eslint/utils": "8.58.0",
54
54
  "@web/rollup-plugin-import-meta-assets": "2.3.0",
55
55
  "chai": "4.3.4",
56
56
  "cssnano": "7.1.2",
@@ -90,14 +90,13 @@
90
90
  "terser": "5.44.1",
91
91
  "ts-lit-plugin": "2.0.2",
92
92
  "typescript": "5.9.3",
93
- "typescript-eslint": "8.47.0",
93
+ "typescript-eslint": "8.58.0",
94
94
  "uuid": "13.0.0",
95
95
  "webidl2": "24.5.0",
96
96
  "yargs": "17.7.2",
97
97
  "js-rouge": "3.2.0"
98
98
  },
99
99
  "overrides": {
100
- "@typescript-eslint/types": "8.47.0",
101
100
  "baseline-browser-mapping": "2.8.25",
102
101
  "electron-to-chromium": "1.5.248",
103
102
  "caniuse-lite": "1.0.30001754",
@@ -105,5 +104,5 @@
105
104
  "flat-cache": "6.1.12"
106
105
  }
107
106
  },
108
- "version": "1.0.1609381"
107
+ "version": "1.0.1611390"
109
108
  }