chrome-devtools-frontend 1.0.1558690 → 1.0.1561080

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 (167) hide show
  1. package/front_end/Images/src/container.svg +4 -0
  2. package/front_end/core/common/Gzip.ts +15 -0
  3. package/front_end/core/host/InspectorFrontendHostStub.ts +0 -3
  4. package/front_end/core/platform/ArrayUtilities.ts +13 -0
  5. package/front_end/core/root/Runtime.ts +0 -5
  6. package/front_end/core/sdk/CSSMetadata.ts +6 -6
  7. package/front_end/core/sdk/CSSModel.ts +2 -2
  8. package/front_end/core/sdk/DOMModel.ts +15 -3
  9. package/front_end/core/sdk/NetworkManager.ts +4 -0
  10. package/front_end/core/sdk/NetworkRequest.ts +9 -0
  11. package/front_end/core/sdk/OverlayModel.ts +20 -9
  12. package/front_end/entrypoints/main/MainImpl.ts +2 -1
  13. package/front_end/generated/InspectorBackendCommands.ts +6 -3
  14. package/front_end/generated/SupportedCSSProperties.js +64 -32
  15. package/front_end/generated/protocol-mapping.d.ts +16 -0
  16. package/front_end/generated/protocol-proxy-api.d.ts +12 -0
  17. package/front_end/generated/protocol.ts +38 -1
  18. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
  19. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +11 -7
  20. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +23 -22
  21. package/front_end/models/badges/UserBadges.ts +48 -16
  22. package/front_end/models/greendev/Prototypes.ts +6 -1
  23. package/front_end/models/trace/LanternComputationData.ts +4 -3
  24. package/front_end/models/trace/Processor.ts +6 -5
  25. package/front_end/models/trace/Styles.ts +10 -1
  26. package/front_end/models/trace/extras/TraceTree.ts +1 -1
  27. package/front_end/models/trace/handlers/LargestImagePaintHandler.ts +2 -2
  28. package/front_end/models/trace/handlers/MetaHandler.ts +14 -0
  29. package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +59 -34
  30. package/front_end/models/trace/helpers/Timing.ts +8 -1
  31. package/front_end/models/trace/insights/Common.ts +1 -1
  32. package/front_end/models/trace/insights/LCPBreakdown.ts +4 -4
  33. package/front_end/models/trace/insights/LCPDiscovery.ts +3 -3
  34. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  35. package/front_end/models/trace/insights/types.ts +1 -1
  36. package/front_end/models/trace/types/TraceEvents.ts +62 -10
  37. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +11 -142
  38. package/front_end/panels/ai_assistance/PatchWidget.ts +90 -72
  39. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
  40. package/front_end/panels/ai_assistance/components/ChatInput.ts +701 -0
  41. package/front_end/panels/ai_assistance/components/ChatView.ts +71 -1268
  42. package/front_end/panels/ai_assistance/components/UserActionRow.ts +514 -31
  43. package/front_end/panels/ai_assistance/components/chatInput.css +387 -0
  44. package/front_end/panels/ai_assistance/components/chatView.css +38 -599
  45. package/front_end/panels/ai_assistance/components/userActionRow.css +230 -0
  46. package/front_end/panels/autofill/AutofillView.ts +2 -2
  47. package/front_end/panels/changes/ChangesView.ts +15 -1
  48. package/front_end/panels/changes/changesView.css +6 -0
  49. package/front_end/panels/common/AiCodeGenerationTeaser.ts +48 -12
  50. package/front_end/panels/common/BadgeNotification.ts +44 -58
  51. package/front_end/panels/common/CopyChangesToPrompt.ts +233 -0
  52. package/front_end/panels/common/aiCodeGenerationTeaser.css +14 -0
  53. package/front_end/panels/common/common.ts +2 -1
  54. package/front_end/panels/console/consoleView.css +1 -1
  55. package/front_end/panels/elements/CSSRuleValidator.ts +38 -0
  56. package/front_end/panels/elements/ElementsTreeElement.ts +222 -377
  57. package/front_end/panels/elements/ElementsTreeOutline.ts +0 -23
  58. package/front_end/panels/elements/ShortcutTreeElement.ts +57 -50
  59. package/front_end/panels/elements/StylePropertiesSection.ts +1 -3
  60. package/front_end/panels/elements/StylesSidebarPane.ts +15 -4
  61. package/front_end/panels/elements/components/AdornerManager.ts +5 -149
  62. package/front_end/panels/issues/HiddenIssuesRow.ts +1 -2
  63. package/front_end/panels/issues/IssueKindView.ts +2 -4
  64. package/front_end/panels/issues/IssueView.ts +2 -4
  65. package/front_end/panels/network/NetworkDataGridNode.ts +65 -1
  66. package/front_end/panels/network/NetworkLogView.ts +2 -4
  67. package/front_end/panels/network/NetworkLogViewColumns.ts +9 -0
  68. package/front_end/panels/screencast/ScreencastApp.ts +1 -0
  69. package/front_end/panels/settings/SettingsScreen.ts +3 -2
  70. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +14 -1
  71. package/front_end/panels/timeline/StatusDialog.ts +4 -3
  72. package/front_end/panels/timeline/ThirdPartyTreeView.ts +1 -4
  73. package/front_end/panels/timeline/TimelineController.ts +185 -3
  74. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +52 -25
  75. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +3 -16
  76. package/front_end/panels/timeline/TimelineFlameChartView.ts +65 -21
  77. package/front_end/panels/timeline/TimelinePanel.ts +86 -126
  78. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  79. package/front_end/panels/timeline/TimelineUIUtils.ts +28 -2
  80. package/front_end/panels/timeline/TimingsTrackAppender.ts +3 -1
  81. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  82. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -2
  83. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +6 -4
  84. package/front_end/panels/timeline/components/insights/Table.ts +3 -3
  85. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +4 -0
  86. package/front_end/panels/timeline/timelinePanel.css +8 -1
  87. package/front_end/panels/timeline/utils/EntryNodes.ts +2 -1
  88. package/front_end/panels/whats_new/ReleaseNoteText.ts +15 -9
  89. package/front_end/panels/whats_new/resources/WNDT.md +6 -6
  90. package/front_end/third_party/chromium/README.chromium +1 -1
  91. package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
  92. package/front_end/third_party/lit/rebuild.sh +1 -1
  93. package/front_end/third_party/puppeteer/README.chromium +2 -2
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +2 -3
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js +9 -0
  99. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPResponse.d.ts +3 -0
  101. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPResponse.js +9 -0
  103. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPResponse.js.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.d.ts +3 -0
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.d.ts.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.js +10 -0
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Request.js.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +8 -4
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts.map +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +10 -1
  123. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +13 -7
  124. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +2 -3
  125. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  126. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js +9 -0
  129. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPResponse.d.ts +3 -0
  131. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPResponse.js +9 -0
  133. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPResponse.js.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.d.ts +3 -0
  135. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.d.ts.map +1 -1
  136. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.js +10 -0
  137. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Request.js.map +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +8 -4
  140. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
  142. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
  144. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  146. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  147. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  148. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  150. package/front_end/third_party/puppeteer/package/lib/types.d.ts +10 -1
  151. package/front_end/third_party/puppeteer/package/package.json +3 -3
  152. package/front_end/third_party/puppeteer/package/src/api/Page.ts +2 -3
  153. package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +13 -0
  154. package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +10 -0
  155. package/front_end/third_party/puppeteer/package/src/bidi/core/Request.ts +15 -0
  156. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +9 -4
  157. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  158. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  159. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  160. package/front_end/ui/components/adorners/Adorner.ts +8 -68
  161. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +70 -28
  162. package/front_end/ui/legacy/SearchableView.ts +11 -5
  163. package/front_end/ui/legacy/SplitWidget.ts +1 -1
  164. package/front_end/ui/legacy/TabbedPane.ts +1 -1
  165. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +43 -9
  166. package/front_end/ui/visual_logging/KnownContextValues.ts +16 -0
  167. package/package.json +2 -1
@@ -0,0 +1,233 @@
1
+ // Copyright 2025 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 Host from '../../core/host/host.js';
6
+ import * as i18n from '../../core/i18n/i18n.js';
7
+ import * as GreenDev from '../../models/greendev/greendev.js';
8
+ import type * as Workspace from '../../models/workspace/workspace.js';
9
+ import * as WorkspaceDiff from '../../models/workspace_diff/workspace_diff.js';
10
+ import * as Diff from '../../third_party/diff/diff.js';
11
+ import * as Buttons from '../../ui/components/buttons/buttons.js';
12
+ import * as Snackbars from '../../ui/components/snackbars/snackbars.js';
13
+ import * as UI from '../../ui/legacy/legacy.js';
14
+ import * as Lit from '../../ui/lit/lit.js';
15
+
16
+ const {render, html} = Lit;
17
+
18
+ const UIStrings = {
19
+ /**
20
+ * @description The message shown in a toast when the response is copied to the clipboard.
21
+ */
22
+ responseCopiedToClipboard: 'Response copied to clipboard',
23
+ } as const;
24
+
25
+ const str_ = i18n.i18n.registerUIStrings('panels/common/CopyChangesToPrompt.ts', UIStrings);
26
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
27
+
28
+ interface CopyChangesDiff {
29
+ diff: Diff.Diff.DiffArray|undefined;
30
+ uiSourceCode: Workspace.UISourceCode.UISourceCode;
31
+ }
32
+
33
+ interface GeminiChangesViewInput {
34
+ /**
35
+ * These are the set of diffs tracked by the Changes Panel.
36
+ */
37
+ diffs: CopyChangesDiff[];
38
+ /**
39
+ * Supplied by the Patch Agent if it has made any changes on behalf of the
40
+ * user.
41
+ */
42
+ patchAgentCSSChange: string|null;
43
+ onCopyToClipboard: (text: string) => void;
44
+ }
45
+
46
+ type GeminiChangesView = (input: GeminiChangesViewInput, output: object, target: HTMLElement) => void;
47
+
48
+ export class CopyChangesToPrompt extends UI.Widget.Widget {
49
+ #workspaceDiff: WorkspaceDiff.WorkspaceDiff.WorkspaceDiffImpl;
50
+ readonly #view: GeminiChangesView;
51
+ #patchAgentCSSChange: string|null = null;
52
+
53
+ constructor(target?: HTMLElement, view = GEMINI_CHANGES_VIEW) {
54
+ super(target);
55
+ this.#view = view;
56
+ this.#workspaceDiff = WorkspaceDiff.WorkspaceDiff.workspaceDiff();
57
+ }
58
+
59
+ get patchAgentCSSChange(): string|null {
60
+ return this.#patchAgentCSSChange;
61
+ }
62
+ set patchAgentCSSChange(code: string) {
63
+ this.#patchAgentCSSChange = code;
64
+ this.requestUpdate();
65
+ }
66
+
67
+ override wasShown(): void {
68
+ super.wasShown();
69
+ this.#workspaceDiff.addEventListener(
70
+ WorkspaceDiff.WorkspaceDiff.Events.MODIFIED_STATUS_CHANGED, this.#onDiffChange, this);
71
+ }
72
+
73
+ override willHide(): void {
74
+ super.willHide();
75
+ this.#workspaceDiff.removeEventListener(
76
+ WorkspaceDiff.WorkspaceDiff.Events.MODIFIED_STATUS_CHANGED, this.#onDiffChange, this);
77
+ }
78
+
79
+ #getModifiledFiles(): Workspace.UISourceCode.UISourceCode[] {
80
+ return this.#workspaceDiff.modifiedUISourceCodes().filter(modified => {
81
+ return !modified.url().startsWith('inspector://');
82
+ });
83
+ }
84
+
85
+ #onDiffChange(): void {
86
+ // TODO: track this and unsubscribe to files?
87
+ for (const file of this.#getModifiledFiles()) {
88
+ this.#workspaceDiff.subscribeToDiffChange(file, this.requestUpdate, this);
89
+ }
90
+ this.requestUpdate();
91
+ }
92
+
93
+ set workspaceDiff(diff: WorkspaceDiff.WorkspaceDiff.WorkspaceDiffImpl) {
94
+ this.#workspaceDiff = diff;
95
+ this.requestUpdate();
96
+ }
97
+
98
+ override async performUpdate(): Promise<void> {
99
+ if (!GreenDev.Prototypes.instance().isEnabled('copyToGemini')) {
100
+ // We expect code that renders this component to only do so based on this flag, but this is a double-check.
101
+ return;
102
+ }
103
+
104
+ const diffs = await Promise.all(this.#getModifiledFiles().map(async modifiedUISourceCode => {
105
+ const diffResponse = await this.#workspaceDiff?.requestDiff(modifiedUISourceCode);
106
+ return {diff: diffResponse?.diff ?? [], uiSourceCode: modifiedUISourceCode};
107
+ }));
108
+ this.#view(
109
+ {
110
+ diffs,
111
+ patchAgentCSSChange: this.#patchAgentCSSChange,
112
+ onCopyToClipboard: (text: string) => {
113
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(text);
114
+ Snackbars.Snackbar.Snackbar.show({
115
+ message: i18nString(UIStrings.responseCopiedToClipboard),
116
+ });
117
+ }
118
+ },
119
+ {}, this.contentElement);
120
+ }
121
+ }
122
+ const GEMINI_CHANGES_VIEW: GeminiChangesView = (input, _output, target) => {
123
+ const hasDiffs = input.diffs.some(d => {
124
+ return d.diff !== undefined && d.diff.length > 0;
125
+ });
126
+
127
+ if (!hasDiffs && !input.patchAgentCSSChange) {
128
+ render(Lit.nothing, target);
129
+ return;
130
+ }
131
+
132
+ const promptForChangesPanel = hasDiffs ? buildGeminiCommand(input.diffs) : '';
133
+ const promptForPatchAgentCSS = input.patchAgentCSSChange ? buildPatchAgentCSSPrompt(input.patchAgentCSSChange) : '';
134
+
135
+ const finalPrompt = [PREAMBLE, promptForChangesPanel, promptForPatchAgentCSS].filter(x => x.length > 0).join(`\n`);
136
+
137
+ function copyClick(): void {
138
+ input.onCopyToClipboard(finalPrompt);
139
+ }
140
+ // clang-format off
141
+ render(html`<devtools-button
142
+ .iconName=${'copy'}
143
+ .variant=${Buttons.Button.Variant.OUTLINED}
144
+ @click=${copyClick}>Copy prompt to clipboard</devtools-button>
145
+ `, target);
146
+ // clang-format on
147
+ };
148
+
149
+ function buildPatchAgentCSSPrompt(code: string): string {
150
+ // clang-format off
151
+ return `The DevTools CSS Patching Agent has also made some CSS changes on behalf of the user. These changes are listed below. Think carefully about how best to apply these changes.
152
+
153
+ **DevTools Patch Agent changes**
154
+ \`\`\`
155
+ ${code}
156
+ \`\`\``;
157
+ // clang-format on
158
+ }
159
+
160
+ function buildGeminiCommand(diffs: readonly CopyChangesDiff[]): string {
161
+ // clang-format off
162
+ const output = `Below this line are a list of files and the diff for each of them. Consider this diff and apply it to the codebase but remembering that the changes in DevTools may not be the most accurate fixes and you should not necessarily apply them directly as DevTools works with the deployed code and not the source code.
163
+
164
+ Within the diffs you will often see lines of code commented out. If the diff contains a new line that was some code being wrapped in comments, treat that as if the intent is to delete the code.
165
+
166
+ How to read a diff:
167
+ * If a line starts with \`-\` , DevTools removed it.
168
+ * If a line starts with \`+\` , DevTools added it.
169
+ * If a line starts with neither a \`+\` or \`-\` , DevTools did not change the line and you can safely ignore it.
170
+
171
+ ${diffs.map(diff => {
172
+ if (!diff.diff || diff.diff.length === 0) {
173
+ return '';
174
+ }
175
+ return `Filename: ${diff.uiSourceCode.fullDisplayName()}
176
+
177
+ Diff:
178
+ ${formatDiffForLLM(diff.diff)}`;
179
+ }).filter(x => x.length).join('\n')}`;
180
+ // clang-format on
181
+ return output;
182
+ }
183
+
184
+ function formatDiffForLLM(diffArray: Diff.Diff.DiffArray): string {
185
+ let formattedDiff = '';
186
+ for (const diffItem of diffArray) {
187
+ const operation = diffItem[0];
188
+ const lines = diffItem[1];
189
+
190
+ for (const line of lines) {
191
+ if (operation === Diff.Diff.Operation.Equal) {
192
+ formattedDiff += ' ' + line + '\n';
193
+ } else if (operation === Diff.Diff.Operation.Insert) {
194
+ formattedDiff += '+ ' + line + '\n';
195
+ } else if (operation === Diff.Diff.Operation.Delete) {
196
+ formattedDiff += '- ' + line + '\n';
197
+ }
198
+ }
199
+ }
200
+ return formattedDiff;
201
+ }
202
+
203
+ const PREAMBLE =
204
+ `You are receiving a set of runtime changes (CSS, HTML, and JS) captured via Browser DevTools. Your goal is to persist these changes into the local source code by identifying the original source-of-truth.
205
+
206
+ Because DevTools reflects the "Flattened Result" of complex build logic, you must follow this "Source-Aware" strategy:
207
+
208
+ 1. **Structural Mapping (HTML/DOM):**
209
+ - If a DOM element was added/removed, identify the source template (JSX, Vue, Svelte, HTML) responsible.
210
+ - **Logic Check:** Determine if the change should be a static element or if it requires a new conditional (\`if/else\`) or loop (\`map\`) based on existing component patterns.
211
+
212
+ 2. **Style Mapping (CSS/Attributes):**
213
+ - Map raw styles to the project's specific styling architecture (Tailwind, SCSS, Styled-Components).
214
+ - Replace hard-coded values with existing Design Tokens or Theme Variables (\`var(--color-primary)\`, etc.) found in the codebase.
215
+ - CSS changes may not be applied to CSS files directly. Consider that CSS could be applied via JavaScript, especially if the codebase is using a component based frontend framework or web components.
216
+
217
+
218
+ 3. **Behavioral Mapping (JS/Event Listeners):**
219
+ - If logic or event handlers were modified, locate the corresponding functions or hooks in the source.
220
+ - Ensure new logic follows the project's state management patterns (e.g., React \`useState\`, Redux, or standard ES6+ modules).
221
+
222
+ 4. **Safety & Ambiguity Protocol:**
223
+ - **Third-Party Code:** If a change targets a DOM element or style generated by an external library (e.g., a UI kit's internal wrapper), do not modify the library's source. Instead, find the appropriate override mechanism in the codebase.
224
+ - **Uncertainty:** If a DevTools change cannot be mapped to the source with 100% confidence (e.g., minified selectors or ambiguous origin), stop and report the conflict rather than guessing.
225
+
226
+ 5. **Agentic Execution Workflow:**
227
+ - **Discovery:** Use your tools (\`grep\`, \`find\`, etc.) to locate unique strings or class names from the DevTools log.
228
+ - **Analysis:** Determine if the target is a reusable component or a specific page instance.
229
+ - **Implementation:** Execute file edits using the project's idiomatic syntax and formatting standards.
230
+
231
+ **INSTRUCTION:**
232
+ Begin by searching for the relevant source files. Explain your mapping logic before performing the edits.
233
+ `;
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright 2025 The Chromium Authors
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ @scope to (devtools-widget > *) {
8
+ .ai-code-generation-teaser {
9
+ .new-badge {
10
+ font-style: normal;
11
+ display: inline-block;
12
+ }
13
+ }
14
+ }
@@ -95,7 +95,7 @@ export class TypeToAllowDialog {
95
95
  }
96
96
 
97
97
  export {AiCodeCompletionTeaser} from './AiCodeCompletionTeaser.js';
98
- export {AiCodeGenerationTeaser} from './AiCodeGenerationTeaser.js';
98
+ export * as AiCodeGenerationTeaser from './AiCodeGenerationTeaser.js';
99
99
  export {AnnotationManager} from './AnnotationManager.js';
100
100
  export {FreDialog} from './FreDialog.js';
101
101
  export {GdpSignUpDialog} from './GdpSignUpDialog.js';
@@ -108,3 +108,4 @@ export * as ExtensionView from './ExtensionView.js';
108
108
  export * as PersistenceUtils from './PersistenceUtils.js';
109
109
  export * as DOMLinkifier from './DOMLinkifier.js';
110
110
  export * as ExtensionIframe from './ExtensionView.js';
111
+ export {CopyChangesToPrompt} from './CopyChangesToPrompt.js';
@@ -221,7 +221,7 @@
221
221
  --console-color-white: #fff;
222
222
 
223
223
  &:focus {
224
- background-color: var(--sys-color-state-focus-highlight);
224
+ background-image: linear-gradient(to bottom, var(--sys-color-state-focus-highlight), var(--sys-color-state-focus-highlight));
225
225
  }
226
226
  }
227
227
 
@@ -85,6 +85,20 @@ const UIStrings = {
85
85
  */
86
86
  flexGridContainerPropertyRuleFix:
87
87
  'Try setting the {PROPERTY_NAME} on the container element or use {ALTERNATIVE_PROPERTY_NAME} instead.',
88
+ /**
89
+ * @description The messages shown in the Style pane when the user hovers over a position-anchor declaration that has no affect on a non-anchor-positioned element.
90
+ * @example {relative} POSITION
91
+ */
92
+ invalidAnchorPositioning:
93
+ 'An anchor was defined but the element was not anchor-positioned but positioned "{POSITION}".',
94
+ /**
95
+ * @description The messages shown in the Style pane when the user hovers over a position-anchor declaration that has no affect on a non-anchor-positioned element.
96
+ */
97
+ invalidAnchorPositioningFix: 'Set position to either "fixed" or "absolute".',
98
+ /**
99
+ * @description The messages shown in the Style pane when the user hovers over a position-anchor declaration that has no affect on hidden element.
100
+ */
101
+ unusedAnchorPositioning: 'An anchor was defined but the element is hidden.',
88
102
  } as const;
89
103
  const str_ = i18n.i18n.registerUIStrings('panels/elements/CSSRuleValidator.ts', UIStrings);
90
104
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -547,6 +561,29 @@ export class ZIndexValidator extends CSSRuleValidator {
547
561
  }
548
562
  }
549
563
 
564
+ export class PositionAnchorValidator extends CSSRuleValidator {
565
+ constructor() {
566
+ super(['position-anchor']);
567
+ }
568
+
569
+ override getHint(propertyName: string, computedStyles?: Map<string, string>): Hint|undefined {
570
+ const position = computedStyles?.get('position') ?? 'static';
571
+ const display = computedStyles?.get('display');
572
+
573
+ if (position !== 'absolute' && position !== 'fixed') {
574
+ return new Hint(
575
+ i18nString(UIStrings.invalidAnchorPositioning, {POSITION: position}),
576
+ i18nString(UIStrings.invalidAnchorPositioningFix));
577
+ }
578
+
579
+ if (display === 'none') {
580
+ return new Hint(i18nString(UIStrings.unusedAnchorPositioning, {POSITION: position}), null);
581
+ }
582
+
583
+ return undefined;
584
+ }
585
+ }
586
+
550
587
  /**
551
588
  * Validates if CSS width/height are having an effect on an element.
552
589
  * See "Applies to" in https://www.w3.org/TR/css-sizing-3/#propdef-width.
@@ -659,6 +696,7 @@ const CSS_RULE_VALIDATORS = [
659
696
  MulticolFlexGridValidator,
660
697
  PaddingValidator,
661
698
  PositionValidator,
699
+ PositionAnchorValidator,
662
700
  SizingValidator,
663
701
  ZIndexValidator,
664
702
  ];