chrome-devtools-frontend 1.0.1537268 → 1.0.1538310

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 (98) hide show
  1. package/.env.template +10 -0
  2. package/docs/get_the_code.md +27 -0
  3. package/eslint.config.mjs +151 -149
  4. package/front_end/core/common/SettingRegistration.ts +10 -7
  5. package/front_end/core/common/Settings.ts +3 -0
  6. package/front_end/core/host/AidaClient.ts +1 -0
  7. package/front_end/core/host/UserMetrics.ts +3 -1
  8. package/front_end/core/root/Runtime.ts +8 -0
  9. package/front_end/core/sdk/sdk-meta.ts +8 -2
  10. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +4 -3
  11. package/front_end/generated/SupportedCSSProperties.js +1 -0
  12. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +23 -7
  13. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +110 -5
  14. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +50 -45
  15. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +151 -0
  16. package/front_end/models/ai_code_generation/ai_code_generation.ts +6 -0
  17. package/front_end/models/ai_code_generation/debug.ts +30 -0
  18. package/front_end/models/cpu_profile/ProfileTreeModel.ts +7 -7
  19. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +1 -1
  20. package/front_end/panels/application/PreloadingTreeElement.ts +10 -2
  21. package/front_end/panels/application/StorageView.ts +3 -2
  22. package/front_end/panels/application/components/BackForwardCacheView.ts +34 -51
  23. package/front_end/panels/application/components/OriginTrialTreeView.ts +141 -170
  24. package/front_end/panels/application/components/backForwardCacheView.css +4 -0
  25. package/front_end/panels/application/components/originTrialTreeView.css +37 -7
  26. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +2 -2
  27. package/front_end/panels/application/preloading/components/PreloadingString.ts +30 -1
  28. package/front_end/panels/autofill/AutofillView.ts +1 -1
  29. package/front_end/panels/console/ConsoleView.ts +11 -9
  30. package/front_end/panels/coverage/CoverageView.ts +1 -2
  31. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +1 -1
  32. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
  33. package/front_end/panels/elements/ElementStatePaneWidget.ts +1 -1
  34. package/front_end/panels/elements/EventListenersWidget.ts +1 -2
  35. package/front_end/panels/elements/PropertiesWidget.ts +1 -1
  36. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +1 -0
  37. package/front_end/panels/network/NetworkConfigView.ts +2 -1
  38. package/front_end/panels/network/NetworkItemView.ts +1 -1
  39. package/front_end/panels/network/NetworkPanel.ts +5 -4
  40. package/front_end/panels/network/NetworkWaterfallColumn.ts +5 -6
  41. package/front_end/panels/network/RequestCookiesView.ts +2 -1
  42. package/front_end/panels/network/RequestTimingView.ts +404 -348
  43. package/front_end/panels/network/networkTimingTable.css +22 -2
  44. package/front_end/panels/profiler/HeapSnapshotView.ts +3 -2
  45. package/front_end/panels/sensors/SensorsView.ts +4 -3
  46. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +8 -6
  47. package/front_end/panels/settings/KeybindsSettingsTab.ts +3 -2
  48. package/front_end/panels/settings/SettingsScreen.ts +2 -1
  49. package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
  50. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -1
  51. package/front_end/panels/sources/SourcesPanel.ts +2 -1
  52. package/front_end/panels/sources/sources-meta.ts +8 -1
  53. package/front_end/panels/timeline/TimelinePanel.ts +4 -3
  54. package/front_end/panels/timeline/TimelineUIUtils.ts +4 -20
  55. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -0
  56. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +42 -3
  57. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +2 -0
  58. package/front_end/panels/timeline/components/networkRequestTooltip.css +19 -0
  59. package/front_end/third_party/chromium/README.chromium +1 -1
  60. package/front_end/ui/components/adorners/Adorner.ts +3 -1
  61. package/front_end/ui/components/buttons/Button.docs.ts +195 -0
  62. package/front_end/ui/components/icon_button/IconButton.ts +1 -0
  63. package/front_end/ui/components/settings/SettingCheckbox.ts +50 -14
  64. package/front_end/ui/components/settings/settingCheckbox.css +6 -1
  65. package/front_end/ui/components/spinners/Spinners.docs.ts +13 -0
  66. package/front_end/ui/components/tooltips/Tooltip.docs.ts +76 -0
  67. package/front_end/ui/legacy/FilterBar.ts +1 -2
  68. package/front_end/ui/legacy/RadioButton.docs.ts +41 -0
  69. package/front_end/ui/legacy/SelectMenu.docs.ts +98 -0
  70. package/front_end/ui/legacy/Toolbar.ts +4 -6
  71. package/front_end/ui/legacy/Treeoutline.ts +15 -0
  72. package/front_end/ui/legacy/UIUtils.ts +117 -1
  73. package/front_end/ui/legacy/Widget.ts +68 -38
  74. package/front_end/ui/legacy/XLink.ts +1 -0
  75. package/front_end/ui/legacy/components/inline_editor/Swatches.ts +1 -0
  76. package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +1 -0
  77. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +125 -0
  78. package/front_end/ui/legacy/components/settings_ui/settings_ui.ts +8 -0
  79. package/front_end/ui/legacy/legacy.ts +0 -2
  80. package/front_end/ui/legacy/popover.css +12 -11
  81. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  82. package/package.json +1 -1
  83. package/front_end/models/trace/lantern/testing/MetricTestUtils.ts +0 -62
  84. package/front_end/models/trace/lantern/testing/testing.ts +0 -5
  85. package/front_end/panels/application/components/badge.css +0 -25
  86. package/front_end/ui/components/docs/button/basic.html +0 -44
  87. package/front_end/ui/components/docs/button/basic.ts +0 -175
  88. package/front_end/ui/components/docs/radio_button/basic.html +0 -23
  89. package/front_end/ui/components/docs/radio_button/basic.ts +0 -50
  90. package/front_end/ui/components/docs/select_menu/basic.html +0 -19
  91. package/front_end/ui/components/docs/select_menu/basic.ts +0 -95
  92. package/front_end/ui/components/docs/select_menu/wide-option.html +0 -38
  93. package/front_end/ui/components/docs/select_menu/wide-option.ts +0 -43
  94. package/front_end/ui/components/docs/spinners/basic.html +0 -17
  95. package/front_end/ui/components/docs/spinners/basic.ts +0 -22
  96. package/front_end/ui/components/docs/tooltip/basic.html +0 -20
  97. package/front_end/ui/components/docs/tooltip/basic.ts +0 -82
  98. package/front_end/ui/legacy/SettingsUI.ts +0 -240
@@ -1,240 +0,0 @@
1
- // Copyright 2014 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- /* eslint-disable @devtools/no-imperative-dom-api */
6
-
7
- import * as Common from '../../core/common/common.js';
8
- import * as Host from '../../core/host/host.js';
9
- import * as i18n from '../../core/i18n/i18n.js';
10
- import * as Platform from '../../core/platform/platform.js';
11
- import * as Settings from '../components/settings/settings.js';
12
- import {Directives} from '../lit/lit.js';
13
- import * as VisualLogging from '../visual_logging/visual_logging.js';
14
-
15
- import * as ARIAUtils from './ARIAUtils.js';
16
- import {InspectorView} from './InspectorView.js';
17
- import {Tooltip} from './Tooltip.js';
18
- import {bindInput, CheckboxLabel, createOption} from './UIUtils.js';
19
-
20
- const UIStrings = {
21
- /**
22
- * @description Note when a setting change will require the user to reload DevTools
23
- */
24
- srequiresReload: '*Requires reload',
25
- /**
26
- * @description Message to display if a setting change requires a reload of DevTools
27
- */
28
- oneOrMoreSettingsHaveChanged: 'One or more settings have changed which requires a reload to take effect',
29
- } as const;
30
- const str_ = i18n.i18n.registerUIStrings('ui/legacy/SettingsUI.ts', UIStrings);
31
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
32
-
33
- export function createSettingCheckbox(
34
- name: Common.UIString.LocalizedString, setting: Common.Settings.Setting<boolean>, tooltip?: string): CheckboxLabel {
35
- const label = CheckboxLabel.create(name, undefined, undefined, setting.name);
36
- label.name = name;
37
- bindCheckbox(label, setting);
38
- if (tooltip) {
39
- Tooltip.install(label, tooltip);
40
- }
41
- return label;
42
- }
43
-
44
- const createSettingSelect = function(
45
- name: string, options: Common.Settings.SimpleSettingOption[], requiresReload: boolean|null,
46
- setting: Common.Settings.Setting<unknown>, subtitle?: string): HTMLElement {
47
- const container = document.createElement('div');
48
- const settingSelectElement = container.createChild('p');
49
- settingSelectElement.classList.add('settings-select');
50
- const label = settingSelectElement.createChild('label');
51
- const select = settingSelectElement.createChild('select');
52
- label.textContent = name;
53
- if (subtitle) {
54
- container.classList.add('chrome-select-label');
55
- label.createChild('p').textContent = subtitle;
56
- }
57
- select.setAttribute('jslog', `${VisualLogging.dropDown().track({change: true}).context(setting.name)}`);
58
- ARIAUtils.bindLabelToControl(label, select);
59
-
60
- for (const option of options) {
61
- if (option.text && typeof option.value === 'string') {
62
- select.add(createOption(option.text, option.value, Platform.StringUtilities.toKebabCase(option.value)));
63
- }
64
- }
65
-
66
- let reloadWarning: HTMLElement|(Element | null) = (null as Element | null);
67
- if (requiresReload) {
68
- reloadWarning = container.createChild('p', 'reload-warning hidden');
69
- reloadWarning.textContent = i18nString(UIStrings.srequiresReload);
70
- ARIAUtils.markAsAlert(reloadWarning);
71
- }
72
-
73
- const {deprecation} = setting;
74
- if (deprecation) {
75
- const warning = new Settings.SettingDeprecationWarning.SettingDeprecationWarning();
76
- warning.data = deprecation;
77
- label.appendChild(warning);
78
- }
79
-
80
- setting.addChangeListener(settingChanged);
81
- settingChanged();
82
- select.addEventListener('change', selectChanged, false);
83
- return container;
84
-
85
- function settingChanged(): void {
86
- const newValue = setting.get();
87
- for (let i = 0; i < options.length; i++) {
88
- if (options[i].value === newValue) {
89
- select.selectedIndex = i;
90
- }
91
- }
92
- select.disabled = setting.disabled();
93
- }
94
-
95
- function selectChanged(): void {
96
- // Don't use event.target.value to avoid conversion of the value to string.
97
- setting.set(options[select.selectedIndex].value);
98
- if (reloadWarning) {
99
- reloadWarning.classList.remove('hidden');
100
- InspectorView.instance().displayReloadRequiredWarning(i18nString(UIStrings.oneOrMoreSettingsHaveChanged));
101
- }
102
- }
103
- };
104
-
105
- export const bindToSetting =
106
- (settingOrName: string|Common.Settings.Setting<boolean|string>|Common.Settings.RegExpSetting,
107
- stringValidator?: (newSettingValue: string) => boolean): ReturnType<typeof Directives.ref> => {
108
- const setting = typeof settingOrName === 'string' ?
109
- Common.Settings.Settings.instance().moduleSetting(settingOrName) :
110
- settingOrName;
111
-
112
- // We can't use `setValue` as the change listener directly, otherwise we won't
113
- // be able to remove it again.
114
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
- let setValue: (value: any) => void;
116
- function settingChanged(): void {
117
- setValue(setting.get());
118
- }
119
-
120
- if (setting.type() === Common.Settings.SettingType.BOOLEAN || typeof setting.defaultValue === 'boolean') {
121
- return Directives.ref(e => {
122
- if (e === undefined) {
123
- setting.removeChangeListener(settingChanged);
124
- return;
125
- }
126
-
127
- setting.addChangeListener(settingChanged);
128
- setValue =
129
- bindCheckboxImpl(e as CheckboxLabel, (setting as Common.Settings.Setting<boolean>).set.bind(setting));
130
- setValue(setting.get());
131
- });
132
- }
133
-
134
- if (setting.type() === Common.Settings.SettingType.REGEX || setting instanceof Common.Settings.RegExpSetting) {
135
- return Directives.ref(e => {
136
- if (e === undefined) {
137
- setting.removeChangeListener(settingChanged);
138
- return;
139
- }
140
-
141
- setting.addChangeListener(settingChanged);
142
- setValue = bindInput(e as HTMLInputElement, setting.set.bind(setting), (value: string) => {
143
- try {
144
- new RegExp(value);
145
- return true;
146
- } catch {
147
- return false;
148
- }
149
- }, /* numeric */ false);
150
- setValue(setting.get());
151
- });
152
- }
153
-
154
- if (typeof setting.defaultValue === 'string') {
155
- return Directives.ref(e => {
156
- if (e === undefined) {
157
- setting.removeChangeListener(settingChanged);
158
- return;
159
- }
160
-
161
- setting.addChangeListener(settingChanged);
162
- setValue = bindInput(
163
- e as HTMLInputElement, setting.set.bind(setting), stringValidator ?? (() => true), /* numeric */ false);
164
- setValue(setting.get());
165
- });
166
- }
167
-
168
- throw new Error(`Cannot infer type for setting '${setting.name}'`);
169
- };
170
-
171
- /**
172
- * @deprecated Prefer {@link bindToSetting} as this function leaks the checkbox via the setting listener.
173
- */
174
- export const bindCheckbox = function(
175
- input: CheckboxLabel, setting: Common.Settings.Setting<boolean>, metric?: UserMetricOptions): void {
176
- const setValue = bindCheckboxImpl(input, setting.set.bind(setting), metric);
177
- setting.addChangeListener(event => setValue(event.data));
178
- setValue(setting.get());
179
- };
180
-
181
- const bindCheckboxImpl = function(
182
- input: CheckboxLabel, apply: (value: boolean) => void, metric?: UserMetricOptions): (value: boolean) => void {
183
- input.addEventListener('change', onInputChanged, false);
184
-
185
- function onInputChanged(): void {
186
- apply(input.checked);
187
-
188
- if (input.checked && metric?.enable) {
189
- Host.userMetrics.actionTaken(metric.enable);
190
- }
191
-
192
- if (!input.checked && metric?.disable) {
193
- Host.userMetrics.actionTaken(metric.disable);
194
- }
195
-
196
- if (metric?.toggle) {
197
- Host.userMetrics.actionTaken(metric.toggle);
198
- }
199
- }
200
-
201
- return function setValue(value: boolean): void {
202
- if (value !== input.checked) {
203
- input.checked = value;
204
- }
205
- };
206
- };
207
-
208
- export const createControlForSetting = function(
209
- setting: Common.Settings.Setting<unknown>, subtitle?: string): HTMLElement|null {
210
- const uiTitle = setting.title();
211
- switch (setting.type()) {
212
- case Common.Settings.SettingType.BOOLEAN: {
213
- const component = new Settings.SettingCheckbox.SettingCheckbox();
214
- component.data = {
215
- setting: setting as Common.Settings.Setting<boolean>,
216
- };
217
- component.onchange = () => {
218
- if (setting.reloadRequired()) {
219
- InspectorView.instance().displayReloadRequiredWarning(i18nString(UIStrings.oneOrMoreSettingsHaveChanged));
220
- }
221
- };
222
- return component;
223
- }
224
- case Common.Settings.SettingType.ENUM:
225
- return createSettingSelect(uiTitle, setting.options(), setting.reloadRequired(), setting, subtitle);
226
- default:
227
- console.error('Invalid setting type: ' + setting.type());
228
- return null;
229
- }
230
- };
231
-
232
- /**
233
- * Track toggle action as a whole or
234
- * track on and off action separately.
235
- */
236
- export interface UserMetricOptions {
237
- toggle?: Host.UserMetrics.Action;
238
- enable?: Host.UserMetrics.Action;
239
- disable?: Host.UserMetrics.Action;
240
- }