chrome-devtools-frontend 1.0.1733843 → 1.0.1736236

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 (184) hide show
  1. package/.agents/rules/tests/test-view-and-presenter-isolation.md +4 -4
  2. package/.agents/rules/ui-and-widgets/ui-declarative-tree-and-prompt-patterns.md +61 -0
  3. package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +11 -7
  4. package/.agents/rules/ui-and-widgets/ui-modern-component-and-encapsulation-standards.md +13 -4
  5. package/.agents/rules/ui-and-widgets/ui-pure-view-and-presenter-separation.md +31 -2
  6. package/.agents/rules/ui-and-widgets/ui-reactive-widget-update-lifecycle.md +23 -4
  7. package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +34 -3
  8. package/.agents/skills/code-review/SKILL.md +27 -0
  9. package/.agents/skills/devtools-uistrings/SKILL.md +147 -0
  10. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +27 -1
  11. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +100 -0
  12. package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +16 -0
  13. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +13 -2
  14. package/.agents/skills/ui-widgets/SKILL.md +25 -25
  15. package/DIR_METADATA +8 -1
  16. package/docs/cookbook/localization.md +1 -1
  17. package/docs/ui_engineering.md +24 -0
  18. package/eslint.config.mjs +0 -1
  19. package/front_end/application_tokens.css +1 -1
  20. package/front_end/core/host/AidaClient.ts +147 -202
  21. package/front_end/core/host/AidaClientTypes.ts +9 -0
  22. package/front_end/core/host/AidaErrors.ts +416 -0
  23. package/front_end/core/host/AidaGcaTranslation.ts +11 -0
  24. package/front_end/core/host/InspectorFrontendHostAPI.ts +9 -2
  25. package/front_end/core/host/UserMetrics.ts +25 -0
  26. package/front_end/core/host/UserMetricsEnums.ts +25 -0
  27. package/front_end/core/host/host.ts +3 -1
  28. package/front_end/core/i18n/collect-ui-strings.js +20 -0
  29. package/front_end/core/root/Runtime.ts +12 -0
  30. package/front_end/core/sdk/CPUThrottlingManager.ts +3 -0
  31. package/front_end/core/sdk/EnhancedTracesParser.ts +8 -4
  32. package/front_end/core/sdk/NetworkManager.ts +0 -6
  33. package/front_end/core/sdk/OverlayModel.ts +0 -6
  34. package/front_end/core/sdk/PreloadingModel.ts +30 -13
  35. package/front_end/core/sdk/PrivateVerificationTokensModel.ts +0 -18
  36. package/front_end/core/sdk/RehydratingConnection.ts +5 -2
  37. package/front_end/core/sdk/ResourceTreeModel.ts +0 -42
  38. package/front_end/core/sdk/ScreenCaptureModel.ts +0 -84
  39. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -15
  40. package/front_end/core/sdk/StorageBucketsModel.ts +0 -15
  41. package/front_end/devtools_compatibility.js +57 -2
  42. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +4 -2
  43. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +203 -127
  44. package/front_end/entrypoints/inspector_main/renderingOptions.css +5 -0
  45. package/front_end/entrypoints/node_app/app/NodeMain.ts +0 -9
  46. package/front_end/entrypoints/node_app/app/nodeConnectionsPanel.css +0 -22
  47. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  48. package/front_end/generated/SupportedCSSProperties.ts +0 -136
  49. package/front_end/generated/protocol-proxy-api.d.ts +231 -231
  50. package/front_end/generated/protocol.ts +1 -0
  51. package/front_end/models/ai_assistance/AiAgent2.ts +4 -1
  52. package/front_end/models/ai_assistance/ChangeManager.ts +3 -1
  53. package/front_end/models/ai_assistance/DOMHelpers.ts +118 -3
  54. package/front_end/models/ai_assistance/ExtensionScope.ts +31 -24
  55. package/front_end/models/ai_assistance/agents/AiAgent.ts +6 -0
  56. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +13 -13
  57. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +1 -1
  58. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  59. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +18 -8
  60. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +2 -2
  61. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +103 -81
  62. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +15 -203
  63. package/front_end/models/ai_assistance/injected.ts +6 -1
  64. package/front_end/models/ai_assistance/skills/lighthouse.md +1 -1
  65. package/front_end/models/ai_assistance/skills/styling.md +8 -10
  66. package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +1 -1
  67. package/front_end/models/ai_assistance/tools/SetElementStyles.ts +288 -0
  68. package/front_end/models/ai_assistance/tools/Tool.ts +1 -0
  69. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +3 -0
  70. package/front_end/models/bindings/ResourceScriptMapping.ts +64 -16
  71. package/front_end/models/comment_manager/CD4ABridge.ts +12 -2
  72. package/front_end/models/comment_manager/CommentManager.ts +24 -4
  73. package/front_end/models/javascript_metadata/NativeFunctions.ts +41 -1
  74. package/front_end/models/project_settings/ProjectSettingsModel.ts +1 -1
  75. package/front_end/models/trace/handlers/FlowsHandler.ts +10 -0
  76. package/front_end/models/trace/handlers/SamplesHandler.ts +3 -2
  77. package/front_end/models/trace/handlers/ScriptsHandler.ts +25 -26
  78. package/front_end/models/trace/helpers/TreeHelpers.ts +4 -0
  79. package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -2
  80. package/front_end/models/trace/types/TraceEvents.ts +21 -22
  81. package/front_end/panels/ai_assistance/components/ChatMessage.ts +9 -1
  82. package/front_end/panels/ai_assistance/components/chatInput.css +4 -4
  83. package/front_end/panels/animation/AnimationTimeline.ts +3 -3
  84. package/front_end/panels/animation/animationTimeline.css +6 -4
  85. package/front_end/panels/application/IndexedDBModel.ts +0 -15
  86. package/front_end/panels/application/appManifestView.css +2 -5
  87. package/front_end/panels/application/components/backForwardCacheView.css +1 -5
  88. package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
  89. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -0
  90. package/front_end/panels/comments/CommentsPane.ts +12 -7
  91. package/front_end/panels/comments/commentsPane.css +16 -2
  92. package/front_end/panels/common/CommentsOverlayWidget.ts +16 -10
  93. package/front_end/panels/common/CommentsStatusBarPill.ts +12 -5
  94. package/front_end/panels/common/commentsOverlay.css +7 -1
  95. package/front_end/panels/common/commentsStatusBarPill.css +30 -0
  96. package/front_end/panels/console/consolePrompt.css +0 -12
  97. package/front_end/panels/console/consoleView.css +2 -2
  98. package/front_end/panels/developer_resources/developerResourcesView.css +4 -3
  99. package/front_end/panels/elements/DOMTreeWidget.ts +29 -9
  100. package/front_end/panels/elements/StylePropertyTreeElement.ts +2 -1
  101. package/front_end/panels/elements/components/CSSHintDetailsView.ts +12 -5
  102. package/front_end/panels/elements/components/cssVariableValueView.css +1 -1
  103. package/front_end/panels/elements/components/elementsBreadcrumbs.css +2 -2
  104. package/front_end/panels/elements/domTreeWidget.css +6 -1
  105. package/front_end/panels/elements/elementsPanel.css +0 -6
  106. package/front_end/panels/elements/layoutPane.css +1 -1
  107. package/front_end/panels/elements/metricsSidebarPane.css +1 -1
  108. package/front_end/panels/elements/platformFontsWidget.css +1 -1
  109. package/front_end/panels/elements/stylesSidebarPane.css +0 -10
  110. package/front_end/panels/emulation/deviceModeView.css +6 -7
  111. package/front_end/panels/explain/components/consoleInsight.css +4 -4
  112. package/front_end/panels/issues/issuesTree.css +1 -26
  113. package/front_end/panels/lighthouse/lighthouseStartView.css +2 -2
  114. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
  115. package/front_end/panels/media/TickingFlameChart.ts +20 -3
  116. package/front_end/panels/media/playerMessagesView.css +2 -2
  117. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +24 -5
  118. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +1 -6
  119. package/front_end/panels/network/networkLogView.css +2 -2
  120. package/front_end/panels/network/networkTimingTable.css +1 -1
  121. package/front_end/panels/performance_monitor/performanceMonitor.css +0 -4
  122. package/front_end/panels/protocol_monitor/JSONEditor.css +1 -1
  123. package/front_end/panels/protocol_monitor/JSONEditor.ts +4 -2
  124. package/front_end/panels/recorder/recorderPanel.css +3 -3
  125. package/front_end/panels/recorder/recordingListView.css +1 -1
  126. package/front_end/panels/screencast/screencastView.css +1 -1
  127. package/front_end/panels/search/searchResultsPane.css +1 -1
  128. package/front_end/panels/security/SecurityModel.ts +0 -6
  129. package/front_end/panels/security/SecurityPanel.ts +120 -108
  130. package/front_end/panels/security/originView.css +1 -1
  131. package/front_end/panels/sensors/locationsSettingsTab.css +3 -3
  132. package/front_end/panels/settings/EditFileSystemView.ts +159 -104
  133. package/front_end/panels/settings/editFileSystemView.css +30 -4
  134. package/front_end/panels/settings/emulation/devicesSettingsTab.css +0 -52
  135. package/front_end/panels/settings/settingsScreen.css +0 -7
  136. package/front_end/panels/sources/CallStackSidebarPane.ts +339 -221
  137. package/front_end/panels/sources/NavigatorView.ts +95 -8
  138. package/front_end/panels/sources/ThreadsSidebarPane.ts +8 -4
  139. package/front_end/panels/sources/breakpointsView.css +1 -3
  140. package/front_end/panels/sources/callStackSidebarPane.css +4 -0
  141. package/front_end/panels/sources/components/HeadersView.ts +15 -2
  142. package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -1
  143. package/front_end/panels/timeline/CountersGraph.ts +0 -4
  144. package/front_end/panels/timeline/TimelineLoader.ts +16 -6
  145. package/front_end/panels/timeline/TimelinePanel.ts +20 -12
  146. package/front_end/panels/timeline/TimelineUIUtils.ts +1 -1
  147. package/front_end/panels/timeline/components/DetailsView.ts +2 -1
  148. package/front_end/panels/timeline/components/cwvMetrics.css +1 -1
  149. package/front_end/panels/timeline/components/metricCard.css +1 -1
  150. package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +4 -4
  151. package/front_end/panels/timeline/timelineFlameChartView.css +1 -1
  152. package/front_end/panels/webauthn/WebauthnPane.ts +13 -14
  153. package/front_end/panels/webauthn/webauthnPane.css +1 -1
  154. package/front_end/third_party/chromium/README.chromium +1 -1
  155. package/front_end/ui/comments/CommentOverlayManager.ts +34 -18
  156. package/front_end/ui/components/icon_button/FileSourceIcon.ts +6 -0
  157. package/front_end/ui/components/input/textInput.css +1 -1
  158. package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +6 -4
  159. package/front_end/ui/components/suggestion_input/suggestionInput.css +2 -2
  160. package/front_end/ui/components/text_editor/AiCodeGenerationTeaser.ts +14 -2
  161. package/front_end/ui/legacy/DockController.ts +17 -4
  162. package/front_end/ui/legacy/Treeoutline.ts +2 -2
  163. package/front_end/ui/legacy/UIUtils.ts +148 -10
  164. package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +3 -2
  165. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +2 -2
  166. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +2 -2
  167. package/front_end/ui/legacy/components/perf_ui/pieChart.css +1 -1
  168. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +5 -4
  169. package/front_end/ui/legacy/components/source_frame/imageView.css +1 -1
  170. package/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts +0 -3
  171. package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
  172. package/front_end/ui/legacy/inspectorCommon.css +1 -14
  173. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +3 -2
  174. package/front_end/ui/legacy/listWidget.css +0 -18
  175. package/front_end/ui/legacy/theme_support/ThemeSupport.ts +44 -9
  176. package/front_end/ui/lit/strip-whitespace.ts +1 -1
  177. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  178. package/package.json +3 -3
  179. package/front_end/generated/Deprecation.ts +0 -471
  180. package/front_end/panels/accessibility/axBreadcrumbs.css +0 -155
  181. package/front_end/panels/network/requestHeadersTree.css +0 -226
  182. package/front_end/panels/recorder/startView.css +0 -38
  183. package/front_end/panels/security/ipProtectionView.css +0 -141
  184. package/front_end/ui/legacy/components/inline_editor/animationNameSwatch.css +0 -27
@@ -207,3 +207,103 @@ The plan you generate **MUST** follow this structure:
207
207
  1. Promote view classes to modern `UI.Widget` classes, hook up
208
208
  `performUpdate()` delegates, export the default view layout, and clean
209
209
  up legacy wrappers.
210
+
211
+ --------------------------------------------------------------------------------
212
+
213
+ ## 3. Incremental Multi-CL Playbook for Complex Tree & List Widgets (`UI.TreeOutline` → `<devtools-tree>`)
214
+
215
+ For complex widgets with deeply nested item hierarchies, custom tree element
216
+ subclasses, or inline editing (such as `NavigatorView` or `SearchResultsPane`),
217
+ monolithic migrations introduce high review friction and regression risk.
218
+ Decompose the work into a 4-phase sequence of small, self-contained CLs
219
+ (~50–250 lines of diff each):
220
+
221
+ ### Phase 0: Safety Net, Cleanup & Latent Bug Fixes (Independent CLs)
222
+ 1. **Dead-Code Removal**: Remove dead helper methods, unused getters, and
223
+ obsolete container references in an initial standalone CL.
224
+ 2. **Implementation-Decoupled Tests**: Add structural and interaction unit
225
+ tests whose DOM assertions route through small local test helpers
226
+ (`dumpTree()`, `findTreeItem()`, `activateRow()`, `openContextMenuOnRow()`)
227
+ rather than scattering direct tree-outline element queries across tests.
228
+ 3. **Screenshot Baselines**: Add `assertScreenshot(...)` golden tests covering
229
+ critical visual states (grouping modes, icons/badges, selection, dimmed
230
+ items) to establish baselines that catch visual regressions independently of
231
+ the underlying widget engine.
232
+ 4. **Targeted Bug Fixes**: If test scaffolding uncovers latent bugs in existing
233
+ logic, fix them in dedicated bugfix CLs before refactoring.
234
+
235
+ ### Phase 1: Decouple Custom Item Subclasses One Concern per CL (`Bug: <id>`)
236
+ 1. **Sorting & Comparators**: Move sorting functions from item elements to
237
+ presenter data nodes.
238
+ 2. **Row Event Handlers**: Move row event handlers (hover, context menu, drag,
239
+ rename triggers) to presenter methods.
240
+ 3. **Icon & Action Templates**: Convert imperative leading/trailing icons,
241
+ badges, and action buttons into module-level Lit template helpers, removing
242
+ view-layer refresh methods (`updateTrailingIcons()`, `updateIcon()`) from
243
+ presenter nodes once state moves to `DEFAULT_VIEW`.
244
+ 4. **State Tracking in Presenter**: Track selection, expansion (`WeakSet`), and
245
+ lazy population in the presenter via tree events rather than overriding
246
+ `TreeElement.onpopulate()` or `onselect()`.
247
+ 5. **Remove Custom Subclasses**: Delete custom `TreeElement` subclasses one
248
+ class per CL, using plain `UI.TreeOutline.TreeElement` instances paired with
249
+ a `WeakMap<TreeElement, Node>` bridge and computing presenter node state
250
+ (`title`, `tooltip`, badges) independently of `TreeElement` creation.
251
+
252
+ ### Phase 2: Persistent `<devtools-prompt>` & `<devtools-tree>` Swap (`Bug: <id>`)
253
+ 1. **Persistent `<devtools-prompt ?editing>`**: Migrate inline renaming or
254
+ editing (`UI.InplaceEditor`) to a persistent `<devtools-prompt ?editing>` in
255
+ its own CL, updating E2E tests waiting on `.being-edited` to wait on
256
+ `devtools-prompt[editing]`.
257
+ 2. **Test-Helper Prep CL**: If `front_end/legacy_test_runner/**` or
258
+ `blink_web_tests` walk internal tree elements, update test helpers to flush
259
+ `innerView.performUpdate()` and `flushPendingUpdatesForTesting()` after
260
+ expanding nodes.
261
+ 3. **`<devtools-tree>` Swap**: Replace `TreeOutlineInShadow` with
262
+ `<devtools-tree autofocus>` in `DEFAULT_VIEW` without widening
263
+ `front_end/ui/legacy/Treeoutline.ts` contracts. Host editable
264
+ `<devtools-prompt ?editing>` rows in a child `UI.Widget` (`${widget(...)}`)
265
+ so `<devtools-tree>`'s light-DOM `MutationObserver` does not re-clone the
266
+ row and blur the active input. Use asynchronous `this.requestUpdate()` across
267
+ all presenter methods and remove
268
+ `/* eslint-disable @devtools/no-imperative-dom-api */`.
269
+
270
+ ### Phase 3: Pure Lifecycle, `INJECT` DI & Final Polish (`Fixed: <id>` on Final CL Only)
271
+ 1. **Non-Destructive Lifecycle**: Move model, workspace, and setting
272
+ subscriptions from `constructor()` into `wasShown()` / `willHide()`,
273
+ reconciling incremental changes that occurred while hidden rather than
274
+ calling `reset()` and wiping open folders or selection on every re-show.
275
+ 2. **Universe Dependency Injection**: Add `static override readonly INJECT` and
276
+ the standard MVP constructor `(element?: HTMLElement, [...]: WidgetDependencies, view: View = DEFAULT_VIEW)`.
277
+ 3. **Private Fields & Completeness**: Convert remaining TypeScript `private`
278
+ members to `#private` (after verifying they are not reflectively accessed in
279
+ `legacy_test_runner` or `blink/web_tests`), and mark `Fixed: <id>` on this
280
+ final CL.
281
+
282
+ --------------------------------------------------------------------------------
283
+
284
+ ## 4. Definition of Done & `Bug:` vs `Fixed:` Completeness Gate
285
+
286
+ > [!WARNING]
287
+ > A clean `@devtools/no-imperative-dom-api` ESLint run does **NOT** prove a UI
288
+ > Eng Vision migration is complete. The linter does not flag `extends UI.TreeOutline.TreeElement` subclasses or `UI.ListControl`.
289
+
290
+ Before closing a UI Eng Vision migration issue with `Fixed: <id>`, verify every
291
+ requirement below. If any item remains incomplete, use `Bug: <id>` and address
292
+ it in a follow-up CL:
293
+
294
+ 1. **No Legacy Widgets**: Zero references to `UI.TreeOutline`, `TreeElement`
295
+ subclasses, `UI.ListControl`, `UI.ListWidget`, or `UI.InplaceEditor`.
296
+ 2. **Standard MVP Constructor**: Constructor accepts `element?: HTMLElement` as
297
+ its first parameter, resolves dependencies via `static override readonly INJECT`,
298
+ and accepts an injectable `view: View = DEFAULT_VIEW`.
299
+ 3. **Widget Update Lifecycle**: Renders exclusively via `override performUpdate(): void`
300
+ and `this.requestUpdate()` (no custom `#renderView()` bypasses or synchronous
301
+ `performUpdate()` calls in presenter methods).
302
+ 4. **Non-Destructive Listener Lifecycle**: External model and setting
303
+ listeners are attached in `wasShown()` and detached symmetrically in
304
+ `willHide()`, preserving populated UI state across hide/show cycles.
305
+ 5. **Declarative Primitives**: Uses `<devtools-tree>`, `<devtools-list>`,
306
+ persistent `<devtools-prompt ?editing>`, `?hidden=${...}` exclusively
307
+ (without `.hidden` classes), and declarative `autofocus` for default focus.
308
+ 6. **ES Private Fields**: Uses ECMAScript `#private` fields and methods for all
309
+ internal members not accessed by `legacy_test_runner` or `blink/web_tests`.
@@ -55,6 +55,22 @@ logical regressions are introduced during modernization.
55
55
  });
56
56
  ```
57
57
 
58
+ * **Implementation-Decoupled Helpers & Screenshot Baselines Before Replacing Legacy Widgets**:
59
+ When scaffolding unit tests ahead of replacing a legacy widget engine
60
+ (`TreeOutline`, `DataGrid`, `ListControl`, `ListWidget`):
61
+ * **Encapsulate DOM Inspection in Local Helpers**: Route tree, row,
62
+ and element queries through small local helper functions (`dumpTree()`,
63
+ `findTreeItem()`, `activateRow()`, `openContextMenuOnRow()`) rather
64
+ than scattering direct internal widget queries across every `it()`
65
+ block. When the legacy widget is subsequently swapped for
66
+ `<devtools-tree>` or `<devtools-data-grid>`, only the helper
67
+ implementations change while dozens of tests remain untouched.
68
+ * **Mandatory Visual Regression Coverage**: Always add
69
+ `assertScreenshot(...)` golden tests covering critical visual
70
+ states (grouping modes, icons/badges, dimmed/dirty states). Unit
71
+ tests often inspect internal state that changes during migration;
72
+ screenshot goldens ensure the user-visible UI remains identical.
73
+
58
74
  4. **Wait for confirmation**:
59
75
 
60
76
  * Wait for an explicit confirmation from the user (or Parent Orchestrator Agent) before proceeding to the next step.
@@ -78,6 +78,15 @@ clean `UI.Widget` classes that use native update rendering delegates.
78
78
  * Inspect instantiator files (e.g., `ApplicationPanelSidebar.ts`) and
79
79
  decouple any direct accesses to `.element`.
80
80
 
81
+ 4. **Verify Full MVP Architecture Completeness**:
82
+ * Ensure the constructor accepts `element?: HTMLElement` as its first parameter and `view: View = DEFAULT_VIEW` as its last parameter.
83
+ * If `Universe` dependencies are used, declare `static override readonly INJECT = [...] as const;` and receive them as constructor parameter #2.
84
+ * If shadow DOM is needed, use `super(element, {useShadowDom: 'pure'})` (never legacy `useShadowDom: true`).
85
+ * Trigger initial renders and external subscriptions in `wasShown()`, detaching them symmetrically in `willHide()`. Reconcile state incrementally rather than wiping populated presenter state via `reset()` on every re-show.
86
+ * Use `this.requestUpdate()` across all presenter methods and setters; avoid synchronous `this.performUpdate()` calls or custom `#renderView()` methods.
87
+ * Use declarative `autofocus` for default focus targets rather than imperative `focus()` overrides or `ViewOutput` focus closures.
88
+ * Verify that no legacy `UI.TreeOutline`, `extends UI.TreeOutline.TreeElement` subclasses, `UI.ListControl`, `UI.ListWidget`, or `UI.InplaceEditor` remain before marking `Fixed: <id>`. If any remain, use `Bug: <id>`.
89
+
81
90
  --------------------------------------------------------------------------------
82
91
 
83
92
  ## 2. Safety & Verification Rules
@@ -92,5 +101,7 @@ clean `UI.Widget` classes that use native update rendering delegates.
92
101
  *Before reporting back or committing, re-read the instructions and verify:*
93
102
  1. ❓ **Decoupling**: Did I remove all direct `.element` or `.contentElement` couplings from instantiator files?
94
103
  2. ❓ **Inheritance**: Does the class now cleanly inherit from `UI.Widget` or its variants?
95
- 3. ❓ **Injectability**: Is the view injectable in the constructor?
96
- 4. ❓ **Build**: Does the code compile and do tests pass?
104
+ 3. ❓ **Injectability & Dependencies**: Is the constructor signature `(element?: HTMLElement, [...]: WidgetDependencies, view: View = DEFAULT_VIEW)` with `static override readonly INJECT`?
105
+ 4. ❓ **Lifecycle & Reactivity**: Does presenter code call `this.requestUpdate()` asynchronously (no synchronous `performUpdate()`), with non-destructive `wasShown()`/`willHide()` subscriptions?
106
+ 5. ❓ **No Legacy Controls**: Are all `TreeOutline`/`TreeElement` subclasses, `ListControl`, and `InplaceEditor` instances eliminated before using `Fixed: <id>`?
107
+ 6. ❓ **Build**: Does the code compile and do tests pass?
@@ -21,9 +21,9 @@ Adhere strictly to the Model-View-Presenter (MVP) architecture.
21
21
  * Constructor MUST call `super()`. If taking `element?: HTMLElement`, pass it to `super(element)`. `super(true)` is forbidden. Do not pass `classes` or `jslog` in `WidgetOptions` (`super(..., {classes: [...], jslog: ...})`); instead, pass container CSS classes and `jslog` via the third parameter of `render(template, target, {container: {classes: [...], attributes: {jslog: ...}}})` in the view function (and if the widget uses shadow DOM, pass `useShadowDom: 'pure'` and extend `Widget<ShadowRoot>` / `VBox<ShadowRoot>` with `target: HTMLElement|DocumentFragment` so `render()` applies `container.classes` and `container.attributes` to the shadow host `this.element`).
22
22
  * Dependencies from `Universe` SHOULD be requested via static `INJECT`: `static override readonly INJECT = [...] as const;` and received as constructor parameter #2 (`[dep1, dep2]: UI.Widget.WidgetDependencies<typeof MyWidget>`).
23
23
  * Styling MUST be handled within the View. `this.registerCSSFiles()` is forbidden.
24
- * Initial render MUST be triggered in `override wasShown(): void` by calling `this.requestUpdate()`.
24
+ * Initial render MUST be triggered in `override wasShown(): void` by calling `this.requestUpdate()`. External model, workspace, and setting subscriptions SHOULD be attached in `wasShown()` and detached symmetrically in `willHide()`, reconciling incremental state changes that occurred while hidden rather than unconditionally calling `reset()` and wiping populated presenter state (such as open tree folders or selection) on every re-show.
25
25
  * MUST hold all UI state as private class fields (e.g., `#counter`).
26
- * To schedule a UI update, MUST call `this.requestUpdate()`. `performUpdate()` MUST NOT be called directly.
26
+ * To schedule a UI update, MUST call `this.requestUpdate()` asynchronously across all presenter methods, property setters, and event handlers. `performUpdate()` MUST NOT be called directly (except in `UI.Panel`/`UI.Dialog` subclasses where `requestUpdate()` is unavailable or when synchronous layout measurement is documented as strictly required). Presenter and presenter-node classes MUST NOT expose imperative view-refresh methods (e.g., `updateTrailingIcons()`, `updateIcon()`); all visual output should be derived declaratively in the view function.
27
27
 
28
28
  ### View (`function`) Rules
29
29
 
@@ -119,6 +119,22 @@ render(html`
119
119
  * **Raw Elements:** Use `Directives.ref` (from `ui/lit/lit.js`) to obtain a reference to a raw `HTMLElement` if needed for imperative APIs (e.g., `splitWidget.installResizer(element)`).
120
120
  * **Child Widgets:** Use `UI.Widget.widgetRef` to obtain the class instance of a child widget inside the view function if you need to call imperative methods on it. **Do NOT store child widget instances on `ViewOutput` as a final result** (doing so is only acceptable temporarily in intermediate migration CLs). Instead, either supply all needed configuration declaratively through setters/inputs on the child widget, or if imperative calls are strictly necessary, expose narrow action functions on `ViewOutput` (e.g., `output.doLayout = () => splitWidget.doLayout()`, `output.revealPosition = pos => childWidget.revealPosition(pos)`). Do not keep `get*ForTest()` methods that return child widget instances via `ViewOutput`; tests should query rendered `<devtools-widget>` elements via `.getWidget()` or assert on `ViewInput` via `createViewFunctionStub`.
121
121
 
122
+ ### Visibility (`?hidden` Attribute Only)
123
+ Toggle element visibility declaratively using the HTML `?hidden` attribute:
124
+ ```ts
125
+ html`<div ?hidden=${!input.isVisible}>...</div>`
126
+ ```
127
+ Never combine a `.hidden` CSS class (`classMap({hidden: ...})` or `classList.toggle('hidden', ...)`) with `?hidden` (`inspectorCommon.css` already defines `[hidden] { display: none !important; }`).
128
+
129
+ ### Declarative Default Focus (`autofocus` / `?autofocus`)
130
+ `UI.Widget.prototype.focus()` natively queries `[autofocus]` via `getDefaultFocusedElement()` across both plain HTML elements (e.g. `<devtools-tree autofocus>`) and child widgets. Mark the default focus target with `autofocus` or `?autofocus=${...}` (ensuring at most one element has `autofocus` in any render state) instead of overriding `focus()`, calling `this.setDefaultFocusedElement(...)`, or plumbing focus closures through `ViewOutput`.
131
+
132
+ ### `<devtools-tree>` & Editable `<devtools-prompt ?editing>` Rows
133
+ * Keep `<devtools-tree>` (`ui/kit/kit.js`) contracts intact without widening `front_end/ui/legacy/Treeoutline.ts` (`TreeViewElement`/`TreeViewTreeElement`). Drive selection and expansion purely via `?selected`, `?open`, `@select`, and `@expand`.
134
+ * Keep `<devtools-prompt ?editing>` persistently mounted in the DOM and toggle `?editing` declaratively; do not duplicate `aria-label` on inner prompts when the `<li role="treeitem">` already labels the row.
135
+ * **Child widget isolation for editable tree rows:** Because `<devtools-tree>` clones light DOM into shadow DOM and re-clones an `<li role="treeitem">` whenever any descendant attribute mutates, place editable prompts inside a small child `UI.Widget` (`${widget(RowPromptWidget, {...})}`) so toggling `?editing` updates the child widget in place without triggering a tree re-clone and blurring the active input.
136
+ * Custom elements inside `<devtools-tree>` templates whose state is passed via JS properties (`.data`) must override `cloneNode(deep)` to copy `.data` and reflect dynamic state via DOM attributes so shadow clones update reliably.
137
+
122
138
  ### Dependencies
123
139
 
124
140
  * **View Dependencies:** The `DEFAULT_VIEW` is typically a module-level function. Ensure all dependencies (enums, constants, other components) are imported at the top of the file so they are available in the function scope.
@@ -163,13 +179,11 @@ Example: `front_end/panels/my_example/MyExampleWidget.ts`.
163
179
  ```ts
164
180
  // front_end/panels/my_example/MyExampleWidget.ts
165
181
 
166
- import {Directives, html, render} from '../../ui/lit/lit.js';
182
+ import {html, render} from '../../ui/lit/lit.js';
167
183
  import * as UI from '../../ui/legacy/legacy.js';
168
184
 
169
185
  import myExampleWidgetStyles from './myExampleWidget.css.js';
170
186
 
171
- const {ref} = Directives;
172
-
173
187
  // 1. Define Input data shape. (Assuming Child Widget configuration for completeness)
174
188
  export interface ViewInput {
175
189
  title: string;
@@ -177,33 +191,24 @@ export interface ViewInput {
177
191
  onButtonClick: () => void;
178
192
  }
179
193
 
180
- // 2. Define Output imperative API shape.
181
- export interface ViewOutput {
182
- focusButton?: () => void;
183
- }
184
-
185
- // 3. Define the View function.
194
+ // 2. Define the View function (output is undefined when no imperative actions exist).
186
195
  // clang-format off
187
- const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLElement): void => {
196
+ const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement): void => {
188
197
  render(html`
189
198
  <style>${myExampleWidgetStyles}</style>
190
199
  <div class="child-widget">
191
200
  <h3>${input.title}</h3>
192
201
  <p>Counter: ${input.counter}</p>
193
- <button @click=${input.onButtonClick} ${ref(el => {
194
- if (el) {
195
- output.focusButton = () => el.focus();
196
- }
197
- })}>Increment</button>
202
+ <button autofocus @click=${input.onButtonClick}>Increment</button>
198
203
  </div>
199
204
  `, target);
200
205
  };
201
206
  // clang-format on
202
207
 
203
- // 4. Type alias for the view.
208
+ // 3. Type alias for the view.
204
209
  type View = typeof DEFAULT_VIEW;
205
210
 
206
- // 5. Define the Presenter.
211
+ // 4. Define the Presenter.
207
212
  export class MyExampleWidget extends UI.Widget.Widget {
208
213
  #counter: number = 0;
209
214
 
@@ -211,7 +216,6 @@ export class MyExampleWidget extends UI.Widget.Widget {
211
216
  title: string = 'Default Title';
212
217
 
213
218
  #view: View;
214
- #viewOutput: ViewOutput = {};
215
219
 
216
220
  constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
217
221
  super(element);
@@ -224,10 +228,6 @@ export class MyExampleWidget extends UI.Widget.Widget {
224
228
  this.requestUpdate();
225
229
  }
226
230
 
227
- focus(): void {
228
- this.#viewOutput.focusButton?.();
229
- }
230
-
231
231
  #handleButtonClick = (): void => {
232
232
  this.#counter++;
233
233
  this.requestUpdate();
@@ -239,7 +239,7 @@ export class MyExampleWidget extends UI.Widget.Widget {
239
239
  counter: this.#counter,
240
240
  onButtonClick: this.#handleButtonClick,
241
241
  };
242
- this.#view(viewInput, this.#viewOutput, this.contentElement);
242
+ this.#view(viewInput, undefined, this.contentElement);
243
243
  }
244
244
  }
245
245
  ```
package/DIR_METADATA CHANGED
@@ -16,6 +16,12 @@ agentic_review: {
16
16
  ".agents/skills/devtools-unicode-escaping/SKILL.md"
17
17
  ]
18
18
  }
19
+ capability_groups: {
20
+ path_expression: ["front_end/.*\\.ts"]
21
+ path_expression_exclusion: [".*\\.test\\.ts"]
22
+ content_patterns: ["UIStrings", "@description", "i18n(String|FormatString|Template)"]
23
+ review_capability_skills: [".agents/skills/devtools-uistrings/SKILL.md"]
24
+ }
19
25
  capability_groups: {
20
26
  path_expression: [
21
27
  "front_end/(core|models|entrypoints|generated)/.*\\.ts",
@@ -60,7 +66,8 @@ agentic_review: {
60
66
  ".agents/rules/ui-and-widgets/ui-weak-dom-references-and-observer-cleanup.md",
61
67
  ".agents/rules/ui-and-widgets/ui-security-and-output-sanitization.md",
62
68
  ".agents/rules/ui-and-widgets/ui-declarative-child-widget-composition.md",
63
- ".agents/rules/ui-and-widgets/ui-await-update-complete-post-render.md"
69
+ ".agents/rules/ui-and-widgets/ui-await-update-complete-post-render.md",
70
+ ".agents/rules/ui-and-widgets/ui-declarative-tree-and-prompt-patterns.md"
64
71
  ]
65
72
  }
66
73
  capability_groups: {
@@ -108,7 +108,7 @@ console.log(message2);
108
108
  4. The following commands would add the new strings to `en-US.json`:
109
109
 
110
110
  - `git cl presubmit --upload`, or
111
- - `node third_party/i18n/collect-strings.js` under the DevTools src folder
111
+ - `./dt collect-strings` in the DevTools checkout
112
112
 
113
113
  5. Strings containing possible plurals have a special format in ICU. This is
114
114
  because plurals work quite differently in other languages, e.g. special
@@ -1499,6 +1499,30 @@ the user.
1499
1499
  `ifExpanded` is a lit directive provided on `UI.TreeOutline` and it makes its
1500
1500
  argument render only if the current tree node is expanded.
1501
1501
 
1502
+ ### TreeOutline Migration Guidelines
1503
+
1504
+ 1. **Keep `Treeoutline.ts` contracts intact**: Do not widen `front_end/ui/legacy/Treeoutline.ts`
1505
+ (`TreeViewElement` or `TreeViewTreeElement`) or add public getters (such as `get scriptsTree()`)
1506
+ on presenters. Render leading icons, labels, tooltips, and trailing actions inline inside
1507
+ `<li role="treeitem">` and drive selection, expansion, and default focus declaratively via
1508
+ `?selected`, `?open`, `@select`, `@expand`, and `autofocus`. Return `nothing` rather than an
1509
+ empty container for trailing icons when none exist, and do not duplicate `class="tree-element-title"`
1510
+ on inner spans (which compounds opacity styling).
1511
+ 2. **Persistent prompt & child widget isolation for editable rows**:
1512
+ Always keep `<devtools-prompt value=${...} ?editing=${...}>` persistently mounted in the row
1513
+ template and toggle `?editing` declaratively. Do not duplicate `aria-label` on inner prompts
1514
+ when the enclosing `<li role="treeitem">` already provides the accessible name. Furthermore,
1515
+ because `<devtools-tree>` clones light DOM into shadow DOM and re-clones an entire `<li role="treeitem">`
1516
+ on light-DOM attribute mutations, wrap editable prompts inside a small child `UI.Widget`
1517
+ (`${widget(WatchExpressionPromptWidget, {...})}`, as in `WatchExpressionsSidebarPane.ts`). This allows
1518
+ toggling `?editing` to update the child widget in place without triggering a tree re-clone that
1519
+ steals focus and blurs the active input.
1520
+ 3. **Custom elements with JavaScript property state**:
1521
+ Custom elements rendered inside `<devtools-tree>` whose state is set via JS properties (`.data`)
1522
+ must override `cloneNode(deep)` to copy `.data` and reflect dynamic state via a DOM attribute
1523
+ (such as `data-badge=${...}`) so `<devtools-tree>`'s `MutationObserver` detects changes and
1524
+ refreshes shadow clones.
1525
+
1502
1526
  ## Refactoring UI.Toolbar.Provider
1503
1527
 
1504
1528
  As part of the migration, sometimes classes need to be broken up into smaller pieces. Classes implementing
package/eslint.config.mjs CHANGED
@@ -29,7 +29,6 @@ export default defineConfig([
29
29
  'front_end/diff/diff_match_patch.js',
30
30
  'front_end/models/javascript_metadata/NativeFunctions.ts',
31
31
  // All of these scripts are auto-generated so don't lint them.
32
- 'front_end/generated/Deprecation.ts',
33
32
  'front_end/generated/InspectorBackendCommands.ts',
34
33
  'front_end/generated/protocol-mapping.d.ts',
35
34
  'front_end/generated/protocol-proxy-api.d.ts',
@@ -299,7 +299,7 @@
299
299
  --color-continue-to-location-hover: var(--ref-palette-yellow40);
300
300
  --color-continue-to-location-hover-border: var(--ref-palette-yellow50);
301
301
  --color-continue-to-location-async: var(--ref-palette-green30);
302
- --color-continue-to-location-async-hover: var(--ref-palette-green4);
302
+ --color-continue-to-location-async-hover: var(--ref-palette-green40);
303
303
  --color-continue-to-location-async-hover-border: var(--ref-palette-green50);
304
304
  --color-evaluated-expression: var(--ref-palette-yellow30);
305
305
  --color-evaluated-expression-border: var(--ref-palette-yellow40);