chrome-devtools-frontend 1.0.1664496 → 1.0.1665921
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/.agents/skills/devtools-testing-guidance/SKILL.md +48 -0
- package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +3 -3
- package/.agents/skills/repro-flaky-tests/SKILL.md +2 -2
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +7 -1
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +2 -0
- package/.agents/skills/version-control/SKILL.md +4 -3
- package/docs/ui_engineering.md +89 -0
- package/eslint.config.mjs +9 -2
- package/front_end/Images/rollup.config.mjs +1 -1
- package/front_end/Tests.js +15 -16
- package/front_end/core/common/Gzip.ts +2 -2
- package/front_end/core/common/Settings.ts +4 -20
- package/front_end/core/common/Srcset.ts +1 -1
- package/front_end/core/common/VersionController.ts +1 -1
- package/front_end/core/host/AidaClient.ts +19 -4
- package/front_end/core/host/AidaGcaTranslation.ts +2 -2
- package/front_end/core/host/GcaClient.ts +2 -2
- package/front_end/core/host/GdpClient.ts +3 -3
- package/front_end/core/host/InspectorFrontendHostStub.ts +1 -1
- package/front_end/core/host/ResourceLoader.ts +15 -15
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +2 -2
- package/front_end/core/protocol_client/InspectorBackend.ts +1 -1
- package/front_end/core/root/Runtime.ts +0 -1
- package/front_end/core/sdk/CSSMatchedStyles.ts +78 -3
- package/front_end/core/sdk/CSSMetadata.ts +17 -12
- package/front_end/core/sdk/CSSProperty.ts +1 -1
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +2 -2
- package/front_end/core/sdk/CSSRule.ts +3 -3
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +3 -3
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
- package/front_end/core/sdk/Connections.ts +1 -1
- package/front_end/core/sdk/DebuggerModel.ts +13 -13
- package/front_end/core/sdk/NetworkManager.ts +19 -19
- package/front_end/core/sdk/NetworkRequest.ts +57 -57
- package/front_end/core/sdk/OverlayModel.ts +1 -1
- package/front_end/core/sdk/PageResourceLoader.ts +2 -2
- package/front_end/core/sdk/RehydratingConnection.ts +5 -5
- package/front_end/core/sdk/ScreenCaptureModel.ts +1 -1
- package/front_end/core/sdk/Script.ts +2 -2
- package/front_end/core/sdk/ServerTiming.ts +7 -7
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +1 -1
- package/front_end/core/sdk/ServiceWorkerManager.ts +11 -11
- package/front_end/core/sdk/SourceMapScopeChainEntry.ts +2 -2
- package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
- package/front_end/core/sdk/StorageKeyManager.ts +1 -1
- package/front_end/core/sdk/sdk-meta.ts +98 -98
- package/front_end/devtools_compatibility.js +15 -13
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +4 -8
- package/front_end/entrypoints/main/MainImpl.ts +2 -3
- package/front_end/entrypoints/main/main-meta.ts +1 -16
- package/front_end/entrypoints/shell/shell.ts +1 -0
- package/front_end/entrypoints/trace_app/trace_app.ts +1 -0
- package/front_end/foundation/README.md +1 -1
- package/front_end/foundation/Universe.test.api.ts +73 -0
- package/front_end/foundation/Universe.ts +22 -0
- package/front_end/generated/InspectorBackendCommands.ts +2 -2
- package/front_end/generated/SupportedCSSProperties.js +1 -1
- package/front_end/generated/protocol.ts +19 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +1 -1
- package/front_end/models/ai_assistance/AiConversation.ts +1 -1
- package/front_end/models/ai_assistance/BuiltInAi.ts +1 -1
- package/front_end/models/ai_assistance/ChangeManager.ts +0 -70
- package/front_end/models/ai_assistance/ExtensionScope.ts +2 -36
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +9 -9
- package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -2
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +4 -4
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +21 -21
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +4 -4
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
- package/front_end/models/ai_assistance/ai_assistance.ts +0 -5
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +11 -4
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +8 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +14 -11
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +2 -2
- package/front_end/models/ai_assistance/performance/AICallTree.ts +2 -2
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -1
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -2
- package/front_end/models/ai_assistance/tools/GetStyles.ts +4 -4
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -5
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -2
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -2
- package/front_end/models/badges/badges-meta.ts +27 -0
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -3
- package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +6 -7
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +5 -4
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +72 -29
- package/front_end/models/bindings/ResourceMapping.ts +38 -32
- package/front_end/models/bindings/ResourceScriptMapping.ts +5 -7
- package/front_end/models/breakpoints/BreakpointManager.ts +2 -1
- package/front_end/models/har/Writer.ts +2 -2
- package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +1 -1
- package/front_end/models/issues_manager/GenericIssue.ts +1 -1
- package/front_end/models/issues_manager/IssuesManager.ts +14 -5
- package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +1 -1
- package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +2 -2
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +13 -2
- package/front_end/models/issues_manager/issues_manager.ts +0 -2
- package/front_end/models/live-metrics/LiveMetrics.ts +22 -5
- package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +1 -1
- package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +10 -4
- package/front_end/models/logs/logs-meta.ts +23 -16
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +2 -2
- package/front_end/models/persistence/IsolatedFileSystem.ts +1 -1
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +1 -1
- package/front_end/models/source_map_scopes/NamesResolver.ts +104 -86
- package/front_end/models/source_map_scopes/ScopeChainModel.ts +6 -2
- package/front_end/models/stack_trace/StackTraceModel.ts +1 -1
- package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -1
- package/front_end/models/trace/handlers/UserTimingsHandler.ts +17 -6
- package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -1
- package/front_end/models/trace/helpers/Timing.ts +1 -1
- package/front_end/models/trace/insights/Common.ts +1 -1
- package/front_end/models/trace/insights/DocumentLatency.ts +3 -3
- package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
- package/front_end/models/trace/insights/ModernHTTP.ts +1 -1
- package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +2 -2
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +14 -9
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -15
- package/front_end/panels/ai_assistance/ai_assistance.ts +1 -2
- package/front_end/panels/ai_assistance/components/ChatInput.ts +23 -19
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +9 -18
- package/front_end/panels/ai_assistance/components/ChatView.ts +2 -35
- package/front_end/panels/ai_assistance/components/DisabledWidget.ts +1 -1
- package/front_end/panels/ai_assistance/components/ExploreWidget.ts +4 -4
- package/front_end/panels/ai_assistance/components/ImageResize.ts +74 -0
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +2 -2
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +28 -29
- package/front_end/panels/animation/AnimationTimeline.ts +3 -3
- package/front_end/panels/animation/animationTimeline.css +0 -2
- package/front_end/panels/application/AppManifestView.ts +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -1
- package/front_end/panels/application/CookieItemsView.ts +1 -1
- package/front_end/panels/application/CrashReportContextView.ts +3 -3
- package/front_end/panels/application/DeviceBoundSessionsModel.ts +1 -1
- package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +1 -1
- package/front_end/panels/application/DeviceBoundSessionsView.ts +1 -1
- package/front_end/panels/application/IndexedDBViews.ts +1 -1
- package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -1
- package/front_end/panels/application/OriginTrialTreeView.ts +1 -1
- package/front_end/panels/application/ServiceWorkersView.ts +6 -6
- package/front_end/panels/application/StorageBucketsTreeElement.ts +1 -1
- package/front_end/panels/application/StorageItemsToolbar.ts +3 -3
- package/front_end/panels/application/WebMCPView.ts +7 -5
- package/front_end/panels/application/components/AdsView.ts +21 -6
- package/front_end/panels/application/components/BackForwardCacheView.ts +2 -2
- package/front_end/panels/application/components/ProtocolHandlersView.ts +1 -1
- package/front_end/panels/application/components/StorageMetadataView.ts +1 -1
- package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
- package/front_end/panels/application/preloading/components/PreloadingString.ts +3 -3
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -1
- package/front_end/panels/autofill/AutofillView.ts +1 -1
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +1 -1
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +2 -2
- package/front_end/panels/changes/ChangesSidebar.ts +2 -2
- package/front_end/panels/changes/ChangesView.ts +4 -5
- package/front_end/panels/changes/CombinedDiffView.ts +3 -3
- package/front_end/panels/changes/changes-meta.ts +2 -2
- package/front_end/panels/common/AiCodeCompletionTeaser.ts +1 -1
- package/front_end/panels/common/AiCodeGenerationTeaser.ts +3 -3
- package/front_end/panels/common/BadgeNotification.ts +8 -8
- package/front_end/panels/common/DOMLinkifier.ts +1 -1
- package/front_end/panels/common/GdpSignUpDialog.ts +2 -2
- package/front_end/panels/common/GeminiRebrandPromoDialog.ts +1 -1
- package/front_end/panels/common/aiCodeCompletionDisclaimer.css +0 -1
- package/front_end/panels/console/ConsoleInsightTeaser.ts +1 -1
- package/front_end/panels/console/ConsolePinPane.ts +3 -3
- package/front_end/panels/console/ConsolePrompt.ts +6 -4
- package/front_end/panels/console/ConsoleSidebar.ts +8 -10
- package/front_end/panels/console_counters/WarningErrorCounter.ts +10 -11
- package/front_end/panels/coverage/CoverageView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
- package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
- package/front_end/panels/elements/ComputedStyleWidget.ts +3 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +3 -3
- package/front_end/panels/elements/EventListenersWidget.ts +1 -3
- package/front_end/panels/elements/LayoutPane.ts +23 -13
- package/front_end/panels/elements/StandaloneStylesContainer.ts +7 -7
- package/front_end/panels/elements/StylePropertiesSection.ts +33 -5
- package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -5
- package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +6 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +4 -3
- package/front_end/panels/elements/elements-meta.ts +18 -2
- package/front_end/panels/emulation/DeviceModeToolbar.ts +100 -40
- package/front_end/panels/emulation/DeviceModeView.ts +5 -4
- package/front_end/panels/emulation/MediaQueryInspector.ts +35 -19
- package/front_end/panels/event_listeners/EventListenersView.ts +4 -4
- package/front_end/panels/explain/components/ConsoleInsight.ts +8 -9
- package/front_end/panels/explain/explain-meta.ts +3 -3
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +135 -167
- package/front_end/panels/layer_viewer/Layers3DView.ts +10 -23
- package/front_end/panels/layer_viewer/layer_viewer-meta.ts +27 -0
- package/front_end/panels/lighthouse/LighthouseController.ts +44 -55
- package/front_end/panels/lighthouse/LighthousePanel.ts +9 -9
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseStartView.ts +9 -12
- package/front_end/panels/lighthouse/LighthouseStatusView.ts +33 -33
- package/front_end/panels/lighthouse/RadioSetting.ts +1 -1
- package/front_end/panels/lighthouse/lighthouse-meta.ts +131 -1
- package/front_end/panels/media/EventDisplayTable.ts +67 -94
- package/front_end/panels/media/PlayerListView.ts +1 -1
- package/front_end/panels/media/eventDisplayTable.css +9 -4
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +5 -5
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
- package/front_end/panels/network/EventSourceMessagesView.ts +98 -107
- package/front_end/panels/network/NetworkLogViewColumns.ts +1 -1
- package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -1
- package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
- package/front_end/panels/network/RequestCookiesView.ts +2 -2
- package/front_end/panels/network/RequestHeadersView.ts +5 -5
- package/front_end/panels/network/RequestPayloadView.ts +4 -4
- package/front_end/panels/network/RequestTimingView.ts +2 -2
- package/front_end/panels/network/components/DirectSocketConnectionView.ts +1 -1
- package/front_end/panels/network/eventSourceMessagesView.css +12 -3
- package/front_end/panels/network/networkTimingTable.css +2 -2
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
- package/front_end/panels/profiler/BottomUpProfileDataGrid.ts +25 -29
- package/front_end/panels/profiler/HeapProfileView.ts +308 -247
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +13 -3
- package/front_end/panels/profiler/HeapSnapshotView.ts +30 -10
- package/front_end/panels/profiler/HeapTimelineOverview.ts +5 -2
- package/front_end/panels/profiler/ProfileDataGrid.ts +128 -157
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +17 -5
- package/front_end/panels/profiler/ProfilesPanel.ts +2 -2
- package/front_end/panels/profiler/TopDownProfileDataGrid.ts +17 -21
- package/front_end/panels/profiler/profilesPanel.css +9 -13
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/recorder/CreateRecordingView.ts +4 -4
- package/front_end/panels/recorder/RecorderPanel.ts +6 -6
- package/front_end/panels/recorder/RecordingView.ts +1 -1
- package/front_end/panels/recorder/ReplaySection.ts +1 -1
- package/front_end/panels/recorder/StepView.ts +1 -1
- package/front_end/panels/recorder/injected/rollup.config.mjs +1 -1
- package/front_end/panels/search/SearchView.ts +1 -1
- package/front_end/panels/security/SecurityPanel.ts +54 -41
- package/front_end/panels/sensors/LocationsSettingsTab.ts +246 -233
- package/front_end/panels/sensors/SensorsView.ts +1 -1
- package/front_end/panels/settings/AISettingsTab.ts +11 -10
- package/front_end/panels/settings/SettingsScreen.ts +29 -24
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +5 -5
- package/front_end/panels/sources/BreakpointEditDialog.ts +2 -2
- package/front_end/panels/sources/BreakpointsView.ts +1 -1
- package/front_end/panels/sources/CallStackSidebarPane.ts +2 -2
- package/front_end/panels/sources/DebuggerPausedMessage.ts +2 -2
- package/front_end/panels/sources/DebuggerPlugin.ts +25 -22
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -1
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +7 -5
- package/front_end/panels/sources/sources-meta.ts +1 -1
- package/front_end/panels/timeline/CountersGraph.ts +1 -2
- package/front_end/panels/timeline/ExtensionTrackAppender.ts +1 -1
- package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +2 -2
- package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -4
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +1 -1
- package/front_end/panels/timeline/TimelinePanel.ts +53 -81
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +10 -3
- package/front_end/panels/timeline/TimelineUIUtils.ts +18 -4
- package/front_end/panels/timeline/TrackConfigBanner.ts +1 -1
- package/front_end/panels/timeline/components/ExportTraceOptions.ts +1 -1
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +8 -9
- package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +1 -1
- package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +1 -1
- package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +2 -2
- package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +1 -1
- package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +1 -1
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +5 -0
- package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +13 -8
- package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +1 -0
- package/front_end/panels/timeline/timeline-meta.ts +169 -0
- package/front_end/panels/timeline/timelineFlameChartView.css +5 -0
- package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
- package/front_end/panels/whats_new/ReleaseNoteText.ts +9 -9
- package/front_end/panels/whats_new/resources/WNDT.md +7 -8
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/web-vitals/README.chromium +2 -2
- package/front_end/third_party/web-vitals/package/README.md +120 -19
- package/front_end/third_party/web-vitals/package/attribution.d.ts +16 -0
- package/front_end/third_party/web-vitals/package/attribution.js +18 -0
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +1 -7
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +53 -32
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +43 -12
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +21 -3
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +30 -24
- package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.d.ts +3 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.js +18 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +2 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +18 -2
- package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +1 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.js +1 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.d.ts +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/getLoadState.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.js +7 -7
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +4 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +7 -3
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +20 -11
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.js +8 -3
- package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.d.ts +3 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +19 -4
- package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.d.ts +3 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.js +38 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/whenIdleOrHidden.js +5 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onCLS.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +30 -11
- package/front_end/third_party/web-vitals/package/dist/modules/onFCP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +36 -4
- package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +42 -22
- package/front_end/third_party/web-vitals/package/dist/modules/onLCP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +109 -30
- package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +25 -7
- package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +24 -1
- package/front_end/third_party/web-vitals/package/dist/modules/types/fcp.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +14 -6
- package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/types/ttfb.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +26 -4
- package/front_end/third_party/web-vitals/package/package.json +21 -22
- package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +62 -39
- package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +52 -15
- package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +25 -7
- package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +43 -37
- package/front_end/third_party/web-vitals/package/src/lib/{polyfills/getFirstHiddenTimePolyfill.ts → FCPEntryManager.ts} +4 -14
- package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +22 -2
- package/front_end/third_party/web-vitals/package/src/lib/LCPEntryManager.ts +1 -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/getLoadState.ts +11 -12
- package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +4 -1
- package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +24 -11
- package/front_end/third_party/web-vitals/package/src/lib/initUnique.ts +12 -4
- package/front_end/third_party/web-vitals/package/src/lib/observe.ts +26 -5
- package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/softNavs.ts +48 -0
- package/front_end/third_party/web-vitals/package/src/lib/whenIdleOrHidden.ts +12 -4
- package/front_end/third_party/web-vitals/package/src/onCLS.ts +75 -18
- package/front_end/third_party/web-vitals/package/src/onFCP.ts +66 -7
- package/front_end/third_party/web-vitals/package/src/onINP.ts +100 -39
- package/front_end/third_party/web-vitals/package/src/onLCP.ts +169 -34
- package/front_end/third_party/web-vitals/package/src/onTTFB.ts +50 -13
- package/front_end/third_party/web-vitals/package/src/types/base.ts +31 -10
- package/front_end/third_party/web-vitals/package/src/types/fcp.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/types/inp.ts +14 -6
- package/front_end/third_party/web-vitals/package/src/types/lcp.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/types/ttfb.ts +2 -2
- package/front_end/third_party/web-vitals/package/src/types.ts +32 -9
- package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +11 -11
- package/front_end/third_party/web-vitals/rebuild.sh +2 -2
- package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +2 -0
- package/front_end/ui/components/buttons/Button.ts +16 -0
- package/front_end/ui/components/dialogs/Dialog.ts +1 -1
- package/front_end/ui/components/highlighting/HighlightManager.ts +6 -1
- package/front_end/ui/components/highlighting/highlighting.ts +1 -1
- package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +2 -2
- package/front_end/ui/components/settings/SettingCheckbox.ts +12 -7
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +2 -2
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +6 -6
- package/front_end/ui/components/text_editor/javascript.ts +3 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/legacy/ContextMenu.ts +12 -2
- package/front_end/ui/legacy/ListControl.ts +1 -1
- package/front_end/ui/legacy/SelectMenu.docs.ts +17 -19
- package/front_end/ui/legacy/Toolbar.ts +4 -1
- package/front_end/ui/legacy/Treeoutline.ts +1 -1
- package/front_end/ui/legacy/components/color_picker/spectrum.css +1 -2
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +50 -4
- package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +4 -4
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +8 -7
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +14 -11
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +1 -1
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +15 -5
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -4
- package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -1
- package/front_end/ui/lit/render.ts +1 -1
- package/front_end/ui/settings/SettingUIRegistration.ts +8 -3
- package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
- package/front_end/ui/visual_logging/LoggingEvents.ts +1 -1
- package/inspector_overlay/main.ts +1 -1
- package/mcp/mcp.ts +5 -4
- package/package.json +13 -13
- package/front_end/models/ai_assistance/AgentProject.ts +0 -261
- package/front_end/models/ai_assistance/agents/PatchAgent.ts +0 -306
- package/front_end/models/issues_manager/CheckFormsIssuesTrigger.ts +0 -45
- package/front_end/models/text_utils/text_utils.ts +0 -5
- package/front_end/panels/ai_assistance/PatchWidget.ts +0 -867
- package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +0 -368
- package/front_end/panels/ai_assistance/selectWorkspaceDialog.css +0 -92
|
@@ -14,17 +14,23 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {onBFCacheRestore} from './lib/bfcache.js';
|
|
17
|
+
import {getBFCacheRestoreTime, onBFCacheRestore} from './lib/bfcache.js';
|
|
18
18
|
import {bindReporter} from './lib/bindReporter.js';
|
|
19
19
|
import {doubleRAF} from './lib/doubleRAF.js';
|
|
20
|
+
import {getVisibilityWatcher} from './lib/getVisibilityWatcher.js';
|
|
20
21
|
import {initMetric} from './lib/initMetric.js';
|
|
21
22
|
import {initUnique} from './lib/initUnique.js';
|
|
22
23
|
import {LayoutShiftManager} from './lib/LayoutShiftManager.js';
|
|
23
24
|
import {observe} from './lib/observe.js';
|
|
25
|
+
import {checkSoftNavsEnabled} from './lib/softNavs.js';
|
|
24
26
|
import {runOnce} from './lib/runOnce.js';
|
|
25
27
|
import {onFCP} from './onFCP.js';
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
+
import type {
|
|
29
|
+
CLSMetric,
|
|
30
|
+
Metric,
|
|
31
|
+
MetricRatingThresholds,
|
|
32
|
+
ReportOpts,
|
|
33
|
+
} from './types.js';
|
|
28
34
|
|
|
29
35
|
/** Thresholds for CLS. See https://web.dev/articles/cls#what_is_a_good_cls_score */
|
|
30
36
|
export const CLSThresholds: MetricRatingThresholds = [0.1, 0.25];
|
|
@@ -64,44 +70,95 @@ export const onCLS = (
|
|
|
64
70
|
|
|
65
71
|
const layoutShiftManager = initUnique(opts, LayoutShiftManager);
|
|
66
72
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
const initNewCLSMetric = (
|
|
74
|
+
navigationType?: Metric['navigationType'],
|
|
75
|
+
navigationId?: number,
|
|
76
|
+
navigationInteractionId?: number,
|
|
77
|
+
navigationURL?: string,
|
|
78
|
+
navigationStartTime?: number,
|
|
79
|
+
) => {
|
|
80
|
+
metric = initMetric(
|
|
81
|
+
'CLS',
|
|
82
|
+
0,
|
|
83
|
+
navigationType,
|
|
84
|
+
navigationId,
|
|
85
|
+
navigationInteractionId,
|
|
86
|
+
navigationURL,
|
|
87
|
+
navigationStartTime,
|
|
88
|
+
);
|
|
89
|
+
layoutShiftManager._sessionValue = 0;
|
|
90
|
+
report = bindReporter(
|
|
91
|
+
onReport,
|
|
92
|
+
metric,
|
|
93
|
+
CLSThresholds,
|
|
94
|
+
opts.reportAllChanges,
|
|
95
|
+
);
|
|
96
|
+
};
|
|
71
97
|
|
|
98
|
+
const updateAndReportMetric = (forceReport: boolean = false) => {
|
|
72
99
|
// If the current session value is larger than the current CLS value,
|
|
73
100
|
// update CLS and the entries contributing to it.
|
|
74
101
|
if (layoutShiftManager._sessionValue > metric.value) {
|
|
75
102
|
metric.value = layoutShiftManager._sessionValue;
|
|
76
103
|
metric.entries = layoutShiftManager._sessionEntries;
|
|
77
|
-
report();
|
|
78
104
|
}
|
|
105
|
+
report(forceReport);
|
|
79
106
|
};
|
|
80
107
|
|
|
81
|
-
const
|
|
108
|
+
const handleSoftNavEntry = (entry: PerformanceSoftNavigation) => {
|
|
109
|
+
updateAndReportMetric(true);
|
|
110
|
+
initNewCLSMetric(
|
|
111
|
+
'soft-navigation',
|
|
112
|
+
entry.navigationId,
|
|
113
|
+
entry.interactionId,
|
|
114
|
+
entry.name,
|
|
115
|
+
entry.startTime,
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const handleEntries = (
|
|
120
|
+
entries: (LayoutShift | PerformanceSoftNavigation)[],
|
|
121
|
+
) => {
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
if (entry.entryType === 'soft-navigation') {
|
|
124
|
+
handleSoftNavEntry(entry as PerformanceSoftNavigation);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
layoutShiftManager._processEntry(entry as LayoutShift);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
updateAndReportMetric();
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const types = ['layout-shift'] as ('layout-shift' | 'soft-navigation')[];
|
|
134
|
+
if (checkSoftNavsEnabled(opts)) {
|
|
135
|
+
types.push('soft-navigation');
|
|
136
|
+
}
|
|
137
|
+
const po = observe(types, handleEntries);
|
|
82
138
|
if (po) {
|
|
83
139
|
report = bindReporter(
|
|
84
140
|
onReport,
|
|
85
141
|
metric,
|
|
86
142
|
CLSThresholds,
|
|
87
|
-
opts
|
|
143
|
+
opts.reportAllChanges,
|
|
88
144
|
);
|
|
89
145
|
|
|
90
146
|
visibilityWatcher.onHidden(() => {
|
|
91
|
-
handleEntries(
|
|
147
|
+
handleEntries(
|
|
148
|
+
po.takeRecords() as [LayoutShift | PerformanceSoftNavigation],
|
|
149
|
+
);
|
|
92
150
|
report(true);
|
|
93
151
|
});
|
|
94
152
|
|
|
95
153
|
// Only report after a bfcache restore if the `PerformanceObserver`
|
|
96
154
|
// successfully registered.
|
|
97
155
|
onBFCacheRestore(() => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
metric,
|
|
103
|
-
|
|
104
|
-
opts!.reportAllChanges,
|
|
156
|
+
initNewCLSMetric(
|
|
157
|
+
'back-forward-cache',
|
|
158
|
+
metric.navigationId,
|
|
159
|
+
metric.navigationInteractionId,
|
|
160
|
+
metric.navigationURL,
|
|
161
|
+
getBFCacheRestoreTime(),
|
|
105
162
|
);
|
|
106
163
|
|
|
107
164
|
doubleRAF(report);
|
|
@@ -14,15 +14,18 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {onBFCacheRestore} from './lib/bfcache.js';
|
|
18
17
|
import {bindReporter} from './lib/bindReporter.js';
|
|
18
|
+
import {checkSoftNavsEnabled, storeSoftNavEntry} from './lib/softNavs.js';
|
|
19
19
|
import {doubleRAF} from './lib/doubleRAF.js';
|
|
20
20
|
import {getActivationStart} from './lib/getActivationStart.js';
|
|
21
21
|
import {getVisibilityWatcher} from './lib/getVisibilityWatcher.js';
|
|
22
22
|
import {initMetric} from './lib/initMetric.js';
|
|
23
|
+
import {initUnique} from './lib/initUnique.js';
|
|
24
|
+
import {FCPEntryManager} from './lib/FCPEntryManager.js';
|
|
23
25
|
import {observe} from './lib/observe.js';
|
|
26
|
+
import {getBFCacheRestoreTime, onBFCacheRestore} from './lib/bfcache.js';
|
|
24
27
|
import {whenActivated} from './lib/whenActivated.js';
|
|
25
|
-
import {FCPMetric, MetricRatingThresholds, ReportOpts} from './types.js';
|
|
28
|
+
import type {FCPMetric, MetricRatingThresholds, ReportOpts} from './types.js';
|
|
26
29
|
|
|
27
30
|
/** Thresholds for FCP. See https://web.dev/articles/fcp#what_is_a_good_fcp_score */
|
|
28
31
|
export const FCPThresholds: MetricRatingThresholds = [1800, 3000];
|
|
@@ -37,7 +40,13 @@ export const onFCP = (
|
|
|
37
40
|
onReport: (metric: FCPMetric) => void,
|
|
38
41
|
opts: ReportOpts = {},
|
|
39
42
|
) => {
|
|
43
|
+
const softNavsEnabled = checkSoftNavsEnabled(opts);
|
|
44
|
+
|
|
40
45
|
whenActivated(() => {
|
|
46
|
+
// Create a new FCP entry manager for each page activation
|
|
47
|
+
// This allows us to track soft navigations separately
|
|
48
|
+
// needed when attribution is enabled.
|
|
49
|
+
const fcpEntryManager = initUnique(opts, FCPEntryManager);
|
|
41
50
|
const visibilityWatcher = getVisibilityWatcher();
|
|
42
51
|
let metric = initMetric('FCP');
|
|
43
52
|
let report: ReturnType<typeof bindReporter>;
|
|
@@ -47,7 +56,7 @@ export const onFCP = (
|
|
|
47
56
|
if (entry.name === 'first-contentful-paint') {
|
|
48
57
|
po!.disconnect();
|
|
49
58
|
|
|
50
|
-
// Only report if the page wasn't hidden prior to
|
|
59
|
+
// Only report if the page wasn't hidden prior to FCP.
|
|
51
60
|
if (entry.startTime < visibilityWatcher.firstHiddenTime) {
|
|
52
61
|
// The activationStart reference is used because FCP should be
|
|
53
62
|
// relative to page activation rather than navigation start if the
|
|
@@ -55,31 +64,41 @@ export const onFCP = (
|
|
|
55
64
|
// after the FCP, this time should be clamped at 0.
|
|
56
65
|
metric.value = Math.max(entry.startTime - getActivationStart(), 0);
|
|
57
66
|
metric.entries.push(entry);
|
|
67
|
+
metric.navigationId = entry.navigationId || metric.navigationId;
|
|
68
|
+
// FCP should only be reported once so can report right away
|
|
58
69
|
report(true);
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
72
|
}
|
|
62
73
|
};
|
|
63
74
|
|
|
64
|
-
const po = observe('paint', handleEntries);
|
|
75
|
+
const po = observe(['paint'], handleEntries);
|
|
65
76
|
|
|
66
77
|
if (po) {
|
|
67
78
|
report = bindReporter(
|
|
68
79
|
onReport,
|
|
69
80
|
metric,
|
|
70
81
|
FCPThresholds,
|
|
71
|
-
opts
|
|
82
|
+
opts.reportAllChanges,
|
|
72
83
|
);
|
|
73
84
|
|
|
74
85
|
// Only report after a bfcache restore if the `PerformanceObserver`
|
|
75
86
|
// successfully registered or the `paint` entry exists.
|
|
76
87
|
onBFCacheRestore((event) => {
|
|
77
|
-
metric = initMetric(
|
|
88
|
+
metric = initMetric(
|
|
89
|
+
'FCP',
|
|
90
|
+
-1,
|
|
91
|
+
'back-forward-cache',
|
|
92
|
+
metric.navigationId,
|
|
93
|
+
metric.navigationInteractionId,
|
|
94
|
+
metric.navigationURL,
|
|
95
|
+
getBFCacheRestoreTime(),
|
|
96
|
+
);
|
|
78
97
|
report = bindReporter(
|
|
79
98
|
onReport,
|
|
80
99
|
metric,
|
|
81
100
|
FCPThresholds,
|
|
82
|
-
opts
|
|
101
|
+
opts.reportAllChanges,
|
|
83
102
|
);
|
|
84
103
|
|
|
85
104
|
doubleRAF(() => {
|
|
@@ -88,5 +107,45 @@ export const onFCP = (
|
|
|
88
107
|
});
|
|
89
108
|
});
|
|
90
109
|
}
|
|
110
|
+
|
|
111
|
+
if (softNavsEnabled) {
|
|
112
|
+
// As first-contentful-paint is only reported once, we can handle soft
|
|
113
|
+
// navigations afterwards on their own for simplicity, as no need to
|
|
114
|
+
// observe both and sort the entries like for the other metrics
|
|
115
|
+
const handleSoftNavEntries = (entries: PerformanceSoftNavigation[]) => {
|
|
116
|
+
entries.forEach((entry) => {
|
|
117
|
+
// Store the soft navigation entries in the entry manager so that
|
|
118
|
+
// they can be retrieved for attribution if necessary. This code
|
|
119
|
+
// is only used when attribution is enabled which sets the
|
|
120
|
+
// _softNavigationEntryMap.
|
|
121
|
+
if (fcpEntryManager._softNavigationEntryMap && entry.navigationId) {
|
|
122
|
+
storeSoftNavEntry(fcpEntryManager._softNavigationEntryMap, entry);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Clamp FCP at 0. It should never be less, but better safe than sorry.
|
|
126
|
+
const FCPTime = Math.max(
|
|
127
|
+
(entry.presentationTime || entry.paintTime || 0) - entry.startTime,
|
|
128
|
+
0,
|
|
129
|
+
);
|
|
130
|
+
metric = initMetric(
|
|
131
|
+
'FCP',
|
|
132
|
+
FCPTime,
|
|
133
|
+
'soft-navigation',
|
|
134
|
+
entry.navigationId,
|
|
135
|
+
entry.interactionId,
|
|
136
|
+
entry.name,
|
|
137
|
+
entry.startTime,
|
|
138
|
+
);
|
|
139
|
+
report = bindReporter(
|
|
140
|
+
onReport,
|
|
141
|
+
metric,
|
|
142
|
+
FCPThresholds,
|
|
143
|
+
opts.reportAllChanges,
|
|
144
|
+
);
|
|
145
|
+
report(true);
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
observe(['soft-navigation'], handleSoftNavEntries, opts);
|
|
149
|
+
}
|
|
91
150
|
});
|
|
92
151
|
};
|
|
@@ -14,24 +14,36 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {onBFCacheRestore} from './lib/bfcache.js';
|
|
17
|
+
import {getBFCacheRestoreTime, onBFCacheRestore} from './lib/bfcache.js';
|
|
18
18
|
import {bindReporter} from './lib/bindReporter.js';
|
|
19
19
|
import {initMetric} from './lib/initMetric.js';
|
|
20
20
|
import {initUnique} from './lib/initUnique.js';
|
|
21
21
|
import {InteractionManager} from './lib/InteractionManager.js';
|
|
22
22
|
import {observe} from './lib/observe.js';
|
|
23
|
+
import {checkSoftNavsEnabled} from './lib/softNavs.js';
|
|
23
24
|
import {initInteractionCountPolyfill} from './lib/polyfills/interactionCountPolyfill.js';
|
|
24
25
|
import {whenActivated} from './lib/whenActivated.js';
|
|
25
26
|
import {getVisibilityWatcher} from './lib/getVisibilityWatcher.js';
|
|
26
27
|
import {whenIdleOrHidden} from './lib/whenIdleOrHidden.js';
|
|
27
28
|
|
|
28
|
-
import {
|
|
29
|
+
import type {
|
|
30
|
+
INPMetric,
|
|
31
|
+
Metric,
|
|
32
|
+
MetricRatingThresholds,
|
|
33
|
+
INPReportOpts,
|
|
34
|
+
} from './types.js';
|
|
29
35
|
|
|
30
36
|
/** Thresholds for INP. See https://web.dev/articles/inp#what_is_a_good_inp_score */
|
|
31
37
|
export const INPThresholds: MetricRatingThresholds = [200, 500];
|
|
32
38
|
|
|
33
39
|
// The default `durationThreshold` used across this library for observing
|
|
34
40
|
// `event` entries via PerformanceObserver.
|
|
41
|
+
// Event Timing entries have their durations rounded to the nearest 8ms,
|
|
42
|
+
// so a duration of 40ms would be any event that spans 2.5 or more frames
|
|
43
|
+
// at 60Hz. This threshold is chosen to strike a balance between usefulness
|
|
44
|
+
// and performance. Running this callback for any interaction that spans
|
|
45
|
+
// just one or two frames is likely not worth the insight that could be
|
|
46
|
+
// gained.
|
|
35
47
|
const DEFAULT_DURATION_THRESHOLD = 40;
|
|
36
48
|
|
|
37
49
|
/**
|
|
@@ -68,12 +80,10 @@ export const onINP = (
|
|
|
68
80
|
opts: INPReportOpts = {},
|
|
69
81
|
) => {
|
|
70
82
|
// Return if the browser doesn't support all APIs needed to measure INP.
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
)
|
|
76
|
-
) {
|
|
83
|
+
if (!(
|
|
84
|
+
globalThis.PerformanceEventTiming &&
|
|
85
|
+
'interactionId' in PerformanceEventTiming.prototype
|
|
86
|
+
)) {
|
|
77
87
|
return;
|
|
78
88
|
}
|
|
79
89
|
|
|
@@ -88,7 +98,59 @@ export const onINP = (
|
|
|
88
98
|
|
|
89
99
|
const interactionManager = initUnique(opts, InteractionManager);
|
|
90
100
|
|
|
91
|
-
const
|
|
101
|
+
const initNewINPMetric = (
|
|
102
|
+
navigationType?: Metric['navigationType'],
|
|
103
|
+
navigationId?: number,
|
|
104
|
+
navigationInteractionId?: number,
|
|
105
|
+
navigationURL?: string,
|
|
106
|
+
navigationStartTime?: number,
|
|
107
|
+
) => {
|
|
108
|
+
interactionManager._resetInteractions();
|
|
109
|
+
metric = initMetric(
|
|
110
|
+
'INP',
|
|
111
|
+
-1,
|
|
112
|
+
navigationType,
|
|
113
|
+
navigationId,
|
|
114
|
+
navigationInteractionId,
|
|
115
|
+
navigationURL,
|
|
116
|
+
navigationStartTime,
|
|
117
|
+
);
|
|
118
|
+
report = bindReporter(
|
|
119
|
+
onReport,
|
|
120
|
+
metric,
|
|
121
|
+
INPThresholds,
|
|
122
|
+
opts.reportAllChanges,
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const updateINPMetric = () => {
|
|
127
|
+
const inp = interactionManager._estimateP98LongestInteraction(
|
|
128
|
+
metric.navigationType,
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
if (inp && inp._latency !== metric.value) {
|
|
132
|
+
metric.value = inp._latency;
|
|
133
|
+
metric.entries = inp.entries;
|
|
134
|
+
report();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const handleSoftNavEntry = (entry: PerformanceSoftNavigation) => {
|
|
139
|
+
updateINPMetric();
|
|
140
|
+
report(true);
|
|
141
|
+
initNewINPMetric(
|
|
142
|
+
'soft-navigation',
|
|
143
|
+
entry.navigationId,
|
|
144
|
+
entry.interactionId,
|
|
145
|
+
entry.name,
|
|
146
|
+
entry.startTime,
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const handleEntries = (
|
|
151
|
+
entries: (PerformanceEventTiming | PerformanceSoftNavigation)[],
|
|
152
|
+
forceReport: boolean = false,
|
|
153
|
+
) => {
|
|
92
154
|
// Queue the `handleEntries()` callback in the next idle task.
|
|
93
155
|
// This is needed to increase the chances that all event entries that
|
|
94
156
|
// occurred between the user interaction and the next paint
|
|
@@ -97,28 +159,29 @@ export const onINP = (
|
|
|
97
159
|
// 123+ that if rolled out fully may make this no longer necessary.
|
|
98
160
|
whenIdleOrHidden(() => {
|
|
99
161
|
for (const entry of entries) {
|
|
100
|
-
|
|
162
|
+
if (entry.entryType === 'soft-navigation') {
|
|
163
|
+
handleSoftNavEntry(entry as PerformanceSoftNavigation);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
interactionManager._processEntry(entry as PerformanceEventTiming);
|
|
101
167
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (inp && inp._latency !== metric.value) {
|
|
106
|
-
metric.value = inp._latency;
|
|
107
|
-
metric.entries = inp.entries;
|
|
108
|
-
report();
|
|
168
|
+
updateINPMetric();
|
|
169
|
+
if (forceReport) {
|
|
170
|
+
report(true);
|
|
109
171
|
}
|
|
110
172
|
});
|
|
111
173
|
};
|
|
112
174
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
175
|
+
const types = ['event', 'first-input'] as (
|
|
176
|
+
'event' | 'first-input' | 'soft-navigation'
|
|
177
|
+
)[];
|
|
178
|
+
if (checkSoftNavsEnabled(opts)) {
|
|
179
|
+
types.push('soft-navigation');
|
|
180
|
+
}
|
|
181
|
+
const po = observe(types, handleEntries, {
|
|
182
|
+
...opts,
|
|
120
183
|
durationThreshold: opts.durationThreshold ?? DEFAULT_DURATION_THRESHOLD,
|
|
121
|
-
});
|
|
184
|
+
} as PerformanceObserverInit);
|
|
122
185
|
|
|
123
186
|
report = bindReporter(
|
|
124
187
|
onReport,
|
|
@@ -128,26 +191,24 @@ export const onINP = (
|
|
|
128
191
|
);
|
|
129
192
|
|
|
130
193
|
if (po) {
|
|
131
|
-
// Also observe entries of type `first-input`. This is useful in cases
|
|
132
|
-
// where the first interaction is less than the `durationThreshold`.
|
|
133
|
-
po.observe({type: 'first-input', buffered: true});
|
|
134
|
-
|
|
135
194
|
visibilityWatcher.onHidden(() => {
|
|
136
|
-
handleEntries(
|
|
137
|
-
|
|
195
|
+
handleEntries(
|
|
196
|
+
po.takeRecords() as [
|
|
197
|
+
PerformanceEventTiming | PerformanceSoftNavigation,
|
|
198
|
+
],
|
|
199
|
+
true, // forceReport after processing all entries
|
|
200
|
+
);
|
|
138
201
|
});
|
|
139
202
|
|
|
140
203
|
// Only report after a bfcache restore if the `PerformanceObserver`
|
|
141
204
|
// successfully registered.
|
|
142
205
|
onBFCacheRestore(() => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
INPThresholds,
|
|
150
|
-
opts.reportAllChanges,
|
|
206
|
+
initNewINPMetric(
|
|
207
|
+
'back-forward-cache',
|
|
208
|
+
metric.navigationId,
|
|
209
|
+
metric.navigationInteractionId,
|
|
210
|
+
metric.navigationURL,
|
|
211
|
+
getBFCacheRestoreTime(),
|
|
151
212
|
);
|
|
152
213
|
});
|
|
153
214
|
}
|