chrome-devtools-frontend 1.0.1376716 → 1.0.1380117

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 (434) hide show
  1. package/config/gni/devtools_grd_files.gni +15 -7
  2. package/config/gni/devtools_image_files.gni +2 -0
  3. package/front_end/Images/src/animation.svg +3 -0
  4. package/front_end/Images/src/brush-2.svg +3 -0
  5. package/front_end/core/common/SettingRegistration.ts +1 -1
  6. package/front_end/core/host/AidaClient.ts +1 -0
  7. package/front_end/core/host/InspectorFrontendHost.ts +4 -0
  8. package/front_end/core/i18n/ByteUtilities.test.ts +34 -0
  9. package/front_end/core/i18n/ByteUtilities.ts +65 -0
  10. package/front_end/core/i18n/NumberFormatter.ts +75 -0
  11. package/front_end/core/i18n/i18n.ts +4 -0
  12. package/front_end/core/i18n/time-utilities.test.ts +20 -2
  13. package/front_end/core/i18n/time-utilities.ts +125 -86
  14. package/front_end/core/platform/NumberUtilities.test.ts +3 -26
  15. package/front_end/core/platform/NumberUtilities.ts +0 -20
  16. package/front_end/core/root/Runtime.ts +6 -3
  17. package/front_end/core/sdk/CPUThrottlingManager.ts +4 -0
  18. package/front_end/core/sdk/CSSContainerQuery.test.ts +10 -16
  19. package/front_end/core/sdk/CSSContainerQuery.ts +3 -15
  20. package/front_end/core/sdk/CSSMatchedStyles.test.ts +4 -0
  21. package/front_end/core/sdk/CSSMatchedStyles.ts +5 -5
  22. package/front_end/core/sdk/CSSModel.ts +18 -0
  23. package/front_end/core/sdk/CSSPropertyParser.test.ts +16 -1
  24. package/front_end/core/sdk/CSSPropertyParser.ts +2 -2
  25. package/front_end/core/sdk/sdk-meta.ts +8 -0
  26. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +3 -3
  27. package/front_end/generated/ARIAProperties.js +4 -0
  28. package/front_end/generated/InspectorBackendCommands.js +8 -6
  29. package/front_end/generated/SupportedCSSProperties.js +17 -4
  30. package/front_end/generated/protocol-mapping.d.ts +15 -1
  31. package/front_end/generated/protocol-proxy-api.d.ts +14 -1
  32. package/front_end/generated/protocol.ts +26 -2
  33. package/front_end/models/extensions/ExtensionAPI.ts +9 -1
  34. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +2 -0
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -21
  36. package/front_end/models/live-metrics/web-vitals-injected/{rollup.config.js → rollup.config.mjs} +1 -1
  37. package/front_end/models/persistence/EditFileSystemView.ts +19 -9
  38. package/front_end/models/persistence/WorkspaceSettingsTab.ts +50 -54
  39. package/front_end/models/persistence/editFileSystemView.css +35 -15
  40. package/front_end/models/persistence/workspaceSettingsTab.css +21 -87
  41. package/front_end/models/timeline_model/timeline_model.ts +0 -6
  42. package/front_end/models/trace/Processor.test.ts +18 -17
  43. package/front_end/models/trace/Processor.ts +10 -14
  44. package/front_end/models/trace/README.md +0 -1
  45. package/front_end/models/{timeline_model → trace/extras}/TimelineJSProfile.ts +19 -29
  46. package/front_end/models/{timeline_model/TimelineModelFilter.test.ts → trace/extras/TraceFilter.test.ts} +15 -17
  47. package/front_end/models/trace/extras/TraceFilter.ts +62 -0
  48. package/front_end/models/{timeline_model/TimelineProfileTree.test.ts → trace/extras/TraceTree.test.ts} +44 -43
  49. package/front_end/models/{timeline_model/TimelineProfileTree.ts → trace/extras/TraceTree.ts} +65 -59
  50. package/front_end/models/trace/extras/extras.ts +3 -0
  51. package/front_end/models/trace/handlers/AnimationHandler.ts +0 -8
  52. package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -11
  53. package/front_end/models/trace/handlers/FramesHandler.test.ts +1 -6
  54. package/front_end/models/trace/handlers/FramesHandler.ts +1 -14
  55. package/front_end/models/trace/handlers/GPUHandler.test.ts +0 -2
  56. package/front_end/models/trace/handlers/GPUHandler.ts +1 -25
  57. package/front_end/models/trace/handlers/ImagePaintingHandler.ts +3 -0
  58. package/front_end/models/trace/handlers/InitiatorsHandler.test.ts +0 -1
  59. package/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -20
  60. package/front_end/models/trace/handlers/InvalidationsHandler.test.ts +0 -1
  61. package/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -18
  62. package/front_end/models/trace/handlers/LargestImagePaintHandler.test.ts +2 -2
  63. package/front_end/models/trace/handlers/LargestImagePaintHandler.ts +63 -3
  64. package/front_end/models/trace/handlers/LargestTextPaintHandler.ts +3 -0
  65. package/front_end/models/trace/handlers/LayerTreeHandler.test.ts +0 -2
  66. package/front_end/models/trace/handlers/LayerTreeHandler.ts +1 -18
  67. package/front_end/models/trace/handlers/LayoutShiftsHandler.test.ts +0 -3
  68. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -20
  69. package/front_end/models/trace/handlers/MemoryHandler.test.ts +0 -1
  70. package/front_end/models/trace/handlers/MemoryHandler.ts +3 -0
  71. package/front_end/models/trace/handlers/MetaHandler.test.ts +1 -32
  72. package/front_end/models/trace/handlers/MetaHandler.ts +2 -30
  73. package/front_end/models/trace/handlers/NetworkRequestsHandler.test.ts +0 -26
  74. package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +4 -23
  75. package/front_end/models/trace/handlers/PageFramesHandler.ts +3 -0
  76. package/front_end/models/trace/handlers/RendererHandler.test.ts +0 -4
  77. package/front_end/models/trace/handlers/RendererHandler.ts +1 -24
  78. package/front_end/models/trace/handlers/SamplesHandler.test.ts +0 -5
  79. package/front_end/models/trace/handlers/SamplesHandler.ts +0 -26
  80. package/front_end/models/trace/handlers/ScreenshotsHandler.test.ts +0 -1
  81. package/front_end/models/trace/handlers/SelectorStatsHandler.ts +3 -0
  82. package/front_end/models/trace/handlers/ServerTimingsHandler.ts +1 -16
  83. package/front_end/models/trace/handlers/Threads.test.ts +1 -2
  84. package/front_end/models/trace/handlers/UserInteractionsHandler.test.ts +4 -27
  85. package/front_end/models/trace/handlers/UserInteractionsHandler.ts +16 -25
  86. package/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -17
  87. package/front_end/models/trace/handlers/WorkersHandler.test.ts +0 -1
  88. package/front_end/models/trace/handlers/WorkersHandler.ts +0 -23
  89. package/front_end/models/trace/handlers/types.ts +1 -8
  90. package/front_end/models/trace/insights/{CumulativeLayoutShift.test.ts → CLSCulprits.test.ts} +21 -21
  91. package/front_end/models/trace/insights/{CumulativeLayoutShift.ts → CLSCulprits.ts} +24 -5
  92. package/front_end/models/trace/insights/Common.ts +5 -55
  93. package/front_end/models/trace/insights/DocumentLatency.test.ts +2 -2
  94. package/front_end/models/trace/insights/DocumentLatency.ts +26 -6
  95. package/front_end/models/trace/insights/FontDisplay.ts +24 -5
  96. package/front_end/models/trace/insights/InteractionToNextPaint.test.ts +1 -1
  97. package/front_end/models/trace/insights/InteractionToNextPaint.ts +26 -6
  98. package/front_end/models/trace/insights/LCPDiscovery.test.ts +58 -0
  99. package/front_end/models/trace/insights/LCPDiscovery.ts +101 -0
  100. package/front_end/models/trace/insights/{LargestContentfulPaint.test.ts → LCPPhases.test.ts} +6 -28
  101. package/front_end/models/trace/insights/{LargestContentfulPaint.ts → LCPPhases.ts} +37 -38
  102. package/front_end/models/trace/insights/{InsightRunners.ts → Models.ts} +4 -3
  103. package/front_end/models/trace/insights/RenderBlocking.test.ts +1 -1
  104. package/front_end/models/trace/insights/RenderBlocking.ts +33 -28
  105. package/front_end/models/trace/insights/SlowCSSSelector.ts +26 -5
  106. package/front_end/models/trace/insights/{ThirdPartyWeb.test.ts → ThirdParties.test.ts} +3 -3
  107. package/front_end/models/trace/insights/{ThirdPartyWeb.ts → ThirdParties.ts} +24 -5
  108. package/front_end/models/trace/insights/Viewport.test.ts +1 -1
  109. package/front_end/models/trace/insights/Viewport.ts +27 -9
  110. package/front_end/models/trace/insights/insights.ts +1 -1
  111. package/front_end/models/trace/insights/types.ts +11 -9
  112. package/front_end/models/trace/types/TraceEvents.ts +51 -22
  113. package/front_end/panels/application/SharedStorageItemsView.test.ts +3 -3
  114. package/front_end/panels/application/SharedStorageItemsView.ts +5 -3
  115. package/front_end/panels/application/StorageView.ts +3 -3
  116. package/front_end/panels/application/components/StorageMetadataView.ts +1 -2
  117. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +34 -31
  118. package/front_end/panels/coverage/CoverageView.ts +3 -3
  119. package/front_end/panels/elements/ComputedStyleModel.ts +9 -2
  120. package/front_end/panels/elements/ComputedStyleWidget.test.ts +72 -0
  121. package/front_end/panels/elements/ComputedStyleWidget.ts +12 -0
  122. package/front_end/panels/elements/ElementStatePaneWidget.test.ts +84 -30
  123. package/front_end/panels/elements/ElementStatePaneWidget.ts +42 -24
  124. package/front_end/panels/elements/ElementsTreeElement.ts +24 -11
  125. package/front_end/panels/elements/MetricsSidebarPane.ts +12 -7
  126. package/front_end/panels/elements/PropertyMatchers.ts +3 -0
  127. package/front_end/panels/elements/StylePropertiesSection.ts +15 -6
  128. package/front_end/panels/elements/StylePropertyTreeElement.test.ts +3 -1
  129. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -3
  130. package/front_end/panels/elements/stylePropertiesTreeOutline.css +2 -2
  131. package/front_end/panels/explain/components/ConsoleInsight.ts +8 -18
  132. package/front_end/panels/freestyler/AiAgent.test.ts +58 -1
  133. package/front_end/panels/freestyler/AiAgent.ts +58 -3
  134. package/front_end/panels/freestyler/DrJonesFileAgent.test.ts +99 -23
  135. package/front_end/panels/freestyler/DrJonesFileAgent.ts +53 -20
  136. package/front_end/panels/freestyler/DrJonesNetworkAgent.test.ts +15 -7
  137. package/front_end/panels/freestyler/DrJonesNetworkAgent.ts +36 -15
  138. package/front_end/panels/freestyler/DrJonesPerformanceAgent.test.ts +6 -6
  139. package/front_end/panels/freestyler/DrJonesPerformanceAgent.ts +48 -8
  140. package/front_end/panels/freestyler/FreestylerAgent.test.ts +15 -14
  141. package/front_end/panels/freestyler/FreestylerAgent.ts +52 -8
  142. package/front_end/panels/freestyler/FreestylerPanel.test.ts +539 -39
  143. package/front_end/panels/freestyler/FreestylerPanel.ts +349 -215
  144. package/front_end/panels/freestyler/components/FreestylerChatUi.test.ts +126 -34
  145. package/front_end/panels/freestyler/components/FreestylerChatUi.ts +320 -268
  146. package/front_end/panels/freestyler/components/UserActionRow.ts +156 -47
  147. package/front_end/panels/freestyler/components/freestylerChatUi.css +69 -34
  148. package/front_end/panels/freestyler/components/userActionRow.css +40 -67
  149. package/front_end/panels/freestyler/freestyler-meta.ts +3 -11
  150. package/front_end/panels/issues/components/HideIssuesMenu.ts +2 -11
  151. package/front_end/panels/layer_viewer/LayerDetailsView.ts +1 -2
  152. package/front_end/panels/layer_viewer/PaintProfilerView.ts +5 -5
  153. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +46 -0
  154. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +26 -17
  155. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +25 -19
  156. package/front_end/panels/network/BinaryResourceView.ts +6 -7
  157. package/front_end/panels/network/EventSourceMessagesView.ts +1 -1
  158. package/front_end/panels/network/NetworkDataGridNode.ts +3 -3
  159. package/front_end/panels/network/NetworkLogView.ts +7 -8
  160. package/front_end/panels/network/RequestTimingView.test.ts +35 -1
  161. package/front_end/panels/network/RequestTimingView.ts +96 -0
  162. package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -2
  163. package/front_end/panels/network/networkTimingTable.css +2 -1
  164. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
  165. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  166. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
  167. package/front_end/panels/profiler/HeapTimelineOverview.ts +12 -12
  168. package/front_end/panels/profiler/IsolateSelector.ts +3 -4
  169. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +1 -1
  170. package/front_end/panels/profiler/ProfileSidebarTreeElement.ts +7 -6
  171. package/front_end/panels/profiler/ProfileView.ts +1 -1
  172. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  173. package/front_end/panels/recorder/injected/{rollup.config.js → rollup.config.mjs} +1 -1
  174. package/front_end/panels/recorder/recorderController.css +0 -4
  175. package/front_end/panels/security/CookieReportTreeElement.ts +1 -9
  176. package/front_end/panels/security/CookieReportView.ts +120 -0
  177. package/front_end/panels/security/SecurityPanel.ts +8 -2
  178. package/front_end/panels/security/cookieReportView.css +46 -0
  179. package/front_end/panels/security/sidebar.css +1 -2
  180. package/front_end/panels/sensors/LocationsSettingsTab.ts +26 -11
  181. package/front_end/panels/sensors/locationsSettingsTab.css +18 -18
  182. package/front_end/panels/settings/AISettingsTab.ts +6 -15
  183. package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
  184. package/front_end/panels/settings/SettingsScreen.ts +61 -56
  185. package/front_end/panels/settings/aiSettingsTab.css +3 -14
  186. package/front_end/panels/settings/components/SyncSection.ts +1 -2
  187. package/front_end/panels/settings/components/syncSection.css +0 -10
  188. package/front_end/panels/settings/frameworkIgnoreListSettingsTab.css +3 -1
  189. package/front_end/panels/settings/keybindsSettingsTab.css +7 -10
  190. package/front_end/panels/settings/settingsScreen.css +27 -125
  191. package/front_end/panels/sources/DebuggerPlugin.ts +9 -4
  192. package/front_end/panels/sources/NavigatorView.ts +11 -13
  193. package/front_end/panels/timeline/ActiveFilters.ts +3 -4
  194. package/front_end/panels/timeline/AnimationsTrackAppender.ts +1 -2
  195. package/front_end/panels/timeline/CountersGraph.ts +2 -4
  196. package/front_end/panels/timeline/EventsTimelineTreeView.ts +7 -8
  197. package/front_end/panels/timeline/README.md +2 -1
  198. package/front_end/panels/timeline/TimelineController.ts +14 -4
  199. package/front_end/panels/timeline/TimelineEventOverview.ts +3 -4
  200. package/front_end/panels/timeline/TimelineFilters.ts +3 -4
  201. package/front_end/panels/timeline/TimelineFlameChartDataProvider.test.ts +1 -1
  202. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -10
  203. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +1 -2
  204. package/front_end/panels/timeline/TimelineFlameChartView.ts +21 -12
  205. package/front_end/panels/timeline/TimelineLoader.test.ts +1 -2
  206. package/front_end/panels/timeline/TimelineLoader.ts +3 -4
  207. package/front_end/panels/timeline/TimelineMiniMap.ts +10 -0
  208. package/front_end/panels/timeline/TimelinePanel.ts +20 -8
  209. package/front_end/panels/timeline/TimelineTreeView.test.ts +12 -13
  210. package/front_end/panels/timeline/TimelineTreeView.ts +35 -40
  211. package/front_end/panels/timeline/TimelineUIUtils.test.ts +2 -2
  212. package/front_end/panels/timeline/TimelineUIUtils.ts +12 -14
  213. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +6 -7
  214. package/front_end/panels/timeline/components/LiveMetricsView.test.ts +3 -3
  215. package/front_end/panels/timeline/components/LiveMetricsView.ts +14 -26
  216. package/front_end/panels/timeline/components/MetricCard.test.ts +1 -1
  217. package/front_end/panels/timeline/components/MetricCard.ts +46 -0
  218. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +3 -4
  219. package/front_end/panels/timeline/components/SidebarSingleInsightSet.test.ts +2 -0
  220. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +41 -36
  221. package/front_end/panels/timeline/components/insights/CLSCulprits.ts +19 -33
  222. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +29 -40
  223. package/front_end/panels/timeline/components/insights/FontDisplay.ts +17 -23
  224. package/front_end/panels/timeline/components/insights/Helpers.ts +12 -16
  225. package/front_end/panels/timeline/components/insights/InteractionToNextPaint.ts +14 -26
  226. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +25 -37
  227. package/front_end/panels/timeline/components/insights/LCPPhases.ts +20 -47
  228. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +19 -28
  229. package/front_end/panels/timeline/components/insights/SidebarInsight.ts +1 -2
  230. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +18 -31
  231. package/front_end/panels/timeline/components/insights/Table.ts +5 -3
  232. package/front_end/panels/timeline/components/insights/ThirdParties.ts +18 -25
  233. package/front_end/panels/timeline/components/insights/Viewport.ts +14 -25
  234. package/front_end/panels/timeline/components/liveMetricsView.css +5 -13
  235. package/front_end/panels/timeline/components/metricCard.css +11 -0
  236. package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
  237. package/front_end/panels/timeline/overlays/OverlaysImpl.test.ts +5 -5
  238. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +13 -12
  239. package/front_end/panels/timeline/timelineFlameChartView.css +1 -1
  240. package/front_end/panels/timeline/utils/AICallTree.test.ts +105 -0
  241. package/front_end/panels/timeline/utils/AICallTree.ts +25 -24
  242. package/front_end/testing/EnvironmentHelpers.ts +5 -18
  243. package/front_end/testing/InsightHelpers.ts +4 -4
  244. package/front_end/testing/TraceHelpers.ts +1 -1
  245. package/front_end/third_party/puppeteer/README.chromium +2 -2
  246. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +2 -3
  247. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  248. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  249. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts +14 -3
  250. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js +16 -2
  252. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts +34 -5
  254. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js +51 -2
  256. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js.map +1 -1
  257. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  258. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js +10 -8
  259. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js.map +1 -1
  260. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  261. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +1 -1
  262. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  263. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts +14 -4
  264. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js +57 -23
  266. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts +1 -1
  268. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js +13 -10
  270. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts +15 -4
  272. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts.map +1 -1
  273. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js +55 -26
  274. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js.map +1 -1
  275. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +0 -8
  276. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js +2 -11
  278. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
  279. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +2 -1
  280. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +5 -2
  282. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
  283. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +7 -0
  284. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -1
  285. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +9 -1
  286. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js.map +1 -1
  287. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.d.ts.map +1 -1
  288. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js +5 -3
  289. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js.map +1 -1
  290. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts +1 -1
  291. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map +1 -1
  292. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js +0 -3
  293. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js.map +1 -1
  294. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
  296. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  298. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  299. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  300. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  301. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  302. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  303. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts +14 -0
  304. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
  305. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js +18 -0
  306. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js.map +1 -0
  307. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +51 -10
  308. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +215 -97
  309. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +2 -3
  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/ElementHandle.d.ts +14 -3
  313. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
  314. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js +16 -2
  315. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
  316. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts +34 -5
  317. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
  318. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js +51 -2
  319. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js.map +1 -1
  320. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  321. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js +10 -8
  322. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js.map +1 -1
  323. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  324. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +1 -1
  325. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  326. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts +14 -4
  327. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts.map +1 -1
  328. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js +57 -23
  329. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js.map +1 -1
  330. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts +1 -1
  331. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  332. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js +13 -10
  333. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js.map +1 -1
  334. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts +15 -4
  335. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts.map +1 -1
  336. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js +55 -26
  337. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js.map +1 -1
  338. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +0 -8
  339. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  340. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js +1 -9
  341. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
  342. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +2 -1
  343. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  344. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js +5 -2
  345. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
  346. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts +7 -0
  347. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts.map +1 -1
  348. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js +7 -0
  349. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js.map +1 -1
  350. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.d.ts.map +1 -1
  351. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js +5 -3
  352. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js.map +1 -1
  353. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts +1 -1
  354. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts.map +1 -1
  355. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js +0 -3
  356. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js.map +1 -1
  357. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
  358. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
  359. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  360. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  361. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  362. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  363. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  364. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts +14 -0
  365. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
  366. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js +15 -0
  367. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js.map +1 -0
  368. package/front_end/third_party/puppeteer/package/lib/types.d.ts +51 -10
  369. package/front_end/third_party/puppeteer/package/package.json +4 -4
  370. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +2 -3
  371. package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +21 -3
  372. package/front_end/third_party/puppeteer/package/src/api/Input.ts +57 -8
  373. package/front_end/third_party/puppeteer/package/src/bidi/ElementHandle.ts +9 -7
  374. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +1 -0
  375. package/front_end/third_party/puppeteer/package/src/bidi/Input.ts +72 -31
  376. package/front_end/third_party/puppeteer/package/src/cdp/ElementHandle.ts +14 -9
  377. package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +71 -26
  378. package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +1 -15
  379. package/front_end/third_party/puppeteer/package/src/common/ConsoleMessage.ts +8 -1
  380. package/front_end/third_party/puppeteer/package/src/common/Errors.ts +7 -0
  381. package/front_end/third_party/puppeteer/package/src/common/WaitTask.ts +9 -9
  382. package/front_end/third_party/puppeteer/package/src/environment.ts +1 -4
  383. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  384. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  385. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  386. package/front_end/third_party/puppeteer/package/src/util/incremental-id-generator.ts +20 -0
  387. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +1 -0
  388. package/front_end/ui/components/buttons/Button.test.ts +14 -0
  389. package/front_end/ui/components/buttons/Button.ts +27 -4
  390. package/front_end/ui/components/cards/card.css +7 -4
  391. package/front_end/ui/components/dialogs/Dialog.ts +2 -4
  392. package/front_end/ui/components/dialogs/ShortcutDialog.ts +15 -13
  393. package/front_end/ui/components/dialogs/dialog.css +2 -6
  394. package/front_end/ui/components/dialogs/shortcutDialog.css +33 -41
  395. package/front_end/ui/components/docs/freestyler/basic.ts +6 -8
  396. package/front_end/ui/components/docs/freestyler/empty_state.ts +6 -8
  397. package/front_end/ui/components/docs/performance_panel/track_example.html +1 -1
  398. package/front_end/ui/components/markdown_view/MarkdownView.test.ts +39 -17
  399. package/front_end/ui/components/markdown_view/MarkdownView.ts +77 -14
  400. package/front_end/ui/components/markdown_view/markdownView.css +15 -0
  401. package/front_end/ui/components/settings/SettingCheckbox.ts +3 -2
  402. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  403. package/front_end/ui/legacy/InplaceEditor.ts +18 -14
  404. package/front_end/ui/legacy/TabbedPane.ts +0 -14
  405. package/front_end/ui/legacy/UIUtils.ts +0 -7
  406. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +7 -2
  407. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +8 -4
  408. package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +20 -11
  409. package/front_end/ui/legacy/components/inline_editor/LinkSwatch.test.ts +19 -0
  410. package/front_end/ui/legacy/components/inline_editor/LinkSwatch.ts +1 -1
  411. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -1
  412. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -22
  413. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +129 -100
  414. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +4 -2
  415. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.test.ts +9 -4
  416. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.ts +6 -6
  417. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +22 -4
  418. package/front_end/ui/legacy/components/perf_ui/flameChart.css +0 -2
  419. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.test.ts +49 -0
  420. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +23 -46
  421. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
  422. package/front_end/ui/legacy/components/utils/ImagePreview.ts +1 -1
  423. package/front_end/ui/legacy/textPrompt.css +1 -1
  424. package/front_end/ui/legacy/toolbar.css +4 -5
  425. package/front_end/ui/visual_logging/KnownContextValues.ts +174 -0
  426. package/front_end/ui/visual_logging/LoggingConfig.ts +6 -2
  427. package/package.json +7 -6
  428. package/scripts/build/ninja/bundle.gni +3 -3
  429. package/scripts/build/{rollup.config.js → rollup.config.mjs} +4 -4
  430. package/scripts/devtools_paths.py +8 -4
  431. package/scripts/eslint_rules/tests/check_test_definitions_test.js +8 -3
  432. package/scripts/tools/update_goldens_v2.py +1 -1
  433. package/front_end/models/timeline_model/TimelineModelFilter.ts +0 -61
  434. /package/front_end/Images/{rollup.config.js → rollup.config.mjs} +0 -0
@@ -2,9 +2,11 @@
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
4
 
5
+ import * as Host from '../../../core/host/host.js';
5
6
  import * as i18n from '../../../core/i18n/i18n.js';
6
7
  import * as Platform from '../../../core/platform/platform.js';
7
8
  import * as CrUXManager from '../../../models/crux-manager/crux-manager.js';
9
+ import * as Buttons from '../../../ui/components/buttons/buttons.js';
8
10
  import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
9
11
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
10
12
 
@@ -121,6 +123,20 @@ const UIStrings = {
121
123
  * @description Column header for table cell values representing a phase duration (in milliseconds) that was measured in the developers local environment.
122
124
  */
123
125
  duration: 'Local duration (ms)',
126
+ /**
127
+ * @description Tooltip text for a link that goes to documentation explaining the Largest Contentful Paint (LCP) metric. "LCP" is an acronym and should not be translated.
128
+ */
129
+ lcpHelpTooltip:
130
+ 'LCP reports the render time of the largest image, text block, or video visible in the viewport. Click here to learn more about LCP.',
131
+ /**
132
+ * @description Tooltip text for a link that goes to documentation explaining the Cumulative Layout Shift (CLS) metric. "CLS" is an acronym and should not be translated.
133
+ */
134
+ clsHelpTooltip: 'CLS measures the amount of unexpected shifted content. Click here to learn more about CLS.',
135
+ /**
136
+ * @description Tooltip text for a link that goes to documentation explaining the Interaction to Next Paint (INP) metric. "INP" is an acronym and should not be translated.
137
+ */
138
+ inpHelpTooltip:
139
+ 'INP measures the overall responsiveness to all click, tap, and keyboard interactions. Click here to learn more about INP.',
124
140
  };
125
141
 
126
142
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/MetricCard.ts', UIStrings);
@@ -291,6 +307,28 @@ export class MetricCard extends HTMLElement {
291
307
  }
292
308
  }
293
309
 
310
+ #getHelpLink(): Platform.DevToolsPath.UrlString {
311
+ switch (this.#data.metric) {
312
+ case 'LCP':
313
+ return 'https://web.dev/articles/lcp' as Platform.DevToolsPath.UrlString;
314
+ case 'CLS':
315
+ return 'https://web.dev/articles/cls' as Platform.DevToolsPath.UrlString;
316
+ case 'INP':
317
+ return 'https://web.dev/articles/inp' as Platform.DevToolsPath.UrlString;
318
+ }
319
+ }
320
+
321
+ #getHelpTooltip(): string {
322
+ switch (this.#data.metric) {
323
+ case 'LCP':
324
+ return i18nString(UIStrings.lcpHelpTooltip);
325
+ case 'CLS':
326
+ return i18nString(UIStrings.clsHelpTooltip);
327
+ case 'INP':
328
+ return i18nString(UIStrings.inpHelpTooltip);
329
+ }
330
+ }
331
+
294
332
  #getLocalValue(): number|undefined {
295
333
  const {localValue} = this.#data;
296
334
  if (localValue === undefined) {
@@ -579,12 +617,20 @@ export class MetricCard extends HTMLElement {
579
617
 
580
618
  #render = (): void => {
581
619
  const fieldEnabled = CrUXManager.CrUXManager.instance().getConfigSetting().get().enabled;
620
+ const helpLink = this.#getHelpLink();
582
621
 
583
622
  // clang-format off
584
623
  const output = html`
585
624
  <div class="metric-card">
586
625
  <h3 class="title">
587
626
  ${this.#getTitle()}
627
+ <devtools-button
628
+ class="title-help"
629
+ title=${this.#getHelpTooltip()}
630
+ .iconName=${'help'}
631
+ .variant=${Buttons.Button.Variant.ICON}
632
+ @click=${() => Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(helpLink)}
633
+ ></devtools-button>
588
634
  </h3>
589
635
  <div tabindex="0" class="metric-values-section"
590
636
  @mouseenter=${() => this.#showTooltip(500)}
@@ -5,7 +5,7 @@
5
5
  import '../../../ui/components/request_link_icon/request_link_icon.js';
6
6
 
7
7
  import * as i18n from '../../../core/i18n/i18n.js';
8
- import * as Platform from '../../../core/platform/platform.js';
8
+ import type * as Platform from '../../../core/platform/platform.js';
9
9
  import type * as SDK from '../../../core/sdk/sdk.js';
10
10
  import * as Helpers from '../../../models/trace/helpers/helpers.js';
11
11
  import * as Trace from '../../../models/trace/trace.js';
@@ -223,8 +223,7 @@ export class NetworkRequestDetails extends HTMLElement {
223
223
  lengthText += i18nString(UIStrings.FromServiceWorker);
224
224
  }
225
225
  if (this.#networkRequest.args.data.encodedDataLength || !lengthText) {
226
- lengthText =
227
- `${Platform.NumberUtilities.bytesToString(this.#networkRequest.args.data.encodedDataLength)}${lengthText}`;
226
+ lengthText = `${i18n.ByteUtilities.bytesToString(this.#networkRequest.args.data.encodedDataLength)}${lengthText}`;
228
227
  }
229
228
  return this.#renderRow(i18nString(UIStrings.encodedData), lengthText);
230
229
  }
@@ -325,7 +324,7 @@ export class NetworkRequestDetails extends HTMLElement {
325
324
  ${this.#renderRow(i18nString(UIStrings.priority), NetworkRequestTooltip.renderPriorityValue(this.#networkRequest))}
326
325
  ${this.#renderRow(i18nString(UIStrings.mimeType), networkData.mimeType)}
327
326
  ${this.#renderEncodedDataLength()}
328
- ${this.#renderRow(i18nString(UIStrings.decodedBody), Platform.NumberUtilities.bytesToString(this.#networkRequest.args.data.decodedBodyLength))}
327
+ ${this.#renderRow(i18nString(UIStrings.decodedBody), i18n.ByteUtilities.bytesToString(this.#networkRequest.args.data.decodedBodyLength))}
329
328
  ${this.#renderBlockingRow()}
330
329
  ${this.#renderFromCache()}
331
330
  </div>
@@ -96,6 +96,7 @@ describeWithEnvironment('SidebarSingleInsightSet', () => {
96
96
  // Does not include "font display", which is experimental.
97
97
  assert.deepEqual(userVisibleTitles, [
98
98
  'LCP by phase',
99
+ 'LCP request discovery',
99
100
  'Layout shift culprits',
100
101
  'Third parties',
101
102
  ]);
@@ -124,6 +125,7 @@ describeWithEnvironment('SidebarSingleInsightSet', () => {
124
125
  // Does not include "font display", which is experimental.
125
126
  assert.deepEqual(userVisibleTitles, [
126
127
  'LCP by phase',
128
+ 'LCP request discovery',
127
129
  'Layout shift culprits',
128
130
  'Font display',
129
131
  'Third parties',
@@ -40,27 +40,27 @@ export interface SidebarSingleInsightSetData {
40
40
  * "enable experimental performance insights" experiment. This is used to enable
41
41
  * us to ship incrementally without turning insights on by default for all
42
42
  * users. */
43
- const EXPERIMENTAL_INSIGHTS: ReadonlySet<typeof Insights.Helpers.BaseInsight> = new Set([
44
- Insights.FontDisplay.FontDisplay,
43
+ const EXPERIMENTAL_INSIGHTS: ReadonlySet<string> = new Set([
44
+ 'FontDisplay',
45
45
  ]);
46
46
 
47
47
  /**
48
48
  * Every insight (INCLUDING experimental ones)
49
- * The order of this array is the order the insights will be shown in the sidebar.
49
+ * The order of these properties is the order the insights will be shown in the sidebar.
50
50
  * TODO(crbug.com/368135130): sort this in a smart way!
51
51
  */
52
- const ALL_INSIGHTS: typeof Insights.Helpers.BaseInsight[] = [
53
- Insights.InteractionToNextPaint.InteractionToNextPaint,
54
- Insights.LCPPhases.LCPPhases,
55
- Insights.LCPDiscovery.LCPDiscovery,
56
- Insights.CLSCulprits.CLSCulprits,
57
- Insights.RenderBlocking.RenderBlockingRequests,
58
- Insights.DocumentLatency.DocumentLatency,
59
- Insights.FontDisplay.FontDisplay,
60
- Insights.Viewport.Viewport,
61
- Insights.ThirdParties.ThirdParties,
62
- Insights.SlowCSSSelector.SlowCSSSelector,
63
- ] as const;
52
+ const INSIGHT_NAME_TO_COMPONENT = {
53
+ InteractionToNextPaint: Insights.InteractionToNextPaint.InteractionToNextPaint,
54
+ LCPPhases: Insights.LCPPhases.LCPPhases,
55
+ LCPDiscovery: Insights.LCPDiscovery.LCPDiscovery,
56
+ CLSCulprits: Insights.CLSCulprits.CLSCulprits,
57
+ RenderBlocking: Insights.RenderBlocking.RenderBlocking,
58
+ DocumentLatency: Insights.DocumentLatency.DocumentLatency,
59
+ FontDisplay: Insights.FontDisplay.FontDisplay,
60
+ Viewport: Insights.Viewport.Viewport,
61
+ ThirdParties: Insights.ThirdParties.ThirdParties,
62
+ SlowCSSSelector: Insights.SlowCSSSelector.SlowCSSSelector,
63
+ };
64
64
 
65
65
  export class SidebarSingleInsightSet extends HTMLElement {
66
66
  readonly #shadow = this.attachShadow({mode: 'open'});
@@ -135,7 +135,7 @@ export class SidebarSingleInsightSet extends HTMLElement {
135
135
 
136
136
  #getLCP(insightSetKey: string):
137
137
  {value: Trace.Types.Timing.MicroSeconds, event: Trace.Types.Events.LargestContentfulPaintCandidate}|null {
138
- const insight = Trace.Insights.Common.getInsight('LargestContentfulPaint', this.#data.insights, insightSetKey);
138
+ const insight = Trace.Insights.Common.getInsight('LCPPhases', this.#data.insights, insightSetKey);
139
139
  if (!insight || !insight.lcpMs || !insight.lcpEvent) {
140
140
  return null;
141
141
  }
@@ -145,7 +145,7 @@ export class SidebarSingleInsightSet extends HTMLElement {
145
145
  }
146
146
 
147
147
  #getCLS(insightSetKey: string): {value: number, worstShiftEvent: Trace.Types.Events.Event|null} {
148
- const insight = Trace.Insights.Common.getInsight('CumulativeLayoutShift', this.#data.insights, insightSetKey);
148
+ const insight = Trace.Insights.Common.getInsight('CLSCulprits', this.#data.insights, insightSetKey);
149
149
  if (!insight) {
150
150
  // Unlike the other metrics, there is still a value for this metric even with no data.
151
151
  // This means this view will always display a CLS score.
@@ -193,37 +193,42 @@ export class SidebarSingleInsightSet extends HTMLElement {
193
193
  `;
194
194
  }
195
195
 
196
- #insightsForRendering(): typeof Insights.Helpers.BaseInsight[] {
196
+ #renderInsights(
197
+ insightSets: Trace.Insights.Types.TraceInsightSets|null,
198
+ parsedTrace: Trace.Handlers.Types.ParsedTrace|null,
199
+ insightSetKey: string,
200
+ ): LitHtml.TemplateResult {
197
201
  const includeExperimental = Root.Runtime.experiments.isEnabled(
198
202
  Root.Runtime.ExperimentName.TIMELINE_EXPERIMENTAL_INSIGHTS,
199
203
  );
200
204
 
201
- if (includeExperimental) {
202
- return ALL_INSIGHTS;
205
+ const models = insightSets?.get(insightSetKey)?.model;
206
+ if (!models) {
207
+ return html``;
203
208
  }
204
209
 
205
- return ALL_INSIGHTS.filter(insight => !EXPERIMENTAL_INSIGHTS.has(insight));
206
- }
210
+ const components: LitHtml.TemplateResult[] = [];
211
+ for (const [name, componentClass] of Object.entries(INSIGHT_NAME_TO_COMPONENT)) {
212
+ if (!includeExperimental && EXPERIMENTAL_INSIGHTS.has(name)) {
213
+ continue;
214
+ }
207
215
 
208
- #renderInsights(
209
- insights: Trace.Insights.Types.TraceInsightSets|null,
210
- parsedTrace: Trace.Handlers.Types.ParsedTrace|null,
211
- insightSetKey: string,
212
- ): LitHtml.TemplateResult {
213
- const insightComponents = this.#insightsForRendering();
214
- // clang-format off
215
- return html`${insightComponents.map(component => {
216
- return html`<div data-single-insight-wrapper>
217
- <${component.litTagName}
218
- .insights=${insights}
216
+ // clang-format off
217
+ const component = html`<div data-single-insight-wrapper>
218
+ <${componentClass.litTagName}
219
+ .model=${models[name as keyof typeof models]}
219
220
  .parsedTrace=${parsedTrace}
220
221
  .insightSetKey=${insightSetKey}
221
222
  .activeInsight=${this.#data.activeInsight}
222
223
  .activeCategory=${this.#data.activeCategory}>
223
- </${component.litTagName}>
224
+ </${componentClass.litTagName}>
224
225
  </div>`;
225
- })}`;
226
- // clang-format on
226
+ // clang-format on
227
+
228
+ components.push(component);
229
+ }
230
+
231
+ return html`${components}`;
227
232
  }
228
233
 
229
234
  #render(): void {
@@ -3,25 +3,18 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
+ import type {CLSCulpritsInsightModel} from '../../../../models/trace/insights/CLSCulprits.js';
6
7
  import * as Trace from '../../../../models/trace/trace.js';
7
8
  import * as LitHtml from '../../../../ui/lit-html/lit-html.js';
8
9
  import type * as Overlays from '../../overlays/overlays.js';
9
10
 
10
11
  import {EventReferenceClick} from './EventRef.js';
11
- import {BaseInsight, shouldRenderForCategory} from './Helpers.js';
12
+ import {BaseInsightComponent, shouldRenderForCategory} from './Helpers.js';
12
13
  import {Category} from './types.js';
13
14
 
14
15
  const {html} = LitHtml;
15
16
 
16
17
  const UIStrings = {
17
- /** Title of an insight that provides details about why elements shift/move on the page. The causes for these shifts are referred to as culprits ("reasons"). */
18
- title: 'Layout shift culprits',
19
- /**
20
- * @description Description of a DevTools insight that identifies the reasons that elements shift on the page.
21
- * This is displayed after a user expands the section to see more. No character length limits.
22
- */
23
- description:
24
- 'Layout shifts occur when elements move absent any user interaction. [Investigate the causes of layout shifts](https://web.dev/articles/optimize-cls), such as elements being added, removed, or their fonts changing as the page loads.',
25
18
  /**
26
19
  *@description Text indicating the worst layout shift cluster.
27
20
  */
@@ -59,19 +52,14 @@ const UIStrings = {
59
52
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/insights/CLSCulprits.ts', UIStrings);
60
53
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
61
54
 
62
- export class CLSCulprits extends BaseInsight {
55
+ export class CLSCulprits extends BaseInsightComponent<CLSCulpritsInsightModel> {
63
56
  static override readonly litTagName = LitHtml.literal`devtools-performance-cls-culprits`;
64
57
  override insightCategory: Category = Category.CLS;
65
58
  override internalName: string = 'cls-culprits';
66
- override userVisibleTitle: string = i18nString(UIStrings.title);
67
- override description: string = i18nString(UIStrings.description);
68
59
 
69
60
  override createOverlays(): Overlays.Overlays.TimelineOverlay[] {
70
- const insight =
71
- Trace.Insights.Common.getInsight('CumulativeLayoutShift', this.data.insights, this.data.insightSetKey);
72
-
73
61
  const clustersByScore =
74
- insight?.clusters.toSorted((a, b) => b.clusterCumulativeScore - a.clusterCumulativeScore) ?? [];
62
+ this.model?.clusters.toSorted((a, b) => b.clusterCumulativeScore - a.clusterCumulativeScore) ?? [];
75
63
  const worstCluster = clustersByScore[0];
76
64
  if (!worstCluster) {
77
65
  return [];
@@ -98,8 +86,7 @@ export class CLSCulprits extends BaseInsight {
98
86
  getTopCulprits(
99
87
  cluster: Trace.Types.Events.SyntheticLayoutShiftCluster,
100
88
  culpritsByShift:
101
- Map<Trace.Types.Events.LayoutShift,
102
- Trace.Insights.InsightRunners.CumulativeLayoutShift.LayoutShiftRootCausesData>): string[] {
89
+ Map<Trace.Types.Events.LayoutShift, Trace.Insights.Models.CLSCulprits.LayoutShiftRootCausesData>): string[] {
103
90
  const MAX_TOP_CULPRITS = 3;
104
91
  const causes: Array<string> = [];
105
92
  if (causes.length === MAX_TOP_CULPRITS) {
@@ -140,8 +127,11 @@ export class CLSCulprits extends BaseInsight {
140
127
  this.dispatchEvent(new EventReferenceClick(event));
141
128
  }
142
129
 
143
- #render(culprits: Array<string>, worstCluster: Trace.Types.Events.SyntheticLayoutShiftCluster):
144
- LitHtml.TemplateResult {
130
+ #render(culprits: Array<string>, worstCluster: Trace.Types.Events.SyntheticLayoutShiftCluster): LitHtml.LitTemplate {
131
+ if (!this.model) {
132
+ return LitHtml.nothing;
133
+ }
134
+
145
135
  const ts = Trace.Types.Timing.MicroSeconds(worstCluster.ts - (this.data.parsedTrace?.Meta.traceBounds.min ?? 0));
146
136
  const clusterTs = i18n.TimeUtilities.formatMicroSecondsTime(ts);
147
137
 
@@ -150,8 +140,8 @@ export class CLSCulprits extends BaseInsight {
150
140
  return html`
151
141
  <div class="insights">
152
142
  <devtools-performance-sidebar-insight .data=${{
153
- title: this.userVisibleTitle,
154
- description: this.description,
143
+ title: this.model.title,
144
+ description: this.model.description,
155
145
  internalName: this.internalName,
156
146
  expanded: this.isActive(),
157
147
  }}
@@ -171,25 +161,21 @@ export class CLSCulprits extends BaseInsight {
171
161
  }
172
162
 
173
163
  override getRelatedEvents(): Trace.Types.Events.Event[] {
174
- const insight =
175
- Trace.Insights.Common.getInsight('CumulativeLayoutShift', this.data.insights, this.data.insightSetKey);
176
- return insight?.relatedEvents ?? [];
164
+ return this.model?.relatedEvents ?? [];
177
165
  }
178
166
 
179
167
  override render(): void {
180
- const insight =
181
- Trace.Insights.Common.getInsight('CumulativeLayoutShift', this.data.insights, this.data.insightSetKey);
182
- if (!insight) {
168
+ if (!this.model) {
183
169
  return;
184
170
  }
185
171
 
186
- const culpritsByShift = insight.shifts;
187
- const clusters = insight.clusters ?? [];
188
- if (!clusters.length || !insight.worstCluster) {
172
+ const culpritsByShift = this.model.shifts;
173
+ const clusters = this.model.clusters ?? [];
174
+ if (!clusters.length || !this.model.worstCluster) {
189
175
  return;
190
176
  }
191
177
 
192
- const causes = this.getTopCulprits(insight.worstCluster, culpritsByShift);
178
+ const causes = this.getTopCulprits(this.model.worstCluster, culpritsByShift);
193
179
 
194
180
  const hasCulprits = causes.length > 0;
195
181
 
@@ -197,7 +183,7 @@ export class CLSCulprits extends BaseInsight {
197
183
  activeCategory: this.data.activeCategory,
198
184
  insightCategory: this.insightCategory,
199
185
  });
200
- const output = hasCulprits && matchesCategory ? this.#render(causes, insight.worstCluster) : LitHtml.nothing;
186
+ const output = hasCulprits && matchesCategory ? this.#render(causes, this.model.worstCluster) : LitHtml.nothing;
201
187
  LitHtml.render(output, this.shadow, {host: this});
202
188
  }
203
189
  }
@@ -5,25 +5,17 @@
5
5
  import '../../../../ui/components/icon_button/icon_button.js';
6
6
 
7
7
  import * as i18n from '../../../../core/i18n/i18n.js';
8
+ import type {DocumentLatencyInsightModel} from '../../../../models/trace/insights/DocumentLatency.js';
8
9
  import * as Trace from '../../../../models/trace/trace.js';
9
10
  import * as LitHtml from '../../../../ui/lit-html/lit-html.js';
10
11
  import type * as Overlays from '../../overlays/overlays.js';
11
12
 
12
- import {BaseInsight, shouldRenderForCategory} from './Helpers.js';
13
+ import {BaseInsightComponent, shouldRenderForCategory} from './Helpers.js';
13
14
  import {Category} from './types.js';
14
15
 
15
16
  const {html} = LitHtml;
16
17
 
17
18
  const UIStrings = {
18
- /**
19
- *@description Title of an insight that provides a breakdown for how long it took to download the main document.
20
- */
21
- title: 'Document request latency',
22
- /**
23
- *@description Description of an insight that provides a breakdown for how long it took to download the main document.
24
- */
25
- description:
26
- 'Your first network request is the most important. Reduce its latency by avoiding redirects, ensuring a fast server response, and enabling text compression.',
27
19
  /**
28
20
  * @description Text to tell the user that the document request does not have redirects.
29
21
  */
@@ -75,12 +67,10 @@ const UIStrings = {
75
67
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/insights/DocumentLatency.ts', UIStrings);
76
68
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
77
69
 
78
- export class DocumentLatency extends BaseInsight {
70
+ export class DocumentLatency extends BaseInsightComponent<DocumentLatencyInsightModel> {
79
71
  static override readonly litTagName = LitHtml.literal`devtools-performance-document-latency`;
80
72
  override insightCategory: Category = Category.ALL;
81
73
  override internalName: string = 'document-latency';
82
- override userVisibleTitle: string = i18nString(UIStrings.title);
83
- override description: string = i18nString(UIStrings.description);
84
74
 
85
75
  #check(didPass: boolean, good: string, bad: string): LitHtml.TemplateResult {
86
76
  const icon = didPass ? 'check-circle' : 'clear';
@@ -98,17 +88,16 @@ export class DocumentLatency extends BaseInsight {
98
88
  }
99
89
 
100
90
  override createOverlays(): Overlays.Overlays.TimelineOverlay[] {
101
- const insight = Trace.Insights.Common.getInsight('DocumentLatency', this.data.insights, this.data.insightSetKey);
102
- if (!insight?.data?.documentRequest) {
91
+ if (!this.model?.data?.documentRequest) {
103
92
  return [];
104
93
  }
105
94
 
106
95
  const overlays: Overlays.Overlays.TimelineOverlay[] = [];
107
- const event = insight.data.documentRequest;
108
- const redirectDurationMicro = Trace.Helpers.Timing.millisecondsToMicroseconds(insight.data.redirectDuration);
96
+ const event = this.model.data.documentRequest;
97
+ const redirectDurationMicro = Trace.Helpers.Timing.millisecondsToMicroseconds(this.model.data.redirectDuration);
109
98
 
110
99
  const sections = [];
111
- if (insight.data.redirectDuration) {
100
+ if (this.model.data.redirectDuration) {
112
101
  const bounds = Trace.Helpers.Timing.traceWindowFromMicroSeconds(
113
102
  event.ts,
114
103
  (event.ts + redirectDurationMicro) as Trace.Types.Timing.MicroSeconds,
@@ -116,8 +105,9 @@ export class DocumentLatency extends BaseInsight {
116
105
  sections.push({bounds, label: i18nString(UIStrings.redirectsLabel), showDuration: true});
117
106
  overlays.push({type: 'CANDY_STRIPED_TIME_RANGE', bounds, entry: event});
118
107
  }
119
- if (insight.data.serverResponseTooSlow) {
120
- const serverResponseTimeMicro = Trace.Helpers.Timing.millisecondsToMicroseconds(insight.data.serverResponseTime);
108
+ if (this.model.data.serverResponseTooSlow) {
109
+ const serverResponseTimeMicro =
110
+ Trace.Helpers.Timing.millisecondsToMicroseconds(this.model.data.serverResponseTime);
121
111
  // NOTE: NetworkRequestHandlers never makes a synthetic network request event if `timing` is missing.
122
112
  const sendEnd = event.args.data.timing?.sendEnd ?? Trace.Types.Timing.MilliSeconds(0);
123
113
  const sendEndMicro = Trace.Helpers.Timing.millisecondsToMicroseconds(sendEnd);
@@ -127,7 +117,7 @@ export class DocumentLatency extends BaseInsight {
127
117
  );
128
118
  sections.push({bounds, label: i18nString(UIStrings.serverResponseTimeLabel), showDuration: true});
129
119
  }
130
- if (insight.data.uncompressedResponseBytes) {
120
+ if (this.model.data.uncompressedResponseBytes) {
131
121
  const bounds = Trace.Helpers.Timing.traceWindowFromMicroSeconds(
132
122
  event.args.data.syntheticData.downloadStart,
133
123
  (event.args.data.syntheticData.downloadStart + event.args.data.syntheticData.download) as
@@ -141,7 +131,7 @@ export class DocumentLatency extends BaseInsight {
141
131
  overlays.push({
142
132
  type: 'TIMESPAN_BREAKDOWN',
143
133
  sections,
144
- entry: insight.data.documentRequest,
134
+ entry: this.model.data.documentRequest,
145
135
  // Always render below because the document request is guaranteed to be
146
136
  // the first request in the network track.
147
137
  renderLocation: 'BELOW_EVENT',
@@ -149,14 +139,14 @@ export class DocumentLatency extends BaseInsight {
149
139
  }
150
140
  overlays.push({
151
141
  type: 'ENTRY_SELECTED',
152
- entry: insight.data.documentRequest,
142
+ entry: this.model.data.documentRequest,
153
143
  });
154
144
 
155
145
  return overlays;
156
146
  }
157
147
 
158
- #renderInsight(insight: Trace.Insights.Types.InsightResults['DocumentLatency']): LitHtml.LitTemplate {
159
- if (!insight.data) {
148
+ #renderInsight(): LitHtml.LitTemplate {
149
+ if (!this.model?.data) {
160
150
  return LitHtml.nothing;
161
151
  }
162
152
 
@@ -164,53 +154,52 @@ export class DocumentLatency extends BaseInsight {
164
154
  return html`
165
155
  <div class="insights">
166
156
  <devtools-performance-sidebar-insight .data=${{
167
- title: this.userVisibleTitle,
168
- description: this.description,
157
+ title: this.model.title,
158
+ description: this.model.description,
169
159
  expanded: this.isActive(),
170
160
  internalName: this.internalName,
171
- estimatedSavingsTime: insight.metricSavings?.FCP,
172
- estimatedSavingsBytes: insight.data.uncompressedResponseBytes,
161
+ estimatedSavingsTime: this.model.metricSavings?.FCP,
162
+ estimatedSavingsBytes: this.model.data.uncompressedResponseBytes,
173
163
  }}
174
164
  @insighttoggleclick=${this.onSidebarClick}
175
165
  >
176
166
  <div slot="insight-content" class="insight-section">
177
167
  <ul class="insight-results insight-icon-results">
178
168
  <li class="insight-entry">
179
- ${this.#check(insight.data.redirectDuration === 0,
169
+ ${this.#check(this.model.data.redirectDuration === 0,
180
170
  i18nString(UIStrings.passingRedirects), i18nString(UIStrings.failedRedirects))}
181
171
  </li>
182
172
  <li class="insight-entry">
183
- ${this.#check(!insight.data.serverResponseTooSlow,
173
+ ${this.#check(!this.model.data.serverResponseTooSlow,
184
174
  i18nString(UIStrings.passingServerResponseTime), i18nString(UIStrings.failedServerResponseTime))}
185
175
  </li>
186
176
  <li class="insight-entry">
187
- ${this.#check(insight.data.uncompressedResponseBytes === 0,
177
+ ${this.#check(this.model.data.uncompressedResponseBytes === 0,
188
178
  i18nString(UIStrings.passingTextCompression), i18nString(UIStrings.failedTextCompression))}
189
179
  </li>
190
180
  </ul>
191
181
  </div>
192
182
  </devtools-performance-sidebar-insight>
193
183
  </div>`;
194
- // clang-format on
184
+ // clang-format on
195
185
  }
196
186
 
197
187
  override getRelatedEvents(): Trace.Types.Events.Event[] {
198
- const insight = Trace.Insights.Common.getInsight('DocumentLatency', this.data.insights, this.data.insightSetKey);
199
- return insight?.relatedEvents ?? [];
188
+ return this.model?.relatedEvents ?? [];
200
189
  }
201
190
 
202
191
  override render(): void {
203
- const insight = Trace.Insights.Common.getInsight('DocumentLatency', this.data.insights, this.data.insightSetKey);
204
- if (insight?.data === undefined) {
192
+ if (this.model?.data === undefined) {
205
193
  return;
206
194
  }
195
+
207
196
  const matchesCategory = shouldRenderForCategory({
208
197
  activeCategory: this.data.activeCategory,
209
198
  insightCategory: this.insightCategory,
210
199
  });
211
- const hasFailure = insight?.data?.redirectDuration > 0 || insight?.data?.serverResponseTooSlow ||
212
- insight.data.uncompressedResponseBytes > 0;
213
- const output = (matchesCategory && hasFailure) ? this.#renderInsight(insight) : LitHtml.nothing;
200
+ const hasFailure = this.model?.data?.redirectDuration > 0 || this.model?.data?.serverResponseTooSlow ||
201
+ this.model.data.uncompressedResponseBytes > 0;
202
+ const output = (matchesCategory && hasFailure) ? this.#renderInsight() : LitHtml.nothing;
214
203
  LitHtml.render(output, this.shadow, {host: this});
215
204
  }
216
205
  }
@@ -5,12 +5,13 @@
5
5
  import './Table.js';
6
6
 
7
7
  import * as i18n from '../../../../core/i18n/i18n.js';
8
- import * as Trace from '../../../../models/trace/trace.js';
8
+ import type {FontDisplayInsightModel} from '../../../../models/trace/insights/FontDisplay.js';
9
+ import type * as Trace from '../../../../models/trace/trace.js';
9
10
  import * as LitHtml from '../../../../ui/lit-html/lit-html.js';
10
11
  import type * as Overlays from '../../overlays/overlays.js';
11
12
 
12
13
  import {eventRef} from './EventRef.js';
13
- import {BaseInsight, shouldRenderForCategory} from './Helpers.js';
14
+ import {BaseInsightComponent, shouldRenderForCategory} from './Helpers.js';
14
15
  import type * as SidebarInsight from './SidebarInsight.js';
15
16
  import type {TableData} from './Table.js';
16
17
  import {Category} from './types.js';
@@ -18,13 +19,6 @@ import {Category} from './types.js';
18
19
  const {html} = LitHtml;
19
20
 
20
21
  const UIStrings = {
21
- /** Title of an insight that provides details about the fonts used on the page, and the value of their `font-display` properties. */
22
- title: 'Font display',
23
- /**
24
- * @description Text to tell the user about the font-display CSS feature to help improve a the UX of a page.
25
- */
26
- description:
27
- 'Consider setting [`font-display`](https://developer.chrome.com/blog/font-display) to `swap` or `optional` to ensure text is consistently visible. `swap` can be further optimized to mitigate layout shifts with [font metric overrides](https://developer.chrome.com/blog/font-fallbacks).',
28
22
  /** Column for a font loaded by the page to render text. */
29
23
  fontColumn: 'Font',
30
24
  /** Column for the amount of time wasted. */
@@ -34,24 +28,21 @@ const UIStrings = {
34
28
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/insights/FontDisplay.ts', UIStrings);
35
29
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
36
30
 
37
- export class FontDisplay extends BaseInsight {
31
+ export class FontDisplay extends BaseInsightComponent<FontDisplayInsightModel> {
38
32
  static override readonly litTagName = LitHtml.literal`devtools-performance-font-display`;
39
33
  override insightCategory = Category.INP;
40
34
  override internalName: string = 'font-display';
41
- override userVisibleTitle: string = i18nString(UIStrings.title);
42
- override description: string = i18nString(UIStrings.description);
43
35
 
44
36
  #overlayForRequest = new Map<Trace.Types.Events.SyntheticNetworkRequest, Overlays.Overlays.TimelineOverlay>();
45
37
 
46
38
  override createOverlays(): Overlays.Overlays.TimelineOverlay[] {
47
39
  this.#overlayForRequest.clear();
48
40
 
49
- const insight = Trace.Insights.Common.getInsight('FontDisplay', this.data.insights, this.data.insightSetKey);
50
- if (!insight) {
41
+ if (!this.model) {
51
42
  return [];
52
43
  }
53
44
 
54
- for (const font of insight.fonts) {
45
+ for (const font of this.model.fonts) {
55
46
  this.#overlayForRequest.set(font.request, {
56
47
  type: 'ENTRY_OUTLINE',
57
48
  entry: font.request,
@@ -62,13 +53,17 @@ export class FontDisplay extends BaseInsight {
62
53
  return [...this.#overlayForRequest.values()];
63
54
  }
64
55
 
65
- #render(insight: Trace.Insights.Types.InsightResults['FontDisplay']): LitHtml.TemplateResult {
56
+ #render(insight: Trace.Insights.Types.InsightModels['FontDisplay']): LitHtml.LitTemplate {
57
+ if (!this.model) {
58
+ return LitHtml.nothing;
59
+ }
60
+
66
61
  // clang-format off
67
62
  return html`
68
63
  <div class="insights">
69
64
  <devtools-performance-sidebar-insight .data=${{
70
- title: this.userVisibleTitle,
71
- description: this.description,
65
+ title: this.model.title,
66
+ description: this.model.description,
72
67
  expanded: this.isActive(),
73
68
  internalName: this.internalName,
74
69
  estimatedSavingsTime: insight.metricSavings?.FCP,
@@ -97,19 +92,18 @@ export class FontDisplay extends BaseInsight {
97
92
  }
98
93
 
99
94
  override getRelatedEvents(): Trace.Types.Events.Event[] {
100
- const insight = Trace.Insights.Common.getInsight('FontDisplay', this.data.insights, this.data.insightSetKey);
101
- return insight?.relatedEvents ?? [];
95
+ return this.model?.relatedEvents ?? [];
102
96
  }
103
97
 
104
98
  override render(): void {
105
- const insight = Trace.Insights.Common.getInsight('FontDisplay', this.data.insights, this.data.insightSetKey);
106
- const shouldShow = insight && insight.fonts.find(font => font.wastedTime);
99
+ const model = this.model;
100
+ const shouldShow = model && model.fonts.find(font => font.wastedTime);
107
101
 
108
102
  const matchesCategory = shouldRenderForCategory({
109
103
  activeCategory: this.data.activeCategory,
110
104
  insightCategory: this.insightCategory,
111
105
  });
112
- const output = shouldShow && matchesCategory ? this.#render(insight) : LitHtml.nothing;
106
+ const output = shouldShow && matchesCategory ? this.#render(model) : LitHtml.nothing;
113
107
  LitHtml.render(output, this.shadow, {host: this});
114
108
  }
115
109
  }