chrome-devtools-frontend 1.0.1592362 → 1.0.1593959

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 (143) hide show
  1. package/docs/contributing/settings-experiments-features.md +75 -100
  2. package/front_end/Images/src/tab-move.svg +1 -0
  3. package/front_end/application_tokens.css +4 -4
  4. package/front_end/core/host/UserMetrics.ts +1 -2
  5. package/front_end/core/root/ExperimentNames.ts +0 -1
  6. package/front_end/entrypoints/main/MainImpl.ts +0 -6
  7. package/front_end/generated/InspectorBackendCommands.ts +8 -5
  8. package/front_end/generated/SupportedCSSProperties.js +2 -2
  9. package/front_end/generated/protocol-mapping.d.ts +14 -0
  10. package/front_end/generated/protocol-proxy-api.d.ts +10 -0
  11. package/front_end/generated/protocol.ts +106 -0
  12. package/front_end/models/ai_assistance/agents/AiAgent.ts +24 -1
  13. package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgent.ts +26 -86
  14. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +14 -4
  15. package/front_end/models/ai_assistance/agents/StylingAgent.ts +16 -2
  16. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +1 -0
  17. package/front_end/models/issues_manager/IssueAggregator.ts +0 -9
  18. package/front_end/models/issues_manager/IssuesManager.ts +0 -5
  19. package/front_end/models/issues_manager/issues_manager.ts +0 -4
  20. package/front_end/models/javascript_metadata/NativeFunctions.js +10 -6
  21. package/front_end/models/lighthouse/lighthouse.ts +9 -0
  22. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +5 -3
  23. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +29 -6
  24. package/front_end/panels/ai_assistance/README.md +61 -0
  25. package/front_end/panels/ai_assistance/components/ChatMessage.ts +141 -27
  26. package/front_end/panels/ai_assistance/components/ChatView.ts +5 -1
  27. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +19 -7
  28. package/front_end/panels/ai_assistance/components/chatMessage.css +30 -0
  29. package/front_end/panels/ai_assistance/components/walkthroughView.css +12 -7
  30. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +1 -1
  31. package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +1 -0
  32. package/front_end/panels/application/components/BackForwardCacheView.ts +4 -2
  33. package/front_end/panels/autofill/AutofillView.ts +1 -1
  34. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +161 -154
  35. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +1 -0
  36. package/front_end/panels/browser_debugger/domBreakpointsSidebarPane.css +58 -36
  37. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +3 -0
  38. package/front_end/panels/common/AiCodeGenerationTeaser.ts +3 -0
  39. package/front_end/panels/console/ConsoleViewMessage.ts +1 -0
  40. package/front_end/panels/console/consoleView.css +7 -2
  41. package/front_end/panels/elements/ComputedStyleWidget.ts +5 -1
  42. package/front_end/panels/elements/ElementsTreeElement.ts +1 -0
  43. package/front_end/panels/elements/LayoutPane.ts +8 -7
  44. package/front_end/panels/elements/StandaloneStylesContainer.ts +254 -0
  45. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +1 -6
  46. package/front_end/panels/elements/StylesSidebarPane.ts +79 -0
  47. package/front_end/panels/elements/components/ComputedStyleTrace.ts +4 -0
  48. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  49. package/front_end/panels/elements/components/StylePropertyEditor.ts +2 -1
  50. package/front_end/panels/elements/components/computedStyleProperty.css +1 -1
  51. package/front_end/panels/elements/elements.ts +2 -0
  52. package/front_end/panels/emulation/DeviceModeToolbar.ts +181 -66
  53. package/front_end/panels/issues/HiddenIssuesRow.ts +1 -1
  54. package/front_end/panels/issues/IssueKindView.ts +2 -1
  55. package/front_end/panels/issues/IssueView.ts +2 -4
  56. package/front_end/panels/issues/IssuesPane.ts +2 -2
  57. package/front_end/panels/lighthouse/LighthouseController.ts +3 -3
  58. package/front_end/panels/lighthouse/LighthousePanel.ts +9 -5
  59. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +5 -5
  60. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +7 -8
  61. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +4 -3
  62. package/front_end/panels/lighthouse/lighthouse.ts +0 -2
  63. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +1 -1
  64. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts +1 -1
  65. package/front_end/panels/media/PlayerListView.ts +1 -1
  66. package/front_end/panels/network/NetworkLogViewColumns.ts +2 -1
  67. package/front_end/panels/network/components/RequestHeaderSection.ts +1 -1
  68. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  69. package/front_end/panels/recorder/components/RecordingListView.ts +1 -1
  70. package/front_end/panels/recorder/components/StepEditor.ts +3 -3
  71. package/front_end/panels/settings/KeybindsSettingsTab.ts +2 -1
  72. package/front_end/panels/sources/components/HeadersView.ts +2 -2
  73. package/front_end/panels/timeline/components/BreadcrumbsUI.ts +1 -1
  74. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +1 -1
  75. package/front_end/third_party/chromium/README.chromium +1 -1
  76. package/front_end/third_party/puppeteer/README.chromium +2 -2
  77. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Navigation.d.ts.map +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Navigation.js +1 -0
  79. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Navigation.js.map +1 -1
  80. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js +1 -1
  81. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +1 -1
  83. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  84. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  86. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +1 -0
  87. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  88. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +6 -6
  95. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Navigation.d.ts.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Navigation.js +1 -0
  97. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Navigation.js.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +1 -0
  104. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  106. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  107. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  110. package/front_end/third_party/puppeteer/package/package.json +4 -4
  111. package/front_end/third_party/puppeteer/package/src/bidi/core/Navigation.ts +1 -0
  112. package/front_end/third_party/puppeteer/package/src/cdp/BrowserContext.ts +1 -1
  113. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +1 -1
  114. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +1 -0
  115. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  116. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  117. package/front_end/third_party/source-map-scopes-codec/package/deno.json +1 -1
  118. package/front_end/third_party/source-map-scopes-codec/package/package.json +1 -1
  119. package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +1 -1
  120. package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +1 -1
  121. package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +1 -1
  122. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +1 -1
  123. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +1 -1
  124. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +2 -2
  125. package/front_end/ui/components/suggestion_input/SuggestionInput.ts +7 -12
  126. package/front_end/ui/components/tree_outline/TreeOutline.ts +6 -2
  127. package/front_end/ui/components/tree_outline/treeOutline.css +5 -0
  128. package/front_end/ui/legacy/ListControl.ts +5 -3
  129. package/front_end/ui/legacy/ListWidget.ts +1 -1
  130. package/front_end/ui/legacy/SoftContextMenu.ts +2 -1
  131. package/front_end/ui/legacy/SuggestBox.ts +4 -0
  132. package/front_end/ui/legacy/TextPrompt.ts +1 -1
  133. package/front_end/ui/legacy/Treeoutline.ts +1 -0
  134. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +4 -2
  135. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -1
  136. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +31 -0
  137. package/front_end/ui/visual_logging/KnownContextValues.ts +16 -0
  138. package/inspector_overlay/highlight_grid_common.ts +11 -8
  139. package/package.json +1 -1
  140. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +0 -78
  141. package/front_end/models/issues_manager/LowTextContrastIssue.ts +0 -63
  142. package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +0 -91
  143. /package/front_end/{panels → models}/lighthouse/LighthouseReporterTypes.ts +0 -0
@@ -228,26 +228,27 @@ const DEFAULT_VIEW: View = (input, output, target) => {
228
228
  event.preventDefault();
229
229
  }
230
230
  };
231
+ // clang-format off
231
232
  const renderElement = (element: LayoutElement): Lit.LitTemplate => html`<div
232
233
  class="element"
233
- jslog=${VisualLogging.item()}>
234
+ jslog=${VisualLogging.item().track({resize: true})}>
234
235
  <devtools-checkbox
235
236
  data-element="true"
236
237
  class="checkbox-label"
237
238
  .checked=${element.enabled}
238
239
  @change=${(e: Event) => input.onElementToggle(element, e)}
239
- jslog=${VisualLogging.toggle().track({
240
- click: true
241
- })}>
240
+ jslog=${VisualLogging.toggle().track({click: true, resize: true })}>
242
241
  <span
243
242
  class="node-text-container"
244
243
  data-label="true"
245
244
  @mouseenter=${(e: MouseEvent) => input.onMouseEnter(element, e)}
246
245
  @mouseleave=${(e: MouseEvent) => input.onMouseLeave(element, e)}>
247
246
  <devtools-node-text .data=${{
248
- nodeId: element.domId, nodeTitle: element.name, nodeClasses: element.domClasses,
249
- }
250
- }></devtools-node-text>
247
+ nodeId: element.domId,
248
+ nodeTitle: element.name,
249
+ nodeClasses: element.domClasses
250
+ }}>
251
+ </devtools-node-text>
251
252
  </span>
252
253
  </devtools-checkbox>
253
254
  <label
@@ -0,0 +1,254 @@
1
+ // Copyright 2026 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
+ import * as Common from '../../core/common/common.js';
6
+ import type * as SDK from '../../core/sdk/sdk.js';
7
+ import * as ComputedStyle from '../../models/computed_style/computed_style.js';
8
+ import type * as TextUtils from '../../models/text_utils/text_utils.js';
9
+ import * as InlineEditor from '../../ui/legacy/components/inline_editor/inline_editor.js';
10
+ import * as Components from '../../ui/legacy/components/utils/utils.js';
11
+ import * as UI from '../../ui/legacy/legacy.js';
12
+ import {html, render} from '../../ui/lit/lit.js';
13
+ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
14
+
15
+ import * as ElementsComponents from './components/components.js';
16
+ import {StylePropertiesSection} from './StylePropertiesSection.js';
17
+ import type {StylePropertyTreeElement} from './StylePropertyTreeElement.js';
18
+ import type {StylesContainer} from './StylesContainer.js';
19
+ import stylesSidebarPaneStyles from './stylesSidebarPane.css.js';
20
+ import {WebCustomData} from './WebCustomData.js';
21
+
22
+ interface ViewInput {
23
+ sections: StylePropertiesSection[];
24
+ }
25
+
26
+ type View = (input: ViewInput, output_: undefined, target: HTMLElement) => void;
27
+
28
+ export const DEFAULT_VIEW: View = (input, _output, target) => {
29
+ render(
30
+ html`
31
+ <style>${stylesSidebarPaneStyles}</style>
32
+ <div class="style-panes-wrapper" jslog=${VisualLogging.section('standalone-styles').track({
33
+ resize: true
34
+ })}>
35
+ <div class="styles-pane">
36
+ ${input.sections.map(section => section.element)}
37
+ </div>
38
+ </div>
39
+ `,
40
+ target);
41
+ };
42
+
43
+ export class StandaloneStylesContainer extends UI.Widget.VBox implements StylesContainer {
44
+ activeCSSAngle: InlineEditor.CSSAngle.CSSAngle|null = null;
45
+ isEditingStyle = false;
46
+ readonly sectionByElement = new WeakMap<Node, StylePropertiesSection>();
47
+ // TODO: Reference the MAX_LINK_LENGTH from StylesSidebarPane at a later stage, when we have a reference to it.
48
+ readonly linkifier: Components.Linkifier.Linkifier =
49
+ new Components.Linkifier.Linkifier(23, /* useLinkDecorator */ true);
50
+
51
+ #webCustomData: WebCustomData|undefined;
52
+ #userOperation = false;
53
+ #sections: StylePropertiesSection[] = [];
54
+ #swatchPopoverHelper = new InlineEditor.SwatchPopoverHelper.SwatchPopoverHelper();
55
+ #computedStyleModelInternal = new ComputedStyle.ComputedStyleModel.ComputedStyleModel();
56
+ #view: View;
57
+
58
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
59
+ super(element, {useShadowDom: true});
60
+ this.#view = view;
61
+ }
62
+
63
+ get userOperation(): boolean {
64
+ return this.#userOperation;
65
+ }
66
+
67
+ get webCustomData(): WebCustomData|undefined {
68
+ if (!this.#webCustomData &&
69
+ Common.Settings.Settings.instance().moduleSetting('show-css-property-documentation-on-hover').get()) {
70
+ this.#webCustomData = WebCustomData.create();
71
+ }
72
+ return this.#webCustomData;
73
+ }
74
+
75
+ async #updateSections(): Promise<void> {
76
+ const node = this.node();
77
+ if (!node) {
78
+ this.#sections = [];
79
+ this.requestUpdate();
80
+ return;
81
+ }
82
+
83
+ const cssModel = node.domModel().cssModel();
84
+ const matchedStyles = await cssModel.cachedMatchedCascadeForNode(node);
85
+ const parentNodeId = matchedStyles?.getParentLayoutNodeId();
86
+
87
+ const [parentStyles, computedStyles, extraStyles] = await Promise.all([
88
+ parentNodeId ? cssModel.getComputedStyle(parentNodeId) : null, cssModel.getComputedStyle(node.id),
89
+ cssModel.getComputedStyleExtraFields(node.id)
90
+ ]);
91
+
92
+ if (!matchedStyles) {
93
+ return;
94
+ }
95
+
96
+ const newSections: StylePropertiesSection[] = [];
97
+ let sectionIdx = 0;
98
+ for (const style of matchedStyles.nodeStyles()) {
99
+ const section = new StylePropertiesSection(
100
+ this, matchedStyles, style, sectionIdx++, computedStyles, parentStyles, extraStyles);
101
+ newSections.push(section);
102
+ this.sectionByElement.set(section.element, section);
103
+ }
104
+ this.#sections = newSections;
105
+ this.swatchPopoverHelper().reposition();
106
+ }
107
+
108
+ override async performUpdate(): Promise<void> {
109
+ if (this.isEditingStyle || this.#userOperation) {
110
+ return;
111
+ }
112
+
113
+ await this.#updateSections();
114
+
115
+ const viewInput: ViewInput = {
116
+ sections: this.#sections,
117
+ };
118
+ this.#view(viewInput, undefined, this.contentElement);
119
+ }
120
+
121
+ swatchPopoverHelper(): InlineEditor.SwatchPopoverHelper.SwatchPopoverHelper {
122
+ return this.#swatchPopoverHelper;
123
+ }
124
+
125
+ // TODO: Refactor StylesContainer to use getter for node(), so that we can have a `node` setter here: set node().
126
+ set domNode(node: SDK.DOMModel.DOMNode|null) {
127
+ if (this.#computedStyleModelInternal.node === node) {
128
+ return;
129
+ }
130
+ this.#computedStyleModelInternal.node = node;
131
+ this.requestUpdate();
132
+ }
133
+
134
+ node(): SDK.DOMModel.DOMNode|null {
135
+ return this.#computedStyleModelInternal.node;
136
+ }
137
+
138
+ cssModel(): SDK.CSSModel.CSSModel|null {
139
+ return this.#computedStyleModelInternal.cssModel();
140
+ }
141
+
142
+ computedStyleModel(): ComputedStyle.ComputedStyleModel.ComputedStyleModel {
143
+ return this.#computedStyleModelInternal;
144
+ }
145
+
146
+ setActiveProperty(_treeElement: StylePropertyTreeElement|null): void {
147
+ }
148
+
149
+ refreshUpdate(editedSection: StylePropertiesSection, editedTreeElement?: StylePropertyTreeElement): void {
150
+ if (editedTreeElement) {
151
+ for (const section of this.#sections) {
152
+ section.updateVarFunctions(editedTreeElement);
153
+ }
154
+ }
155
+
156
+ if (this.isEditingStyle) {
157
+ return;
158
+ }
159
+
160
+ for (const section of this.#sections) {
161
+ section.update(section === editedSection);
162
+ }
163
+ this.swatchPopoverHelper().reposition();
164
+ }
165
+
166
+ filterRegex(): RegExp|null {
167
+ return null;
168
+ }
169
+
170
+ setEditingStyle(editing: boolean): void {
171
+ this.isEditingStyle = editing;
172
+ }
173
+
174
+ setUserOperation(userOperation: boolean): void {
175
+ this.#userOperation = userOperation;
176
+ }
177
+
178
+ forceUpdate(): void {
179
+ this.hideAllPopovers();
180
+ this.requestUpdate();
181
+ }
182
+
183
+ hideAllPopovers(): void {
184
+ this.#swatchPopoverHelper.hide();
185
+ }
186
+
187
+ allSections(): StylePropertiesSection[] {
188
+ return this.#sections;
189
+ }
190
+
191
+ getVariablePopoverContents(
192
+ matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, variableName: string,
193
+ computedValue: string|null): ElementsComponents.CSSVariableValueView.CSSVariableValueView {
194
+ const registration = matchedStyles.getRegisteredProperty(variableName);
195
+ return new ElementsComponents.CSSVariableValueView.CSSVariableValueView({
196
+ variableName,
197
+ value: computedValue ?? undefined,
198
+ // TODO: provide a goToDefinition to jump to the StylesSidebarPane
199
+ details: registration ? {registration, goToDefinition: () => {}} : undefined,
200
+ });
201
+ }
202
+
203
+ getVariableParserError(_matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, _variableName: string):
204
+ ElementsComponents.CSSVariableValueView.CSSVariableParserError|null {
205
+ return null;
206
+ }
207
+
208
+ jumpToFunctionDefinition(_functionName: string): void {
209
+ }
210
+
211
+ continueEditingElement(_sectionIndex: number, _propertyIndex: number): void {
212
+ }
213
+
214
+ revealProperty(_cssProperty: SDK.CSSProperty.CSSProperty): void {
215
+ }
216
+
217
+ resetFocus(): void {
218
+ const firstVisibleSection = this.#sections[0]?.findCurrentOrNextVisible(true);
219
+ if (firstVisibleSection) {
220
+ firstVisibleSection.element.tabIndex = this.hasFocus() ? -1 : 0;
221
+ }
222
+ }
223
+
224
+ removeSection(_section: StylePropertiesSection): void {
225
+ }
226
+
227
+ focusedSectionIndex(): number {
228
+ return this.#sections.findIndex(section => section.element.hasFocus());
229
+ }
230
+
231
+ addBlankSection(
232
+ _insertAfterSection: StylePropertiesSection, _styleSheetHeader: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader,
233
+ _ruleLocation: TextUtils.TextRange.TextRange): void {
234
+ }
235
+
236
+ jumpToProperty(_propertyName: string, _sectionName?: string, _blockName?: string): boolean {
237
+ return false;
238
+ }
239
+
240
+ jumpToSectionBlock(_section: string): void {
241
+ }
242
+
243
+ jumpToFontPaletteDefinition(_paletteName: string): void {
244
+ }
245
+
246
+ jumpToDeclaration(_valueSource: SDK.CSSMatchedStyles.CSSValueSource): void {
247
+ }
248
+
249
+ addStyleUpdateListener(_listener: () => void): void {
250
+ }
251
+
252
+ removeStyleUpdateListener(_listener: () => void): void {
253
+ }
254
+ }
@@ -18,11 +18,6 @@ export class StylesAiCodeCompletionProvider {
18
18
 
19
19
  #boundOnUpdateAiCodeCompletionState = this.#updateAiCodeCompletionState.bind(this);
20
20
 
21
- #debouncedRequestAidaSuggestion =
22
- Common.Debouncer.debounce((prefix: string, suffix: string, cursorPositionAtRequest: number) => {
23
- void this.#requestAidaSuggestion(prefix, suffix, cursorPositionAtRequest);
24
- }, TextEditor.AiCodeCompletionProvider.AIDA_REQUEST_DEBOUNCE_TIMEOUT_MS);
25
-
26
21
  private constructor(aiCodeCompletionConfig: TextEditor.AiCodeCompletionProvider.AiCodeCompletionConfig) {
27
22
  const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
28
23
  if (!AiCodeCompletion.AiCodeCompletion.AiCodeCompletion.isAiCodeCompletionStylesEnabled(devtoolsLocale.locale)) {
@@ -113,7 +108,7 @@ export class StylesAiCodeCompletionProvider {
113
108
  prefix = prefix + text;
114
109
  const suffix = content.substring(propertyEndOffset);
115
110
  // TODO(b/476098133): Consider adjusting cursor position
116
- this.#debouncedRequestAidaSuggestion(prefix, suffix, cursorPosition);
111
+ await this.#requestAidaSuggestion(prefix, suffix, cursorPosition);
117
112
  }
118
113
 
119
114
  async #requestAidaSuggestion(prefix: string, suffix: string, cursorPositionAtRequest: number): Promise<void> {
@@ -42,9 +42,11 @@ import {assertNotNullOrUndefined} from '../../core/platform/platform.js';
42
42
  import * as Root from '../../core/root/root.js';
43
43
  import * as SDK from '../../core/sdk/sdk.js';
44
44
  import * as Protocol from '../../generated/protocol.js';
45
+ import * as AiCodeCompletion from '../../models/ai_code_completion/ai_code_completion.js';
45
46
  import * as Bindings from '../../models/bindings/bindings.js';
46
47
  import type * as ComputedStyle from '../../models/computed_style/computed_style.js';
47
48
  import * as TextUtils from '../../models/text_utils/text_utils.js';
49
+ import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
48
50
  import {createIcon, Icon} from '../../ui/kit/kit.js';
49
51
  import * as InlineEditor from '../../ui/legacy/components/inline_editor/inline_editor.js';
50
52
  import * as Components from '../../ui/legacy/components/utils/utils.js';
@@ -70,6 +72,7 @@ import {
70
72
  } from './StylePropertiesSection.js';
71
73
  import {StylePropertyHighlighter} from './StylePropertyHighlighter.js';
72
74
  import type {StylePropertyTreeElement} from './StylePropertyTreeElement.js';
75
+ import * as StylesAiCodeCompletionProvider from './StylesAiCodeCompletionProvider.js';
73
76
  import type {StylesContainer} from './StylesContainer.js';
74
77
  import stylesSidebarPaneStyles from './stylesSidebarPane.css.js';
75
78
  import {WebCustomData} from './WebCustomData.js';
@@ -1736,6 +1739,12 @@ export class CSSPropertyPrompt extends UI.TextPrompt.TextPrompt {
1736
1739
  private treeElement: StylePropertyTreeElement;
1737
1740
  private isEditingName: boolean;
1738
1741
  private readonly cssVariables: string[];
1742
+ aiCodeCompletionConfig?: TextEditor.AiCodeCompletionProvider.AiCodeCompletionConfig;
1743
+ aiCodeCompletionProvider?: StylesAiCodeCompletionProvider.StylesAiCodeCompletionProvider;
1744
+
1745
+ #debouncedTriggerAiCodeCompletion = Common.Debouncer.debounce(() => {
1746
+ void this.triggerAiCodeCompletion();
1747
+ }, TextEditor.AiCodeCompletionProvider.AIDA_REQUEST_DEBOUNCE_TIMEOUT_MS);
1739
1748
 
1740
1749
  constructor(treeElement: StylePropertyTreeElement, isEditingName: boolean, completions: string[] = []) {
1741
1750
  // Use the same callback both for applyItemCallback and acceptItemCallback.
@@ -1794,6 +1803,27 @@ export class CSSPropertyPrompt extends UI.TextPrompt.TextPrompt {
1794
1803
  }
1795
1804
  }
1796
1805
  }
1806
+
1807
+ const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
1808
+ if (AiCodeCompletion.AiCodeCompletion.AiCodeCompletion.isAiCodeCompletionStylesEnabled(devtoolsLocale.locale)) {
1809
+ this.aiCodeCompletionConfig = {
1810
+ completionContext: {},
1811
+ generationContext: {},
1812
+ onFeatureEnabled: () => {},
1813
+ onFeatureDisabled: () => {},
1814
+ onSuggestionAccepted: () => {},
1815
+ onRequestTriggered: () => {},
1816
+ onResponseReceived: () => {},
1817
+ panel: AiCodeCompletion.AiCodeCompletion.ContextFlavor.STYLES,
1818
+ getCompletionHint: this.getCompletionHint.bind(this),
1819
+ getCurrentText: () => {
1820
+ return this.text();
1821
+ },
1822
+ setAiAutoCompletion: () => {},
1823
+ };
1824
+ this.aiCodeCompletionProvider =
1825
+ StylesAiCodeCompletionProvider.StylesAiCodeCompletionProvider.createInstance(this.aiCodeCompletionConfig);
1826
+ }
1797
1827
  }
1798
1828
 
1799
1829
  override onKeyDown(event: Event): void {
@@ -1844,6 +1874,13 @@ export class CSSPropertyPrompt extends UI.TextPrompt.TextPrompt {
1844
1874
  return false;
1845
1875
  }
1846
1876
 
1877
+ override onInput(event: Event): void {
1878
+ super.onInput(event);
1879
+ if (this.aiCodeCompletionProvider) {
1880
+ this.#debouncedTriggerAiCodeCompletion();
1881
+ }
1882
+ }
1883
+
1847
1884
  private handleNameOrValueUpDown(event: Event): boolean {
1848
1885
  function finishHandler(this: CSSPropertyPrompt, _originalValue: string, _replacementString: string): void {
1849
1886
  // Synthesize property text disregarding any comments, custom whitespace etc.
@@ -2054,6 +2091,48 @@ export class CSSPropertyPrompt extends UI.TextPrompt.TextPrompt {
2054
2091
  return subtitleElement;
2055
2092
  }
2056
2093
  }
2094
+
2095
+ private async triggerAiCodeCompletion(): Promise<void> {
2096
+ const selection = this.element().getComponentSelection();
2097
+ if (!this.aiCodeCompletionProvider || !selection || selection.rangeCount === 0) {
2098
+ return;
2099
+ }
2100
+ const range = selection.getRangeAt(0);
2101
+ const userInput = this.text();
2102
+ // Only trigger if caret is at end of text content
2103
+ if (range.endOffset < userInput.length) {
2104
+ return;
2105
+ }
2106
+ const cssModel = this.treeElement.stylesContainer().cssModel();
2107
+ if (!cssModel) {
2108
+ return;
2109
+ }
2110
+ await this.aiCodeCompletionProvider.triggerAiCodeCompletion(
2111
+ userInput, range.endOffset, this.isEditingName, this.treeElement.property, cssModel);
2112
+ }
2113
+
2114
+ /**
2115
+ * Extracts the remaining portion of the suggestion text that follows the
2116
+ * user's current input.
2117
+ */
2118
+ private getCompletionHint(): string|null {
2119
+ const topSuggestion = this.isSuggestBoxVisible() ? this.suggestBox?.completion() : null;
2120
+ const suggestionText = topSuggestion?.text;
2121
+ if (!suggestionText) {
2122
+ return null;
2123
+ }
2124
+ const userInput = this.text();
2125
+ let completionHint = suggestionText;
2126
+ // Iterate from the longest possible overlap down to the shortest
2127
+ for (let i = Math.min(userInput.length, suggestionText.length); i > 0; i--) {
2128
+ const overlapCandidate = suggestionText.substring(0, i);
2129
+ if (userInput.endsWith(overlapCandidate)) {
2130
+ completionHint = suggestionText.slice(i);
2131
+ break;
2132
+ }
2133
+ }
2134
+ return completionHint;
2135
+ }
2057
2136
  }
2058
2137
 
2059
2138
  export function unescapeCssString(input: string): string {
@@ -24,6 +24,10 @@ export class ComputedStyleTrace extends HTMLElement {
24
24
  #onNavigateToSource: ((event?: Event) => void) = () => {};
25
25
  #ruleOriginNode?: Node;
26
26
 
27
+ connectedCallback(): void {
28
+ this.#render();
29
+ }
30
+
27
31
  set data(data: ComputedStyleTraceData) {
28
32
  this.#selector = data.selector;
29
33
  this.#active = data.active;
@@ -303,7 +303,7 @@ export class ElementsBreadcrumbs extends HTMLElement {
303
303
  data-crumb="true"
304
304
  >
305
305
  <a href="#" draggable=false class="crumb-link"
306
- jslog=${VisualLogging.item().track({click:true})}
306
+ jslog=${VisualLogging.item().track({click:true, resize:true})}
307
307
  @click=${this.#onCrumbClick(crumb.node)}
308
308
  @mousemove=${this.#onCrumbMouseMove(crumb.node)}
309
309
  @mouseleave=${this.#onCrumbMouseLeave(crumb.node)}
@@ -194,7 +194,8 @@ export class StylePropertyEditor extends HTMLElement {
194
194
  return html`
195
195
  <button title=${title}
196
196
  class=${classes}
197
- jslog=${VisualLogging.item().track({click: true}).context(`${propertyName}-${propertyValue}`)}
197
+ jslog=${
198
+ VisualLogging.item().track({click: true, resize: true}).context(`${propertyName}-${propertyValue}`)}
198
199
  @click=${() => this.#onButtonClick(propertyName, propertyValue, selected)}>
199
200
  <devtools-icon style=${transform} name=${iconInfo.iconName}>
200
201
  </devtools-icon>
@@ -19,7 +19,7 @@
19
19
  min-height: 16px;
20
20
  box-sizing: border-box;
21
21
  padding-top: 2px;
22
- white-space: nowrap;
22
+ white-space: var(--override-computed-style-property-white-space, nowrap);
23
23
  user-select: text;
24
24
  }
25
25
 
@@ -54,6 +54,7 @@ import * as NodeStackTraceWidget from './NodeStackTraceWidget.js';
54
54
  import * as PlatformFontsWidget from './PlatformFontsWidget.js';
55
55
  import * as PropertiesWidget from './PropertiesWidget.js';
56
56
  import * as PropertyRenderer from './PropertyRenderer.js';
57
+ import * as StandaloneStylesContainer from './StandaloneStylesContainer.js';
57
58
  import * as StyleEditorWidget from './StyleEditorWidget.js';
58
59
  import * as StylePropertiesSection from './StylePropertiesSection.js';
59
60
  import * as StylePropertyHighlighter from './StylePropertyHighlighter.js';
@@ -90,6 +91,7 @@ export {
90
91
  PlatformFontsWidget,
91
92
  PropertiesWidget,
92
93
  PropertyRenderer,
94
+ StandaloneStylesContainer,
93
95
  StyleEditorWidget,
94
96
  StylePropertiesSection,
95
97
  StylePropertyHighlighter,