chrome-devtools-frontend 1.0.1526630 → 1.0.1529186

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 (339) hide show
  1. package/docs/ui_engineering.md +159 -0
  2. package/eslint.config.mjs +6 -1
  3. package/front_end/core/host/UserMetrics.ts +2 -1
  4. package/front_end/core/i18n/i18nImpl.ts +6 -1
  5. package/front_end/core/protocol_client/protocol_client.ts +1 -1
  6. package/front_end/core/root/Runtime.ts +38 -4
  7. package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
  8. package/front_end/core/sdk/CSSRule.ts +35 -6
  9. package/front_end/core/sdk/Connections.ts +2 -1
  10. package/front_end/core/sdk/DOMModel.ts +4 -0
  11. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  12. package/front_end/core/sdk/NetworkManager.ts +267 -34
  13. package/front_end/core/sdk/PreloadingModel.ts +82 -17
  14. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
  15. package/front_end/core/sdk/RehydratingConnection.ts +29 -4
  16. package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
  17. package/front_end/core/sdk/SourceMap.ts +41 -11
  18. package/front_end/core/sdk/SourceMapManager.ts +13 -2
  19. package/front_end/core/sdk/SourceMapScopesInfo.ts +49 -2
  20. package/front_end/core/sdk/TargetManager.ts +0 -22
  21. package/front_end/core/sdk/TraceObject.ts +8 -7
  22. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
  23. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  24. package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
  25. package/front_end/entrypoints/main/MainImpl.ts +42 -28
  26. package/front_end/generated/InspectorBackendCommands.js +3 -2
  27. package/front_end/generated/SupportedCSSProperties.js +2 -0
  28. package/front_end/generated/protocol.ts +17 -3
  29. package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
  30. package/front_end/models/ai_assistance/ConversationHandler.ts +15 -14
  31. package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
  32. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
  33. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
  34. package/front_end/models/extensions/ExtensionView.ts +3 -0
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +31 -27
  36. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
  37. package/front_end/models/persistence/NetworkPersistenceManager.ts +3 -5
  38. package/front_end/models/persistence/PersistenceImpl.ts +0 -5
  39. package/front_end/models/persistence/persistence-meta.ts +0 -31
  40. package/front_end/models/persistence/persistence.ts +0 -6
  41. package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
  42. package/front_end/models/stack_trace/Trie.ts +9 -0
  43. package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
  44. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
  45. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
  46. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
  47. package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
  48. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
  49. package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
  50. package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
  51. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  52. package/front_end/panels/application/CookieItemsView.ts +1 -0
  53. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  54. package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
  55. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
  56. package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
  57. package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
  58. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
  59. package/front_end/panels/changes/CombinedDiffView.ts +1 -0
  60. package/front_end/{models/persistence → panels/common}/PersistenceUtils.ts +15 -17
  61. package/front_end/panels/common/common.ts +1 -0
  62. package/front_end/panels/console/ConsoleInsightTeaser.ts +369 -0
  63. package/front_end/panels/console/ConsolePanel.ts +2 -0
  64. package/front_end/panels/console/ConsolePrompt.ts +12 -2
  65. package/front_end/panels/console/ConsoleSidebar.ts +1 -1
  66. package/front_end/panels/console/ConsoleView.ts +12 -0
  67. package/front_end/panels/console/ConsoleViewMessage.ts +44 -0
  68. package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
  69. package/front_end/panels/console/console-meta.ts +14 -0
  70. package/front_end/panels/console/console.ts +6 -0
  71. package/front_end/panels/console/consoleInsightTeaser.css +83 -0
  72. package/front_end/panels/coverage/CoverageListView.ts +29 -11
  73. package/front_end/panels/coverage/CoverageView.ts +292 -284
  74. package/front_end/panels/coverage/coverageView.css +17 -0
  75. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
  76. package/front_end/panels/elements/LayoutPane.ts +1 -0
  77. package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
  78. package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
  79. package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
  80. package/front_end/panels/emulation/DeviceModeView.ts +2 -0
  81. package/front_end/panels/explain/ActionDelegate.ts +4 -2
  82. package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
  83. package/front_end/panels/explain/explain-meta.ts +7 -0
  84. package/front_end/panels/explain/explain.ts +0 -1
  85. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
  86. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
  87. package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
  88. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
  89. package/front_end/panels/media/MainView.ts +1 -0
  90. package/front_end/panels/media/TickingFlameChart.ts +2 -0
  91. package/front_end/panels/network/BlockedURLsPane.ts +237 -108
  92. package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
  93. package/front_end/panels/network/NetworkItemView.ts +1 -0
  94. package/front_end/panels/network/NetworkLogView.ts +9 -7
  95. package/front_end/panels/network/NetworkOverview.ts +1 -0
  96. package/front_end/panels/network/RequestCookiesView.ts +1 -0
  97. package/front_end/panels/network/RequestHTMLView.ts +1 -0
  98. package/front_end/panels/network/RequestInitiatorView.ts +1 -0
  99. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  100. package/front_end/panels/network/RequestPreviewView.ts +1 -0
  101. package/front_end/panels/network/RequestResponseView.ts +1 -0
  102. package/front_end/panels/network/RequestTimingView.ts +2 -0
  103. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
  104. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
  105. package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
  106. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
  107. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
  108. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
  109. package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
  110. package/front_end/panels/profiler/IsolateSelector.ts +1 -0
  111. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
  112. package/front_end/panels/profiler/ProfileView.ts +1 -0
  113. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
  114. package/front_end/panels/recorder/RecorderPanel.ts +2 -0
  115. package/front_end/panels/screencast/ScreencastView.ts +1 -0
  116. package/front_end/panels/search/SearchView.ts +1 -0
  117. package/front_end/panels/settings/AISettingsTab.ts +3 -3
  118. package/front_end/{models/persistence → panels/settings}/EditFileSystemView.ts +3 -6
  119. package/front_end/panels/settings/WorkspaceSettingsTab.ts +4 -1
  120. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
  121. package/front_end/panels/settings/settings.ts +2 -0
  122. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
  123. package/front_end/panels/sources/BreakpointsView.ts +1 -0
  124. package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
  125. package/front_end/{models/persistence → panels/sources}/PersistenceActions.ts +8 -12
  126. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -1
  127. package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
  128. package/front_end/panels/sources/sources-meta.ts +15 -0
  129. package/front_end/panels/sources/sources.ts +2 -0
  130. package/front_end/panels/timeline/README.md +2 -2
  131. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  132. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
  133. package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
  134. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
  135. package/front_end/panels/timeline/TimelinePanel.ts +43 -62
  136. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  137. package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
  138. package/front_end/panels/timeline/components/Sidebar.ts +2 -0
  139. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  140. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
  141. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
  142. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  143. package/front_end/panels/utils/utils.ts +2 -1
  144. package/front_end/panels/web_audio/WebAudioView.ts +1 -0
  145. package/front_end/third_party/chromium/README.chromium +1 -1
  146. package/front_end/third_party/diff/diff_match_patch.js +1 -1
  147. package/front_end/third_party/lighthouse/README.chromium +2 -2
  148. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
  149. package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
  150. package/front_end/third_party/lighthouse/locales/ar.json +107 -455
  151. package/front_end/third_party/lighthouse/locales/bg.json +96 -444
  152. package/front_end/third_party/lighthouse/locales/ca.json +96 -444
  153. package/front_end/third_party/lighthouse/locales/cs.json +96 -444
  154. package/front_end/third_party/lighthouse/locales/da.json +96 -444
  155. package/front_end/third_party/lighthouse/locales/de.json +96 -444
  156. package/front_end/third_party/lighthouse/locales/el.json +96 -444
  157. package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
  158. package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
  159. package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
  160. package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
  161. package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
  162. package/front_end/third_party/lighthouse/locales/es.json +96 -444
  163. package/front_end/third_party/lighthouse/locales/fi.json +96 -444
  164. package/front_end/third_party/lighthouse/locales/fil.json +96 -444
  165. package/front_end/third_party/lighthouse/locales/fr.json +96 -444
  166. package/front_end/third_party/lighthouse/locales/he.json +118 -466
  167. package/front_end/third_party/lighthouse/locales/hi.json +96 -444
  168. package/front_end/third_party/lighthouse/locales/hr.json +100 -448
  169. package/front_end/third_party/lighthouse/locales/hu.json +96 -444
  170. package/front_end/third_party/lighthouse/locales/id.json +96 -444
  171. package/front_end/third_party/lighthouse/locales/it.json +96 -444
  172. package/front_end/third_party/lighthouse/locales/ja.json +96 -444
  173. package/front_end/third_party/lighthouse/locales/ko.json +97 -445
  174. package/front_end/third_party/lighthouse/locales/lt.json +96 -444
  175. package/front_end/third_party/lighthouse/locales/lv.json +97 -445
  176. package/front_end/third_party/lighthouse/locales/nl.json +96 -444
  177. package/front_end/third_party/lighthouse/locales/no.json +96 -444
  178. package/front_end/third_party/lighthouse/locales/pl.json +96 -444
  179. package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
  180. package/front_end/third_party/lighthouse/locales/pt.json +97 -445
  181. package/front_end/third_party/lighthouse/locales/ro.json +97 -445
  182. package/front_end/third_party/lighthouse/locales/ru.json +96 -444
  183. package/front_end/third_party/lighthouse/locales/sk.json +96 -444
  184. package/front_end/third_party/lighthouse/locales/sl.json +96 -444
  185. package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
  186. package/front_end/third_party/lighthouse/locales/sr.json +96 -444
  187. package/front_end/third_party/lighthouse/locales/sv.json +96 -444
  188. package/front_end/third_party/lighthouse/locales/ta.json +96 -444
  189. package/front_end/third_party/lighthouse/locales/te.json +97 -445
  190. package/front_end/third_party/lighthouse/locales/th.json +96 -444
  191. package/front_end/third_party/lighthouse/locales/tr.json +96 -444
  192. package/front_end/third_party/lighthouse/locales/uk.json +96 -444
  193. package/front_end/third_party/lighthouse/locales/vi.json +96 -444
  194. package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
  195. package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
  196. package/front_end/third_party/lighthouse/locales/zh.json +96 -444
  197. package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
  198. package/front_end/third_party/lighthouse/report/bundle.js +10 -49
  199. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  200. package/front_end/third_party/web-vitals/README.chromium +5 -8
  201. package/front_end/third_party/web-vitals/package/README.md +191 -152
  202. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
  203. package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
  204. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
  205. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
  206. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
  207. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
  208. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
  209. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
  210. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
  211. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
  212. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
  213. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
  214. package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
  215. package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
  216. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
  217. package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
  218. package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
  219. package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
  220. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
  221. package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
  222. package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
  223. package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
  224. package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
  225. package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
  226. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
  227. package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
  228. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
  229. package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
  230. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
  231. package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
  232. package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
  233. package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
  234. package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
  235. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
  236. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
  237. package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
  238. package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
  239. package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
  240. package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
  241. package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
  242. package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
  243. package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
  244. package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
  245. package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
  246. package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
  247. package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
  248. package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
  249. package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
  250. package/front_end/third_party/web-vitals/package/package.json +4 -10
  251. package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
  252. package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
  253. package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
  254. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
  255. package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
  256. package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
  257. package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
  258. package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
  259. package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
  260. package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
  261. package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
  262. package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
  263. package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
  264. package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
  265. package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
  266. package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
  267. package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
  268. package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
  269. package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
  270. package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
  271. package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
  272. package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
  273. package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
  274. package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
  275. package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
  276. package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
  277. package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
  278. package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
  279. package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
  280. package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
  281. package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
  282. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
  283. package/front_end/third_party/web-vitals/rebuild.sh +32 -18
  284. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
  285. package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
  286. package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
  287. package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
  288. package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
  289. package/front_end/ui/legacy/InspectorView.ts +2 -0
  290. package/front_end/ui/legacy/ListWidget.ts +2 -2
  291. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  292. package/front_end/ui/legacy/TabbedPane.ts +1 -0
  293. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
  294. package/front_end/ui/legacy/UIUtils.ts +8 -19
  295. package/front_end/ui/legacy/ViewManager.ts +1 -0
  296. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
  297. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
  298. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
  299. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
  300. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
  301. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
  302. package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
  303. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
  304. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
  305. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  306. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
  307. package/front_end/ui/visual_logging/KnownContextValues.ts +25 -0
  308. package/mcp/README.md +7 -0
  309. package/mcp/mcp.ts +8 -0
  310. package/package.json +1 -1
  311. package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
  312. package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
  313. package/front_end/third_party/web-vitals/package/attribution.js +0 -18
  314. package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
  315. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
  316. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
  317. package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
  318. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
  319. package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
  320. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
  321. package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
  322. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
  323. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
  324. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
  325. package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
  326. package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
  327. package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
  328. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
  329. package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
  330. package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
  331. package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
  332. package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
  333. package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
  334. package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
  335. package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
  336. package/front_end/ui/components/text_editor/textEditor.css +0 -18
  337. package/front_end/ui/legacy/inlineButton.css +0 -22
  338. /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
  339. /package/front_end/{models/persistence → panels/settings}/editFileSystemView.css +0 -0
@@ -1,10 +1,10 @@
1
1
  Name: Web Vitals
2
2
  Short Name: Web Vitals
3
3
  URL: https://github.com/GoogleChrome/web-vitals
4
- Version: 4.2.4
4
+ Version: 5.1.0
5
5
  License: Apache-2.0
6
6
  License File: package/LICENSE
7
- Revision: 3d2b3dc8576cc003618952fa39902fab764a53e2
7
+ Revision: 1b872cf5f2159e8ace0e98d55d8eb54fb09adfbe
8
8
  Update Mechanism: Manual
9
9
  Security Critical: no
10
10
  Shipped: yes
@@ -14,15 +14,12 @@ Essential metrics for a healthy site.
14
14
 
15
15
  ## Bumping.
16
16
 
17
+ First, go update rebuild.sh to specify the version you want. Then run the rebuild script:
18
+
17
19
  ```bash
18
20
  ./front_end/third_party/web-vitals/rebuild.sh
19
-
20
- # Also, consider commenting out roll script to just recompile without a bump, however this will reset some edits 2,3 listed below.
21
21
  ```
22
22
 
23
23
  ## DevTools edits to web-vitals
24
24
 
25
- 1. There's a sed edit in the rebuild.sh to expose `attributeINP`. That'll continue in v5 but be harder to do.
26
- 2. Some lines are manually commented out in `attribution/onINP.js`'s `saveInteractionTarget`. b/376777343 Unknown if needed in v5.
27
- 3. Some lines are added in `onHidden.js` to resolve a memory leak. Not needed in v5. b/425309898#comment4
28
- 4. (Not part of package, but..) There's a hack to clear `interactionTargetElement` in our own web-vitals-injected that won't be necessary in v5.
25
+ Local patches are kept in the "patches" folder. See the note in rebuild.sh for how to change these patches.
@@ -42,17 +42,13 @@ The library supports all of the [Core Web Vitals](https://web.dev/articles/vital
42
42
 
43
43
  - [First Contentful Paint (FCP)](https://web.dev/articles/fcp)
44
44
  - [Time to First Byte (TTFB)](https://web.dev/articles/ttfb)
45
- - [First Input Delay (FID)](https://web.dev/articles/fid)
46
45
 
47
- > [!CAUTION]
48
- > FID is deprecated and will be removed in the next major release.
49
-
50
- <a name="installation"><a>
51
- <a name="load-the-library"><a>
46
+ <a name="installation"></a>
47
+ <a name="load-the-library"></a>
52
48
 
53
49
  ## Install and load the library
54
50
 
55
- <a name="import-web-vitals-from-npm"><a>
51
+ <a name="import-web-vitals-from-npm"></a>
56
52
 
57
53
  The `web-vitals` library uses the `buffered` flag for [PerformanceObserver](https://developer.mozilla.org/docs/Web/API/PerformanceObserver/observe), allowing it to access performance entries that occurred before the library was loaded.
58
54
 
@@ -79,16 +75,9 @@ To load the "standard" build, import modules from the `web-vitals` package in yo
79
75
 
80
76
  ```js
81
77
  import {onLCP, onINP, onCLS} from 'web-vitals';
82
-
83
- onCLS(console.log);
84
- onINP(console.log);
85
- onLCP(console.log);
86
78
  ```
87
79
 
88
- > [!NOTE]
89
- > In version 2, these functions were named `getXXX()` rather than `onXXX()`. They've [been renamed](https://github.com/GoogleChrome/web-vitals/pull/222) in version 3 to reduce confusion (see [#217](https://github.com/GoogleChrome/web-vitals/pull/217) for details) and will continue to be available using the `getXXX()` until at least version 4. Users are encouraged to switch to the new names, though, for future compatibility.
90
-
91
- <a name="attribution-build"><a>
80
+ <a name="attribution-build"></a>
92
81
 
93
82
  **2. The "attribution" build**
94
83
 
@@ -96,20 +85,20 @@ Measuring the Web Vitals scores for your real users is a great first step toward
96
85
 
97
86
  The "attribution" build helps you do that by including additional diagnostic information with each metric to help you identify the root cause of poor performance as well as prioritize the most important things to fix.
98
87
 
99
- The "attribution" build is slightly larger than the "standard" build (by about 600 bytes, brotli'd), so while the code size is still small, it's only recommended if you're actually using these features.
88
+ The "attribution" build is slightly larger than the "standard" build (by about 1.5K, brotli'd), so while the code size is still small, it's only recommended if you're actually using these features.
100
89
 
101
90
  To load the "attribution" build, change any `import` statements that reference `web-vitals` to `web-vitals/attribution`:
102
91
 
103
92
  ```diff
104
- - import {onLCP, onINP, onCLS} from 'web-vitals';
105
- + import {onLCP, onINP, onCLS} from 'web-vitals/attribution';
93
+ import {onLCP, onINP, onCLS} from 'web-vitals';
94
+ import {onLCP, onINP, onCLS} from 'web-vitals/attribution';
106
95
  ```
107
96
 
108
97
  Usage for each of the imported function is identical to the standard build, but when importing from the attribution build, the [metric](#metric) objects will contain an additional [`attribution`](#attribution) property.
109
98
 
110
99
  See [Send attribution data](#send-attribution-data) for usage examples, and the [`attribution` reference](#attribution) for details on what values are added for each metric.
111
100
 
112
- <a name="load-web-vitals-from-a-cdn"><a>
101
+ <a name="load-web-vitals-from-a-cdn"></a>
113
102
 
114
103
  ### From a CDN
115
104
 
@@ -124,7 +113,7 @@ _**Important!** The [unpkg.com](https://unpkg.com), [jsDelivr](https://www.jsdel
124
113
  ```html
125
114
  <!-- Append the `?module` param to load the module version of `web-vitals` -->
126
115
  <script type="module">
127
- import {onCLS, onINP, onLCP} from 'https://unpkg.com/web-vitals@4?module';
116
+ import {onCLS, onINP, onLCP} from 'https://unpkg.com/web-vitals@5?module';
128
117
 
129
118
  onCLS(console.log);
130
119
  onINP(console.log);
@@ -132,13 +121,15 @@ _**Important!** The [unpkg.com](https://unpkg.com), [jsDelivr](https://www.jsdel
132
121
  </script>
133
122
  ```
134
123
 
124
+ Note: When the web-vitals code is isolated from the application code in this way, there is less need to depend on dynamic imports so this code uses a regular `import` line.
125
+
135
126
  **Load the "standard" build** _(using a classic script)_
136
127
 
137
128
  ```html
138
129
  <script>
139
130
  (function () {
140
131
  var script = document.createElement('script');
141
- script.src = 'https://unpkg.com/web-vitals@4/dist/web-vitals.iife.js';
132
+ script.src = 'https://unpkg.com/web-vitals@5/dist/web-vitals.iife.js';
142
133
  script.onload = function () {
143
134
  // When loading `web-vitals` using a classic script, all the public
144
135
  // methods can be found on the `webVitals` global namespace.
@@ -160,7 +151,7 @@ _**Important!** The [unpkg.com](https://unpkg.com), [jsDelivr](https://www.jsdel
160
151
  onCLS,
161
152
  onINP,
162
153
  onLCP,
163
- } from 'https://unpkg.com/web-vitals@4/dist/web-vitals.attribution.js?module';
154
+ } from 'https://unpkg.com/web-vitals@5/dist/web-vitals.attribution.js?module';
164
155
 
165
156
  onCLS(console.log);
166
157
  onINP(console.log);
@@ -175,7 +166,7 @@ _**Important!** The [unpkg.com](https://unpkg.com), [jsDelivr](https://www.jsdel
175
166
  (function () {
176
167
  var script = document.createElement('script');
177
168
  script.src =
178
- 'https://unpkg.com/web-vitals@4/dist/web-vitals.attribution.iife.js';
169
+ 'https://unpkg.com/web-vitals@5/dist/web-vitals.attribution.iife.js';
179
170
  script.onload = function () {
180
171
  // When loading `web-vitals` using a classic script, all the public
181
172
  // methods can be found on the `webVitals` global namespace.
@@ -210,8 +201,8 @@ Note that some of these metrics will not report until the user has interacted wi
210
201
 
211
202
  Also, in some cases a metric callback may never be called:
212
203
 
213
- - FID and INP are not reported if the user never interacts with the page.
214
- - CLS, FCP, FID, and LCP are not reported if the page was loaded in the background.
204
+ - INP is not reported if the user never interacts with the page.
205
+ - CLS, FCP, and LCP are not reported if the page was loaded in the background.
215
206
 
216
207
  In other cases, a metric callback may be called more than once:
217
208
 
@@ -225,8 +216,7 @@ In other cases, a metric callback may be called more than once:
225
216
 
226
217
  In most cases, you only want the `callback` function to be called when the metric is ready to be reported. However, it is possible to report every change (e.g. each larger layout shift as it happens) by setting `reportAllChanges` to `true` in the optional, [configuration object](#reportopts) (second parameter).
227
218
 
228
- > [!IMPORTANT]
229
- > `reportAllChanges` only reports when the **metric changes**, not for each **input to the metric**. For example, a new layout shift that does not increase the CLS metric will not be reported even with `reportAllChanges` set to `true` because the CLS metric has not changed. Similarly, for INP, each interaction is not reported even with `reportAllChanges` set to `true`—just when an interaction causes an increase to INP.
219
+ > [!IMPORTANT] > `reportAllChanges` only reports when the **metric changes**, not for each **input to the metric**. For example, a new layout shift that does not increase the CLS metric will not be reported even with `reportAllChanges` set to `true` because the CLS metric has not changed. Similarly, for INP, each interaction is not reported even with `reportAllChanges` set to `true`—just when an interaction causes an increase to INP.
230
220
 
231
221
  This can be useful when debugging, but in general using `reportAllChanges` is not needed (or recommended) for measuring these metrics in production.
232
222
 
@@ -266,19 +256,23 @@ In addition to using the `id` field to group multiple deltas for the same metric
266
256
 
267
257
  The following example measures each of the Core Web Vitals metrics and reports them to a hypothetical `/analytics` endpoint, as soon as each is ready to be sent.
268
258
 
269
- The `sendToAnalytics()` function uses the [`navigator.sendBeacon()`](https://developer.mozilla.org/docs/Web/API/Navigator/sendBeacon) method (if available), but falls back to the [`fetch()`](https://developer.mozilla.org/docs/Web/API/Fetch_API) API when not.
259
+ The `sendToAnalytics()` function uses the [`navigator.sendBeacon()`](https://developer.mozilla.org/docs/Web/API/Navigator/sendBeacon) method, which is widely available across browsers, and supports sending data as the page is being unloaded.
270
260
 
271
261
  ```js
272
262
  import {onCLS, onINP, onLCP} from 'web-vitals';
273
263
 
274
264
  function sendToAnalytics(metric) {
275
- // Replace with whatever serialization method you prefer.
276
- // Note: JSON.stringify will likely include more data than you need.
277
- const body = JSON.stringify(metric);
265
+ const body = JSON.stringify({
266
+ name: metric.name,
267
+ value: metric.value,
268
+ id: metric.id,
269
+
270
+ // Include additional data as needed...
271
+ });
278
272
 
279
- // Use `navigator.sendBeacon()` if available, falling back to `fetch()`.
280
- (navigator.sendBeacon && navigator.sendBeacon('/analytics', body)) ||
281
- fetch('/analytics', {body, method: 'POST', keepalive: true});
273
+ // Use `navigator.sendBeacon()` to send the data, which supports
274
+ // sending while the page is unloading.
275
+ navigator.sendBeacon('/analytics', body);
282
276
  }
283
277
 
284
278
  onCLS(sendToAnalytics);
@@ -396,9 +390,9 @@ function flushQueue() {
396
390
  // Note: JSON.stringify will likely include more data than you need.
397
391
  const body = JSON.stringify([...queue]);
398
392
 
399
- // Use `navigator.sendBeacon()` if available, falling back to `fetch()`.
400
- (navigator.sendBeacon && navigator.sendBeacon('/analytics', body)) ||
401
- fetch('/analytics', {body, method: 'POST', keepalive: true});
393
+ // Use `navigator.sendBeacon()` to send the data, which supports
394
+ // sending while the page is unloading.
395
+ navigator.sendBeacon('/analytics', body);
402
396
 
403
397
  queue.clear();
404
398
  }
@@ -419,7 +413,7 @@ addEventListener('visibilitychange', () => {
419
413
  > [!NOTE]
420
414
  > See [the Page Lifecycle guide](https://developers.google.com/web/updates/2018/07/page-lifecycle-api#legacy-lifecycle-apis-to-avoid) for an explanation of why `visibilitychange` is recommended over events like `beforeunload` and `unload`.
421
415
 
422
- <a name="bundle-versions"><a>
416
+ <a name="bundle-versions"></a>
423
417
 
424
418
  ## Build options
425
419
 
@@ -481,7 +475,7 @@ The following table lists all the builds distributed with the `web-vitals` packa
481
475
  </tr>
482
476
  </table>
483
477
 
484
- <a name="which-build-is-right-for-you"><a>
478
+ <a name="which-build-is-right-for-you"></a>
485
479
 
486
480
  ### Which build is right for you?
487
481
 
@@ -504,7 +498,7 @@ interface Metric {
504
498
  /**
505
499
  * The name of the metric (in acronym form).
506
500
  */
507
- name: 'CLS' | 'FCP' | 'FID' | 'INP' | 'LCP' | 'TTFB';
501
+ name: 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';
508
502
 
509
503
  /**
510
504
  * The current value of the metric.
@@ -583,18 +577,6 @@ interface FCPMetric extends Metric {
583
577
  }
584
578
  ```
585
579
 
586
- ##### `FIDMetric`
587
-
588
- > [!CAUTION]
589
- > This interface is deprecated and will be removed in the next major release.
590
-
591
- ```ts
592
- interface FIDMetric extends Metric {
593
- name: 'FID';
594
- entries: PerformanceEventTiming[];
595
- }
596
- ```
597
-
598
580
  ##### `INPMetric`
599
581
 
600
582
  ```ts
@@ -647,6 +629,35 @@ _See also [Rating Thresholds](#rating-thresholds)._
647
629
  ```ts
648
630
  interface ReportOpts {
649
631
  reportAllChanges?: boolean;
632
+ }
633
+ ```
634
+
635
+ Metric-specific subclasses:
636
+
637
+ ##### `INPReportOpts`
638
+
639
+ ```ts
640
+ interface INPReportOpts extends ReportOpts {
641
+ durationThreshold?: number;
642
+ }
643
+ ```
644
+
645
+ #### `AttributionReportOpts`
646
+
647
+ A subclass of `ReportOpts` used for each metric function exported in the [attribution build](#attribution).
648
+
649
+ ```ts
650
+ interface AttributionReportOpts extends ReportOpts {
651
+ generateTarget?: (el: Node | null) => string | null | undefined;
652
+ }
653
+ ```
654
+
655
+ Metric-specific subclasses:
656
+
657
+ ##### `INPAttributionReportOpts`
658
+
659
+ ```ts
660
+ interface INPAttributionReportOpts extends AttributionReportOpts {
650
661
  durationThreshold?: number;
651
662
  }
652
663
  ```
@@ -688,11 +699,11 @@ function onCLS(callback: (metric: CLSMetric) => void, opts?: ReportOpts): void;
688
699
 
689
700
  Calculates the [CLS](https://web.dev/articles/cls) value for the current page and calls the `callback` function once the value is ready to be reported, along with all `layout-shift` performance entries that were used in the metric value calculation. The reported value is a [double](https://heycam.github.io/webidl/#idl-double) (corresponding to a [layout shift score](https://web.dev/articles/cls#layout_shift_score)).
690
701
 
691
- If the `reportAllChanges` [configuration option](#reportopts) is set to `true`, the `callback` function will be called as soon as the value is initially determined as well as any time the value changes throughout the page lifespan (Note [not necessarily for every layout shift](#report-the-value-on-every-change)).
692
-
693
702
  > [!IMPORTANT]
694
703
  > CLS should be continually monitored for changes throughout the entire lifespan of a page—including if the user returns to the page after it's been hidden/backgrounded. However, since browsers often [will not fire additional callbacks once the user has backgrounded a page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden), `callback` is always called when the page's visibility state changes to hidden. As a result, the `callback` function might be called multiple times during the same page load (see [Reporting only the delta of changes](#report-only-the-delta-of-changes) for how to manage this).
695
704
 
705
+ If the `reportAllChanges` [configuration option](#reportopts) is set to `true`, the `callback` function will be called as soon as the value is initially determined as well as any time the value changes throughout the page lifespan (though [not necessarily for every layout shift](#report-the-value-on-every-change)). Note that regardless of whether `reportAllChanges` is used, the final reported value will be the same.
706
+
696
707
  #### `onFCP()`
697
708
 
698
709
  ```ts
@@ -701,35 +712,24 @@ function onFCP(callback: (metric: FCPMetric) => void, opts?: ReportOpts): void;
701
712
 
702
713
  Calculates the [FCP](https://web.dev/articles/fcp) value for the current page and calls the `callback` function once the value is ready, along with the relevant `paint` performance entry used to determine the value. The reported value is a [`DOMHighResTimeStamp`](https://developer.mozilla.org/docs/Web/API/DOMHighResTimeStamp).
703
714
 
704
- #### `onFID()`
705
-
706
- > [!CAUTION]
707
- > This function is deprecated and will be removed in the next major release.
708
-
709
- ```ts
710
- function onFID(callback: (metric: FIDMetric) => void, opts?: ReportOpts): void;
711
- ```
712
-
713
- Calculates the [FID](https://web.dev/articles/fid) value for the current page and calls the `callback` function once the value is ready, along with the relevant `first-input` performance entry used to determine the value. The reported value is a [`DOMHighResTimeStamp`](https://developer.mozilla.org/docs/Web/API/DOMHighResTimeStamp).
714
-
715
- > [!IMPORTANT]
716
- > Since FID is only reported after the user interacts with the page, it's possible that it will not be reported for some page loads.
717
-
718
715
  #### `onINP()`
719
716
 
720
717
  ```ts
721
- function onINP(callback: (metric: INPMetric) => void, opts?: ReportOpts): void;
718
+ function onINP(
719
+ callback: (metric: INPMetric) => void,
720
+ opts?: INPReportOpts,
721
+ ): void;
722
722
  ```
723
723
 
724
724
  Calculates the [INP](https://web.dev/articles/inp) value for the current page and calls the `callback` function once the value is ready, along with the `event` performance entries reported for that interaction. The reported value is a [`DOMHighResTimeStamp`](https://developer.mozilla.org/docs/Web/API/DOMHighResTimeStamp).
725
725
 
726
- A custom `durationThreshold` [configuration option](#reportopts) can optionally be passed to control what `event-timing` entries are considered for INP reporting. The default threshold is `40`, which means INP scores of less than 40 are reported as 0. Note that this will not affect your 75th percentile INP value unless that value is also less than 40 (well below the recommended [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).
727
-
728
- If the `reportAllChanges` [configuration option](#reportopts) is set to `true`, the `callback` function will be called as soon as the value is initially determined as well as any time the value changes throughout the page lifespan (Note [not necessarily for every interaction](#report-the-value-on-every-change)).
729
-
730
726
  > [!IMPORTANT]
731
727
  > INP should be continually monitored for changes throughout the entire lifespan of a page—including if the user returns to the page after it's been hidden/backgrounded. However, since browsers often [will not fire additional callbacks once the user has backgrounded a page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden), `callback` is always called when the page's visibility state changes to hidden. As a result, the `callback` function might be called multiple times during the same page load (see [Reporting only the delta of changes](#report-only-the-delta-of-changes) for how to manage this).
732
728
 
729
+ A custom `durationThreshold` [configuration option](#reportopts) can optionally be passed to control the minimum duration filter for `event-timing`. Events which are faster than this threshold are not reported. Note that the `first-input` entry is always observed, regardless of duration, to ensure you always have some INP score. The default threshold, after the library is initialized, is `40` milliseconds (the `event-timing` default of `104` milliseconds applies to all events emitted before the library is initialised). This default threshold of `40` is chosen to strike a balance between usefulness and performance. Running this callback for any interaction that spans just one or two frames is likely not worth the insight that could be gained.
730
+
731
+ If the `reportAllChanges` [configuration option](#reportopts) is set to `true`, the `callback` function will be called as soon as the value is initially determined as well as any time the value changes throughout the page lifespan (though [not necessarily for every interaction](#report-the-value-on-every-change)). Note that regardless of whether `reportAllChanges` is used, the final reported value will be the same.
732
+
733
733
  #### `onLCP()`
734
734
 
735
735
  ```ts
@@ -738,7 +738,7 @@ function onLCP(callback: (metric: LCPMetric) => void, opts?: ReportOpts): void;
738
738
 
739
739
  Calculates the [LCP](https://web.dev/articles/lcp) value for the current page and calls the `callback` function once the value is ready (along with the relevant `largest-contentful-paint` performance entry used to determine the value). The reported value is a [`DOMHighResTimeStamp`](https://developer.mozilla.org/docs/Web/API/DOMHighResTimeStamp).
740
740
 
741
- If the `reportAllChanges` [configuration option](#reportopts) is set to `true`, the `callback` function will be called any time a new `largest-contentful-paint` performance entry is dispatched, or once the final value of the metric has been determined.
741
+ If the `reportAllChanges` [configuration option](#reportopts) is set to `true`, the `callback` function will be called any time a new `largest-contentful-paint` performance entry is dispatched, or once the final value of the metric has been determined. Note that regardless of whether `reportAllChanges` is used, the final reported value will be the same.
742
742
 
743
743
  #### `onTTFB()`
744
744
 
@@ -788,20 +788,44 @@ console.log(LCPThresholds); // [ 2500, 4000 ]
788
788
 
789
789
  ### Attribution:
790
790
 
791
- The following objects contain potentially-helpful debugging information that can be sent along with the metric values for the current page visit in order to help identify issues happening to real-users in the field.
791
+ In the [attribution build](#attribution-build) each of the metric functions has two primary differences from their standard build counterparts:
792
+
793
+ 1. Their callback is invoked with a `MetricWithAttribution` objects instead of a `Metric` object. Each `MetricWithAttribution` extends the `Metric` object and adds an additional `attribution` object, which contains potentially-helpful debugging information that can be sent along with the metric values for the current page visit in order to help identify issues happening to real-users in the field.
794
+
795
+ 2. They accept an `AttributionReportOpts` objects instead of a `ReportOpts` object. The `AttributionReportOpts` object supports an additional, optional, `generateTarget()` function that lets developers customize how DOM elements are stringified for reporting purposes. When passed, the return value of the `generateTarget()` function will be used for any "target" properties in the following attribution objects: [`CLSAttribution`](#CLSAttribution), [`INPAttribution`](#INPAttribution), and [`LCPAttribution`](#LCPAttribution). If `null` or `undefined` is returned by the `generateTarget()` function, or no function is given, then the default selector function will be used.
792
796
 
793
- When using the attribution build, these objects are found as an `attribution` property on each metric.
797
+ ```ts
798
+ interface AttributionReportOpts extends ReportOpts {
799
+ generateTarget?: (el: Node | null) => string | null | undefined;
800
+ }
801
+ ```
794
802
 
795
- See the [attribution build](#attribution-build) section for details on how to use this feature.
803
+ For example, if a web page has unique `data-name` attibute on many elements, you may prefer to use those over the built-in selector-style strings that are generated by default.
804
+
805
+ ```js
806
+ function customGenerateTarget(el) {
807
+ if (el.dataset.name) {
808
+ return el.dataset.name;
809
+ }
810
+
811
+ // Otherwise use default selector function
812
+ }
813
+
814
+ onLCP(sendToAnalytics, {generateTarget: customGenerateTarget});
815
+ ```
816
+
817
+ The next sections document the shape of the `attribution` object for each of the metrics:
796
818
 
797
819
  #### `CLSAttribution`
798
820
 
799
821
  ```ts
800
822
  interface CLSAttribution {
801
823
  /**
802
- * A selector identifying the first element (in document order) that
803
- * shifted when the single largest layout shift contributing to the page's
804
- * CLS score occurred.
824
+ * By default, a selector identifying the first element (in document order)
825
+ * that shifted when the single largest layout shift that contributed to the
826
+ * page's CLS score occurred. If the `generateTarget` configuration option
827
+ * was passed, then this will instead be the return value of that function,
828
+ * falling back to the default if that returns null or undefined.
805
829
  */
806
830
  largestShiftTarget?: string;
807
831
  /**
@@ -867,77 +891,26 @@ interface FCPAttribution {
867
891
  }
868
892
  ```
869
893
 
870
- #### `FIDAttribution`
871
-
872
- > [!CAUTION]
873
- > This interface is deprecated and will be removed in the next major release.
874
-
875
- ```ts
876
- interface FIDAttribution {
877
- /**
878
- * A selector identifying the element that the user interacted with. This
879
- * element will be the `target` of the `event` dispatched.
880
- */
881
- eventTarget: string;
882
- /**
883
- * The time when the user interacted. This time will match the `timeStamp`
884
- * value of the `event` dispatched.
885
- */
886
- eventTime: number;
887
- /**
888
- * The `type` of the `event` dispatched from the user interaction.
889
- */
890
- eventType: string;
891
- /**
892
- * The `PerformanceEventTiming` entry corresponding to FID.
893
- */
894
- eventEntry: PerformanceEventTiming;
895
- /**
896
- * The loading state of the document at the time when the first interaction
897
- * occurred (see `LoadState` for details). If the first interaction occurred
898
- * while the document was loading and executing script (e.g. usually in the
899
- * `dom-interactive` phase) it can result in long input delays.
900
- */
901
- loadState: LoadState;
902
- }
903
- ```
904
-
905
894
  #### `INPAttribution`
906
895
 
907
896
  ```ts
908
897
  interface INPAttribution {
909
898
  /**
910
- * A selector identifying the element that the user first interacted with
911
- * as part of the frame where the INP candidate interaction occurred.
912
- * If this value is an empty string, that generally means the element was
913
- * removed from the DOM after the interaction.
899
+ * By default, a selector identifying the element that the user first
900
+ * interacted with as part of the frame where the INP candidate interaction
901
+ * occurred. If this value is an empty string, that generally means the
902
+ * element was removed from the DOM after the interaction. If the
903
+ * `generateTarget` configuration option was passed, then this will instead
904
+ * be the return value of that function, falling back to the default if that
905
+ * returns null or undefined.
914
906
  */
915
907
  interactionTarget: string;
916
- /**
917
- * A reference to the HTML element identified by `interactionTarget`.
918
- * NOTE: for attribution purpose, a selector identifying the element is
919
- * typically more useful than the element itself. However, the element is
920
- * also made available in case additional context is needed.
921
- */
922
- interactionTargetElement: Node | undefined;
923
908
  /**
924
909
  * The time when the user first interacted during the frame where the INP
925
910
  * candidate interaction occurred (if more than one interaction occurred
926
911
  * within the frame, only the first time is reported).
927
912
  */
928
913
  interactionTime: DOMHighResTimeStamp;
929
- /**
930
- * The best-guess timestamp of the next paint after the interaction.
931
- * In general, this timestamp is the same as the `startTime + duration` of
932
- * the event timing entry. However, since `duration` values are rounded to
933
- * the nearest 8ms, it can sometimes appear that the paint occurred before
934
- * processing ended (which cannot happen). This value clamps the paint time
935
- * so it's always after `processingEnd` from the Event Timing API and
936
- * `renderStart` from the Long Animation Frame API (where available).
937
- * It also averages the duration values for all entries in the same
938
- * animation frame, which should be closer to the "real" value.
939
- */
940
- nextPaintTime: DOMHighResTimeStamp;
941
914
  /**
942
915
  * The type of interaction, based on the event type of the `event` entry
943
916
  * that corresponds to the interaction (i.e. the first `event` entry
@@ -946,20 +919,19 @@ interface INPAttribution {
946
919
  * and for "keydown" or "keyup" events this will be "keyboard".
947
920
  */
948
921
  interactionType: 'pointer' | 'keyboard';
922
+ /**
923
+ * The best-guess timestamp of the next paint after the interaction.
924
+ * In general, this timestamp is the same as the `startTime + duration` of
925
+ * the event timing entry. However, since duration values are rounded to the
926
+ * nearest 8ms (and can be rounded down), this value is clamped to always be
927
+ * reported after the processing times.
928
+ */
929
+ nextPaintTime: DOMHighResTimeStamp;
949
930
  /**
950
931
  * An array of Event Timing entries that were processed within the same
951
932
  * animation frame as the INP candidate interaction.
952
933
  */
953
934
  processedEventEntries: PerformanceEventTiming[];
954
- /**
955
- * If the browser supports the Long Animation Frame API, this array will
956
- * include any `long-animation-frame` entries that intersect with the INP
957
- * candidate interaction's `startTime` and the `processingEnd` time of the
958
- * last event processed within that animation frame. If the browser does not
959
- * support the Long Animation Frame API or no `long-animation-frame` entries
960
- * are detect, this array will be empty.
961
- */
962
- longAnimationFrameEntries: PerformanceLongAnimationFrameTiming[];
963
935
  /**
964
936
  * The time from when the user interacted with the page until when the
965
937
  * browser was first able to start processing event listeners for that
@@ -988,6 +960,68 @@ interface INPAttribution {
988
960
  * (e.g. usually in the `dom-interactive` phase) it can result in long delays.
989
961
  */
990
962
  loadState: LoadState;
963
+ /**
964
+ * If the browser supports the Long Animation Frame API, this array will
965
+ * include any `long-animation-frame` entries that intersect with the INP
966
+ * candidate interaction's `startTime` and the `processingEnd` time of the
967
+ * last event processed within that animation frame. If the browser does not
968
+ * support the Long Animation Frame API or no `long-animation-frame` entries
969
+ * are detected, this array will be empty.
970
+ */
971
+ longAnimationFrameEntries: PerformanceLongAnimationFrameTiming[];
972
+ /**
973
+ * Summary information about the longest script entry intersecting the INP
974
+ * duration. Note, only script entries above 5 milliseconds are reported by
975
+ * the Long Animation Frame API.
976
+ */
977
+ longestScript?: INPLongestScriptSummary;
978
+ /**
979
+ * The total duration of Long Animation Frame scripts that intersect the INP
980
+ * duration excluding any forced style and layout (that is included in
981
+ * totalStyleAndLayout). Note, this is limited to scripts > 5 milliseconds.
982
+ */
983
+ totalScriptDuration?: number;
984
+ /**
985
+ * The total style and layout duration from any Long Animation Frames
986
+ * intersecting the INP interaction. This includes any end-of-frame style and
987
+ * layout duration + any forced style and layout duration.
988
+ */
989
+ totalStyleAndLayoutDuration?: number;
990
+ /**
991
+ * The off main-thread presentation delay from the end of the last Long
992
+ * Animation Frame (where available) until the INP end point.
993
+ */
994
+ totalPaintDuration?: number;
995
+ /**
996
+ * The total unattributed time not included in any of the previous totals.
997
+ * This includes scripts < 5 milliseconds and other timings not attributed
998
+ * by Long Animation Frame (including when a frame is < 50ms and so has no
999
+ * Long Animation Frame).
1000
+ * When no Long Animation Frames are present this will be undefined, rather
1001
+ * than everything being unattributed to make it clearer when it's expected
1002
+ * to be small.
1003
+ */
1004
+ totalUnattributedDuration?: number;
1005
+ }
1006
+ ```
1007
+
1008
+ #### `INPLongestScriptSummary`
1009
+
1010
+ ```ts
1011
+ interface INPLongestScriptSummary {
1012
+ /**
1013
+ * The longest Long Animation Frame script entry that intersects the INP
1014
+ * interaction.
1015
+ */
1016
+ entry: PerformanceScriptTiming;
1017
+ /**
1018
+ * The INP subpart where the longest script ran.
1019
+ */
1020
+ subpart: 'input-delay' | 'processing-duration' | 'presentation-delay';
1021
+ /**
1022
+ * The amount of time the longest script intersected the INP duration.
1023
+ */
1024
+ intersectingDuration: number;
991
1025
  }
992
1026
  ```
993
1027
 
@@ -996,9 +1030,13 @@ interface INPAttribution {
996
1030
  ```ts
997
1031
  interface LCPAttribution {
998
1032
  /**
999
- * The element corresponding to the largest contentful paint for the page.
1033
+ * By default, a selector identifying the element corresponding to the
1034
+ * largest contentful paint for the page. If the `generateTarget`
1035
+ * configuration option was passed, then this will instead be the return
1036
+ * value of that function, falling back to the default if that returns null
1037
+ * or undefined.
1000
1038
  */
1001
- element?: string;
1039
+ target?: string;
1002
1040
  /**
1003
1041
  * The URL (if applicable) of the LCP image resource. If the LCP element
1004
1042
  * is a text node, this value will not be set.
@@ -1049,7 +1087,7 @@ interface LCPAttribution {
1049
1087
  #### `TTFBAttribution`
1050
1088
 
1051
1089
  ```ts
1052
- export interface TTFBAttribution {
1090
+ interface TTFBAttribution {
1053
1091
  /**
1054
1092
  * The total time from when the user initiates loading the page to when the
1055
1093
  * page starts to handle the request. Large values here are typically due
@@ -1089,13 +1127,14 @@ export interface TTFBAttribution {
1089
1127
 
1090
1128
  ## Browser Support
1091
1129
 
1092
- The `web-vitals` code has been tested and will run without error in all major browsers as well as Internet Explorer back to version 9. However, some of the APIs required to capture these metrics are currently only available in Chromium-based browsers (e.g. Chrome, Edge, Opera, Samsung Internet).
1130
+ The `web-vitals` code is tested in Chrome, Firefox, and Safari. In addition, all JavaScript features used in the code are part of ([Baseline Widely Available](https://web.dev/baseline)), and thus should run without error in all versions of these browsers released within the last 30 months.
1131
+
1132
+ However, some of the APIs required to capture these metrics are currently only available in Chromium-based browsers (e.g. Chrome, Edge, Opera, Samsung Internet), which means in some browsers those metrics will not be reported.
1093
1133
 
1094
1134
  Browser support for each function is as follows:
1095
1135
 
1096
1136
  - `onCLS()`: Chromium
1097
1137
  - `onFCP()`: Chromium, Firefox, Safari
1098
- - `onFID()`: Chromium, Firefox _(Deprecated)_
1099
1138
  - `onINP()`: Chromium
1100
1139
  - `onLCP()`: Chromium, Firefox
1101
1140
  - `onTTFB()`: Chromium, Firefox, Safari
@@ -8,5 +8,4 @@ export { FCPThresholds } from '../onFCP.js';
8
8
  export { INPThresholds } from '../onINP.js';
9
9
  export { LCPThresholds } from '../onLCP.js';
10
10
  export { TTFBThresholds } from '../onTTFB.js';
11
- export * from './deprecated.js';
12
11
  export * from '../types.js';
@@ -23,5 +23,4 @@ export { FCPThresholds } from '../onFCP.js';
23
23
  export { INPThresholds } from '../onINP.js';
24
24
  export { LCPThresholds } from '../onLCP.js';
25
25
  export { TTFBThresholds } from '../onTTFB.js';
26
- export * from './deprecated.js';
27
26
  export * from '../types.js';
@@ -1,4 +1,4 @@
1
- import { CLSMetricWithAttribution, ReportOpts } from '../types.js';
1
+ import { CLSMetricWithAttribution, AttributionReportOpts } from '../types.js';
2
2
  /**
3
3
  * Calculates the [CLS](https://web.dev/articles/cls) value for the current page and
4
4
  * calls the `callback` function once the value is ready to be reported, along
@@ -20,4 +20,4 @@ import { CLSMetricWithAttribution, ReportOpts } from '../types.js';
20
20
  * hidden. As a result, the `callback` function might be called multiple times
21
21
  * during the same page load._
22
22
  */
23
- export declare const onCLS: (onReport: (metric: CLSMetricWithAttribution) => void, opts?: ReportOpts) => void;
23
+ export declare const onCLS: (onReport: (metric: CLSMetricWithAttribution) => void, opts?: AttributionReportOpts) => void;