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.
- package/docs/ui_engineering.md +159 -0
- package/eslint.config.mjs +6 -1
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/i18nImpl.ts +6 -1
- package/front_end/core/protocol_client/protocol_client.ts +1 -1
- package/front_end/core/root/Runtime.ts +38 -4
- package/front_end/core/sdk/CSSMatchedStyles.ts +50 -7
- package/front_end/core/sdk/CSSRule.ts +35 -6
- package/front_end/core/sdk/Connections.ts +2 -1
- package/front_end/core/sdk/DOMModel.ts +4 -0
- package/front_end/core/sdk/DebuggerModel.ts +5 -1
- package/front_end/core/sdk/NetworkManager.ts +267 -34
- package/front_end/core/sdk/PreloadingModel.ts +82 -17
- package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1 -1
- package/front_end/core/sdk/RehydratingConnection.ts +29 -4
- package/front_end/core/sdk/ScopeTreeCache.ts +8 -3
- package/front_end/core/sdk/SourceMap.ts +41 -11
- package/front_end/core/sdk/SourceMapManager.ts +13 -2
- package/front_end/core/sdk/SourceMapScopesInfo.ts +49 -2
- package/front_end/core/sdk/TargetManager.ts +0 -22
- package/front_end/core/sdk/TraceObject.ts +8 -7
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +81 -0
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
- package/front_end/entrypoints/main/GlobalAiButton.ts +1 -0
- package/front_end/entrypoints/main/MainImpl.ts +42 -28
- package/front_end/generated/InspectorBackendCommands.js +3 -2
- package/front_end/generated/SupportedCSSProperties.js +2 -0
- package/front_end/generated/protocol.ts +17 -3
- package/front_end/models/ai_assistance/BuiltInAi.ts +111 -0
- package/front_end/models/ai_assistance/ConversationHandler.ts +15 -14
- package/front_end/models/ai_assistance/ai_assistance.ts +53 -24
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +105 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -1
- package/front_end/models/extensions/ExtensionView.ts +3 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +31 -27
- package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +31 -29
- package/front_end/models/persistence/NetworkPersistenceManager.ts +3 -5
- package/front_end/models/persistence/PersistenceImpl.ts +0 -5
- package/front_end/models/persistence/persistence-meta.ts +0 -31
- package/front_end/models/persistence/persistence.ts +0 -6
- package/front_end/models/source_map_scopes/NamesResolver.ts +5 -11
- package/front_end/models/stack_trace/Trie.ts +9 -0
- package/front_end/models/trace/lantern/types/Lantern.ts +1 -1
- package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -0
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +120 -113
- package/front_end/panels/ai_assistance/PatchWidget.ts +9 -8
- package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +2 -0
- package/front_end/panels/ai_assistance/components/ChatView.ts +29 -29
- package/front_end/panels/ai_assistance/components/UserActionRow.ts +1 -0
- package/front_end/panels/animation/AnimationTimeline.ts +1 -0
- package/front_end/panels/application/CookieItemsView.ts +1 -0
- package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -0
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +11 -5
- package/front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingString.ts +7 -5
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +22 -10
- package/front_end/panels/changes/CombinedDiffView.ts +1 -0
- package/front_end/{models/persistence → panels/common}/PersistenceUtils.ts +15 -17
- package/front_end/panels/common/common.ts +1 -0
- package/front_end/panels/console/ConsoleInsightTeaser.ts +369 -0
- package/front_end/panels/console/ConsolePanel.ts +2 -0
- package/front_end/panels/console/ConsolePrompt.ts +12 -2
- package/front_end/panels/console/ConsoleSidebar.ts +1 -1
- package/front_end/panels/console/ConsoleView.ts +12 -0
- package/front_end/panels/console/ConsoleViewMessage.ts +44 -0
- package/front_end/panels/{explain → console}/PromptBuilder.ts +12 -7
- package/front_end/panels/console/console-meta.ts +14 -0
- package/front_end/panels/console/console.ts +6 -0
- package/front_end/panels/console/consoleInsightTeaser.css +83 -0
- package/front_end/panels/coverage/CoverageListView.ts +29 -11
- package/front_end/panels/coverage/CoverageView.ts +292 -284
- package/front_end/panels/coverage/coverageView.css +17 -0
- package/front_end/panels/elements/ComputedStyleWidget.ts +1 -0
- package/front_end/panels/elements/LayoutPane.ts +1 -0
- package/front_end/panels/elements/NodeStackTraceWidget.ts +1 -0
- package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -1
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +17 -0
- package/front_end/panels/emulation/DeviceModeView.ts +2 -0
- package/front_end/panels/explain/ActionDelegate.ts +4 -2
- package/front_end/panels/explain/components/ConsoleInsight.ts +14 -12
- package/front_end/panels/explain/explain-meta.ts +7 -0
- package/front_end/panels/explain/explain.ts +0 -1
- package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -1
- package/front_end/panels/layer_viewer/Layers3DView.ts +2 -0
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -0
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +1 -0
- package/front_end/panels/media/MainView.ts +1 -0
- package/front_end/panels/media/TickingFlameChart.ts +2 -0
- package/front_end/panels/network/BlockedURLsPane.ts +237 -108
- package/front_end/panels/network/EventSourceMessagesView.ts +1 -0
- package/front_end/panels/network/NetworkItemView.ts +1 -0
- package/front_end/panels/network/NetworkLogView.ts +9 -7
- package/front_end/panels/network/NetworkOverview.ts +1 -0
- package/front_end/panels/network/RequestCookiesView.ts +1 -0
- package/front_end/panels/network/RequestHTMLView.ts +1 -0
- package/front_end/panels/network/RequestInitiatorView.ts +1 -0
- package/front_end/panels/network/RequestPayloadView.ts +1 -0
- package/front_end/panels/network/RequestPreviewView.ts +1 -0
- package/front_end/panels/network/RequestResponseView.ts +1 -0
- package/front_end/panels/network/RequestTimingView.ts +2 -0
- package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -0
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -0
- package/front_end/panels/network/components/RequestHeadersView.ts +2 -0
- package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -0
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -0
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +2 -0
- package/front_end/panels/profiler/HeapSnapshotView.ts +7 -0
- package/front_end/panels/profiler/IsolateSelector.ts +1 -0
- package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -0
- package/front_end/panels/profiler/ProfileView.ts +1 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -0
- package/front_end/panels/recorder/RecorderPanel.ts +2 -0
- package/front_end/panels/screencast/ScreencastView.ts +1 -0
- package/front_end/panels/search/SearchView.ts +1 -0
- package/front_end/panels/settings/AISettingsTab.ts +3 -3
- package/front_end/{models/persistence → panels/settings}/EditFileSystemView.ts +3 -6
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +4 -1
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
- package/front_end/panels/settings/settings.ts +2 -0
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +12 -0
- package/front_end/panels/sources/BreakpointsView.ts +1 -0
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
- package/front_end/{models/persistence → panels/sources}/PersistenceActions.ts +8 -12
- package/front_end/panels/sources/TabbedEditorContainer.ts +2 -1
- package/front_end/panels/sources/UISourceCodeFrame.ts +17 -2
- package/front_end/panels/sources/sources-meta.ts +15 -0
- package/front_end/panels/sources/sources.ts +2 -0
- package/front_end/panels/timeline/README.md +2 -2
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
- package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -3
- package/front_end/panels/timeline/TimelineLayersView.ts +1 -0
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +114 -37
- package/front_end/panels/timeline/TimelinePanel.ts +43 -62
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
- package/front_end/panels/timeline/components/LiveMetricsView.ts +4 -8
- package/front_end/panels/timeline/components/Sidebar.ts +2 -0
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +7 -7
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
- package/front_end/panels/utils/utils.ts +2 -1
- package/front_end/panels/web_audio/WebAudioView.ts +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/diff/diff_match_patch.js +1 -1
- package/front_end/third_party/lighthouse/README.chromium +2 -2
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1530 -2426
- package/front_end/third_party/lighthouse/locales/ar-XB.json +107 -455
- package/front_end/third_party/lighthouse/locales/ar.json +107 -455
- package/front_end/third_party/lighthouse/locales/bg.json +96 -444
- package/front_end/third_party/lighthouse/locales/ca.json +96 -444
- package/front_end/third_party/lighthouse/locales/cs.json +96 -444
- package/front_end/third_party/lighthouse/locales/da.json +96 -444
- package/front_end/third_party/lighthouse/locales/de.json +96 -444
- package/front_end/third_party/lighthouse/locales/el.json +96 -444
- package/front_end/third_party/lighthouse/locales/en-GB.json +96 -444
- package/front_end/third_party/lighthouse/locales/en-US.json +116 -467
- package/front_end/third_party/lighthouse/locales/en-XA.json +93 -441
- package/front_end/third_party/lighthouse/locales/en-XL.json +116 -467
- package/front_end/third_party/lighthouse/locales/es-419.json +96 -444
- package/front_end/third_party/lighthouse/locales/es.json +96 -444
- package/front_end/third_party/lighthouse/locales/fi.json +96 -444
- package/front_end/third_party/lighthouse/locales/fil.json +96 -444
- package/front_end/third_party/lighthouse/locales/fr.json +96 -444
- package/front_end/third_party/lighthouse/locales/he.json +118 -466
- package/front_end/third_party/lighthouse/locales/hi.json +96 -444
- package/front_end/third_party/lighthouse/locales/hr.json +100 -448
- package/front_end/third_party/lighthouse/locales/hu.json +96 -444
- package/front_end/third_party/lighthouse/locales/id.json +96 -444
- package/front_end/third_party/lighthouse/locales/it.json +96 -444
- package/front_end/third_party/lighthouse/locales/ja.json +96 -444
- package/front_end/third_party/lighthouse/locales/ko.json +97 -445
- package/front_end/third_party/lighthouse/locales/lt.json +96 -444
- package/front_end/third_party/lighthouse/locales/lv.json +97 -445
- package/front_end/third_party/lighthouse/locales/nl.json +96 -444
- package/front_end/third_party/lighthouse/locales/no.json +96 -444
- package/front_end/third_party/lighthouse/locales/pl.json +96 -444
- package/front_end/third_party/lighthouse/locales/pt-PT.json +96 -444
- package/front_end/third_party/lighthouse/locales/pt.json +97 -445
- package/front_end/third_party/lighthouse/locales/ro.json +97 -445
- package/front_end/third_party/lighthouse/locales/ru.json +96 -444
- package/front_end/third_party/lighthouse/locales/sk.json +96 -444
- package/front_end/third_party/lighthouse/locales/sl.json +96 -444
- package/front_end/third_party/lighthouse/locales/sr-Latn.json +96 -444
- package/front_end/third_party/lighthouse/locales/sr.json +96 -444
- package/front_end/third_party/lighthouse/locales/sv.json +96 -444
- package/front_end/third_party/lighthouse/locales/ta.json +96 -444
- package/front_end/third_party/lighthouse/locales/te.json +97 -445
- package/front_end/third_party/lighthouse/locales/th.json +96 -444
- package/front_end/third_party/lighthouse/locales/tr.json +96 -444
- package/front_end/third_party/lighthouse/locales/uk.json +96 -444
- package/front_end/third_party/lighthouse/locales/vi.json +96 -444
- package/front_end/third_party/lighthouse/locales/zh-HK.json +96 -444
- package/front_end/third_party/lighthouse/locales/zh-TW.json +97 -445
- package/front_end/third_party/lighthouse/locales/zh.json +96 -444
- package/front_end/third_party/lighthouse/report/bundle.d.ts +8 -14
- package/front_end/third_party/lighthouse/report/bundle.js +10 -49
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
- package/front_end/third_party/web-vitals/README.chromium +5 -8
- package/front_end/third_party/web-vitals/package/README.md +191 -152
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.d.ts +0 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/index.js +0 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.js +45 -26
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +3 -3
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +10 -10
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +307 -206
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +69 -49
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/index.d.ts +0 -1
- package/front_end/third_party/web-vitals/package/dist/modules/index.js +0 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +33 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +111 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +4 -0
- package/front_end/third_party/web-vitals/package/dist/modules/{attribution/deprecated.js → lib/LCPEntryManager.js} +6 -7
- package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.d.ts +6 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/LayoutShiftManager.js +44 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getActivationStart.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getNavigationEntry.js +5 -7
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +9 -12
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +52 -33
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +0 -2
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.d.ts +6 -0
- package/front_end/third_party/web-vitals/package/dist/modules/{deprecated.js → lib/initUnique.js} +11 -4
- package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +3 -6
- package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +6 -6
- package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.d.ts → whenIdleOrHidden.d.ts} +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/{whenIdle.js → whenIdleOrHidden.js} +10 -8
- package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +17 -35
- package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +3 -5
- package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +9 -7
- package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +27 -19
- package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +33 -26
- package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +2 -4
- package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +6 -5
- package/front_end/third_party/web-vitals/package/dist/modules/types/cls.d.ts +5 -3
- package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +80 -33
- package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +6 -2
- package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +28 -4
- package/front_end/third_party/web-vitals/package/dist/modules/types.js +0 -1
- package/front_end/third_party/web-vitals/package/package.json +4 -10
- package/front_end/third_party/web-vitals/package/src/attribution/index.ts +0 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +58 -33
- package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +4 -4
- package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +382 -258
- package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +96 -69
- package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +3 -3
- package/front_end/third_party/web-vitals/package/src/index.ts +0 -1
- package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +146 -0
- package/front_end/third_party/web-vitals/package/src/{attribution/deprecated.ts → lib/LCPEntryManager.ts} +6 -9
- package/front_end/third_party/web-vitals/package/src/lib/LayoutShiftManager.ts +50 -0
- package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/getActivationStart.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/getNavigationEntry.ts +5 -8
- package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +12 -12
- package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +57 -35
- package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +2 -2
- package/front_end/third_party/web-vitals/package/src/{deprecated.ts → lib/initUnique.ts} +14 -8
- package/front_end/third_party/web-vitals/package/src/lib/observe.ts +3 -11
- package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +12 -6
- package/front_end/third_party/web-vitals/package/src/lib/{whenIdle.ts → whenIdleOrHidden.ts} +10 -8
- package/front_end/third_party/web-vitals/package/src/onCLS.ts +17 -38
- package/front_end/third_party/web-vitals/package/src/onFCP.ts +3 -6
- package/front_end/third_party/web-vitals/package/src/onINP.ts +33 -28
- package/front_end/third_party/web-vitals/package/src/onLCP.ts +36 -29
- package/front_end/third_party/web-vitals/package/src/onTTFB.ts +2 -5
- package/front_end/third_party/web-vitals/package/src/types/base.ts +5 -5
- package/front_end/third_party/web-vitals/package/src/types/cls.ts +5 -3
- package/front_end/third_party/web-vitals/package/src/types/inp.ts +88 -33
- package/front_end/third_party/web-vitals/package/src/types/lcp.ts +6 -2
- package/front_end/third_party/web-vitals/package/src/types.ts +47 -4
- package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +75 -0
- package/front_end/third_party/web-vitals/rebuild.sh +32 -18
- package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +5 -10
- package/front_end/third_party/web-vitals/web-vitals.ts +0 -2
- package/front_end/ui/components/docs/console_insight/basic.ts +3 -2
- package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +2 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +0 -2
- package/front_end/ui/legacy/InspectorView.ts +2 -0
- package/front_end/ui/legacy/ListWidget.ts +2 -2
- package/front_end/ui/legacy/SplitWidget.ts +2 -0
- package/front_end/ui/legacy/TabbedPane.ts +1 -0
- package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -0
- package/front_end/ui/legacy/UIUtils.ts +8 -19
- package/front_end/ui/legacy/ViewManager.ts +1 -0
- package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +7 -20
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +2 -0
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -0
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +1 -0
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +1 -0
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +2 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +25 -0
- package/mcp/README.md +7 -0
- package/mcp/mcp.ts +8 -0
- package/package.json +1 -1
- package/front_end/models/live-metrics/web-vitals-injected/OnEachInteraction.ts +0 -34
- package/front_end/third_party/web-vitals/package/attribution.d.ts +0 -16
- package/front_end/third_party/web-vitals/package/attribution.js +0 -18
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/deprecated.d.ts +0 -7
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.d.ts +0 -11
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFID.js +0 -46
- package/front_end/third_party/web-vitals/package/dist/modules/deprecated.d.ts +0 -5
- package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.d.ts +0 -31
- package/front_end/third_party/web-vitals/package/dist/modules/lib/interactions.js +0 -107
- package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.d.ts +0 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/onHidden.js +0 -22
- package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.d.ts +0 -7
- package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/firstInputPolyfill.js +0 -147
- package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.d.ts +0 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/getFirstHiddenTimePolyfill.js +0 -25
- package/front_end/third_party/web-vitals/package/dist/modules/onFID.d.ts +0 -13
- package/front_end/third_party/web-vitals/package/dist/modules/onFID.js +0 -70
- package/front_end/third_party/web-vitals/package/dist/modules/types/fid.d.ts +0 -46
- package/front_end/third_party/web-vitals/package/dist/modules/types/fid.js +0 -16
- package/front_end/third_party/web-vitals/package/src/attribution/onFID.ts +0 -62
- package/front_end/third_party/web-vitals/package/src/lib/interactions.ts +0 -139
- package/front_end/third_party/web-vitals/package/src/lib/onHidden.ts +0 -23
- package/front_end/third_party/web-vitals/package/src/lib/polyfills/firstInputPolyfill.ts +0 -174
- package/front_end/third_party/web-vitals/package/src/onFID.ts +0 -105
- package/front_end/third_party/web-vitals/package/src/types/fid.ts +0 -65
- package/front_end/ui/components/text_editor/textEditor.css +0 -18
- package/front_end/ui/legacy/inlineButton.css +0 -22
- /package/front_end/entrypoints/{rehydrated_devtools_app/rehydrated_devtools_app.ts → trace_app/trace_app.ts} +0 -0
- /package/front_end/{models/persistence → panels/settings}/editFileSystemView.css +0 -0
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type { LoadState, Metric } from './base.js';
|
|
1
|
+
import type { LoadState, Metric, ReportOpts, AttributionReportOpts } from './base.js';
|
|
2
|
+
export interface INPReportOpts extends ReportOpts {
|
|
3
|
+
durationThreshold?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface INPAttributionReportOpts extends AttributionReportOpts {
|
|
6
|
+
durationThreshold?: number;
|
|
7
|
+
onEachInteraction?: (interaction: INPMetricWithAttribution) => void;
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* An INP-specific version of the Metric object.
|
|
4
11
|
*/
|
|
@@ -6,6 +13,21 @@ export interface INPMetric extends Metric {
|
|
|
6
13
|
name: 'INP';
|
|
7
14
|
entries: PerformanceEventTiming[];
|
|
8
15
|
}
|
|
16
|
+
export interface INPLongestScriptSummary {
|
|
17
|
+
/**
|
|
18
|
+
* The longest Long Animation Frame script entry that intersects the INP
|
|
19
|
+
* interaction.
|
|
20
|
+
*/
|
|
21
|
+
entry: PerformanceScriptTiming;
|
|
22
|
+
/**
|
|
23
|
+
* The INP subpart where the longest script ran.
|
|
24
|
+
*/
|
|
25
|
+
subpart: 'input-delay' | 'processing-duration' | 'presentation-delay';
|
|
26
|
+
/**
|
|
27
|
+
* The amount of time the longest script intersected the INP duration.
|
|
28
|
+
*/
|
|
29
|
+
intersectingDuration: number;
|
|
30
|
+
}
|
|
9
31
|
/**
|
|
10
32
|
* An object containing potentially-helpful debugging information that
|
|
11
33
|
* can be sent along with the INP value for the current page visit in order
|
|
@@ -13,37 +35,21 @@ export interface INPMetric extends Metric {
|
|
|
13
35
|
*/
|
|
14
36
|
export interface INPAttribution {
|
|
15
37
|
/**
|
|
16
|
-
*
|
|
17
|
-
* as part of the frame where the INP candidate interaction
|
|
18
|
-
* If this value is an empty string, that generally means the
|
|
19
|
-
* removed from the DOM after the interaction.
|
|
38
|
+
* By default, a selector identifying the element that the user first
|
|
39
|
+
* interacted with as part of the frame where the INP candidate interaction
|
|
40
|
+
* occurred. If this value is an empty string, that generally means the
|
|
41
|
+
* element was removed from the DOM after the interaction. If the
|
|
42
|
+
* `generateTarget` configuration option was passed, then this will instead
|
|
43
|
+
* be the return value of that function, falling back to the default if that
|
|
44
|
+
* returns null or undefined.
|
|
20
45
|
*/
|
|
21
46
|
interactionTarget: string;
|
|
22
|
-
/**
|
|
23
|
-
* A reference to the HTML element identified by `interactionTargetSelector`.
|
|
24
|
-
* NOTE: for attribution purpose, a selector identifying the element is
|
|
25
|
-
* typically more useful than the element itself. However, the element is
|
|
26
|
-
* also made available in case additional context is needed.
|
|
27
|
-
*/
|
|
28
|
-
interactionTargetElement: Node | undefined;
|
|
29
47
|
/**
|
|
30
48
|
* The time when the user first interacted during the frame where the INP
|
|
31
49
|
* candidate interaction occurred (if more than one interaction occurred
|
|
32
50
|
* within the frame, only the first time is reported).
|
|
33
51
|
*/
|
|
34
52
|
interactionTime: DOMHighResTimeStamp;
|
|
35
|
-
/**
|
|
36
|
-
* The best-guess timestamp of the next paint after the interaction.
|
|
37
|
-
* In general, this timestamp is the same as the `startTime + duration` of
|
|
38
|
-
* the event timing entry. However, since `duration` values are rounded to
|
|
39
|
-
* the nearest 8ms, it can sometimes appear that the paint occurred before
|
|
40
|
-
* processing ended (which cannot happen). This value clamps the paint time
|
|
41
|
-
* so it's always after `processingEnd` from the Event Timing API and
|
|
42
|
-
* `renderStart` from the Long Animation Frame API (where available).
|
|
43
|
-
* It also averages the duration values for all entries in the same
|
|
44
|
-
* animation frame, which should be closer to the "real" value.
|
|
45
|
-
*/
|
|
46
|
-
nextPaintTime: DOMHighResTimeStamp;
|
|
47
53
|
/**
|
|
48
54
|
* The type of interaction, based on the event type of the `event` entry
|
|
49
55
|
* that corresponds to the interaction (i.e. the first `event` entry
|
|
@@ -52,20 +58,19 @@ export interface INPAttribution {
|
|
|
52
58
|
* and for "keydown" or "keyup" events this will be "keyboard".
|
|
53
59
|
*/
|
|
54
60
|
interactionType: 'pointer' | 'keyboard';
|
|
61
|
+
/**
|
|
62
|
+
* The best-guess timestamp of the next paint after the interaction.
|
|
63
|
+
* In general, this timestamp is the same as the `startTime + duration` of
|
|
64
|
+
* the event timing entry. However, since duration values are rounded to the
|
|
65
|
+
* nearest 8ms (and can be rounded down), this value is clamped to always be
|
|
66
|
+
* reported after the processing times.
|
|
67
|
+
*/
|
|
68
|
+
nextPaintTime: DOMHighResTimeStamp;
|
|
55
69
|
/**
|
|
56
70
|
* An array of Event Timing entries that were processed within the same
|
|
57
71
|
* animation frame as the INP candidate interaction.
|
|
58
72
|
*/
|
|
59
73
|
processedEventEntries: PerformanceEventTiming[];
|
|
60
|
-
/**
|
|
61
|
-
* If the browser supports the Long Animation Frame API, this array will
|
|
62
|
-
* include any `long-animation-frame` entries that intersect with the INP
|
|
63
|
-
* candidate interaction's `startTime` and the `processingEnd` time of the
|
|
64
|
-
* last event processed within that animation frame. If the browser does not
|
|
65
|
-
* support the Long Animation Frame API or no `long-animation-frame` entries
|
|
66
|
-
* are detect, this array will be empty.
|
|
67
|
-
*/
|
|
68
|
-
longAnimationFrameEntries: PerformanceLongAnimationFrameTiming[];
|
|
69
74
|
/**
|
|
70
75
|
* The time from when the user interacted with the page until when the
|
|
71
76
|
* browser was first able to start processing event listeners for that
|
|
@@ -94,6 +99,48 @@ export interface INPAttribution {
|
|
|
94
99
|
* (e.g. usually in the `dom-interactive` phase) it can result in long delays.
|
|
95
100
|
*/
|
|
96
101
|
loadState: LoadState;
|
|
102
|
+
/**
|
|
103
|
+
* If the browser supports the Long Animation Frame API, this array will
|
|
104
|
+
* include any `long-animation-frame` entries that intersect with the INP
|
|
105
|
+
* candidate interaction's `startTime` and the `processingEnd` time of the
|
|
106
|
+
* last event processed within that animation frame. If the browser does not
|
|
107
|
+
* support the Long Animation Frame API or no `long-animation-frame` entries
|
|
108
|
+
* are detected, this array will be empty.
|
|
109
|
+
*/
|
|
110
|
+
longAnimationFrameEntries: PerformanceLongAnimationFrameTiming[];
|
|
111
|
+
/**
|
|
112
|
+
* Summary information about the longest script entry intersecting the INP
|
|
113
|
+
* duration. Note, only script entries above 5 milliseconds are reported by
|
|
114
|
+
* the Long Animation Frame API.
|
|
115
|
+
*/
|
|
116
|
+
longestScript?: INPLongestScriptSummary;
|
|
117
|
+
/**
|
|
118
|
+
* The total duration of Long Animation Frame scripts that intersect the INP
|
|
119
|
+
* duration excluding any forced style and layout (that is included in
|
|
120
|
+
* totalStyleAndLayout). Note, this is limited to scripts > 5 milliseconds.
|
|
121
|
+
*/
|
|
122
|
+
totalScriptDuration?: number;
|
|
123
|
+
/**
|
|
124
|
+
* The total style and layout duration from any Long Animation Frames
|
|
125
|
+
* intersecting the INP interaction. This includes any end-of-frame style and
|
|
126
|
+
* layout duration + any forced style and layout duration.
|
|
127
|
+
*/
|
|
128
|
+
totalStyleAndLayoutDuration?: number;
|
|
129
|
+
/**
|
|
130
|
+
* The off main-thread presentation delay from the end of the last Long
|
|
131
|
+
* Animation Frame (where available) until the INP end point.
|
|
132
|
+
*/
|
|
133
|
+
totalPaintDuration?: number;
|
|
134
|
+
/**
|
|
135
|
+
* The total unattributed time not included in any of the previous totals.
|
|
136
|
+
* This includes scripts < 5 milliseconds and other timings not attributed
|
|
137
|
+
* by Long Animation Frame (including when a frame is < 50ms and so has no
|
|
138
|
+
* Long Animation Frame).
|
|
139
|
+
* When no Long Animation Frames are present this will be undefined, rather
|
|
140
|
+
* than everything being unattributed to make it clearer when it's expected
|
|
141
|
+
* to be small.
|
|
142
|
+
*/
|
|
143
|
+
totalUnattributedDuration?: number;
|
|
97
144
|
}
|
|
98
145
|
/**
|
|
99
146
|
* An INP-specific version of the Metric object with attribution.
|
|
@@ -13,9 +13,13 @@ export interface LCPMetric extends Metric {
|
|
|
13
13
|
*/
|
|
14
14
|
export interface LCPAttribution {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* By default, a selector identifying the element corresponding to the
|
|
17
|
+
* largest contentful paint for the page. If the `generateTarget`
|
|
18
|
+
* configuration option was passed, then this will instead be the return
|
|
19
|
+
* value of that function, falling back to the default if that returns null
|
|
20
|
+
* or undefined.
|
|
17
21
|
*/
|
|
18
|
-
|
|
22
|
+
target?: string;
|
|
19
23
|
/**
|
|
20
24
|
* The URL (if applicable) of the LCP image resource. If the LCP element
|
|
21
25
|
* is a text node, this value will not be set.
|
|
@@ -2,7 +2,6 @@ export * from './types/base.js';
|
|
|
2
2
|
export * from './types/polyfills.js';
|
|
3
3
|
export * from './types/cls.js';
|
|
4
4
|
export * from './types/fcp.js';
|
|
5
|
-
export * from './types/fid.js';
|
|
6
5
|
export * from './types/inp.js';
|
|
7
6
|
export * from './types/lcp.js';
|
|
8
7
|
export * from './types/ttfb.js';
|
|
@@ -30,7 +29,7 @@ declare global {
|
|
|
30
29
|
interactionId: number;
|
|
31
30
|
}
|
|
32
31
|
interface LayoutShiftAttribution {
|
|
33
|
-
node
|
|
32
|
+
node: Node | null;
|
|
34
33
|
previousRect: DOMRectReadOnly;
|
|
35
34
|
currentRect: DOMRectReadOnly;
|
|
36
35
|
}
|
|
@@ -47,8 +46,33 @@ declare global {
|
|
|
47
46
|
readonly url: string;
|
|
48
47
|
readonly element: Element | null;
|
|
49
48
|
}
|
|
49
|
+
export type ScriptInvokerType = 'classic-script' | 'module-script' | 'event-listener' | 'user-callback' | 'resolve-promise' | 'reject-promise';
|
|
50
|
+
export type ScriptWindowAttribution = 'self' | 'descendant' | 'ancestor' | 'same-page' | 'other';
|
|
51
|
+
interface PerformanceScriptTiming extends PerformanceEntry {
|
|
52
|
+
readonly startTime: DOMHighResTimeStamp;
|
|
53
|
+
readonly duration: DOMHighResTimeStamp;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly entryType: string;
|
|
56
|
+
readonly invokerType: ScriptInvokerType;
|
|
57
|
+
readonly invoker: string;
|
|
58
|
+
readonly executionStart: DOMHighResTimeStamp;
|
|
59
|
+
readonly sourceURL: string;
|
|
60
|
+
readonly sourceFunctionName: string;
|
|
61
|
+
readonly sourceCharPosition: number;
|
|
62
|
+
readonly pauseDuration: DOMHighResTimeStamp;
|
|
63
|
+
readonly forcedStyleAndLayoutDuration: DOMHighResTimeStamp;
|
|
64
|
+
readonly window?: Window;
|
|
65
|
+
readonly windowAttribution: ScriptWindowAttribution;
|
|
66
|
+
}
|
|
50
67
|
interface PerformanceLongAnimationFrameTiming extends PerformanceEntry {
|
|
51
|
-
|
|
52
|
-
duration: DOMHighResTimeStamp;
|
|
68
|
+
readonly startTime: DOMHighResTimeStamp;
|
|
69
|
+
readonly duration: DOMHighResTimeStamp;
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly entryType: string;
|
|
72
|
+
readonly renderStart: DOMHighResTimeStamp;
|
|
73
|
+
readonly styleAndLayoutStart: DOMHighResTimeStamp;
|
|
74
|
+
readonly blockingDuration: DOMHighResTimeStamp;
|
|
75
|
+
readonly firstUIEventTimestamp: DOMHighResTimeStamp;
|
|
76
|
+
readonly scripts: PerformanceScriptTiming[];
|
|
53
77
|
}
|
|
54
78
|
}
|
|
@@ -17,7 +17,6 @@ export * from './types/base.js';
|
|
|
17
17
|
export * from './types/polyfills.js';
|
|
18
18
|
export * from './types/cls.js';
|
|
19
19
|
export * from './types/fcp.js';
|
|
20
|
-
export * from './types/fid.js';
|
|
21
20
|
export * from './types/inp.js';
|
|
22
21
|
export * from './types/lcp.js';
|
|
23
22
|
export * from './types/ttfb.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-vitals",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Easily measure performance metrics in JavaScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"typings": "dist/modules/index.d.ts",
|
|
@@ -31,10 +31,6 @@
|
|
|
31
31
|
"types": "./dist/modules/onFCP.d.ts",
|
|
32
32
|
"default": "./dist/modules/onFCP.js"
|
|
33
33
|
},
|
|
34
|
-
"./onFID.js": {
|
|
35
|
-
"types": "./dist/modules/onFID.d.ts",
|
|
36
|
-
"default": "./dist/modules/onFID.js"
|
|
37
|
-
},
|
|
38
34
|
"./onINP.js": {
|
|
39
35
|
"types": "./dist/modules/onINP.d.ts",
|
|
40
36
|
"default": "./dist/modules/onINP.js"
|
|
@@ -55,10 +51,6 @@
|
|
|
55
51
|
"types": "./dist/modules/attribution/onFCP.d.ts",
|
|
56
52
|
"default": "./dist/modules/attribution/onFCP.js"
|
|
57
53
|
},
|
|
58
|
-
"./attribution/onFID.js": {
|
|
59
|
-
"types": "./dist/modules/attribution/onFID.d.ts",
|
|
60
|
-
"default": "./dist/modules/attribution/onFID.js"
|
|
61
|
-
},
|
|
62
54
|
"./attribution/onINP.js": {
|
|
63
55
|
"types": "./dist/modules/attribution/onINP.d.ts",
|
|
64
56
|
"default": "./dist/modules/attribution/onINP.js"
|
|
@@ -92,6 +84,9 @@
|
|
|
92
84
|
"release:major": "npm version major -m 'Release v%s' && npm publish",
|
|
93
85
|
"release:minor": "npm version minor -m 'Release v%s' && npm publish",
|
|
94
86
|
"release:patch": "npm version patch -m 'Release v%s' && npm publish",
|
|
87
|
+
"release:alpha": "npm version prerelease --preid=alpha -m 'Release v%s' && npm publish --tag next",
|
|
88
|
+
"release:beta": "npm version prerelease --preid=beta -m 'Release v%s' && npm publish --tag next",
|
|
89
|
+
"release:rc": "npm version prerelease --preid=rc -m 'Release v%s' && npm publish --tag next",
|
|
95
90
|
"test": "npm-run-all build test:unit -p -r test:e2e test:server",
|
|
96
91
|
"test:e2e": "wdio wdio.conf.cjs",
|
|
97
92
|
"test:server": "node test/server.js",
|
|
@@ -110,7 +105,6 @@
|
|
|
110
105
|
"Core Web Vitals",
|
|
111
106
|
"CLS",
|
|
112
107
|
"FCP",
|
|
113
|
-
"FID",
|
|
114
108
|
"INP",
|
|
115
109
|
"LCP",
|
|
116
110
|
"TTFB"
|
|
@@ -14,51 +14,24 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import {LayoutShiftManager} from '../lib/LayoutShiftManager.js';
|
|
17
18
|
import {getLoadState} from '../lib/getLoadState.js';
|
|
18
19
|
import {getSelector} from '../lib/getSelector.js';
|
|
20
|
+
import {initUnique} from '../lib/initUnique.js';
|
|
19
21
|
import {onCLS as unattributedOnCLS} from '../onCLS.js';
|
|
20
22
|
import {
|
|
21
23
|
CLSAttribution,
|
|
22
24
|
CLSMetric,
|
|
23
25
|
CLSMetricWithAttribution,
|
|
24
|
-
|
|
26
|
+
AttributionReportOpts,
|
|
25
27
|
} from '../types.js';
|
|
26
28
|
|
|
27
29
|
const getLargestLayoutShiftEntry = (entries: LayoutShift[]) => {
|
|
28
|
-
return entries.reduce((a, b) => (a
|
|
30
|
+
return entries.reduce((a, b) => (a.value > b.value ? a : b));
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
const getLargestLayoutShiftSource = (sources: LayoutShiftAttribution[]) => {
|
|
32
|
-
return sources.find((s) => s.node
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const attributeCLS = (metric: CLSMetric): CLSMetricWithAttribution => {
|
|
36
|
-
// Use an empty object if no other attribution has been set.
|
|
37
|
-
let attribution: CLSAttribution = {};
|
|
38
|
-
|
|
39
|
-
if (metric.entries.length) {
|
|
40
|
-
const largestEntry = getLargestLayoutShiftEntry(metric.entries);
|
|
41
|
-
if (largestEntry && largestEntry.sources && largestEntry.sources.length) {
|
|
42
|
-
const largestSource = getLargestLayoutShiftSource(largestEntry.sources);
|
|
43
|
-
if (largestSource) {
|
|
44
|
-
attribution = {
|
|
45
|
-
largestShiftTarget: getSelector(largestSource.node),
|
|
46
|
-
largestShiftTime: largestEntry.startTime,
|
|
47
|
-
largestShiftValue: largestEntry.value,
|
|
48
|
-
largestShiftSource: largestSource,
|
|
49
|
-
largestShiftEntry: largestEntry,
|
|
50
|
-
loadState: getLoadState(largestEntry.startTime),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Use Object.assign to set property to keep tsc happy.
|
|
57
|
-
const metricWithAttribution: CLSMetricWithAttribution = Object.assign(
|
|
58
|
-
metric,
|
|
59
|
-
{attribution},
|
|
60
|
-
);
|
|
61
|
-
return metricWithAttribution;
|
|
34
|
+
return sources.find((s) => s.node?.nodeType === 1) || sources[0];
|
|
62
35
|
};
|
|
63
36
|
|
|
64
37
|
/**
|
|
@@ -84,8 +57,60 @@ const attributeCLS = (metric: CLSMetric): CLSMetricWithAttribution => {
|
|
|
84
57
|
*/
|
|
85
58
|
export const onCLS = (
|
|
86
59
|
onReport: (metric: CLSMetricWithAttribution) => void,
|
|
87
|
-
opts
|
|
60
|
+
opts: AttributionReportOpts = {},
|
|
88
61
|
) => {
|
|
62
|
+
// Clone the opts object to ensure it's unique, so we can initialize a
|
|
63
|
+
// single instance of the `LayoutShiftManager` class that's shared only with
|
|
64
|
+
// this function invocation and the `unattributedOnCLS()` invocation below
|
|
65
|
+
// (which is passed the same `opts` object).
|
|
66
|
+
opts = Object.assign({}, opts);
|
|
67
|
+
|
|
68
|
+
const layoutShiftManager = initUnique(opts, LayoutShiftManager);
|
|
69
|
+
const layoutShiftTargetMap: WeakMap<LayoutShiftAttribution, string> =
|
|
70
|
+
new WeakMap();
|
|
71
|
+
|
|
72
|
+
layoutShiftManager._onAfterProcessingUnexpectedShift = (
|
|
73
|
+
entry: LayoutShift,
|
|
74
|
+
) => {
|
|
75
|
+
if (entry?.sources?.length) {
|
|
76
|
+
const largestSource = getLargestLayoutShiftSource(entry.sources);
|
|
77
|
+
const node = largestSource?.node;
|
|
78
|
+
if (node) {
|
|
79
|
+
const customTarget = opts.generateTarget?.(node) ?? getSelector(node);
|
|
80
|
+
layoutShiftTargetMap.set(largestSource, customTarget);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const attributeCLS = (metric: CLSMetric): CLSMetricWithAttribution => {
|
|
86
|
+
// Use an empty object if no other attribution has been set.
|
|
87
|
+
let attribution: CLSAttribution = {};
|
|
88
|
+
|
|
89
|
+
if (metric.entries.length) {
|
|
90
|
+
const largestEntry = getLargestLayoutShiftEntry(metric.entries);
|
|
91
|
+
if (largestEntry?.sources?.length) {
|
|
92
|
+
const largestSource = getLargestLayoutShiftSource(largestEntry.sources);
|
|
93
|
+
if (largestSource) {
|
|
94
|
+
attribution = {
|
|
95
|
+
largestShiftTarget: layoutShiftTargetMap.get(largestSource),
|
|
96
|
+
largestShiftTime: largestEntry.startTime,
|
|
97
|
+
largestShiftValue: largestEntry.value,
|
|
98
|
+
largestShiftSource: largestSource,
|
|
99
|
+
largestShiftEntry: largestEntry,
|
|
100
|
+
loadState: getLoadState(largestEntry.startTime),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Use `Object.assign()` to ensure the original metric object is returned.
|
|
107
|
+
const metricWithAttribution: CLSMetricWithAttribution = Object.assign(
|
|
108
|
+
metric,
|
|
109
|
+
{attribution},
|
|
110
|
+
);
|
|
111
|
+
return metricWithAttribution;
|
|
112
|
+
};
|
|
113
|
+
|
|
89
114
|
unattributedOnCLS((metric: CLSMetric) => {
|
|
90
115
|
const metricWithAttribution = attributeCLS(metric);
|
|
91
116
|
onReport(metricWithAttribution);
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
FCPAttribution,
|
|
23
23
|
FCPMetric,
|
|
24
24
|
FCPMetricWithAttribution,
|
|
25
|
-
|
|
25
|
+
AttributionReportOpts,
|
|
26
26
|
} from '../types.js';
|
|
27
27
|
|
|
28
28
|
const attributeFCP = (metric: FCPMetric): FCPMetricWithAttribution => {
|
|
@@ -35,7 +35,7 @@ const attributeFCP = (metric: FCPMetric): FCPMetricWithAttribution => {
|
|
|
35
35
|
|
|
36
36
|
if (metric.entries.length) {
|
|
37
37
|
const navigationEntry = getNavigationEntry();
|
|
38
|
-
const fcpEntry = metric.entries
|
|
38
|
+
const fcpEntry = metric.entries.at(-1);
|
|
39
39
|
|
|
40
40
|
if (navigationEntry) {
|
|
41
41
|
const activationStart = navigationEntry.activationStart || 0;
|
|
@@ -51,7 +51,7 @@ const attributeFCP = (metric: FCPMetric): FCPMetricWithAttribution => {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// Use Object.assign to
|
|
54
|
+
// Use `Object.assign()` to ensure the original metric object is returned.
|
|
55
55
|
const metricWithAttribution: FCPMetricWithAttribution = Object.assign(
|
|
56
56
|
metric,
|
|
57
57
|
{attribution},
|
|
@@ -67,7 +67,7 @@ const attributeFCP = (metric: FCPMetric): FCPMetricWithAttribution => {
|
|
|
67
67
|
*/
|
|
68
68
|
export const onFCP = (
|
|
69
69
|
onReport: (metric: FCPMetricWithAttribution) => void,
|
|
70
|
-
opts
|
|
70
|
+
opts: AttributionReportOpts = {},
|
|
71
71
|
) => {
|
|
72
72
|
unattributedOnFCP((metric: FCPMetric) => {
|
|
73
73
|
const metricWithAttribution = attributeFCP(metric);
|