chrome-devtools-frontend 1.0.1550444 → 1.0.1555174

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 (466) hide show
  1. package/docs/styleguide/ux/components.md +34 -8
  2. package/eslint.config.mjs +7 -0
  3. package/front_end/Images/generate-css-vars.js +8 -4
  4. package/front_end/Images/src/spark.svg +10 -0
  5. package/front_end/core/common/Settings.ts +20 -8
  6. package/front_end/core/host/UserMetrics.ts +3 -1
  7. package/front_end/core/i18n/collect-ui-strings.js +19 -10
  8. package/front_end/core/i18n/generate-locales-js.js +4 -4
  9. package/front_end/core/protocol_client/CDPConnection.ts +1 -0
  10. package/front_end/core/protocol_client/InspectorBackend.ts +5 -1
  11. package/front_end/core/root/Runtime.ts +0 -12
  12. package/front_end/core/sdk/DOMModel.ts +38 -3
  13. package/front_end/core/sdk/DebuggerModel.ts +9 -4
  14. package/front_end/core/sdk/IsolateManager.ts +7 -0
  15. package/front_end/core/sdk/PageResourceLoader.ts +3 -3
  16. package/front_end/core/sdk/RehydratingConnection.ts +5 -2
  17. package/front_end/core/sdk/ResourceTreeModel.ts +0 -1
  18. package/front_end/entrypoints/main/MainImpl.ts +28 -10
  19. package/front_end/generated/SupportedCSSProperties.js +32 -0
  20. package/front_end/models/ai_assistance/AiConversation.ts +94 -4
  21. package/front_end/models/ai_assistance/agents/AiAgent.ts +30 -15
  22. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +179 -41
  23. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +5 -0
  24. package/front_end/models/ai_assistance/agents/StylingAgent.ts +62 -0
  25. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +2 -1
  26. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +1 -7
  27. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +124 -12
  28. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +125 -30
  29. package/front_end/models/ai_assistance/performance/AICallTree.ts +42 -0
  30. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +12 -0
  31. package/front_end/models/issues_manager/Issue.ts +1 -0
  32. package/front_end/models/issues_manager/IssueAggregator.ts +9 -0
  33. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  34. package/front_end/models/issues_manager/PermissionElementIssue.ts +262 -0
  35. package/front_end/models/issues_manager/descriptions/permissionElementActivationDisabled.md +7 -0
  36. package/front_end/models/issues_manager/descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
  37. package/front_end/models/issues_manager/descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
  38. package/front_end/models/issues_manager/descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
  39. package/front_end/models/issues_manager/descriptions/permissionElementFencedFrameDisallowed.md +5 -0
  40. package/front_end/models/issues_manager/descriptions/permissionElementFontSizeTooLarge.md +5 -0
  41. package/front_end/models/issues_manager/descriptions/permissionElementFontSizeTooSmall.md +5 -0
  42. package/front_end/models/issues_manager/descriptions/permissionElementGeolocationDeprecated.md +5 -0
  43. package/front_end/models/issues_manager/descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
  44. package/front_end/models/issues_manager/descriptions/permissionElementInvalidDisplayStyle.md +5 -0
  45. package/front_end/models/issues_manager/descriptions/permissionElementInvalidSizeValue.md +5 -0
  46. package/front_end/models/issues_manager/descriptions/permissionElementInvalidType.md +5 -0
  47. package/front_end/models/issues_manager/descriptions/permissionElementInvalidTypeActivation.md +5 -0
  48. package/front_end/models/issues_manager/descriptions/permissionElementLowContrast.md +5 -0
  49. package/front_end/models/issues_manager/descriptions/permissionElementNonOpaqueColor.md +5 -0
  50. package/front_end/models/issues_manager/descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
  51. package/front_end/models/issues_manager/descriptions/permissionElementPaddingRightUnsupported.md +6 -0
  52. package/front_end/models/issues_manager/descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
  53. package/front_end/models/issues_manager/descriptions/permissionElementRegistrationFailed.md +5 -0
  54. package/front_end/models/issues_manager/descriptions/permissionElementRequestInProgress.md +5 -0
  55. package/front_end/models/issues_manager/descriptions/permissionElementSecurityChecksFailed.md +5 -0
  56. package/front_end/models/issues_manager/descriptions/permissionElementTypeNotSupported.md +5 -0
  57. package/front_end/models/issues_manager/descriptions/permissionElementUntrustedEvent.md +7 -0
  58. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  59. package/front_end/models/javascript_metadata/NativeFunctions.js +23 -23
  60. package/front_end/models/stack_trace/StackTraceModel.ts +37 -18
  61. package/front_end/models/trace/Processor.ts +14 -15
  62. package/front_end/models/trace/insights/Common.ts +2 -8
  63. package/front_end/models/trace/insights/types.ts +12 -2
  64. package/front_end/models/trace/types/TraceEvents.ts +4 -1
  65. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +28 -6
  66. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +9 -23
  67. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
  68. package/front_end/panels/ai_assistance/components/ChatView.ts +78 -2
  69. package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +71 -0
  70. package/front_end/panels/ai_assistance/components/PerformanceAgentFlameChart.ts +126 -0
  71. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +131 -2
  72. package/front_end/panels/ai_assistance/components/chatView.css +28 -0
  73. package/front_end/panels/ai_assistance/components/collapsibleAssistanceContentWidget.css +33 -0
  74. package/front_end/panels/application/AppManifestView.ts +1007 -521
  75. package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -17
  76. package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +2 -6
  77. package/front_end/panels/application/ExtensionStorageItemsView.ts +3 -5
  78. package/front_end/panels/application/KeyValueStorageItemsView.ts +3 -2
  79. package/front_end/panels/application/components/BackForwardCacheView.ts +2 -2
  80. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +133 -118
  81. package/front_end/panels/application/preloading/PreloadingView.ts +46 -45
  82. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +80 -75
  83. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +169 -133
  84. package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +74 -93
  85. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +142 -117
  86. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +51 -11
  87. package/front_end/panels/application/preloading/components/components.ts +0 -2
  88. package/front_end/panels/common/Annotation.ts +184 -0
  89. package/front_end/panels/common/AnnotationManager.ts +148 -11
  90. package/front_end/panels/common/ExtensionView.ts +47 -0
  91. package/front_end/panels/common/PersistenceUtils.ts +22 -25
  92. package/front_end/panels/common/annotation.css +40 -0
  93. package/front_end/panels/common/common.ts +1 -0
  94. package/front_end/panels/console/ConsoleInsightTeaser.ts +187 -5
  95. package/front_end/panels/console/ConsolePinPane.ts +437 -217
  96. package/front_end/panels/console/ConsolePrompt.ts +32 -223
  97. package/front_end/panels/console/ConsoleView.ts +67 -66
  98. package/front_end/panels/console/ConsoleViewMessage.ts +8 -3
  99. package/front_end/panels/console/consoleInsightTeaser.css +23 -0
  100. package/front_end/panels/console/consoleView.css +1 -1
  101. package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +89 -0
  102. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +2 -2
  103. package/front_end/panels/elements/ComputedStyleWidget.ts +16 -5
  104. package/front_end/panels/elements/ElementsPanel.ts +38 -12
  105. package/front_end/panels/elements/ElementsSidebarPane.ts +1 -3
  106. package/front_end/panels/elements/ElementsTreeElement.ts +313 -353
  107. package/front_end/panels/elements/ElementsTreeOutline.ts +39 -13
  108. package/front_end/panels/elements/StylePropertyTreeElement.ts +15 -14
  109. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  110. package/front_end/panels/emulation/MediaQueryInspector.ts +171 -125
  111. package/front_end/panels/explain/components/ConsoleInsight.ts +175 -150
  112. package/front_end/panels/explain/components/consoleInsight.css +348 -347
  113. package/front_end/panels/issues/AffectedPermissionElementsView.ts +46 -0
  114. package/front_end/panels/issues/IssueView.ts +2 -0
  115. package/front_end/panels/issues/IssuesPane.ts +6 -0
  116. package/front_end/panels/layer_viewer/LayerDetailsView.ts +165 -149
  117. package/front_end/panels/layer_viewer/Layers3DView.ts +131 -78
  118. package/front_end/panels/lighthouse/LighthouseStatusView.ts +149 -100
  119. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +90 -64
  120. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +25 -34
  121. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +60 -44
  122. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts +170 -151
  123. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +50 -51
  124. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +0 -13
  125. package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +20 -18
  126. package/front_end/panels/mobile_throttling/CalibrationController.ts +3 -1
  127. package/front_end/panels/network/NetworkDataGridNode.ts +14 -6
  128. package/front_end/panels/network/NetworkItemView.ts +42 -3
  129. package/front_end/panels/network/NetworkLogView.ts +10 -11
  130. package/front_end/panels/network/NetworkPanel.ts +63 -1
  131. package/front_end/panels/network/RequestInitiatorView.ts +146 -113
  132. package/front_end/panels/network/components/RequestHeaderSection.css +51 -50
  133. package/front_end/panels/network/components/RequestHeaderSection.ts +81 -71
  134. package/front_end/panels/network/components/RequestHeadersView.css +1 -1
  135. package/front_end/panels/network/components/RequestHeadersView.ts +26 -11
  136. package/front_end/panels/network/components/RequestTrustTokensView.css +24 -14
  137. package/front_end/panels/network/components/RequestTrustTokensView.ts +144 -140
  138. package/front_end/panels/profiler/IsolateSelector.ts +2 -1
  139. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +49 -33
  140. package/front_end/panels/recorder/RecorderController.ts +2 -3
  141. package/front_end/panels/recorder/components/ControlButton.ts +68 -34
  142. package/front_end/panels/recorder/components/CreateRecordingView.ts +9 -6
  143. package/front_end/panels/recorder/components/RecordingView.ts +81 -88
  144. package/front_end/panels/recorder/components/ReplaySection.ts +226 -145
  145. package/front_end/panels/recorder/{controllers → components}/SelectorPicker.ts +129 -52
  146. package/front_end/panels/recorder/components/StepEditor.ts +21 -67
  147. package/front_end/panels/recorder/components/StepView.ts +222 -180
  148. package/front_end/panels/recorder/components/TimelineSection.ts +69 -48
  149. package/front_end/panels/recorder/components/components.ts +2 -2
  150. package/front_end/panels/recorder/components/selectorPicker.css +14 -0
  151. package/front_end/panels/recorder/components/stepEditor.css +0 -5
  152. package/front_end/panels/recorder/components/stepView.css +196 -198
  153. package/front_end/panels/recorder/extensions/ExtensionManager.ts +4 -48
  154. package/front_end/panels/recorder/models/ScreenshotUtils.ts +17 -11
  155. package/front_end/panels/security/CookieControlsView.ts +30 -26
  156. package/front_end/panels/settings/components/SyncSection.ts +0 -1
  157. package/front_end/panels/sources/CSSPlugin.ts +3 -3
  158. package/front_end/panels/sources/CallStackSidebarPane.ts +60 -75
  159. package/front_end/panels/sources/SourcesPanel.ts +1 -11
  160. package/front_end/panels/sources/TabbedEditorContainer.ts +11 -8
  161. package/front_end/panels/sources/ThreadsSidebarPane.ts +96 -101
  162. package/front_end/panels/sources/threadsSidebarPane.css +6 -5
  163. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +0 -1
  164. package/front_end/panels/timeline/InteractionsTrackAppender.ts +2 -3
  165. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +23 -33
  166. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +4 -3
  167. package/front_end/panels/timeline/TimelineFlameChartView.ts +12 -0
  168. package/front_end/panels/timeline/TimelinePanel.ts +3 -5
  169. package/front_end/panels/timeline/components/IgnoreListSetting.ts +164 -142
  170. package/front_end/panels/timeline/components/InteractionBreakdown.ts +48 -28
  171. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +18 -23
  172. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +98 -73
  173. package/front_end/panels/timeline/components/Sidebar.ts +16 -7
  174. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +174 -137
  175. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +262 -291
  176. package/front_end/panels/timeline/components/Utils.ts +25 -0
  177. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +210 -146
  178. package/front_end/panels/timeline/components/insights/CLSCulprits.ts +8 -20
  179. package/front_end/panels/timeline/components/insights/Cache.ts +0 -9
  180. package/front_end/panels/timeline/components/insights/Checklist.ts +53 -43
  181. package/front_end/panels/timeline/components/insights/DOMSize.ts +11 -33
  182. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +6 -12
  183. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +0 -9
  184. package/front_end/panels/timeline/components/insights/EventRef.ts +47 -109
  185. package/front_end/panels/timeline/components/insights/FontDisplay.ts +0 -9
  186. package/front_end/panels/timeline/components/insights/ForcedReflow.ts +0 -9
  187. package/front_end/panels/timeline/components/insights/INPBreakdown.ts +0 -9
  188. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -10
  189. package/front_end/panels/timeline/components/insights/ImageRef.ts +112 -0
  190. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +91 -0
  191. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +0 -9
  192. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +11 -14
  193. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +0 -9
  194. package/front_end/panels/timeline/components/insights/ModernHTTP.ts +0 -9
  195. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +6 -21
  196. package/front_end/panels/timeline/components/insights/NodeLink.ts +68 -43
  197. package/front_end/panels/timeline/components/insights/README.md +2 -3
  198. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +0 -9
  199. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +0 -9
  200. package/front_end/panels/timeline/components/insights/ThirdParties.ts +0 -9
  201. package/front_end/panels/timeline/components/insights/Viewport.ts +7 -19
  202. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +5 -0
  203. package/front_end/panels/timeline/components/insights/insights.ts +2 -0
  204. package/front_end/panels/timeline/components/interactionBreakdown.css +15 -13
  205. package/front_end/panels/timeline/components/sidebarInsightsTab.css +50 -48
  206. package/front_end/panels/timeline/enable-easter-egg.js +7 -3
  207. package/front_end/third_party/chromium/README.chromium +1 -1
  208. package/front_end/third_party/puppeteer/README.chromium +2 -2
  209. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts +96 -0
  210. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
  211. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.js +8 -0
  212. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BluetoothEmulation.js.map +1 -0
  213. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +87 -0
  214. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  215. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts +2 -6
  217. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -1
  218. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js +5 -24
  219. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js.map +1 -1
  220. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +5 -0
  221. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  222. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  223. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/api.d.ts +1 -0
  224. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/api.d.ts.map +1 -1
  225. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/api.js.map +1 -1
  226. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
  227. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
  228. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js +42 -0
  229. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
  230. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts +4 -1
  231. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
  232. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js +10 -0
  233. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
  234. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
  235. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
  236. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js +90 -0
  237. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
  238. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts +3 -1
  239. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  240. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +3 -2
  241. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  242. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +4 -1
  243. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  244. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +5 -2
  245. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  246. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +4 -0
  247. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  248. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +14 -2
  249. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  250. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.d.ts.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js +7 -0
  252. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +1 -1
  254. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
  256. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
  257. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js +30 -0
  258. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
  259. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +5 -2
  260. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  261. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +22 -3
  262. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  263. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.d.ts +1 -1
  264. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts +2 -3
  266. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js +4 -6
  268. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.d.ts +2 -2
  270. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.js +1 -1
  272. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/FrameManager.js.map +1 -1
  273. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +2 -0
  274. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  275. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +8 -0
  276. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.d.ts.map +1 -1
  278. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.js +8 -3
  279. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.js.map +1 -1
  280. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.d.ts +1 -0
  281. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.d.ts.map +1 -1
  282. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.js +1 -0
  283. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/cdp.js.map +1 -1
  284. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +30 -0
  285. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
  286. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +15 -0
  287. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  288. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  289. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts +1 -1
  290. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  291. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +2 -13
  292. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  293. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts +5 -3
  294. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.js +17 -0
  296. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.js.map +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  298. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  299. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  300. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  301. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  302. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  303. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +221 -4
  304. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +182 -95
  305. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts +96 -0
  306. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
  307. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.js +7 -0
  308. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BluetoothEmulation.js.map +1 -0
  309. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +87 -0
  310. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  311. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  312. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts +2 -6
  313. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -1
  314. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.js +4 -22
  315. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/DeviceRequestPrompt.js.map +1 -1
  316. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +5 -0
  317. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  318. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  319. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/api.d.ts +1 -0
  320. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/api.d.ts.map +1 -1
  321. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/api.js.map +1 -1
  322. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
  323. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
  324. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.js +38 -0
  325. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
  326. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts +4 -1
  327. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
  328. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js +10 -0
  329. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
  330. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
  331. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
  332. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js +85 -0
  333. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
  334. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts +3 -1
  335. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  336. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +3 -2
  337. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  338. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +4 -1
  339. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  340. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +5 -2
  341. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  342. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +4 -0
  343. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  344. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +14 -2
  345. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  346. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.d.ts.map +1 -1
  347. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js +7 -0
  348. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js.map +1 -1
  349. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +1 -1
  350. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  351. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
  352. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
  353. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.js +26 -0
  354. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
  355. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +5 -2
  356. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  357. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +22 -3
  358. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  359. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.d.ts +1 -1
  360. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  361. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts +2 -3
  362. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
  363. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js +2 -4
  364. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
  365. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.d.ts +2 -2
  366. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  367. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js +2 -2
  368. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/FrameManager.js.map +1 -1
  369. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +2 -0
  370. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  371. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +8 -0
  372. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  373. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.d.ts.map +1 -1
  374. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.js +8 -3
  375. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.js.map +1 -1
  376. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.d.ts +1 -0
  377. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.d.ts.map +1 -1
  378. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.js +1 -0
  379. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/cdp.js.map +1 -1
  380. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +31 -1
  381. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
  382. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts +15 -0
  383. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  384. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts +1 -1
  385. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  386. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +2 -13
  387. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  388. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts +5 -3
  389. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  390. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js +16 -1
  391. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js.map +1 -1
  392. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  393. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  394. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  395. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  396. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  397. package/front_end/third_party/puppeteer/package/lib/types.d.ts +221 -4
  398. package/front_end/third_party/puppeteer/package/package.json +4 -4
  399. package/front_end/third_party/puppeteer/package/src/api/BluetoothEmulation.ts +103 -0
  400. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +96 -1
  401. package/front_end/third_party/puppeteer/package/src/api/DeviceRequestPrompt.ts +2 -10
  402. package/front_end/third_party/puppeteer/package/src/api/Page.ts +6 -0
  403. package/front_end/third_party/puppeteer/package/src/api/api.ts +1 -0
  404. package/front_end/third_party/puppeteer/package/src/bidi/BluetoothEmulation.ts +52 -0
  405. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +15 -0
  406. package/front_end/third_party/puppeteer/package/src/bidi/DeviceRequestPrompt.ts +138 -0
  407. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +7 -3
  408. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +10 -2
  409. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +30 -2
  410. package/front_end/third_party/puppeteer/package/src/bidi/util.ts +8 -0
  411. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +1 -1
  412. package/front_end/third_party/puppeteer/package/src/cdp/BluetoothEmulation.ts +47 -0
  413. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +33 -3
  414. package/front_end/third_party/puppeteer/package/src/cdp/CdpSession.ts +1 -1
  415. package/front_end/third_party/puppeteer/package/src/cdp/DeviceRequestPrompt.ts +3 -8
  416. package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +2 -2
  417. package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +9 -4
  418. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +13 -0
  419. package/front_end/third_party/puppeteer/package/src/cdp/WebWorker.ts +8 -3
  420. package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
  421. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +45 -1
  422. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +20 -0
  423. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +5 -17
  424. package/front_end/third_party/puppeteer/package/src/node/LaunchOptions.ts +23 -7
  425. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  426. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  427. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +4 -0
  428. package/front_end/ui/components/annotations/AnnotationRepository.ts +153 -13
  429. package/front_end/ui/components/settings/SettingCheckbox.ts +4 -6
  430. package/front_end/ui/components/snackbars/Snackbars.docs.ts +0 -1
  431. package/front_end/ui/components/text_editor/AiCodeCompletionTeaserPlaceholder.ts +12 -3
  432. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +182 -0
  433. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  434. package/front_end/ui/helpers/OpenInNewTab.ts +5 -1
  435. package/front_end/ui/i18n/i18n.ts +9 -9
  436. package/front_end/ui/kit/icons/Icon.docs.ts +22 -65
  437. package/front_end/ui/kit/kit.ts +1 -0
  438. package/front_end/ui/kit/link/Link.docs.ts +15 -0
  439. package/front_end/ui/kit/link/Link.ts +151 -0
  440. package/front_end/ui/kit/link/link.css +27 -0
  441. package/front_end/ui/legacy/EmptyWidget.ts +6 -0
  442. package/front_end/ui/legacy/Floaty.ts +442 -0
  443. package/front_end/ui/legacy/InspectorView.ts +12 -0
  444. package/front_end/ui/legacy/ReportView.ts +1 -1
  445. package/front_end/ui/legacy/SelectMenu.docs.ts +0 -1
  446. package/front_end/ui/legacy/TabbedPane.ts +150 -65
  447. package/front_end/ui/legacy/Widget.ts +1 -3
  448. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -1
  449. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +36 -36
  450. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +22 -37
  451. package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +31 -1
  452. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -2
  453. package/front_end/ui/legacy/components/utils/Linkifier.ts +7 -11
  454. package/front_end/ui/legacy/floaty.css +77 -0
  455. package/front_end/ui/legacy/legacy.ts +2 -0
  456. package/front_end/ui/legacy/tabbedPane.css +4 -7
  457. package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
  458. package/inspector_overlay/loadCSS.rollup.js +5 -4
  459. package/package.json +2 -2
  460. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +0 -99
  461. package/front_end/panels/recorder/components/SelectButton.ts +0 -304
  462. package/front_end/panels/recorder/controllers/controllers.ts +0 -7
  463. package/front_end/ui/components/chrome_link/ChromeLink.ts +0 -76
  464. package/front_end/ui/components/chrome_link/chromeLink.css +0 -12
  465. package/front_end/ui/components/chrome_link/chrome_link.ts +0 -9
  466. /package/front_end/panels/recorder/components/{selectButton.css → replaySection.css} +0 -0
@@ -1,7 +1,6 @@
1
1
  // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
4
 
6
5
  import * as i18n from '../../../core/i18n/i18n.js';
7
6
  import * as Platform from '../../../core/platform/platform.js';
@@ -9,17 +8,15 @@ import * as AIAssistance from '../../../models/ai_assistance/ai_assistance.js';
9
8
  import * as CrUXManager from '../../../models/crux-manager/crux-manager.js';
10
9
  import * as Trace from '../../../models/trace/trace.js';
11
10
  import * as Buttons from '../../../ui/components/buttons/buttons.js';
12
- import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
11
+ import * as UI from '../../../ui/legacy/legacy.js';
13
12
  import * as Lit from '../../../ui/lit/lit.js';
14
- import {nothing} from '../../../ui/lit/lit.js';
15
13
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
16
14
 
17
- import type {BaseInsightComponent} from './insights/BaseInsightComponent.js';
18
15
  import {md, shouldRenderForCategory} from './insights/Helpers.js';
19
16
  import * as Insights from './insights/insights.js';
20
17
  import type {ActiveInsight} from './Sidebar.js';
21
18
  import sidebarSingleInsightSetStyles from './sidebarSingleInsightSet.css.js';
22
- import {determineCompareRating, NumberWithUnit} from './Utils.js';
19
+ import {isFieldWorseThanLocal, NumberWithUnit} from './Utils.js';
23
20
 
24
21
  const {html} = Lit.StaticHtml;
25
22
 
@@ -70,6 +67,7 @@ const UIStrings = {
70
67
  'There are many reasons why local and field metrics [may not match](https://web.dev/articles/lab-and-field-data-differences). ' +
71
68
  'Adjust [throttling settings and device emulation](https://developer.chrome.com/docs/devtools/device-mode) to analyze traces more similar to the average user\'s environment.',
72
69
  } as const;
70
+
73
71
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/SidebarSingleInsightSet.ts', UIStrings);
74
72
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
75
73
 
@@ -80,96 +78,124 @@ export interface SidebarSingleInsightSetData {
80
78
  parsedTrace: Trace.TraceModel.ParsedTrace|null;
81
79
  }
82
80
 
83
- type InsightNameToComponentMapping =
84
- Record<string, typeof Insights.BaseInsightComponent.BaseInsightComponent<Trace.Insights.Types.InsightModel>>;
85
-
86
- interface CategorizedInsightData {
87
- componentClass: typeof Insights.BaseInsightComponent.BaseInsightComponent<Trace.Insights.Types.InsightModel>;
81
+ interface InsightData {
82
+ insightName: string;
88
83
  model: Trace.Insights.Types.InsightModel;
89
84
  }
90
85
 
91
- /**
92
- * Every insight (INCLUDING experimental ones).
93
- *
94
- * Order does not matter (but keep alphabetized).
95
- */
96
- const INSIGHT_NAME_TO_COMPONENT: InsightNameToComponentMapping = {
97
- Cache: Insights.Cache.Cache,
98
- CLSCulprits: Insights.CLSCulprits.CLSCulprits,
99
- DocumentLatency: Insights.DocumentLatency.DocumentLatency,
100
- DOMSize: Insights.DOMSize.DOMSize,
101
- DuplicatedJavaScript: Insights.DuplicatedJavaScript.DuplicatedJavaScript,
102
- FontDisplay: Insights.FontDisplay.FontDisplay,
103
- ForcedReflow: Insights.ForcedReflow.ForcedReflow,
104
- ImageDelivery: Insights.ImageDelivery.ImageDelivery,
105
- INPBreakdown: Insights.INPBreakdown.INPBreakdown,
106
- LCPDiscovery: Insights.LCPDiscovery.LCPDiscovery,
107
- LCPBreakdown: Insights.LCPBreakdown.LCPBreakdown,
108
- LegacyJavaScript: Insights.LegacyJavaScript.LegacyJavaScript,
109
- ModernHTTP: Insights.ModernHTTP.ModernHTTP,
110
- NetworkDependencyTree: Insights.NetworkDependencyTree.NetworkDependencyTree,
111
- RenderBlocking: Insights.RenderBlocking.RenderBlocking,
112
- SlowCSSSelector: Insights.SlowCSSSelector.SlowCSSSelector,
113
- ThirdParties: Insights.ThirdParties.ThirdParties,
114
- Viewport: Insights.Viewport.Viewport,
115
- };
86
+ interface LocalMetrics {
87
+ lcp: {value: Trace.Types.Timing.Micro, event: Trace.Types.Events.LargestContentfulPaintCandidate}|null;
88
+ cls: {value: number, worstClusterEvent: Trace.Types.Events.Event|null};
89
+ inp: {value: Trace.Types.Timing.Micro, event: Trace.Types.Events.SyntheticInteractionPair}|null;
90
+ }
116
91
 
117
- export class SidebarSingleInsightSet extends HTMLElement {
118
- readonly #shadow = this.attachShadow({mode: 'open'});
92
+ interface ViewInput {
93
+ shownInsights: InsightData[];
94
+ passedInsights: InsightData[];
95
+ local: LocalMetrics|null;
96
+ field: Trace.Insights.Common.CrUXFieldMetricResults|null;
97
+ activeCategory: Trace.Insights.Types.InsightCategory;
98
+ showFieldMismatchNotice: boolean;
99
+ onDismisFieldMismatchNotice: () => void;
100
+ onClickMetric: (traceEvent: Trace.Types.Events.Event) => void;
101
+ renderInsightComponent: (insightData: InsightData) => Lit.LitTemplate;
102
+ }
119
103
 
120
- #activeInsightElement: BaseInsightComponent<Trace.Insights.Types.InsightModel>|null = null;
104
+ type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
105
+
106
+ export const DEFAULT_VIEW: View = (input, output, target) => {
107
+ const {
108
+ shownInsights,
109
+ passedInsights,
110
+ local,
111
+ field,
112
+ activeCategory,
113
+ showFieldMismatchNotice,
114
+ onDismisFieldMismatchNotice,
115
+ onClickMetric,
116
+ renderInsightComponent,
117
+ } = input;
118
+
119
+ function renderMetrics(): Lit.TemplateResult {
120
+ const lcpEl = renderMetricValue('LCP', local?.lcp?.value ?? null, local?.lcp?.event ?? null);
121
+ const inpEl = renderMetricValue('INP', local?.inp?.value ?? null, local?.inp?.event ?? null);
122
+ const clsEl = renderMetricValue('CLS', local?.cls?.value ?? null, local?.cls?.worstClusterEvent ?? null);
121
123
 
122
- #data: SidebarSingleInsightSetData = {
123
- insightSetKey: null,
124
- activeCategory: Trace.Insights.Types.InsightCategory.ALL,
125
- activeInsight: null,
126
- parsedTrace: null,
127
- };
124
+ const localMetricsTemplateResult = html`
125
+ <div class="metrics-row">
126
+ <span>${lcpEl}</span>
127
+ <span>${inpEl}</span>
128
+ <span>${clsEl}</span>
129
+ <span class="row-label">Local</span>
130
+ </div>
131
+ <span class="row-border"></span>
132
+ `;
128
133
 
129
- #dismissedFieldMismatchNotice = false;
130
- #activeHighlightTimeout = -1;
134
+ let fieldMetricsTemplateResult;
135
+ if (field) {
136
+ const {lcp, inp, cls} = field;
131
137
 
132
- set data(data: SidebarSingleInsightSetData) {
133
- this.#data = data;
134
- void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#render);
135
- }
136
- connectedCallback(): void {
137
- this.#render();
138
- }
138
+ const lcpEl = renderMetricValue('LCP', lcp?.value ?? null, null);
139
+ const inpEl = renderMetricValue('INP', inp?.value ?? null, null);
140
+ const clsEl = renderMetricValue('CLS', cls?.value ?? null, null);
139
141
 
140
- disconnectedCallback(): void {
141
- window.clearTimeout(this.#activeHighlightTimeout);
142
- }
142
+ let scope = i18nString(UIStrings.originOption);
143
+ if (lcp?.pageScope === 'url' || inp?.pageScope === 'url') {
144
+ scope = i18nString(UIStrings.urlOption);
145
+ }
143
146
 
144
- highlightActiveInsight(): void {
145
- if (!this.#activeInsightElement) {
146
- return;
147
+ // clang-format off
148
+ fieldMetricsTemplateResult = html`
149
+ <div class="metrics-row">
150
+ <span>${lcpEl}</span>
151
+ <span>${inpEl}</span>
152
+ <span>${clsEl}</span>
153
+ <span class="row-label">${i18nString(UIStrings.fieldScoreLabel, {PH1: scope})}</span>
154
+ </div>
155
+ <span class="row-border"></span>
156
+ `;
157
+ // clang-format on
147
158
  }
148
- // First clear any existing highlight that is going on.
149
- this.#activeInsightElement.removeAttribute('highlight-insight');
150
- window.clearTimeout(this.#activeHighlightTimeout);
151
159
 
152
- requestAnimationFrame(() => {
153
- this.#activeInsightElement?.setAttribute('highlight-insight', 'true');
154
- this.#activeHighlightTimeout = window.setTimeout(() => {
155
- this.#activeInsightElement?.removeAttribute('highlight-insight');
156
- }, 2_000);
157
- });
158
- }
159
-
160
- #metricIsVisible(label: 'LCP'|'CLS'|'INP'): boolean {
161
- if (this.#data.activeCategory === Trace.Insights.Types.InsightCategory.ALL) {
162
- return true;
160
+ let fieldIsDifferentEl;
161
+ if (showFieldMismatchNotice) {
162
+ // clang-format off
163
+ fieldIsDifferentEl = html`
164
+ <div class="field-mismatch-notice" jslog=${VisualLogging.section('timeline.insights.field-mismatch')}>
165
+ <h3>${i18nString(UIStrings.fieldMismatchTitle)}</h3>
166
+ <devtools-button
167
+ title=${i18nString(UIStrings.dismissTitle)}
168
+ .iconName=${'cross'}
169
+ .variant=${Buttons.Button.Variant.ICON}
170
+ .jslogContext=${'timeline.insights.dismiss-field-mismatch'}
171
+ @click=${onDismisFieldMismatchNotice}
172
+ ></devtools-button>
173
+ <div class="field-mismatch-notice__body">${md(i18nString(UIStrings.fieldMismatchNotice))}</div>
174
+ </div>
175
+ `;
176
+ // clang-format on
163
177
  }
164
- return label === this.#data.activeCategory;
165
- }
166
178
 
167
- #onClickMetric(traceEvent: Trace.Types.Events.Event): void {
168
- this.dispatchEvent(new Insights.EventRef.EventReferenceClick(traceEvent));
179
+ const classes = {metrics: true, 'metrics--field': Boolean(fieldMetricsTemplateResult)};
180
+ const metricsTableEl = html`<div class=${Lit.Directives.classMap(classes)}>
181
+ <div class="metrics-row">
182
+ <span class="metric-label">LCP</span>
183
+ <span class="metric-label">INP</span>
184
+ <span class="metric-label">CLS</span>
185
+ <span class="row-label"></span>
186
+ </div>
187
+ ${localMetricsTemplateResult}
188
+ ${fieldMetricsTemplateResult}
189
+ </div>`;
190
+
191
+ return html`
192
+ ${metricsTableEl}
193
+ ${fieldIsDifferentEl}
194
+ `;
169
195
  }
170
196
 
171
- #renderMetricValue(metric: 'LCP'|'CLS'|'INP', value: number|null, relevantEvent: Trace.Types.Events.Event|null):
172
- Lit.LitTemplate {
197
+ function renderMetricValue(
198
+ metric: 'LCP'|'CLS'|'INP', value: number|null, relevantEvent: Trace.Types.Events.Event|null): Lit.LitTemplate {
173
199
  let valueText: string;
174
200
  let valueDisplay: HTMLElement|string;
175
201
  let classification;
@@ -207,9 +233,9 @@ export class SidebarSingleInsightSet extends HTMLElement {
207
233
  i18nString(UIStrings.metricScore, {PH1: metric, PH2: valueText, PH3: classification}) :
208
234
  i18nString(UIStrings.metricScoreUnavailable, {PH1: metric});
209
235
 
210
- return this.#metricIsVisible(metric) ? html`
236
+ return metricIsVisible(activeCategory, metric) ? html`
211
237
  <button class="metric"
212
- @click=${relevantEvent ? this.#onClickMetric.bind(this, relevantEvent) : null}
238
+ @click=${relevantEvent ? onClickMetric.bind(relevantEvent) : null}
213
239
  title=${title}
214
240
  aria-label=${title}
215
241
  >
@@ -219,15 +245,103 @@ export class SidebarSingleInsightSet extends HTMLElement {
219
245
  // clang-format on
220
246
  }
221
247
 
222
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
223
- #getLocalMetrics(insightSetKey: string) {
248
+ function renderInsights(): Lit.LitTemplate {
249
+ const shownInsightTemplates = shownInsights.map(renderInsightComponent);
250
+ const passedInsightsTemplates = passedInsights.map(renderInsightComponent);
251
+
252
+ // clang-format off
253
+ return html`
254
+ ${shownInsightTemplates}
255
+ ${passedInsightsTemplates.length ? html`
256
+ <details class="passed-insights-section">
257
+ <summary>${i18nString(UIStrings.passedInsights, {
258
+ PH1: passedInsightsTemplates.length,
259
+ })}</summary>
260
+ ${passedInsightsTemplates}
261
+ </details>
262
+ ` : Lit.nothing}
263
+ `;
264
+ // clang-format on
265
+ }
266
+
267
+ // clang-format off
268
+ Lit.render(html`
269
+ <style>${sidebarSingleInsightSetStyles}</style>
270
+ <div class="navigation">
271
+ ${renderMetrics()}
272
+ ${renderInsights()}
273
+ </div>
274
+ `, target);
275
+ // clang-format on
276
+ };
277
+
278
+ function metricIsVisible(activeCategory: Trace.Insights.Types.InsightCategory, label: 'LCP'|'CLS'|'INP'): boolean {
279
+ if (activeCategory === Trace.Insights.Types.InsightCategory.ALL) {
280
+ return true;
281
+ }
282
+
283
+ return label === activeCategory;
284
+ }
285
+
286
+ export class SidebarSingleInsightSet extends UI.Widget.Widget {
287
+ #view: View;
288
+ #insightRenderer = new Insights.InsightRenderer.InsightRenderer();
289
+ #activeInsightElement: HTMLElement|null = null;
290
+ #activeHighlightTimeout = -1;
291
+
292
+ #data: SidebarSingleInsightSetData = {
293
+ insightSetKey: null,
294
+ activeCategory: Trace.Insights.Types.InsightCategory.ALL,
295
+ activeInsight: null,
296
+ parsedTrace: null,
297
+ };
298
+
299
+ #didDismissFieldMismatchNotice = false;
300
+
301
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
302
+ super(element, {useShadowDom: true});
303
+ this.#view = view;
304
+ }
305
+
306
+ set data(data: SidebarSingleInsightSetData) {
307
+ this.#data = data;
308
+ this.requestUpdate();
309
+ }
310
+
311
+ override willHide(): void {
312
+ super.willHide();
313
+ window.clearTimeout(this.#activeHighlightTimeout);
314
+ }
315
+
316
+ highlightActiveInsight(): void {
317
+ if (!this.#activeInsightElement) {
318
+ return;
319
+ }
320
+
321
+ // First clear any existing highlight that is going on.
322
+ this.#activeInsightElement.removeAttribute('highlight-insight');
323
+ window.clearTimeout(this.#activeHighlightTimeout);
324
+
325
+ requestAnimationFrame(() => {
326
+ this.#activeInsightElement?.setAttribute('highlight-insight', 'true');
327
+ this.#activeHighlightTimeout = window.setTimeout(() => {
328
+ this.#activeInsightElement?.removeAttribute('highlight-insight');
329
+ }, 2_000);
330
+ });
331
+ }
332
+
333
+ #onClickMetric(traceEvent: Trace.Types.Events.Event): void {
334
+ this.element.dispatchEvent(new Insights.EventRef.EventReferenceClick(traceEvent));
335
+ }
336
+
337
+ #getLocalMetrics(insightSetKey: string): LocalMetrics|null {
224
338
  if (!this.#data.parsedTrace) {
225
- return {};
339
+ return null;
226
340
  }
227
341
 
228
342
  const insightSet = this.#data.parsedTrace.insights?.get(insightSetKey);
229
343
  if (!insightSet) {
230
- return {};
344
+ return null;
231
345
  }
232
346
 
233
347
  const lcp = Trace.Insights.Common.getLCP(insightSet);
@@ -256,251 +370,108 @@ export class SidebarSingleInsightSet extends HTMLElement {
256
370
  return fieldMetricsResults;
257
371
  }
258
372
 
259
- /**
260
- * Returns true if LCP or INP are worse in the field than what was observed locally.
261
- *
262
- * CLS is ignored because the guidance of applying throttling or device emulation doesn't
263
- * correlate as much with observing a more average user experience.
264
- */
265
- #isFieldWorseThanLocal(local: {lcp?: Trace.Types.Timing.Milli, inp?: Trace.Types.Timing.Milli}, field: {
266
- lcp?: Trace.Types.Timing.Milli,
267
- inp?: Trace.Types.Timing.Milli,
268
- }): boolean {
269
- if (local.lcp !== undefined && field.lcp !== undefined) {
270
- if (determineCompareRating('LCP', local.lcp, field.lcp) === 'better') {
271
- return true;
272
- }
273
- }
274
-
275
- if (local.inp !== undefined && field.inp !== undefined) {
276
- if (determineCompareRating('LCP', local.inp, field.inp) === 'better') {
277
- return true;
278
- }
279
- }
280
-
281
- return false;
282
- }
283
-
284
- #dismissFieldMismatchNotice(): void {
285
- this.#dismissedFieldMismatchNotice = true;
286
- this.#render();
287
- }
288
-
289
- #renderMetrics(insightSetKey: string): Lit.TemplateResult {
290
- const local = this.#getLocalMetrics(insightSetKey);
291
- const field = this.#getFieldMetrics(insightSetKey);
292
-
293
- const lcpEl = this.#renderMetricValue('LCP', local.lcp?.value ?? null, local.lcp?.event ?? null);
294
- const inpEl = this.#renderMetricValue('INP', local.inp?.value ?? null, local.inp?.event ?? null);
295
- const clsEl = this.#renderMetricValue('CLS', local.cls?.value ?? null, local.cls?.worstClusterEvent ?? null);
296
-
297
- const localMetricsTemplateResult = html`
298
- <div class="metrics-row">
299
- <span>${lcpEl}</span>
300
- <span>${inpEl}</span>
301
- <span>${clsEl}</span>
302
- <span class="row-label">Local</span>
303
- </div>
304
- <span class="row-border"></span>
305
- `;
306
-
307
- let fieldMetricsTemplateResult;
308
- if (field) {
309
- const {lcp, inp, cls} = field;
310
-
311
- const lcpEl = this.#renderMetricValue('LCP', lcp?.value ?? null, null);
312
- const inpEl = this.#renderMetricValue('INP', inp?.value ?? null, null);
313
- const clsEl = this.#renderMetricValue('CLS', cls?.value ?? null, null);
314
-
315
- let scope = i18nString(UIStrings.originOption);
316
- if (lcp?.pageScope === 'url' || inp?.pageScope === 'url') {
317
- scope = i18nString(UIStrings.urlOption);
318
- }
319
-
320
- // clang-format off
321
- fieldMetricsTemplateResult = html`
322
- <div class="metrics-row">
323
- <span>${lcpEl}</span>
324
- <span>${inpEl}</span>
325
- <span>${clsEl}</span>
326
- <span class="row-label">${i18nString(UIStrings.fieldScoreLabel, {PH1: scope})}</span>
327
- </div>
328
- <span class="row-border"></span>
329
- `;
330
- // clang-format on
331
- }
332
-
333
- const localValues = {
334
- lcp: local.lcp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(local.lcp.value) : undefined,
335
- inp: local.inp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(local.inp.value) : undefined,
336
- };
337
- const fieldValues = field && {
338
- lcp: field.lcp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(field.lcp.value) : undefined,
339
- inp: field.inp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(field.inp.value) : undefined,
340
- };
341
-
342
- let fieldIsDifferentEl;
343
- if (!this.#dismissedFieldMismatchNotice && fieldValues && this.#isFieldWorseThanLocal(localValues, fieldValues)) {
344
- // clang-format off
345
- fieldIsDifferentEl = html`
346
- <div class="field-mismatch-notice" jslog=${VisualLogging.section('timeline.insights.field-mismatch')}>
347
- <h3>${i18nString(UIStrings.fieldMismatchTitle)}</h3>
348
- <devtools-button
349
- title=${i18nString(UIStrings.dismissTitle)}
350
- .iconName=${'cross'}
351
- .variant=${Buttons.Button.Variant.ICON}
352
- .jslogContext=${'timeline.insights.dismiss-field-mismatch'}
353
- @click=${this.#dismissFieldMismatchNotice}
354
- ></devtools-button>
355
- <div class="field-mismatch-notice__body">${md(i18nString(UIStrings.fieldMismatchNotice))}</div>
356
- </div>
357
- `;
358
- // clang-format on
359
- }
360
-
361
- const classes = {metrics: true, 'metrics--field': Boolean(fieldMetricsTemplateResult)};
362
- const metricsTableEl = html`<div class=${Lit.Directives.classMap(classes)}>
363
- <div class="metrics-row">
364
- <span class="metric-label">LCP</span>
365
- <span class="metric-label">INP</span>
366
- <span class="metric-label">CLS</span>
367
- <span class="row-label"></span>
368
- </div>
369
- ${localMetricsTemplateResult}
370
- ${fieldMetricsTemplateResult}
371
- </div>`;
372
-
373
- return html`
374
- ${metricsTableEl}
375
- ${fieldIsDifferentEl}
376
- `;
373
+ #onDismisFieldMismatchNotice(): void {
374
+ this.#didDismissFieldMismatchNotice = true;
375
+ this.requestUpdate();
377
376
  }
378
377
 
379
378
  static categorizeInsights(
380
379
  insightSets: Trace.Insights.Types.TraceInsightSets|null,
381
380
  insightSetKey: string,
382
381
  activeCategory: Trace.Insights.Types.InsightCategory,
383
- ): {shownInsights: CategorizedInsightData[], passedInsights: CategorizedInsightData[]} {
382
+ ): {shownInsights: InsightData[], passedInsights: InsightData[]} {
384
383
  const insightSet = insightSets?.get(insightSetKey);
385
384
  if (!insightSet) {
386
385
  return {shownInsights: [], passedInsights: []};
387
386
  }
388
387
 
389
- const shownInsights: CategorizedInsightData[] = [];
390
- const passedInsights: CategorizedInsightData[] = [];
391
-
392
- for (const [name, model] of Object.entries(insightSet.model)) {
393
- const componentClass = INSIGHT_NAME_TO_COMPONENT[name as keyof Trace.Insights.Types.InsightModels];
394
- if (!componentClass) {
395
- continue;
396
- }
388
+ const shownInsights: InsightData[] = [];
389
+ const passedInsights: InsightData[] = [];
397
390
 
391
+ for (const [insightName, model] of Object.entries(insightSet.model)) {
398
392
  if (!model || !shouldRenderForCategory({activeCategory, insightCategory: model.category})) {
399
393
  continue;
400
394
  }
401
395
 
402
- if (model instanceof Error) {
403
- continue;
404
- }
405
-
406
396
  if (model.state === 'pass') {
407
- passedInsights.push({componentClass, model});
397
+ passedInsights.push({insightName, model});
408
398
  } else {
409
- shownInsights.push({componentClass, model});
399
+ shownInsights.push({insightName, model});
410
400
  }
411
401
  }
412
402
  return {shownInsights, passedInsights};
413
403
  }
414
404
 
415
- #renderInsights(
416
- insights: Trace.Insights.Types.TraceInsightSets|null,
417
- insightSetKey: string,
418
- ): Lit.LitTemplate {
419
- const insightSet = insights?.get(insightSetKey);
420
- if (!insightSet) {
405
+ #renderInsightComponent(
406
+ insightSet: Trace.Insights.Types.InsightSet, insightData: InsightData,
407
+ fieldMetrics: Trace.Insights.Common.CrUXFieldMetricResults|null): Lit.LitTemplate {
408
+ if (!this.#data.parsedTrace) {
421
409
  return Lit.nothing;
422
410
  }
423
411
 
424
- const fieldMetrics = this.#getFieldMetrics(insightSetKey);
425
- const {shownInsights: shownInsightsData, passedInsights: passedInsightsData} =
426
- SidebarSingleInsightSet.categorizeInsights(
427
- insights,
428
- insightSetKey,
429
- this.#data.activeCategory,
430
- );
431
-
432
- const renderInsightComponent = (insightData: CategorizedInsightData): Lit.LitTemplate => {
433
- const {componentClass, model} = insightData;
434
- if (!this.#data.parsedTrace?.insights) {
435
- return nothing;
436
- }
412
+ const {insightName, model} = insightData;
413
+ const activeInsight = this.#data.activeInsight;
414
+ const agentFocus = AIAssistance.AIContext.AgentFocus.fromInsight(this.#data.parsedTrace, model);
437
415
 
438
- const agentFocus = AIAssistance.AIContext.AgentFocus.fromInsight(this.#data.parsedTrace, model);
439
- // clang-format off
440
- /* eslint-disable lit/binding-positions,lit/no-invalid-html */
441
- return html`<div>
442
- <${componentClass.litTagName}
443
- .selected=${this.#data.activeInsight?.model === model}
444
- ${Lit.Directives.ref(elem => {
445
- if(this.#data.activeInsight?.model === model && elem) {
446
- this.#activeInsightElement = elem as BaseInsightComponent<Trace.Insights.Types.InsightModel>;
447
- }
448
- })}
449
- .model=${model}
450
- .bounds=${insightSet.bounds}
451
- .insightSetKey=${insightSetKey}
452
- .agentFocus=${agentFocus}
453
- .fieldMetrics=${fieldMetrics}>
454
- </${componentClass.litTagName}>
455
- </div>`;
456
- /* eslint-enable lit/binding-positions,lit/no-invalid-html */
457
- // clang-format on
458
- };
416
+ const widgetElement =
417
+ this.#insightRenderer.renderInsightToWidgetElement(this.#data.parsedTrace, insightSet, model, insightName, {
418
+ selected: activeInsight?.model === model,
419
+ agentFocus,
420
+ fieldMetrics,
421
+ });
459
422
 
460
- const shownInsights = shownInsightsData.map(renderInsightComponent);
461
- const passedInsights = passedInsightsData.map(renderInsightComponent);
423
+ if (activeInsight?.model === model) {
424
+ this.#activeInsightElement = widgetElement;
425
+ }
462
426
 
463
- // clang-format off
464
- return html`
465
- ${shownInsights}
466
- ${passedInsights.length ? html`
467
- <details class="passed-insights-section">
468
- <summary>${i18nString(UIStrings.passedInsights, {
469
- PH1: passedInsights.length,
470
- })}</summary>
471
- ${passedInsights}
472
- </details>
473
- ` : Lit.nothing}
474
- `;
475
- // clang-format on
427
+ return html`${widgetElement}`;
476
428
  }
477
429
 
478
- #render(): void {
430
+ override performUpdate(): void {
479
431
  const {
480
432
  parsedTrace,
481
433
  insightSetKey,
482
434
  } = this.#data;
435
+
483
436
  if (!parsedTrace?.insights || !insightSetKey) {
484
- Lit.render(Lit.nothing, this.#shadow, {host: this});
485
437
  return;
486
438
  }
487
439
 
488
- // clang-format off
489
- Lit.render(html`
490
- <style>${sidebarSingleInsightSetStyles}</style>
491
- <div class="navigation">
492
- ${this.#renderMetrics(insightSetKey)}
493
- ${this.#renderInsights(parsedTrace.insights, insightSetKey)}
494
- </div>
495
- `, this.#shadow, {host: this});
496
- // clang-format on
497
- }
498
- }
440
+ const insightSet = parsedTrace.insights.get(insightSetKey);
441
+ if (!insightSet) {
442
+ return;
443
+ }
444
+
445
+ const local = this.#getLocalMetrics(insightSetKey);
446
+ const field = this.#getFieldMetrics(insightSetKey);
447
+ const {shownInsights, passedInsights} = SidebarSingleInsightSet.categorizeInsights(
448
+ parsedTrace.insights,
449
+ insightSetKey,
450
+ this.#data.activeCategory,
451
+ );
499
452
 
500
- declare global {
501
- interface HTMLElementTagNameMap {
502
- 'devtools-performance-sidebar-single-navigation': SidebarSingleInsightSet;
453
+ const localValues = {
454
+ lcp: local?.lcp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(local?.lcp.value) : undefined,
455
+ inp: local?.inp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(local?.inp.value) : undefined,
456
+ };
457
+ const fieldValues = field && {
458
+ lcp: field.lcp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(field.lcp.value) : undefined,
459
+ inp: field.inp?.value !== undefined ? Trace.Helpers.Timing.microToMilli(field.inp.value) : undefined,
460
+ };
461
+ const showFieldMismatchNotice =
462
+ !this.#didDismissFieldMismatchNotice && !!fieldValues && isFieldWorseThanLocal(localValues, fieldValues);
463
+
464
+ const input: ViewInput = {
465
+ shownInsights,
466
+ passedInsights,
467
+ local,
468
+ field,
469
+ activeCategory: this.#data.activeCategory,
470
+ showFieldMismatchNotice,
471
+ onDismisFieldMismatchNotice: this.#onDismisFieldMismatchNotice.bind(this),
472
+ onClickMetric: this.#onClickMetric.bind(this),
473
+ renderInsightComponent: insightData => this.#renderInsightComponent(insightSet, insightData, field),
474
+ };
475
+ this.#view(input, undefined, this.contentElement);
503
476
  }
504
477
  }
505
-
506
- customElements.define('devtools-performance-sidebar-single-navigation', SidebarSingleInsightSet);