chrome-devtools-frontend 1.0.1526630 → 1.0.1528866

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 (319) hide show
  1. package/docs/ui_engineering.md +159 -0
  2. package/eslint.config.mjs +6 -1
  3. package/front_end/core/i18n/i18nImpl.ts +6 -1
  4. package/front_end/core/protocol_client/protocol_client.ts +1 -1
  5. package/front_end/core/root/Runtime.ts +28 -4
  6. package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
  7. package/front_end/core/sdk/CSSRule.ts +35 -6
  8. package/front_end/core/sdk/Connections.ts +2 -1
  9. package/front_end/core/sdk/DOMModel.ts +4 -0
  10. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  11. package/front_end/core/sdk/NetworkManager.ts +214 -31
  12. package/front_end/core/sdk/PreloadingModel.ts +82 -17
  13. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
  14. package/front_end/core/sdk/RehydratingConnection.ts +29 -4
  15. package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
  16. package/front_end/core/sdk/SourceMap.ts +37 -11
  17. package/front_end/core/sdk/SourceMapManager.ts +13 -2
  18. package/front_end/core/sdk/SourceMapScopesInfo.ts +17 -0
  19. package/front_end/core/sdk/TargetManager.ts +0 -22
  20. package/front_end/core/sdk/TraceObject.ts +8 -7
  21. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
  22. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  23. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
  24. package/front_end/entrypoints/main/MainImpl.ts +20 -25
  25. package/front_end/generated/InspectorBackendCommands.js +3 -2
  26. package/front_end/generated/protocol.ts +17 -3
  27. package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
  28. package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
  29. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
  30. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
  31. package/front_end/models/extensions/ExtensionView.ts +3 -0
  32. package/front_end/models/javascript_metadata/NativeFunctions.js +23 -27
  33. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
  34. package/front_end/models/persistence/EditFileSystemView.ts +1 -0
  35. package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
  36. package/front_end/models/stack_trace/Trie.ts +9 -0
  37. package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
  38. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
  39. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
  40. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
  41. package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
  42. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
  43. package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
  44. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
  45. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  46. package/front_end/panels/application/CookieItemsView.ts +1 -0
  47. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  48. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
  49. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
  50. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
  51. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
  52. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
  53. package/front_end/panels/changes/CombinedDiffView.ts +1 -0
  54. package/front_end/panels/console/ConsoleInsightTeaser.ts +106 -0
  55. package/front_end/panels/console/ConsolePanel.ts +2 -0
  56. package/front_end/panels/console/ConsolePrompt.ts +12 -2
  57. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  58. package/front_end/panels/console/ConsoleView.ts +12 -0
  59. package/front_end/panels/console/ConsoleViewMessage.ts +27 -0
  60. package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
  61. package/front_end/panels/console/console.ts +6 -0
  62. package/front_end/panels/console/consoleInsightTeaser.css +55 -0
  63. package/front_end/panels/coverage/CoverageListView.ts +29 -11
  64. package/front_end/panels/coverage/CoverageView.ts +292 -284
  65. package/front_end/panels/coverage/coverageView.css +17 -0
  66. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
  67. package/front_end/panels/elements/LayoutPane.ts +1 -0
  68. package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
  69. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
  70. package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
  71. package/front_end/panels/emulation/DeviceModeView.ts +2 -0
  72. package/front_end/panels/explain/ActionDelegate.ts +1 -2
  73. package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
  74. package/front_end/panels/explain/explain.ts +0 -1
  75. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
  76. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
  77. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
  78. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
  79. package/front_end/panels/media/MainView.ts +1 -0
  80. package/front_end/panels/media/TickingFlameChart.ts +2 -0
  81. package/front_end/panels/network/BlockedURLsPane.ts +111 -85
  82. package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
  83. package/front_end/panels/network/NetworkItemView.ts +1 -0
  84. package/front_end/panels/network/NetworkLogView.ts +9 -7
  85. package/front_end/panels/network/NetworkOverview.ts +1 -0
  86. package/front_end/panels/network/RequestCookiesView.ts +1 -0
  87. package/front_end/panels/network/RequestHTMLView.ts +1 -0
  88. package/front_end/panels/network/RequestInitiatorView.ts +1 -0
  89. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  90. package/front_end/panels/network/RequestPreviewView.ts +1 -0
  91. package/front_end/panels/network/RequestResponseView.ts +1 -0
  92. package/front_end/panels/network/RequestTimingView.ts +2 -0
  93. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
  94. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  95. package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
  96. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
  97. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
  98. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
  99. package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
  100. package/front_end/panels/profiler/IsolateSelector.ts +1 -0
  101. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
  102. package/front_end/panels/profiler/ProfileView.ts +1 -0
  103. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
  104. package/front_end/panels/recorder/RecorderPanel.ts +2 -0
  105. package/front_end/panels/screencast/ScreencastView.ts +1 -0
  106. package/front_end/panels/search/SearchView.ts +1 -0
  107. package/front_end/panels/settings/AISettingsTab.ts +3 -3
  108. package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -0
  109. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  110. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
  111. package/front_end/panels/sources/BreakpointsView.ts +1 -0
  112. package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
  113. package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
  114. package/front_end/panels/timeline/README.md +2 -2
  115. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  116. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
  117. package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
  118. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
  119. package/front_end/panels/timeline/TimelinePanel.ts +43 -62
  120. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  121. package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
  122. package/front_end/panels/timeline/components/Sidebar.ts +2 -0
  123. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  124. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
  125. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
  126. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  127. package/front_end/panels/web_audio/WebAudioView.ts +1 -0
  128. package/front_end/third_party/chromium/README.chromium +1 -1
  129. package/front_end/third_party/lighthouse/README.chromium +2 -2
  130. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
  131. package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
  132. package/front_end/third_party/lighthouse/locales/ar.json +107 -455
  133. package/front_end/third_party/lighthouse/locales/bg.json +96 -444
  134. package/front_end/third_party/lighthouse/locales/ca.json +96 -444
  135. package/front_end/third_party/lighthouse/locales/cs.json +96 -444
  136. package/front_end/third_party/lighthouse/locales/da.json +96 -444
  137. package/front_end/third_party/lighthouse/locales/de.json +96 -444
  138. package/front_end/third_party/lighthouse/locales/el.json +96 -444
  139. package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
  140. package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
  141. package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
  142. package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
  143. package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
  144. package/front_end/third_party/lighthouse/locales/es.json +96 -444
  145. package/front_end/third_party/lighthouse/locales/fi.json +96 -444
  146. package/front_end/third_party/lighthouse/locales/fil.json +96 -444
  147. package/front_end/third_party/lighthouse/locales/fr.json +96 -444
  148. package/front_end/third_party/lighthouse/locales/he.json +118 -466
  149. package/front_end/third_party/lighthouse/locales/hi.json +96 -444
  150. package/front_end/third_party/lighthouse/locales/hr.json +100 -448
  151. package/front_end/third_party/lighthouse/locales/hu.json +96 -444
  152. package/front_end/third_party/lighthouse/locales/id.json +96 -444
  153. package/front_end/third_party/lighthouse/locales/it.json +96 -444
  154. package/front_end/third_party/lighthouse/locales/ja.json +96 -444
  155. package/front_end/third_party/lighthouse/locales/ko.json +97 -445
  156. package/front_end/third_party/lighthouse/locales/lt.json +96 -444
  157. package/front_end/third_party/lighthouse/locales/lv.json +97 -445
  158. package/front_end/third_party/lighthouse/locales/nl.json +96 -444
  159. package/front_end/third_party/lighthouse/locales/no.json +96 -444
  160. package/front_end/third_party/lighthouse/locales/pl.json +96 -444
  161. package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
  162. package/front_end/third_party/lighthouse/locales/pt.json +97 -445
  163. package/front_end/third_party/lighthouse/locales/ro.json +97 -445
  164. package/front_end/third_party/lighthouse/locales/ru.json +96 -444
  165. package/front_end/third_party/lighthouse/locales/sk.json +96 -444
  166. package/front_end/third_party/lighthouse/locales/sl.json +96 -444
  167. package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
  168. package/front_end/third_party/lighthouse/locales/sr.json +96 -444
  169. package/front_end/third_party/lighthouse/locales/sv.json +96 -444
  170. package/front_end/third_party/lighthouse/locales/ta.json +96 -444
  171. package/front_end/third_party/lighthouse/locales/te.json +97 -445
  172. package/front_end/third_party/lighthouse/locales/th.json +96 -444
  173. package/front_end/third_party/lighthouse/locales/tr.json +96 -444
  174. package/front_end/third_party/lighthouse/locales/uk.json +96 -444
  175. package/front_end/third_party/lighthouse/locales/vi.json +96 -444
  176. package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
  177. package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
  178. package/front_end/third_party/lighthouse/locales/zh.json +96 -444
  179. package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
  180. package/front_end/third_party/lighthouse/report/bundle.js +10 -49
  181. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  182. package/front_end/third_party/web-vitals/README.chromium +5 -8
  183. package/front_end/third_party/web-vitals/package/README.md +191 -152
  184. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
  185. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
  186. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
  187. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
  188. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
  189. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
  190. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
  191. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
  192. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
  193. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
  194. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
  195. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
  196. package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
  197. package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
  198. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
  199. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
  200. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
  201. package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
  202. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
  203. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
  204. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
  205. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  206. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
  207. package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
  208. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
  209. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
  210. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
  211. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
  212. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
  213. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
  214. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
  215. package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
  216. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
  217. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
  218. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
  219. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
  220. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
  221. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
  222. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
  223. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
  224. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
  225. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
  226. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
  227. package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
  228. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
  229. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
  230. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
  231. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  232. package/front_end/third_party/web-vitals/package/package.json +4 -10
  233. package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
  234. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
  235. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
  236. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
  237. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
  238. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
  239. package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
  240. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
  241. package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
  242. package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
  243. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  244. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  245. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
  246. package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
  247. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
  248. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
  249. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
  250. package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
  251. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
  252. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
  253. package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
  254. package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
  255. package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
  256. package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
  257. package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
  258. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
  259. package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
  260. package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
  261. package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
  262. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
  263. package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
  264. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
  265. package/front_end/third_party/web-vitals/rebuild.sh +32 -18
  266. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
  267. package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
  268. package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
  269. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
  270. package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
  271. package/front_end/ui/legacy/InspectorView.ts +2 -0
  272. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  273. package/front_end/ui/legacy/TabbedPane.ts +1 -0
  274. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
  275. package/front_end/ui/legacy/UIUtils.ts +8 -19
  276. package/front_end/ui/legacy/ViewManager.ts +1 -0
  277. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
  278. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
  279. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
  280. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
  281. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
  282. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
  283. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
  284. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
  285. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
  286. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  287. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
  288. package/front_end/ui/visual_logging/KnownContextValues.ts +17 -0
  289. package/mcp/README.md +7 -0
  290. package/mcp/mcp.ts +8 -0
  291. package/package.json +1 -1
  292. package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
  293. package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
  294. package/front_end/third_party/web-vitals/package/attribution.js +0 -18
  295. package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
  296. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
  297. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
  298. package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
  299. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
  300. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
  301. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
  302. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
  303. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
  304. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
  305. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
  306. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
  307. package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
  308. package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
  309. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
  310. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
  311. package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
  312. package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
  313. package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
  314. package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
  315. package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
  316. package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
  317. package/front_end/ui/components/text_editor/textEditor.css +0 -18
  318. package/front_end/ui/legacy/inlineButton.css +0 -22
  319. /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
@@ -4,15 +4,13 @@
4
4
 
5
5
  import * as Common from '../../../../core/common/common.js';
6
6
  import * as i18n from '../../../../core/i18n/i18n.js';
7
- import * as IconButton from '../../../components/icon_button/icon_button.js';
8
7
  import * as UI from '../../legacy.js';
9
8
 
10
9
  const UIStrings = {
11
10
  /**
12
- * @description Tooltip text describing that a color was clipped after conversion to match the target gamut
13
- * @example {rgb(255 255 255)} PH1
11
+ * @description Menu warning that some color will be clipped after conversion to match the target gamut
14
12
  */
15
- colorClippedTooltipText: 'This color was clipped to match the format\'s gamut. The actual result was {PH1}',
13
+ colorShiftWarning: '⚠️ Conversion to a narrow gamut will cause color shifts',
16
14
  } as const;
17
15
  const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/color_picker/FormatPickerContextMenu.ts', UIStrings);
18
16
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -56,10 +54,13 @@ export class FormatPickerContextMenu {
56
54
  Common.Color.Format.XYZ_D65,
57
55
  ];
58
56
  const menu = new UI.ContextMenu.ContextMenu(e, {onSoftMenuClosed: () => resolve()});
57
+ const disclamerSection = menu.section('disclaimer');
59
58
  const legacySection = menu.section('legacy');
60
59
  const wideSection = menu.section('wide');
61
60
  const colorFunctionSection = menu.section('color-function').appendSubMenuItem('color()', false, 'color').section();
62
61
 
62
+ disclamerSection.appendItem(i18nString(UIStrings.colorShiftWarning), () => {}, {disabled: true});
63
+
63
64
  if (!(this.#color instanceof Common.Color.Nickname)) {
64
65
  const nickname = this.#color.asLegacyColor().nickname();
65
66
  if (nickname) {
@@ -102,27 +103,13 @@ export class FormatPickerContextMenu {
102
103
  return;
103
104
  }
104
105
  }
105
- const label = newColor.asString();
106
+ const label = newColor.isGamutClipped() ? newColor.asString() + ' ⚠️' : newColor.asString();
106
107
  if (!label) {
107
108
  return;
108
109
  }
109
- let icon = undefined;
110
- if (newColor.isGamutClipped()) {
111
- icon = new IconButton.Icon.Icon();
112
- icon.name = 'warning';
113
- icon.classList.add('medium');
114
- icon.style.marginLeft = '1px';
115
- icon.style.marginTop = '-1px';
116
- icon.style.minWidth = '16px';
117
- icon.style.minHeight = '16px';
118
- }
119
- const tooltip =
120
- icon ? i18nString(UIStrings.colorClippedTooltipText, {PH1: newColor.getAsRawString() ?? 'none'}) : undefined;
121
110
 
122
111
  const handler = (): void => onSelect(newColor);
123
112
 
124
- section.appendItem(
125
- label, handler,
126
- {additionalElement: icon, tooltip, jslogContext: newColor.isGamutClipped() ? 'color' : 'clipped-color'});
113
+ section.appendItem(label, handler, {jslogContext: newColor.isGamutClipped() ? 'color' : 'clipped-color'});
127
114
  }
128
115
  }
@@ -1366,6 +1366,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
1366
1366
  }
1367
1367
 
1368
1368
  override wasShown(): void {
1369
+ super.wasShown();
1369
1370
  this.hueAlphaWidth = this.hueElement.offsetWidth;
1370
1371
  this.slideHelperWidth = this.hueSlider.offsetWidth / 2;
1371
1372
  this.dragWidth = this.colorElement.offsetWidth;
@@ -1388,6 +1389,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
1388
1389
  }
1389
1390
 
1390
1391
  override willHide(): void {
1392
+ super.willHide();
1391
1393
  void this.toggleColorPicker(false);
1392
1394
  if (this.contrastDetails && this.contrastDetailsBackgroundColorPickerToggledBound) {
1393
1395
  this.contrastDetails.removeEventListener(
@@ -325,6 +325,7 @@ export class CookiesTable extends UI.Widget.VBox {
325
325
  }
326
326
 
327
327
  override willHide(): void {
328
+ super.willHide();
328
329
  this.lastEditedColumnId = null;
329
330
  }
330
331
 
@@ -99,6 +99,7 @@ export class BezierEditor extends Common.ObjectWrapper.eventMixin<EventTypes, ty
99
99
  }
100
100
 
101
101
  override wasShown(): void {
102
+ super.wasShown();
102
103
  this.unselectPresets();
103
104
  // Check if bezier matches a preset
104
105
  for (const category of this.presetCategories) {
@@ -498,6 +498,7 @@ export class ChartViewport extends UI.Widget.VBox {
498
498
  }
499
499
 
500
500
  override willHide(): void {
501
+ super.willHide();
501
502
  // Stop animations when the view is hidden (or destroyed).
502
503
  // In this case, we also jump the time immediately to the target time, so
503
504
  // that if the view is restored, the time shown is correct.
@@ -229,6 +229,7 @@ export class FilteredListWidget extends Common.ObjectWrapper.eventMixin<EventTyp
229
229
  }
230
230
 
231
231
  override willHide(): void {
232
+ super.willHide();
232
233
  if (this.provider) {
233
234
  this.provider.detach();
234
235
  }
@@ -128,6 +128,7 @@ export class FontView extends UI.View.SimpleView {
128
128
  }
129
129
 
130
130
  override wasShown(): void {
131
+ super.wasShown();
131
132
  this.createContentIfNeeded();
132
133
 
133
134
  this.updateFontPreviewSize();
@@ -141,6 +141,7 @@ export class ImageView extends UI.View.SimpleView {
141
141
  }
142
142
 
143
143
  override wasShown(): void {
144
+ super.wasShown();
144
145
  void this.updateContentIfNeeded();
145
146
  }
146
147
 
@@ -134,6 +134,7 @@ export class JSONView extends UI.Widget.VBox implements UI.SearchableView.Search
134
134
  }
135
135
 
136
136
  override wasShown(): void {
137
+ super.wasShown();
137
138
  this.initialize();
138
139
  }
139
140
 
@@ -480,6 +480,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
480
480
  }
481
481
 
482
482
  override wasShown(): void {
483
+ super.wasShown();
483
484
  void this.ensureContentLoaded();
484
485
  this.wasShownOrLoaded();
485
486
  }
@@ -34,6 +34,7 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
34
34
  }
35
35
 
36
36
  override wasShown(): void {
37
+ super.wasShown();
37
38
  this.refreshData();
38
39
  }
39
40
 
@@ -99,6 +100,7 @@ export class StreamingContentHexView extends LinearMemoryInspectorView {
99
100
  }
100
101
 
101
102
  override wasShown(): void {
103
+ super.wasShown();
102
104
  this.#updateMemoryFromContentData();
103
105
  this.#streamingContentData.addEventListener(
104
106
  TextUtils.StreamingContentData.Events.CHUNK_ADDED, this.#updateMemoryFromContentData, this);
@@ -2181,9 +2181,11 @@ export const knownContextValues = new Set([
2181
2181
  'lighthouse.audit.bootup-time',
2182
2182
  'lighthouse.audit.button-name',
2183
2183
  'lighthouse.audit.bypass',
2184
+ 'lighthouse.audit.cache-insight',
2184
2185
  'lighthouse.audit.canonical',
2185
2186
  'lighthouse.audit.charset',
2186
2187
  'lighthouse.audit.clickjacking-mitigation',
2188
+ 'lighthouse.audit.cls-culprits-insight',
2187
2189
  'lighthouse.audit.color-contrast',
2188
2190
  'lighthouse.audit.crawlable-anchors',
2189
2191
  'lighthouse.audit.critical-request-chains',
@@ -2196,10 +2198,13 @@ export const knownContextValues = new Set([
2196
2198
  'lighthouse.audit.diagnostics',
2197
2199
  'lighthouse.audit.dlitem',
2198
2200
  'lighthouse.audit.doctype',
2201
+ 'lighthouse.audit.document-latency-insight',
2199
2202
  'lighthouse.audit.document-title',
2200
2203
  'lighthouse.audit.dom-size',
2204
+ 'lighthouse.audit.dom-size-insight',
2201
2205
  'lighthouse.audit.duplicate-id-aria',
2202
2206
  'lighthouse.audit.duplicated-javascript',
2207
+ 'lighthouse.audit.duplicated-javascript-insight',
2203
2208
  'lighthouse.audit.efficient-animated-content',
2204
2209
  'lighthouse.audit.empty-heading',
2205
2210
  'lighthouse.audit.errors-in-console',
@@ -2209,7 +2214,9 @@ export const knownContextValues = new Set([
2209
2214
  'lighthouse.audit.focus-traps',
2210
2215
  'lighthouse.audit.focusable-controls',
2211
2216
  'lighthouse.audit.font-display',
2217
+ 'lighthouse.audit.font-display-insight',
2212
2218
  'lighthouse.audit.font-size',
2219
+ 'lighthouse.audit.forced-reflow-insight',
2213
2220
  'lighthouse.audit.form-field-multiple-labels',
2214
2221
  'lighthouse.audit.frame-title',
2215
2222
  'lighthouse.audit.geolocation-on-start',
@@ -2223,8 +2230,10 @@ export const knownContextValues = new Set([
2223
2230
  'lighthouse.audit.identical-links-same-purpose',
2224
2231
  'lighthouse.audit.image-alt',
2225
2232
  'lighthouse.audit.image-aspect-ratio',
2233
+ 'lighthouse.audit.image-delivery-insight',
2226
2234
  'lighthouse.audit.image-redundant-alt',
2227
2235
  'lighthouse.audit.image-size-responsive',
2236
+ 'lighthouse.audit.inp-breakdown-insight',
2228
2237
  'lighthouse.audit.input-button-name',
2229
2238
  'lighthouse.audit.input-image-alt',
2230
2239
  'lighthouse.audit.inspector-issues',
@@ -2240,8 +2249,11 @@ export const knownContextValues = new Set([
2240
2249
  'lighthouse.audit.largest-contentful-paint',
2241
2250
  'lighthouse.audit.largest-contentful-paint-element',
2242
2251
  'lighthouse.audit.layout-shifts',
2252
+ 'lighthouse.audit.lcp-breakdown-insight',
2253
+ 'lighthouse.audit.lcp-discovery-insight',
2243
2254
  'lighthouse.audit.lcp-lazy-loaded',
2244
2255
  'lighthouse.audit.legacy-javascript',
2256
+ 'lighthouse.audit.legacy-javascript-insight',
2245
2257
  'lighthouse.audit.link-in-text-block',
2246
2258
  'lighthouse.audit.link-name',
2247
2259
  'lighthouse.audit.link-text',
@@ -2257,7 +2269,9 @@ export const knownContextValues = new Set([
2257
2269
  'lighthouse.audit.meta-refresh',
2258
2270
  'lighthouse.audit.meta-viewport',
2259
2271
  'lighthouse.audit.metrics',
2272
+ 'lighthouse.audit.modern-http-insight',
2260
2273
  'lighthouse.audit.modern-image-formats',
2274
+ 'lighthouse.audit.network-dependency-tree-insight',
2261
2275
  'lighthouse.audit.network-requests',
2262
2276
  'lighthouse.audit.network-rtt',
2263
2277
  'lighthouse.audit.network-server-latency',
@@ -2272,6 +2286,7 @@ export const knownContextValues = new Set([
2272
2286
  'lighthouse.audit.prioritize-lcp-image',
2273
2287
  'lighthouse.audit.redirects',
2274
2288
  'lighthouse.audit.redirects-http',
2289
+ 'lighthouse.audit.render-blocking-insight',
2275
2290
  'lighthouse.audit.render-blocking-resources',
2276
2291
  'lighthouse.audit.resource-summary',
2277
2292
  'lighthouse.audit.robots-txt',
@@ -2289,6 +2304,7 @@ export const knownContextValues = new Set([
2289
2304
  'lighthouse.audit.td-has-header',
2290
2305
  'lighthouse.audit.td-headers-attr',
2291
2306
  'lighthouse.audit.th-has-data-cells',
2307
+ 'lighthouse.audit.third-parties-insight',
2292
2308
  'lighthouse.audit.third-party-cookies',
2293
2309
  'lighthouse.audit.third-party-facades',
2294
2310
  'lighthouse.audit.third-party-summary',
@@ -2314,6 +2330,7 @@ export const knownContextValues = new Set([
2314
2330
  'lighthouse.audit.valid-source-maps',
2315
2331
  'lighthouse.audit.video-caption',
2316
2332
  'lighthouse.audit.viewport',
2333
+ 'lighthouse.audit.viewport-insight',
2317
2334
  'lighthouse.audit.visual-order-follows-dom',
2318
2335
  'lighthouse.audit.work-during-interaction',
2319
2336
  'lighthouse.cancel',
package/mcp/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # MCP
2
+
3
+ This is the entrypoint for
4
+ [chrome-devtools-mcp](https://github.com/ChromeDevTools/chrome-devtools-mcp).
5
+ Unlike other entrypoints in front_end, the build output of this one is not
6
+ consumed (yet). Instead, `chrome-devtools-mcp` integrates files exported here
7
+ and their transitive dependencies into its own build.
package/mcp/mcp.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Copyright 2025 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ export {PerformanceInsightFormatter} from '../front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js';
6
+ export {PerformanceTraceFormatter} from '../front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js';
7
+ export {AgentFocus} from '../front_end/models/ai_assistance/performance/AIContext.js';
8
+ export * as TraceEngine from '../front_end/models/trace/trace.js';
package/package.json CHANGED
@@ -102,5 +102,5 @@
102
102
  "flat-cache": "6.1.12"
103
103
  }
104
104
  },
105
- "version": "1.0.1526630"
105
+ "version": "1.0.1528866"
106
106
  }
@@ -1,34 +0,0 @@
1
- // Copyright 2024 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- /**
6
- * @file web-vitals.js doesn't provide a log of all interactions.
7
- * This solution is hacky but it was recommended by web-vitals devs:
8
- * b/371052022
9
- */
10
-
11
- import * as WebVitals from '../../../third_party/web-vitals/web-vitals.js';
12
-
13
- export function onEachInteraction(onReport: (metric: WebVitals.INPMetricWithAttribution) => void): void {
14
- WebVitals.entryPreProcessingCallbacks.push((entry: PerformanceEventTiming) => {
15
- // Wait a microtask so this "pre" processing callback actually
16
- // becomes a "post" processing callback.
17
- void Promise.resolve().then(() => {
18
- if (entry.interactionId) {
19
- const interaction = WebVitals.attributeINP({
20
- entries: [entry],
21
- // The only value we really need for `attributeINP` is `entries`
22
- // Everything else is included to fill out the type.
23
- name: 'INP',
24
- rating: 'good',
25
- value: entry.duration,
26
- delta: entry.duration,
27
- navigationType: 'navigate',
28
- id: 'N/A',
29
- });
30
- onReport(interaction);
31
- }
32
- });
33
- });
34
- }
@@ -1,16 +0,0 @@
1
- /*
2
- Copyright 2022 Google LLC
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- https://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
- */
15
-
16
- export * from './dist/modules/attribution/index.js';
@@ -1,18 +0,0 @@
1
- /*
2
- Copyright 2022 Google LLC
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- https://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
14
- */
15
-
16
- // Creates the `web-vitals/attribution` import in node-based bundlers.
17
- // This will not be needed when export maps are widely supported.
18
- export * from './dist/web-vitals.attribution.js';
@@ -1,7 +0,0 @@
1
- export {
2
- /**
3
- * @deprecated Use `onINP()` instead.
4
- */
5
- onFID, } from './onFID.js';
6
- export { FIDThresholds } from '../onFID.js';
7
- export * from '../types.js';
@@ -1,11 +0,0 @@
1
- import { FIDMetricWithAttribution, ReportOpts } from '../types.js';
2
- /**
3
- * Calculates the [FID](https://web.dev/articles/fid) value for the current page and
4
- * calls the `callback` function once the value is ready, along with the
5
- * relevant `first-input` performance entry used to determine the value. The
6
- * reported value is a `DOMHighResTimeStamp`.
7
- *
8
- * _**Important:** since FID is only reported after the user interacts with the
9
- * page, it's possible that it will not be reported for some page loads._
10
- */
11
- export declare const onFID: (onReport: (metric: FIDMetricWithAttribution) => void, opts?: ReportOpts) => void;
@@ -1,46 +0,0 @@
1
- /*
2
- * Copyright 2022 Google LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * https://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { getLoadState } from '../lib/getLoadState.js';
17
- import { getSelector } from '../lib/getSelector.js';
18
- import { onFID as unattributedOnFID } from '../onFID.js';
19
- const attributeFID = (metric) => {
20
- const fidEntry = metric.entries[0];
21
- const attribution = {
22
- eventTarget: getSelector(fidEntry.target),
23
- eventType: fidEntry.name,
24
- eventTime: fidEntry.startTime,
25
- eventEntry: fidEntry,
26
- loadState: getLoadState(fidEntry.startTime),
27
- };
28
- // Use Object.assign to set property to keep tsc happy.
29
- const metricWithAttribution = Object.assign(metric, { attribution });
30
- return metricWithAttribution;
31
- };
32
- /**
33
- * Calculates the [FID](https://web.dev/articles/fid) value for the current page and
34
- * calls the `callback` function once the value is ready, along with the
35
- * relevant `first-input` performance entry used to determine the value. The
36
- * reported value is a `DOMHighResTimeStamp`.
37
- *
38
- * _**Important:** since FID is only reported after the user interacts with the
39
- * page, it's possible that it will not be reported for some page loads._
40
- */
41
- export const onFID = (onReport, opts) => {
42
- unattributedOnFID((metric) => {
43
- const metricWithAttribution = attributeFID(metric);
44
- onReport(metricWithAttribution);
45
- }, opts);
46
- };
@@ -1,5 +0,0 @@
1
- export {
2
- /**
3
- * @deprecated Use `onINP()` instead.
4
- */
5
- onFID, FIDThresholds, } from './onFID.js';
@@ -1,31 +0,0 @@
1
- interface Interaction {
2
- id: number;
3
- latency: number;
4
- entries: PerformanceEventTiming[];
5
- }
6
- interface EntryPreProcessingHook {
7
- (entry: PerformanceEventTiming): void;
8
- }
9
- export declare const longestInteractionList: Interaction[];
10
- export declare const longestInteractionMap: Map<number, Interaction>;
11
- export declare const DEFAULT_DURATION_THRESHOLD = 40;
12
- export declare const resetInteractions: () => void;
13
- /**
14
- * Returns the estimated p98 longest interaction based on the stored
15
- * interaction candidates and the interaction count for the current page.
16
- */
17
- export declare const estimateP98LongestInteraction: () => Interaction;
18
- /**
19
- * A list of callback functions to run before each entry is processed.
20
- * Exposing this list allows the attribution build to hook into the
21
- * entry processing pipeline.
22
- */
23
- export declare const entryPreProcessingCallbacks: EntryPreProcessingHook[];
24
- /**
25
- * Takes a performance entry and adds it to the list of worst interactions
26
- * if its duration is long enough to make it among the worst. If the
27
- * entry is part of an existing interaction, it is merged and the latency
28
- * and entries list is updated as needed.
29
- */
30
- export declare const processInteractionEntry: (entry: PerformanceEventTiming) => void;
31
- export {};
@@ -1,107 +0,0 @@
1
- /*
2
- * Copyright 2024 Google LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * https://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { getInteractionCount } from './polyfills/interactionCountPolyfill.js';
17
- // A list of longest interactions on the page (by latency) sorted so the
18
- // longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER long.
19
- export const longestInteractionList = [];
20
- // A mapping of longest interactions by their interaction ID.
21
- // This is used for faster lookup.
22
- export const longestInteractionMap = new Map();
23
- // The default `durationThreshold` used across this library for observing
24
- // `event` entries via PerformanceObserver.
25
- export const DEFAULT_DURATION_THRESHOLD = 40;
26
- // Used to store the interaction count after a bfcache restore, since p98
27
- // interaction latencies should only consider the current navigation.
28
- let prevInteractionCount = 0;
29
- /**
30
- * Returns the interaction count since the last bfcache restore (or for the
31
- * full page lifecycle if there were no bfcache restores).
32
- */
33
- const getInteractionCountForNavigation = () => {
34
- return getInteractionCount() - prevInteractionCount;
35
- };
36
- export const resetInteractions = () => {
37
- prevInteractionCount = getInteractionCount();
38
- longestInteractionList.length = 0;
39
- longestInteractionMap.clear();
40
- };
41
- /**
42
- * Returns the estimated p98 longest interaction based on the stored
43
- * interaction candidates and the interaction count for the current page.
44
- */
45
- export const estimateP98LongestInteraction = () => {
46
- const candidateInteractionIndex = Math.min(longestInteractionList.length - 1, Math.floor(getInteractionCountForNavigation() / 50));
47
- return longestInteractionList[candidateInteractionIndex];
48
- };
49
- // To prevent unnecessary memory usage on pages with lots of interactions,
50
- // store at most 10 of the longest interactions to consider as INP candidates.
51
- const MAX_INTERACTIONS_TO_CONSIDER = 10;
52
- /**
53
- * A list of callback functions to run before each entry is processed.
54
- * Exposing this list allows the attribution build to hook into the
55
- * entry processing pipeline.
56
- */
57
- export const entryPreProcessingCallbacks = [];
58
- /**
59
- * Takes a performance entry and adds it to the list of worst interactions
60
- * if its duration is long enough to make it among the worst. If the
61
- * entry is part of an existing interaction, it is merged and the latency
62
- * and entries list is updated as needed.
63
- */
64
- export const processInteractionEntry = (entry) => {
65
- entryPreProcessingCallbacks.forEach((cb) => cb(entry));
66
- // Skip further processing for entries that cannot be INP candidates.
67
- if (!(entry.interactionId || entry.entryType === 'first-input'))
68
- return;
69
- // The least-long of the 10 longest interactions.
70
- const minLongestInteraction = longestInteractionList[longestInteractionList.length - 1];
71
- const existingInteraction = longestInteractionMap.get(entry.interactionId);
72
- // Only process the entry if it's possibly one of the ten longest,
73
- // or if it's part of an existing interaction.
74
- if (existingInteraction ||
75
- longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER ||
76
- entry.duration > minLongestInteraction.latency) {
77
- // If the interaction already exists, update it. Otherwise create one.
78
- if (existingInteraction) {
79
- // If the new entry has a longer duration, replace the old entries,
80
- // otherwise add to the array.
81
- if (entry.duration > existingInteraction.latency) {
82
- existingInteraction.entries = [entry];
83
- existingInteraction.latency = entry.duration;
84
- }
85
- else if (entry.duration === existingInteraction.latency &&
86
- entry.startTime === existingInteraction.entries[0].startTime) {
87
- existingInteraction.entries.push(entry);
88
- }
89
- }
90
- else {
91
- const interaction = {
92
- id: entry.interactionId,
93
- latency: entry.duration,
94
- entries: [entry],
95
- };
96
- longestInteractionMap.set(interaction.id, interaction);
97
- longestInteractionList.push(interaction);
98
- }
99
- // Sort the entries by latency (descending) and keep only the top ten.
100
- longestInteractionList.sort((a, b) => b.latency - a.latency);
101
- if (longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) {
102
- longestInteractionList
103
- .splice(MAX_INTERACTIONS_TO_CONSIDER)
104
- .forEach((i) => longestInteractionMap.delete(i.id));
105
- }
106
- }
107
- };
@@ -1 +0,0 @@
1
- export declare const onHidden: (cb: () => void) => void;
@@ -1,22 +0,0 @@
1
- /*
2
- * Copyright 2020 Google LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * https://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export const onHidden = (cb) => {
17
- document.addEventListener('visibilitychange', () => {
18
- if (document.visibilityState === 'hidden') {
19
- cb();
20
- }
21
- });
22
- };
@@ -1,7 +0,0 @@
1
- import { FirstInputPolyfillCallback } from '../../types.js';
2
- /**
3
- * Accepts a callback to be invoked once the first input delay and event
4
- * are known.
5
- */
6
- export declare const firstInputPolyfill: (onFirstInput: FirstInputPolyfillCallback) => void;
7
- export declare const resetFirstInputPolyfill: () => void;