chrome-devtools-frontend 1.0.1568190 → 1.0.1569477

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 (46) hide show
  1. package/front_end/Images/src/grid-direction.svg +6 -0
  2. package/front_end/core/common/ParsedURL.ts +3 -0
  3. package/front_end/core/host/AidaClient.ts +1 -0
  4. package/front_end/core/root/Runtime.ts +4 -8
  5. package/front_end/entrypoints/main/MainImpl.ts +17 -20
  6. package/front_end/generated/InspectorBackendCommands.ts +6 -6
  7. package/front_end/generated/SupportedCSSProperties.js +14 -14
  8. package/front_end/generated/protocol.ts +0 -18
  9. package/front_end/models/ai_assistance/agents/PatchAgent.ts +4 -1
  10. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +12 -0
  11. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +12 -2
  12. package/front_end/models/ai_assistance/agents/StylingAgent.ts +4 -1
  13. package/front_end/models/ai_assistance/injected.ts +7 -22
  14. package/front_end/models/javascript_metadata/NativeFunctions.js +12 -0
  15. package/front_end/models/stack_trace/StackTraceImpl.ts +12 -2
  16. package/front_end/models/stack_trace/StackTraceModel.ts +9 -1
  17. package/front_end/models/trace/Styles.ts +11 -8
  18. package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +3 -2
  19. package/front_end/models/trace/types/TraceEvents.ts +19 -10
  20. package/front_end/panels/application/preloading/PreloadingView.ts +1 -3
  21. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +13 -28
  22. package/front_end/panels/common/AiCodeCompletionTeaser.ts +58 -15
  23. package/front_end/panels/common/AiCodeGenerationTeaser.ts +1 -1
  24. package/front_end/panels/elements/ElementsPanel.ts +6 -3
  25. package/front_end/panels/elements/ElementsSidebarPane.ts +7 -28
  26. package/front_end/panels/elements/MetricsSidebarPane.ts +208 -216
  27. package/front_end/panels/elements/StylesSidebarPane.ts +6 -6
  28. package/front_end/panels/elements/components/CSSPropertyIconResolver.ts +57 -4
  29. package/front_end/panels/elements/components/StylePropertyEditor.ts +93 -1
  30. package/front_end/panels/elements/metricsSidebarPane.css +3 -11
  31. package/front_end/panels/settings/SettingsScreen.ts +8 -38
  32. package/front_end/panels/settings/settingsScreen.css +0 -4
  33. package/front_end/panels/sources/BreakpointEditDialog.ts +203 -138
  34. package/front_end/panels/sources/DebuggerPlugin.ts +15 -7
  35. package/front_end/panels/timeline/TimelineUIUtils.ts +9 -3
  36. package/front_end/panels/timeline/TimingsTrackAppender.ts +1 -0
  37. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +3 -1
  38. package/front_end/panels/timeline/timelineFlameChartView.css +1 -0
  39. package/front_end/third_party/chromium/README.chromium +1 -1
  40. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +23 -1
  41. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +16 -4
  42. package/front_end/ui/kit/link/Link.ts +14 -8
  43. package/front_end/ui/kit/link/link.css +1 -1
  44. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  45. package/mcp/mcp.ts +1 -0
  46. package/package.json +1 -1
@@ -4,8 +4,10 @@
4
4
  /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
5
 
6
6
  import '../../../ui/kit/kit.js';
7
+ import '../../../ui/legacy/legacy.js';
7
8
 
8
9
  import * as i18n from '../../../core/i18n/i18n.js';
10
+ import * as Input from '../../../ui/components/input/input.js';
9
11
  import * as Lit from '../../../ui/lit/lit.js';
10
12
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
11
13
 
@@ -25,6 +27,10 @@ const UIStrings = {
25
27
  * @example {row} propertyValue
26
28
  */
27
29
  deselectButton: 'Remove {propertyName}: {propertyValue}',
30
+ /**
31
+ * @description Label for the dense checkbox in the grid-auto-flow editor.
32
+ */
33
+ denseLabel: 'Dense',
28
34
  } as const;
29
35
  const str_ = i18n.i18n.registerUIStrings('panels/elements/components/StylePropertyEditor.ts', UIStrings);
30
36
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -89,6 +95,7 @@ export class StylePropertyEditor extends HTMLElement {
89
95
  // clang-format off
90
96
  render(html`
91
97
  <style>${stylePropertyEditorStyles}</style>
98
+ <style>${Input.checkboxStyles}</style>
92
99
  <div class="container">
93
100
  ${this.editableProperties.map(prop => this.#renderProperty(prop))}
94
101
  </div>
@@ -106,6 +113,12 @@ export class StylePropertyEditor extends HTMLElement {
106
113
  'property-value': true,
107
114
  'not-authored': notAuthored,
108
115
  });
116
+
117
+ // Special handling for grid-auto-flow with dense checkbox
118
+ if (prop.propertyName === 'grid-auto-flow') {
119
+ return this.#renderGridAutoFlowProperty(prop, shownValue, classes);
120
+ }
121
+
109
122
  return html`<div class="row">
110
123
  <div class="property">
111
124
  <span class="property-name">${prop.propertyName}</span>: <span class=${classes}>${shownValue}</span>
@@ -116,6 +129,55 @@ export class StylePropertyEditor extends HTMLElement {
116
129
  </div>`;
117
130
  }
118
131
 
132
+ #renderGridAutoFlowProperty(
133
+ prop: EditableProperty, shownValue: string|undefined,
134
+ classes: ReturnType<typeof Directives.classMap>): Lit.TemplateResult {
135
+ const authoredValue = this.#authoredProperties.get(prop.propertyName);
136
+
137
+ const isDense = authoredValue === 'dense' || authoredValue === 'row dense' || authoredValue === 'column dense';
138
+ const isRow = authoredValue === 'row' || authoredValue === 'row dense';
139
+ const isColumn = authoredValue === 'column' || authoredValue === 'column dense';
140
+
141
+ return html`<div class="row">
142
+ <div class="property">
143
+ <span class="property-name">${prop.propertyName}</span>: <span class=${classes}>${shownValue}</span>
144
+ </div>
145
+ <div class="buttons">
146
+ ${this.#renderButton('row', prop.propertyName, isRow)}
147
+ ${this.#renderButton('column', prop.propertyName, isColumn)}
148
+ <devtools-checkbox
149
+ .checked=${isDense}
150
+ @change=${(e: Event) => this.#onDenseCheckboxChange(e, isRow, isColumn)}
151
+ >
152
+ ${i18nString(UIStrings.denseLabel)}
153
+ </devtools-checkbox>
154
+ </div>
155
+ </div>`;
156
+ }
157
+
158
+ #onDenseCheckboxChange(e: Event, isRow: boolean, isColumn: boolean): void {
159
+ const checked = (e.target as HTMLInputElement).checked;
160
+ const propertyName = 'grid-auto-flow';
161
+ const currentValue = this.#authoredProperties.get(propertyName);
162
+
163
+ let newValue = '';
164
+ if (isRow) {
165
+ newValue = checked ? 'row dense' : 'row';
166
+ } else if (isColumn) {
167
+ newValue = checked ? 'column dense' : 'column';
168
+ } else {
169
+ newValue = checked ? 'dense' : '';
170
+ }
171
+
172
+ if (currentValue) {
173
+ this.dispatchEvent(new PropertyDeselectedEvent(propertyName, currentValue));
174
+ }
175
+
176
+ if (newValue) {
177
+ this.dispatchEvent(new PropertySelectedEvent(propertyName, newValue));
178
+ }
179
+ }
180
+
119
181
  #renderButton(propertyValue: string, propertyName: string, selected = false): Lit.TemplateResult {
120
182
  const query = `${propertyName}: ${propertyValue}`;
121
183
  const iconInfo = this.findIcon(query, this.#computedProperties);
@@ -141,7 +203,30 @@ export class StylePropertyEditor extends HTMLElement {
141
203
  }
142
204
 
143
205
  #onButtonClick(propertyName: string, propertyValue: string, selected: boolean): void {
144
- if (selected) {
206
+ if (propertyName === 'grid-auto-flow') {
207
+ const currentValue = this.#authoredProperties.get(propertyName);
208
+ const isDense = currentValue?.includes('dense') || false;
209
+
210
+ if (selected) {
211
+ const newValue = isDense ? 'dense' : '';
212
+
213
+ if (currentValue) {
214
+ this.dispatchEvent(new PropertyDeselectedEvent(propertyName, currentValue));
215
+ }
216
+
217
+ if (newValue) {
218
+ this.dispatchEvent(new PropertySelectedEvent(propertyName, newValue));
219
+ }
220
+ } else {
221
+ const newValue = isDense ? `${propertyValue} dense` : propertyValue;
222
+
223
+ if (currentValue) {
224
+ this.dispatchEvent(new PropertyDeselectedEvent(propertyName, currentValue));
225
+ }
226
+
227
+ this.dispatchEvent(new PropertySelectedEvent(propertyName, newValue));
228
+ }
229
+ } else if (selected) {
145
230
  this.dispatchEvent(new PropertyDeselectedEvent(propertyName, propertyValue));
146
231
  } else {
147
232
  this.dispatchEvent(new PropertySelectedEvent(propertyName, propertyValue));
@@ -256,6 +341,13 @@ export const FlexboxEditableProperties = [
256
341
  ];
257
342
 
258
343
  export const GridEditableProperties = [
344
+ {
345
+ propertyName: 'grid-auto-flow',
346
+ propertyValues: [
347
+ 'row',
348
+ 'column',
349
+ ],
350
+ },
259
351
  {
260
352
  propertyName: 'align-content',
261
353
  propertyValues: [
@@ -8,7 +8,7 @@
8
8
  font-size: 10px;
9
9
  text-align: center;
10
10
  white-space: nowrap;
11
- min-height: var(--metrics-height);
11
+ height: var(--metrics-height);
12
12
  display: flex;
13
13
  flex-direction: column;
14
14
  align-items: center;
@@ -26,19 +26,11 @@
26
26
 
27
27
  :host {
28
28
  --metrics-height: 190px;
29
-
30
- height: var(--metrics-height);
31
- contain: strict;
32
- }
33
-
34
- :host(.invisible) {
35
- visibility: hidden;
36
- height: 0;
37
29
  }
38
30
 
39
- :host(.collapsed) {
40
- visibility: collapse;
31
+ .metrics.collapsed {
41
32
  height: 0;
33
+ padding: 0;
42
34
  }
43
35
  /* The font we use on Windows takes up more vertical space, so adjust
44
36
  * the height of the metrics sidebar pane accordingly.
@@ -27,11 +27,6 @@ import type {KeybindsSettingsTab} from './KeybindsSettingsTab.js';
27
27
  import settingsScreenStyles from './settingsScreen.css.js';
28
28
 
29
29
  const UIStrings = {
30
-
31
- /**
32
- * @description Card header in Experiments settings tab that list all available unstable experiments that can be turned on or off.
33
- */
34
- unstableExperiments: 'Unstable experiments',
35
30
  /**
36
31
  * @description Name of the Settings view
37
32
  */
@@ -61,10 +56,6 @@ const UIStrings = {
61
56
  */
62
57
  greenDevUnstable:
63
58
  'Warning: All these features are prototype and very unstable. They exist for user testing and are not designed to be relied on.',
64
- /**
65
- * @description Message text content in Settings Screen of the Settings
66
- */
67
- theseExperimentsAreParticularly: 'Warning: These experiments are particularly unstable. Enable at your own risk.',
68
59
  /**
69
60
  * @description Message to display if a setting change requires a reload of DevTools
70
61
  */
@@ -392,7 +383,6 @@ export class GenericSettingsTab extends UI.Widget.VBox implements SettingsTab {
392
383
 
393
384
  export class ExperimentsSettingsTab extends UI.Widget.VBox implements SettingsTab {
394
385
  #experimentsSection: Card|undefined;
395
- #unstableExperimentsSection: Card|undefined;
396
386
  private readonly experimentToControl = new Map<Root.Runtime.Experiment, HTMLElement>();
397
387
  private readonly containerElement: HTMLElement;
398
388
 
@@ -427,45 +417,28 @@ export class ExperimentsSettingsTab extends UI.Widget.VBox implements SettingsTa
427
417
  if (this.#experimentsSection) {
428
418
  this.#experimentsSection.remove();
429
419
  }
430
- if (this.#unstableExperimentsSection) {
431
- this.#unstableExperimentsSection.remove();
432
- }
433
- const experiments = Root.Runtime.experiments.allConfigurableExperiments().sort();
434
- const unstableExperiments = experiments.filter(e => e.unstable && e.title.toLowerCase().includes(filterText));
435
- const stableExperiments = experiments.filter(e => !e.unstable && e.title.toLowerCase().includes(filterText));
436
- if (stableExperiments.length) {
420
+ const experiments = Root.Runtime.experiments.allConfigurableExperiments().sort((a, b) => {
421
+ return a.title.localeCompare(b.title);
422
+ });
423
+ const filteredExperiments = experiments.filter(e => e.title.toLowerCase().includes(filterText));
424
+ if (filteredExperiments.length) {
437
425
  const experimentsBlock = document.createElement('div');
438
426
  experimentsBlock.classList.add('settings-experiments-block');
439
427
  const warningMessage = i18nString(UIStrings.theseExperimentsCouldBeUnstable);
440
428
  const warningSection = this.createExperimentsWarningSubsection(warningMessage);
441
- for (const experiment of stableExperiments) {
429
+ for (const experiment of filteredExperiments) {
442
430
  experimentsBlock.appendChild(this.createExperimentCheckbox(experiment));
443
431
  }
444
432
  this.#experimentsSection =
445
433
  createSettingsCard(i18nString(UIStrings.experiments), warningSection, experimentsBlock);
446
434
  this.containerElement.appendChild(this.#experimentsSection);
447
- }
448
- if (unstableExperiments.length) {
449
- const experimentsBlock = document.createElement('div');
450
- experimentsBlock.classList.add('settings-experiments-block');
451
- const warningMessage = i18nString(UIStrings.theseExperimentsAreParticularly);
452
- for (const experiment of unstableExperiments) {
453
- experimentsBlock.appendChild(this.createExperimentCheckbox(experiment));
454
- }
455
- this.#unstableExperimentsSection = createSettingsCard(
456
- i18nString(UIStrings.unstableExperiments), this.createExperimentsWarningSubsection(warningMessage),
457
- experimentsBlock);
458
- this.containerElement.appendChild(this.#unstableExperimentsSection);
459
- }
460
- if (!stableExperiments.length && !unstableExperiments.length) {
435
+ UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.experimentsFound, {n: filteredExperiments.length}));
436
+ } else {
461
437
  const warning = document.createElement('span');
462
438
  warning.textContent = i18nString(UIStrings.noResults);
463
439
  UI.ARIAUtils.LiveAnnouncer.alert(warning.textContent);
464
440
  this.#experimentsSection = createSettingsCard(i18nString(UIStrings.experiments), warning);
465
441
  this.containerElement.appendChild(this.#experimentsSection);
466
- } else {
467
- UI.ARIAUtils.LiveAnnouncer.alert(
468
- i18nString(UIStrings.experimentsFound, {n: stableExperiments.length + unstableExperiments.length}));
469
442
  }
470
443
  }
471
444
 
@@ -495,9 +468,6 @@ export class ExperimentsSettingsTab extends UI.Widget.VBox implements SettingsTa
495
468
  const p = document.createElement('p');
496
469
  this.experimentToControl.set(experiment, p);
497
470
  p.classList.add('settings-experiment');
498
- if (experiment.unstable && !experiment.isEnabled()) {
499
- p.classList.add('settings-experiment-unstable');
500
- }
501
471
  p.appendChild(checkbox);
502
472
 
503
473
  const experimentLink = experiment.docLink;
@@ -146,10 +146,6 @@ devtools-button.link-icon {
146
146
  white-space: normal;
147
147
  }
148
148
 
149
- .settings-experiment-unstable {
150
- color: var(--sys-color-token-subtle);
151
- }
152
-
153
149
  .settings-experiment .feedback-link {
154
150
  color: var(--sys-color-primary);
155
151
  text-decoration-line: underline;