chrome-devtools-frontend 1.0.1512349 → 1.0.1513662
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/cookbook/release_management.md +15 -13
- package/docs/get_the_code.md +114 -35
- package/front_end/core/common/Color.ts +40 -44
- package/front_end/core/common/Console.ts +4 -4
- package/front_end/core/common/ParsedURL.ts +14 -14
- package/front_end/core/common/ResourceType.ts +20 -20
- package/front_end/core/common/SegmentedRange.ts +13 -14
- package/front_end/core/common/Settings.ts +4 -4
- package/front_end/core/common/StringOutputStream.ts +4 -4
- package/front_end/core/host/GdpClient.ts +38 -0
- package/front_end/core/host/InspectorFrontendHost.ts +4 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
- package/front_end/core/host/ResourceLoader.ts +2 -2
- package/front_end/core/host/UserMetrics.ts +0 -2
- package/front_end/core/protocol_client/InspectorBackend.ts +9 -9
- package/front_end/core/root/Runtime.ts +5 -2
- package/front_end/core/sdk/AccessibilityModel.ts +48 -48
- package/front_end/core/sdk/AnimationModel.ts +78 -79
- package/front_end/core/sdk/CPUProfilerModel.ts +5 -5
- package/front_end/core/sdk/CPUThrottlingManager.ts +17 -17
- package/front_end/core/sdk/CSSMatchedStyles.ts +44 -44
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSModel.ts +4 -4
- package/front_end/core/sdk/CSSProperty.ts +9 -9
- package/front_end/core/sdk/CSSPropertyParser.ts +1 -2
- package/front_end/core/sdk/CSSRule.ts +3 -3
- package/front_end/core/sdk/CSSStyleDeclaration.ts +27 -28
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +13 -13
- package/front_end/core/sdk/CategorizedBreakpoint.ts +4 -4
- package/front_end/core/sdk/ChildTargetManager.ts +6 -6
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +4 -4
- package/front_end/core/sdk/ConsoleModel.ts +24 -24
- package/front_end/core/sdk/Cookie.ts +16 -16
- package/front_end/core/sdk/CookieParser.ts +6 -6
- package/front_end/core/sdk/DOMDebuggerModel.ts +88 -89
- package/front_end/core/sdk/DOMModel.ts +113 -113
- package/front_end/core/sdk/DebuggerModel.ts +102 -103
- package/front_end/core/sdk/EmulationModel.ts +6 -6
- package/front_end/core/sdk/EventBreakpointsModel.ts +5 -5
- package/front_end/core/sdk/HeapProfilerModel.ts +5 -5
- package/front_end/core/sdk/IsolateManager.ts +26 -26
- package/front_end/core/sdk/LayerTreeBase.ts +29 -30
- package/front_end/core/sdk/OverlayModel.ts +6 -6
- package/front_end/core/sdk/Resource.ts +43 -43
- package/front_end/core/sdk/ResourceTreeModel.ts +58 -61
- package/front_end/core/sdk/RuntimeModel.ts +12 -13
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/Script.ts +17 -17
- package/front_end/core/sdk/SecurityOriginManager.ts +14 -14
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +15 -15
- package/front_end/core/sdk/ServiceWorkerManager.ts +19 -24
- package/front_end/core/sdk/SourceMap.ts +10 -10
- package/front_end/core/sdk/StorageKeyManager.ts +12 -12
- package/front_end/core/sdk/Target.ts +33 -34
- package/front_end/core/sdk/TargetManager.ts +20 -20
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +8 -8
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +7 -7
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +7 -7
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +24 -24
- package/front_end/entrypoints/main/GlobalAiButton.ts +3 -3
- package/front_end/entrypoints/main/MainImpl.ts +16 -14
- package/front_end/entrypoints/main/main-meta.ts +1 -2
- package/front_end/generated/InspectorBackendCommands.js +3 -2
- package/front_end/generated/SupportedCSSProperties.js +20 -0
- package/front_end/generated/protocol-mapping.d.ts +4 -0
- package/front_end/generated/protocol-proxy-api.d.ts +5 -0
- package/front_end/generated/protocol.ts +20 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +15 -16
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +127 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +149 -26
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +6 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +9 -10
- package/front_end/models/badges/AiExplorerBadge.ts +21 -0
- package/front_end/models/badges/Badge.ts +3 -5
- package/front_end/models/badges/CodeWhispererBadge.ts +21 -0
- package/front_end/models/badges/DOMDetectiveBadge.ts +4 -3
- package/front_end/models/badges/SpeedsterBadge.ts +6 -4
- package/front_end/models/badges/StarterBadge.ts +4 -3
- package/front_end/models/badges/UserBadges.ts +29 -3
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +6 -6
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +18 -18
- package/front_end/models/bindings/FileUtils.ts +15 -15
- package/front_end/models/bindings/ResourceScriptMapping.ts +14 -14
- package/front_end/models/elements/ElementUpdateRecord.ts +11 -11
- package/front_end/models/emulation/DeviceModeModel.ts +123 -131
- package/front_end/models/emulation/EmulatedDevices.ts +22 -22
- package/front_end/models/extensions/ExtensionPanel.ts +24 -24
- package/front_end/models/extensions/ExtensionServer.ts +4 -4
- package/front_end/models/javascript_metadata/NativeFunctions.js +14 -2
- package/front_end/models/persistence/IsolatedFileSystem.ts +18 -19
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +13 -13
- package/front_end/models/trace/EventsSerializer.ts +5 -5
- package/front_end/models/trace/LanternComputationData.ts +10 -10
- package/front_end/models/trace/ModelImpl.ts +32 -41
- package/front_end/models/trace/Processor.ts +28 -30
- package/front_end/models/trace/extras/FilmStrip.ts +6 -6
- package/front_end/models/trace/extras/StackTraceForEvent.ts +22 -25
- package/front_end/models/trace/extras/ThirdParties.ts +16 -17
- package/front_end/models/trace/extras/TraceFilter.ts +1 -1
- package/front_end/models/trace/handlers/Threads.ts +10 -10
- package/front_end/models/trace/handlers/helpers.ts +9 -9
- package/front_end/models/trace/handlers/types.ts +3 -3
- package/front_end/models/trace/insights/CLSCulprits.ts +12 -14
- package/front_end/models/trace/insights/Cache.ts +8 -4
- package/front_end/models/trace/insights/DOMSize.ts +8 -5
- package/front_end/models/trace/insights/DocumentLatency.ts +2 -2
- package/front_end/models/trace/insights/DuplicatedJavaScript.ts +3 -3
- package/front_end/models/trace/insights/FontDisplay.ts +3 -4
- package/front_end/models/trace/insights/ForcedReflow.ts +3 -3
- package/front_end/models/trace/insights/INPBreakdown.ts +2 -2
- package/front_end/models/trace/insights/ImageDelivery.ts +11 -11
- package/front_end/models/trace/insights/LCPBreakdown.ts +4 -4
- package/front_end/models/trace/insights/LCPDiscovery.ts +4 -4
- package/front_end/models/trace/insights/LegacyJavaScript.ts +2 -2
- package/front_end/models/trace/insights/ModernHTTP.ts +4 -5
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +12 -12
- package/front_end/models/trace/insights/RenderBlocking.ts +9 -10
- package/front_end/models/trace/insights/SlowCSSSelector.ts +2 -2
- package/front_end/models/trace/insights/ThirdParties.ts +4 -5
- package/front_end/models/trace/insights/Viewport.ts +8 -5
- package/front_end/models/trace/insights/types.ts +1 -0
- package/front_end/models/trace/lantern/testing/MetricTestUtils.ts +10 -10
- package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +52 -52
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +8 -8
- package/front_end/panels/animation/AnimationTimeline.ts +5 -5
- package/front_end/panels/animation/AnimationUI.ts +22 -23
- package/front_end/panels/application/ApplicationPanelSidebar.ts +12 -12
- package/front_end/panels/application/DOMStorageModel.ts +23 -23
- package/front_end/panels/application/ExtensionStorageModel.ts +31 -31
- package/front_end/panels/application/IndexedDBModel.ts +1 -0
- package/front_end/panels/application/PreloadingTreeElement.ts +8 -8
- package/front_end/panels/application/ServiceWorkersView.ts +0 -53
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -2
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -2
- package/front_end/panels/common/BadgeNotification.ts +24 -4
- package/front_end/panels/common/GdpSignUpDialog.ts +5 -0
- package/front_end/panels/common/badgeNotification.css +26 -9
- package/front_end/panels/console/ConsoleContextSelector.ts +9 -9
- package/front_end/panels/console/ConsolePrompt.ts +8 -5
- package/front_end/panels/console/ConsoleView.ts +13 -13
- package/front_end/panels/console/ConsoleViewport.ts +29 -29
- package/front_end/panels/coverage/CoverageModel.ts +22 -22
- package/front_end/panels/elements/ClassesPaneWidget.ts +1 -1
- package/front_end/panels/elements/ComputedStyleModel.ts +17 -18
- package/front_end/panels/elements/DOMPath.ts +2 -2
- package/front_end/panels/elements/ElementsPanel.ts +13 -13
- package/front_end/panels/elements/ElementsTreeElement.ts +18 -18
- package/front_end/panels/elements/ElementsTreeOutline.ts +41 -48
- package/front_end/panels/elements/ShortcutTreeElement.ts +4 -4
- package/front_end/panels/elements/StylePropertiesSection.ts +4 -4
- package/front_end/panels/elements/StylePropertyTreeElement.ts +49 -50
- package/front_end/panels/elements/StylesSidebarPane.ts +19 -19
- package/front_end/panels/emulation/DeviceModeToolbar.ts +7 -7
- package/front_end/panels/emulation/DeviceModeView.ts +6 -6
- package/front_end/panels/emulation/MediaQueryInspector.ts +18 -18
- package/front_end/panels/event_listeners/EventListenersView.ts +13 -14
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +3 -3
- package/front_end/panels/layer_viewer/LayerViewHost.ts +13 -13
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +9 -10
- package/front_end/panels/layer_viewer/TransformController.ts +34 -36
- package/front_end/panels/layers/LayerTreeModel.ts +41 -40
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +13 -13
- package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -7
- package/front_end/panels/media/PlayerMessagesView.ts +5 -5
- package/front_end/panels/media/TickingFlameChart.ts +24 -24
- package/front_end/panels/media/TickingFlameChartHelpers.ts +32 -32
- package/front_end/panels/network/NetworkItemView.ts +4 -4
- package/front_end/panels/network/NetworkLogViewColumns.ts +29 -29
- package/front_end/panels/network/NetworkPanel.ts +8 -5
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +10 -10
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +3 -3
- package/front_end/panels/profiler/HeapProfileView.ts +1 -1
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +3 -4
- package/front_end/panels/profiler/ProfileHeader.ts +25 -25
- package/front_end/panels/profiler/ProfileLauncherView.ts +5 -6
- package/front_end/panels/recorder/components/ReplaySection.ts +3 -1
- package/front_end/panels/security/OriginTreeElement.ts +8 -8
- package/front_end/panels/security/SecurityPanel.ts +5 -5
- package/front_end/panels/settings/SettingsScreen.ts +18 -12
- package/front_end/panels/settings/components/SyncSection.ts +20 -6
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +3 -0
- package/front_end/panels/sources/DebuggerPausedMessage.ts +8 -9
- package/front_end/panels/sources/NavigatorView.ts +43 -46
- package/front_end/panels/sources/SourcesPanel.ts +35 -35
- package/front_end/panels/sources/SourcesView.ts +13 -13
- package/front_end/panels/sources/TabbedEditorContainer.ts +19 -22
- package/front_end/panels/sources/UISourceCodeFrame.ts +4 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +34 -36
- package/front_end/panels/timeline/AnimationsTrackAppender.ts +3 -3
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +8 -8
- package/front_end/panels/timeline/CountersGraph.ts +16 -16
- package/front_end/panels/timeline/EntriesFilter.ts +4 -3
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +3 -3
- package/front_end/panels/timeline/GPUTrackAppender.ts +3 -3
- package/front_end/panels/timeline/Initiators.ts +10 -10
- package/front_end/panels/timeline/InteractionsTrackAppender.ts +5 -5
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +7 -7
- package/front_end/panels/timeline/ModificationsManager.ts +8 -15
- package/front_end/panels/timeline/TargetForEvent.ts +2 -2
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +1 -1
- package/front_end/panels/timeline/ThreadAppender.ts +13 -13
- package/front_end/panels/timeline/TimelineDetailsView.ts +6 -14
- package/front_end/panels/timeline/TimelineEventOverview.ts +27 -26
- package/front_end/panels/timeline/TimelineFilters.ts +5 -5
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +54 -53
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +34 -34
- package/front_end/panels/timeline/TimelineFlameChartView.ts +18 -31
- package/front_end/panels/timeline/TimelineHistoryManager.ts +17 -18
- package/front_end/panels/timeline/TimelineMiniMap.ts +6 -6
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +6 -6
- package/front_end/panels/timeline/TimelinePanel.ts +52 -59
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +7 -5
- package/front_end/panels/timeline/TimelineTreeView.ts +10 -10
- package/front_end/panels/timeline/TimelineUIUtils.ts +43 -43
- package/front_end/panels/timeline/TimingsTrackAppender.ts +12 -12
- package/front_end/panels/timeline/TracingLayerTree.ts +43 -43
- package/front_end/panels/timeline/TrackConfigBanner.ts +6 -6
- package/front_end/panels/timeline/TrackConfiguration.ts +1 -1
- package/front_end/panels/timeline/components/DetailsView.ts +4 -4
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +12 -21
- package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -1
- package/front_end/panels/timeline/components/NetworkRequestDetails.ts +5 -5
- package/front_end/panels/timeline/components/Sidebar.ts +4 -14
- package/front_end/panels/timeline/components/SidebarInsightsTab.ts +13 -36
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +21 -19
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +1 -1
- package/front_end/panels/timeline/components/insights/Cache.ts +4 -0
- package/front_end/panels/timeline/components/insights/DOMSize.ts +5 -1
- package/front_end/panels/timeline/components/insights/Helpers.ts +19 -0
- package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +1 -1
- package/front_end/panels/timeline/components/insights/Viewport.ts +4 -0
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
- package/front_end/panels/timeline/utils/AICallTree.ts +11 -11
- package/front_end/panels/timeline/utils/AIContext.ts +17 -19
- package/front_end/panels/timeline/utils/EntityMapper.ts +6 -5
- package/front_end/panels/timeline/utils/EntryName.ts +2 -2
- package/front_end/panels/timeline/utils/EntryNodes.ts +5 -5
- package/front_end/panels/timeline/utils/EntryStyles.ts +4 -4
- package/front_end/panels/timeline/utils/FreshRecording.ts +3 -3
- package/front_end/panels/timeline/utils/Helpers.ts +0 -18
- package/front_end/panels/timeline/utils/InsightAIContext.ts +6 -6
- package/front_end/panels/timeline/utils/SourceMapsResolver.ts +7 -7
- package/front_end/panels/webauthn/WebauthnPane.ts +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/angular.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/legacy.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/vue.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +1 -1
- package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
- package/front_end/third_party/json5/rebuild.sh +1 -1
- package/front_end/third_party/legacy-javascript/{update.sh → rebuild.sh} +1 -1
- package/front_end/third_party/lit/lib/decorators.d.ts +26 -9
- package/front_end/third_party/lit/lib/decorators.js +5 -5
- package/front_end/third_party/lit/lib/decorators.js.map +1 -1
- package/front_end/third_party/lit/lib/directive.js.map +1 -1
- package/front_end/third_party/lit/lib/directives.js +8 -13
- package/front_end/third_party/lit/lib/directives.js.map +1 -1
- package/front_end/third_party/lit/lib/lit.d.ts +26 -9
- package/front_end/third_party/lit/lib/lit.js +5 -5
- package/front_end/third_party/lit/lib/lit.js.map +1 -1
- package/front_end/third_party/lit/lib/static-html.js +2 -2
- package/front_end/third_party/lit/lib/static-html.js.map +1 -1
- package/front_end/third_party/lit/rebuild.sh +1 -1
- package/front_end/third_party/third-party-web/rebuild.sh +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +6 -7
- package/front_end/ui/legacy/ActionRegistration.ts +9 -9
- package/front_end/ui/legacy/DockController.ts +18 -18
- package/front_end/ui/legacy/FilterBar.ts +7 -7
- package/front_end/ui/legacy/Fragment.ts +4 -4
- package/front_end/ui/legacy/GlassPane.ts +12 -12
- package/front_end/ui/legacy/InspectorView.ts +5 -15
- package/front_end/ui/legacy/ListControl.ts +27 -27
- package/front_end/ui/legacy/ListWidget.ts +4 -4
- package/front_end/ui/legacy/PopoverHelper.ts +4 -4
- package/front_end/ui/legacy/ShortcutRegistry.ts +17 -17
- package/front_end/ui/legacy/TabbedPane.ts +74 -75
- package/front_end/ui/legacy/TextPrompt.ts +31 -31
- package/front_end/ui/legacy/Toolbar.ts +13 -14
- package/front_end/ui/legacy/ViewManager.ts +30 -31
- package/front_end/ui/legacy/Widget.ts +6 -6
- package/front_end/ui/legacy/XLink.ts +9 -9
- package/front_end/ui/legacy/ZoomManager.ts +9 -9
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +27 -27
- package/front_end/ui/legacy/components/color_picker/ContrastInfo.ts +30 -32
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +15 -15
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +64 -64
- package/front_end/ui/legacy/components/data_grid/ShowMoreDataGridNode.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +10 -11
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +12 -12
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +3 -3
- package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +14 -14
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +8 -8
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -5
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +4 -4
- package/front_end/ui/legacy/theme_support/ThemeSupport.ts +4 -4
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -2
- package/package.json +1 -1
@@ -583,16 +583,16 @@ const expandableContainerForView = new WeakMap<View, ExpandableContainerWidget>(
|
|
583
583
|
class Location {
|
584
584
|
protected readonly manager: ViewManager;
|
585
585
|
private readonly revealCallback: (() => void)|undefined;
|
586
|
-
|
586
|
+
readonly #widget: Widget;
|
587
587
|
|
588
588
|
constructor(manager: ViewManager, widget: Widget, revealCallback?: (() => void)) {
|
589
589
|
this.manager = manager;
|
590
590
|
this.revealCallback = revealCallback;
|
591
|
-
this
|
591
|
+
this.#widget = widget;
|
592
592
|
}
|
593
593
|
|
594
594
|
widget(): Widget {
|
595
|
-
return this
|
595
|
+
return this.#widget;
|
596
596
|
}
|
597
597
|
|
598
598
|
reveal(): void {
|
@@ -623,7 +623,7 @@ type CloseableTabSetting = Record<string, boolean>;
|
|
623
623
|
type TabOrderSetting = Record<string, number>;
|
624
624
|
|
625
625
|
class TabbedLocation extends Location implements TabbedViewLocation {
|
626
|
-
|
626
|
+
#tabbedPane: TabbedPane;
|
627
627
|
private readonly location: string;
|
628
628
|
private readonly allowReorder: boolean|undefined;
|
629
629
|
private readonly closeableTabSetting: Common.Settings.Setting<CloseableTabSetting>;
|
@@ -642,13 +642,12 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
642
642
|
|
643
643
|
super(manager, tabbedPane, revealCallback);
|
644
644
|
this.location = location;
|
645
|
-
this
|
645
|
+
this.#tabbedPane = tabbedPane;
|
646
646
|
this.allowReorder = allowReorder;
|
647
647
|
|
648
|
-
this.
|
649
|
-
this.
|
650
|
-
this.
|
651
|
-
TabbedPaneEvents.PaneVisibilityChanged, this.tabbedPaneVisibilityChanged, this);
|
648
|
+
this.#tabbedPane.addEventListener(TabbedPaneEvents.TabSelected, this.tabSelected, this);
|
649
|
+
this.#tabbedPane.addEventListener(TabbedPaneEvents.TabClosed, this.tabClosed, this);
|
650
|
+
this.#tabbedPane.addEventListener(TabbedPaneEvents.PaneVisibilityChanged, this.tabbedPaneVisibilityChanged, this);
|
652
651
|
|
653
652
|
this.closeableTabSetting = Common.Settings.Settings.instance().createSetting('closeable-tabs', {});
|
654
653
|
// As we give tabs the capability to be closed we also need to add them to the setting so they are still open
|
@@ -656,7 +655,7 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
656
655
|
this.setOrUpdateCloseableTabsSetting();
|
657
656
|
|
658
657
|
this.tabOrderSetting = Common.Settings.Settings.instance().createSetting(location + '-tab-order', {});
|
659
|
-
this.
|
658
|
+
this.#tabbedPane.addEventListener(TabbedPaneEvents.TabOrderChanged, this.persistTabOrder, this);
|
660
659
|
if (restoreSelection) {
|
661
660
|
this.lastSelectedTabSetting = Common.Settings.Settings.instance().createSetting(location + '-selected-tab', '');
|
662
661
|
}
|
@@ -678,17 +677,17 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
678
677
|
}
|
679
678
|
|
680
679
|
override widget(): Widget {
|
681
|
-
return this
|
680
|
+
return this.#tabbedPane;
|
682
681
|
}
|
683
682
|
|
684
683
|
tabbedPane(): TabbedPane {
|
685
|
-
return this
|
684
|
+
return this.#tabbedPane;
|
686
685
|
}
|
687
686
|
|
688
687
|
enableMoreTabsButton(): ToolbarMenuButton {
|
689
688
|
const moreTabsButton = new ToolbarMenuButton(
|
690
689
|
this.appendTabsToMenu.bind(this), /* isIconDropdown */ true, undefined, 'more-tabs', 'dots-vertical');
|
691
|
-
this.
|
690
|
+
this.#tabbedPane.leftToolbar().appendToolbarItem(moreTabsButton);
|
692
691
|
return moreTabsButton;
|
693
692
|
}
|
694
693
|
|
@@ -720,9 +719,9 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
720
719
|
|
721
720
|
// If a default tab was provided we open or select it
|
722
721
|
if (this.defaultTab) {
|
723
|
-
if (this.
|
722
|
+
if (this.#tabbedPane.hasTab(this.defaultTab)) {
|
724
723
|
// If the tabbed pane already has the tab we just have to select it
|
725
|
-
this.
|
724
|
+
this.#tabbedPane.selectTab(this.defaultTab);
|
726
725
|
} else {
|
727
726
|
// If the tab is not present already it can be because:
|
728
727
|
// it doesn't correspond to this tabbed location
|
@@ -733,8 +732,8 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
733
732
|
void this.showView(view);
|
734
733
|
}
|
735
734
|
}
|
736
|
-
} else if (this.lastSelectedTabSetting && this.
|
737
|
-
this.
|
735
|
+
} else if (this.lastSelectedTabSetting && this.#tabbedPane.hasTab(this.lastSelectedTabSetting.get())) {
|
736
|
+
this.#tabbedPane.selectTab(this.lastSelectedTabSetting.get());
|
738
737
|
}
|
739
738
|
}
|
740
739
|
|
@@ -790,18 +789,18 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
790
789
|
}
|
791
790
|
|
792
791
|
private appendTab(view: View, index?: number): void {
|
793
|
-
this.
|
792
|
+
this.#tabbedPane.appendTab(
|
794
793
|
view.viewId(), view.title(), new ContainerWidget(view), undefined, false,
|
795
794
|
view.isCloseable() || view.isTransient(), view.isPreviewFeature(), index);
|
796
795
|
const iconName = view.iconName();
|
797
796
|
if (iconName) {
|
798
797
|
const icon = IconButton.Icon.create(iconName);
|
799
|
-
this.
|
798
|
+
this.#tabbedPane.setTabIcon(view.viewId(), icon);
|
800
799
|
}
|
801
800
|
}
|
802
801
|
|
803
802
|
appendView(view: View, insertBefore?: View|null): void {
|
804
|
-
if (this.
|
803
|
+
if (this.#tabbedPane.hasTab(view.viewId())) {
|
805
804
|
return;
|
806
805
|
}
|
807
806
|
const oldLocation = locationForView.get(view);
|
@@ -812,7 +811,7 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
812
811
|
this.manager.views.set(view.viewId(), view);
|
813
812
|
this.views.set(view.viewId(), view);
|
814
813
|
let index: number|undefined = undefined;
|
815
|
-
const tabIds = this.
|
814
|
+
const tabIds = this.#tabbedPane.tabIds();
|
816
815
|
if (this.allowReorder) {
|
817
816
|
const orderSetting = this.tabOrderSetting.get();
|
818
817
|
const order = orderSetting[view.viewId()];
|
@@ -848,38 +847,38 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
848
847
|
shouldSelectTab: boolean|undefined = true): Promise<void> {
|
849
848
|
this.appendView(view, insertBefore);
|
850
849
|
if (shouldSelectTab) {
|
851
|
-
this.
|
850
|
+
this.#tabbedPane.selectTab(view.viewId(), userGesture);
|
852
851
|
}
|
853
852
|
if (!omitFocus) {
|
854
|
-
this.
|
853
|
+
this.#tabbedPane.focus();
|
855
854
|
}
|
856
|
-
const widget = (this.
|
855
|
+
const widget = (this.#tabbedPane.tabView(view.viewId()) as ContainerWidget);
|
857
856
|
await widget.materialize();
|
858
857
|
}
|
859
858
|
|
860
859
|
override removeView(view: View): void {
|
861
|
-
if (!this.
|
860
|
+
if (!this.#tabbedPane.hasTab(view.viewId())) {
|
862
861
|
return;
|
863
862
|
}
|
864
863
|
|
865
864
|
locationForView.delete(view);
|
866
865
|
this.manager.views.delete(view.viewId());
|
867
|
-
this.
|
866
|
+
this.#tabbedPane.closeTab(view.viewId());
|
868
867
|
this.views.delete(view.viewId());
|
869
868
|
}
|
870
869
|
|
871
870
|
override isViewVisible(view: View): boolean {
|
872
|
-
return this.
|
871
|
+
return this.#tabbedPane.isShowing() && this.#tabbedPane?.selectedTabId === view.viewId();
|
873
872
|
}
|
874
873
|
|
875
874
|
private tabbedPaneVisibilityChanged(event: Common.EventTarget.EventTargetEvent<{isVisible: boolean}>): void {
|
876
|
-
if (!this.
|
875
|
+
if (!this.#tabbedPane.selectedTabId) {
|
877
876
|
return;
|
878
877
|
}
|
879
878
|
this.manager.dispatchEventToListeners(Events.VIEW_VISIBILITY_CHANGED, {
|
880
879
|
location: this.location,
|
881
|
-
revealedViewId: event.data.isVisible ? this.
|
882
|
-
hiddenViewId: event.data.isVisible ? undefined : this.
|
880
|
+
revealedViewId: event.data.isVisible ? this.#tabbedPane.selectedTabId : undefined,
|
881
|
+
hiddenViewId: event.data.isVisible ? undefined : this.#tabbedPane.selectedTabId,
|
883
882
|
});
|
884
883
|
}
|
885
884
|
|
@@ -909,7 +908,7 @@ class TabbedLocation extends Location implements TabbedViewLocation {
|
|
909
908
|
}
|
910
909
|
|
911
910
|
private persistTabOrder(): void {
|
912
|
-
const tabIds = this.
|
911
|
+
const tabIds = this.#tabbedPane.tabIds();
|
913
912
|
const tabOrders: Record<string, number> = {};
|
914
913
|
for (let i = 0; i < tabIds.length; i++) {
|
915
914
|
tabOrders[tabIds[i]] = (i + 1) * TabbedLocation.orderStep;
|
@@ -497,7 +497,7 @@ export class Widget {
|
|
497
497
|
}
|
498
498
|
this.attach(currentWidget);
|
499
499
|
}
|
500
|
-
this
|
500
|
+
this.#showWidget(parentElement, insertBefore);
|
501
501
|
}
|
502
502
|
|
503
503
|
private attach(parentWidget: Widget): void {
|
@@ -519,10 +519,10 @@ export class Widget {
|
|
519
519
|
if (!this.element.parentElement) {
|
520
520
|
throw new Error('Attempt to show widget that is not hidden using hideWidget().');
|
521
521
|
}
|
522
|
-
this
|
522
|
+
this.#showWidget(this.element.parentElement, this.element.nextSibling);
|
523
523
|
}
|
524
524
|
|
525
|
-
|
525
|
+
#showWidget(parentElement: Element, insertBefore?: Node|null): void {
|
526
526
|
let currentParent: Element|null = parentElement;
|
527
527
|
while (currentParent && !widgetMap.get(currentParent)) {
|
528
528
|
currentParent = currentParent.parentElementOrShadowHost();
|
@@ -576,10 +576,10 @@ export class Widget {
|
|
576
576
|
if (!this.#visible) {
|
577
577
|
return;
|
578
578
|
}
|
579
|
-
this
|
579
|
+
this.#hideWidget(false);
|
580
580
|
}
|
581
581
|
|
582
|
-
|
582
|
+
#hideWidget(removeFromDOM: boolean): void {
|
583
583
|
this.#visible = false;
|
584
584
|
const {parentElement} = this.element;
|
585
585
|
|
@@ -627,7 +627,7 @@ export class Widget {
|
|
627
627
|
// responsibility for the consequences.
|
628
628
|
const removeFromDOM = overrideHideOnDetach || !this.shouldHideOnDetach();
|
629
629
|
if (this.#visible) {
|
630
|
-
this
|
630
|
+
this.#hideWidget(removeFromDOM);
|
631
631
|
} else if (removeFromDOM) {
|
632
632
|
const {parentElement} = this.element;
|
633
633
|
if (parentElement) {
|
@@ -20,7 +20,7 @@ import {
|
|
20
20
|
import {XElement} from './XElement.js';
|
21
21
|
|
22
22
|
export class XLink extends XElement {
|
23
|
-
|
23
|
+
#href: Platform.DevToolsPath.UrlString|null;
|
24
24
|
private clickable: boolean;
|
25
25
|
private readonly onClick: (arg0: Event) => void;
|
26
26
|
private readonly onKeyDown: (arg0: KeyboardEvent) => void;
|
@@ -49,21 +49,21 @@ export class XLink extends XElement {
|
|
49
49
|
this.setAttribute('target', '_blank');
|
50
50
|
this.setAttribute('rel', 'noopener');
|
51
51
|
|
52
|
-
this
|
52
|
+
this.#href = null;
|
53
53
|
this.clickable = true;
|
54
54
|
|
55
55
|
this.onClick = (event: Event) => {
|
56
56
|
event.consume(true);
|
57
|
-
if (this
|
58
|
-
openInNewTab(this
|
57
|
+
if (this.#href) {
|
58
|
+
openInNewTab(this.#href);
|
59
59
|
}
|
60
60
|
this.dispatchEvent(new Event('x-link-invoke'));
|
61
61
|
};
|
62
62
|
this.onKeyDown = (event: KeyboardEvent) => {
|
63
63
|
if (Platform.KeyboardUtilities.isEnterOrSpaceKey(event)) {
|
64
64
|
event.consume(true);
|
65
|
-
if (this
|
66
|
-
openInNewTab(this
|
65
|
+
if (this.#href) {
|
66
|
+
openInNewTab(this.#href);
|
67
67
|
}
|
68
68
|
}
|
69
69
|
this.dispatchEvent(new Event('x-link-invoke'));
|
@@ -76,7 +76,7 @@ export class XLink extends XElement {
|
|
76
76
|
}
|
77
77
|
|
78
78
|
get href(): Platform.DevToolsPath.UrlString|null {
|
79
|
-
return this
|
79
|
+
return this.#href;
|
80
80
|
}
|
81
81
|
|
82
82
|
override attributeChangedCallback(attr: string, oldValue: string|null, newValue: string|null): void {
|
@@ -100,7 +100,7 @@ export class XLink extends XElement {
|
|
100
100
|
} catch {
|
101
101
|
}
|
102
102
|
|
103
|
-
this
|
103
|
+
this.#href = href;
|
104
104
|
if (!this.hasAttribute('title')) {
|
105
105
|
Tooltip.install(this, newValue);
|
106
106
|
}
|
@@ -119,7 +119,7 @@ export class XLink extends XElement {
|
|
119
119
|
}
|
120
120
|
|
121
121
|
private updateClick(): void {
|
122
|
-
if (this
|
122
|
+
if (this.#href !== null && this.clickable) {
|
123
123
|
this.addEventListener('click', this.onClick, false);
|
124
124
|
this.addEventListener('keydown', this.onKeyDown, false);
|
125
125
|
this.style.setProperty('cursor', 'pointer');
|
@@ -9,12 +9,12 @@ let zoomManagerInstance: ZoomManager|undefined;
|
|
9
9
|
|
10
10
|
export class ZoomManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
11
11
|
private frontendHost: Host.InspectorFrontendHostAPI.InspectorFrontendHostAPI;
|
12
|
-
|
12
|
+
#zoomFactor: number;
|
13
13
|
|
14
14
|
private constructor(window: Window, frontendHost: Host.InspectorFrontendHostAPI.InspectorFrontendHostAPI) {
|
15
15
|
super();
|
16
16
|
this.frontendHost = frontendHost;
|
17
|
-
this
|
17
|
+
this.#zoomFactor = this.frontendHost.zoomFactor();
|
18
18
|
window.addEventListener('resize', this.onWindowResize.bind(this), true);
|
19
19
|
}
|
20
20
|
|
@@ -41,22 +41,22 @@ export class ZoomManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
41
41
|
}
|
42
42
|
|
43
43
|
zoomFactor(): number {
|
44
|
-
return this
|
44
|
+
return this.#zoomFactor;
|
45
45
|
}
|
46
46
|
|
47
47
|
cssToDIP(value: number): number {
|
48
|
-
return value * this
|
48
|
+
return value * this.#zoomFactor;
|
49
49
|
}
|
50
50
|
|
51
51
|
dipToCSS(valueDIP: number): number {
|
52
|
-
return valueDIP / this
|
52
|
+
return valueDIP / this.#zoomFactor;
|
53
53
|
}
|
54
54
|
|
55
55
|
private onWindowResize(): void {
|
56
|
-
const oldZoomFactor = this
|
57
|
-
this
|
58
|
-
if (oldZoomFactor !== this
|
59
|
-
this.dispatchEventToListeners(Events.ZOOM_CHANGED, {from: oldZoomFactor, to: this
|
56
|
+
const oldZoomFactor = this.#zoomFactor;
|
57
|
+
this.#zoomFactor = this.frontendHost.zoomFactor();
|
58
|
+
if (oldZoomFactor !== this.#zoomFactor) {
|
59
|
+
this.dispatchEventToListeners(Events.ZOOM_CHANGED, {from: oldZoomFactor, to: this.#zoomFactor});
|
60
60
|
}
|
61
61
|
}
|
62
62
|
}
|
@@ -67,15 +67,15 @@ const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/color_picker/Cont
|
|
67
67
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
68
68
|
export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
69
69
|
private contrastInfo: ContrastInfo;
|
70
|
-
|
70
|
+
readonly #element: HTMLElement;
|
71
71
|
private readonly toggleMainColorPicker:
|
72
72
|
(arg0?: boolean|undefined, arg1?: Common.EventTarget.EventTargetEvent<unknown>|undefined) => void;
|
73
73
|
private readonly expandedChangedCallback: () => void;
|
74
74
|
private readonly colorSelectedCallback: (arg0: Common.Color.Legacy) => void;
|
75
|
-
|
75
|
+
#expanded: boolean;
|
76
76
|
private passesAA: boolean;
|
77
77
|
private contrastUnknown: boolean;
|
78
|
-
|
78
|
+
#visible: boolean;
|
79
79
|
private readonly noContrastInfoAvailable: Element;
|
80
80
|
private readonly contrastValueBubble: HTMLElement;
|
81
81
|
private contrastValue: HTMLElement;
|
@@ -101,7 +101,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
101
101
|
expandedChangedCallback: () => void, colorSelectedCallback: (arg0: Common.Color.Legacy) => void) {
|
102
102
|
super();
|
103
103
|
this.contrastInfo = contrastInfo;
|
104
|
-
this
|
104
|
+
this.#element = contentElement.createChild('div', 'spectrum-contrast-details collapsed');
|
105
105
|
|
106
106
|
this.toggleMainColorPicker = toggleMainColorPickerCallback;
|
107
107
|
|
@@ -109,7 +109,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
109
109
|
|
110
110
|
this.colorSelectedCallback = colorSelectedCallback;
|
111
111
|
|
112
|
-
this
|
112
|
+
this.#expanded = false;
|
113
113
|
|
114
114
|
this.passesAA = true;
|
115
115
|
|
@@ -117,7 +117,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
117
117
|
|
118
118
|
// This will not be visible if we don't get ContrastInfo,
|
119
119
|
// e.g. for a non-font color property such as border-color.
|
120
|
-
this
|
120
|
+
this.#visible = false;
|
121
121
|
|
122
122
|
// No contrast info message is created to show if it's not possible to provide the extended details.
|
123
123
|
|
@@ -125,7 +125,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
125
125
|
this.noContrastInfoAvailable.textContent = i18nString(UIStrings.noContrastInformationAvailable);
|
126
126
|
this.noContrastInfoAvailable.classList.add('hidden');
|
127
127
|
|
128
|
-
const contrastValueRow = this.
|
128
|
+
const contrastValueRow = this.#element.createChild('div');
|
129
129
|
contrastValueRow.addEventListener('click', this.topRowClicked.bind(this));
|
130
130
|
const contrastValueRowContents = contrastValueRow.createChild('div', 'container');
|
131
131
|
UI.UIUtils.createTextChild(contrastValueRowContents, i18nString(UIStrings.contrastRatio));
|
@@ -147,7 +147,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
147
147
|
UI.ARIAUtils.setExpanded(this.expandButton.element, false);
|
148
148
|
expandToolbar.appendToolbarItem(this.expandButton);
|
149
149
|
|
150
|
-
this.expandedDetails = this.
|
150
|
+
this.expandedDetails = this.#element.createChild('div', 'expanded-details');
|
151
151
|
UI.ARIAUtils.setControls(this.expandButton.element, this.expandedDetails);
|
152
152
|
|
153
153
|
this.contrastThresholds = this.expandedDetails.createChild('div', 'contrast-thresholds');
|
@@ -170,7 +170,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
170
170
|
this.bgColorPickerButton = new UI.Toolbar.ToolbarToggle(
|
171
171
|
i18nString(UIStrings.toggleBackgroundColorPicker), 'color-picker', 'color-picker-filled');
|
172
172
|
this.bgColorPickerButton.addEventListener(
|
173
|
-
UI.Toolbar.ToolbarButton.Events.CLICK, this.
|
173
|
+
UI.Toolbar.ToolbarButton.Events.CLICK, this.#toggleBackgroundColorPicker.bind(this, undefined, true));
|
174
174
|
pickerToolbar.appendToolbarItem(this.bgColorPickerButton);
|
175
175
|
this.bgColorPickedBound = this.bgColorPicked.bind(this);
|
176
176
|
|
@@ -286,7 +286,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
286
286
|
}
|
287
287
|
}
|
288
288
|
labelAPCA.addEventListener('click', (_event: Event) => ContrastDetails.showHelp());
|
289
|
-
this.
|
289
|
+
this.#element.classList.toggle('contrast-fail', !passesAPCA);
|
290
290
|
this.contrastValueBubble.classList.toggle('contrast-aa', passesAPCA);
|
291
291
|
this.bgColorSwatch.setColors(fgColor, bgColor);
|
292
292
|
return;
|
@@ -356,7 +356,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
356
356
|
|
357
357
|
[labelAA, labelAAA].forEach(e => e.addEventListener('click', () => ContrastDetails.showHelp()));
|
358
358
|
|
359
|
-
this.
|
359
|
+
this.#element.classList.toggle('contrast-fail', !this.passesAA);
|
360
360
|
// show checkmark icon when passes AA, but not AAA
|
361
361
|
this.contrastValueBubble.classList.toggle('contrast-aa', this.passesAA && !passesAAA);
|
362
362
|
this.contrastValueBubble.classList.toggle('contrast-aaa', passesAAA);
|
@@ -367,16 +367,16 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
367
367
|
}
|
368
368
|
|
369
369
|
setVisible(visible: boolean): void {
|
370
|
-
this
|
371
|
-
this.
|
370
|
+
this.#visible = visible;
|
371
|
+
this.#element.classList.toggle('hidden', !visible);
|
372
372
|
}
|
373
373
|
|
374
374
|
visible(): boolean {
|
375
|
-
return this
|
375
|
+
return this.#visible;
|
376
376
|
}
|
377
377
|
|
378
378
|
element(): HTMLElement {
|
379
|
-
return this
|
379
|
+
return this.#element;
|
380
380
|
}
|
381
381
|
|
382
382
|
private expandButtonClicked(): void {
|
@@ -397,18 +397,18 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
397
397
|
}
|
398
398
|
|
399
399
|
private toggleExpanded(): void {
|
400
|
-
this
|
401
|
-
UI.ARIAUtils.setExpanded(this.expandButton.element, this
|
402
|
-
this.
|
403
|
-
if (this
|
400
|
+
this.#expanded = !this.#expanded;
|
401
|
+
UI.ARIAUtils.setExpanded(this.expandButton.element, this.#expanded);
|
402
|
+
this.#element.classList.toggle('collapsed', !this.#expanded);
|
403
|
+
if (this.#expanded) {
|
404
404
|
this.toggleMainColorPicker(false);
|
405
405
|
this.expandButton.setGlyph('chevron-up');
|
406
406
|
this.expandButton.setTitle(i18nString(UIStrings.showLess));
|
407
407
|
if (this.contrastUnknown) {
|
408
|
-
this
|
408
|
+
this.#toggleBackgroundColorPicker(true);
|
409
409
|
}
|
410
410
|
} else {
|
411
|
-
this
|
411
|
+
this.#toggleBackgroundColorPicker(false);
|
412
412
|
this.expandButton.setGlyph('chevron-down');
|
413
413
|
this.expandButton.setTitle(i18nString(UIStrings.showMore));
|
414
414
|
}
|
@@ -416,13 +416,13 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
416
416
|
}
|
417
417
|
|
418
418
|
collapse(): void {
|
419
|
-
this.
|
420
|
-
this
|
419
|
+
this.#element.classList.remove('expanded');
|
420
|
+
this.#toggleBackgroundColorPicker(false);
|
421
421
|
this.toggleMainColorPicker(false);
|
422
422
|
}
|
423
423
|
|
424
424
|
expanded(): boolean {
|
425
|
-
return this
|
425
|
+
return this.#expanded;
|
426
426
|
}
|
427
427
|
|
428
428
|
backgroundColorPickerEnabled(): boolean {
|
@@ -430,10 +430,10 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
430
430
|
}
|
431
431
|
|
432
432
|
toggleBackgroundColorPicker(enabled: boolean): void {
|
433
|
-
this
|
433
|
+
this.#toggleBackgroundColorPicker(enabled, false);
|
434
434
|
}
|
435
435
|
|
436
|
-
|
436
|
+
#toggleBackgroundColorPicker(enabled?: boolean, shouldTriggerEvent: boolean|undefined = true): void {
|
437
437
|
if (enabled === undefined) {
|
438
438
|
enabled = this.bgColorPickerButton.isToggled();
|
439
439
|
}
|
@@ -458,7 +458,7 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
458
458
|
const rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100];
|
459
459
|
const color = Common.Color.Legacy.fromRGBA(rgba);
|
460
460
|
this.contrastInfo.setBgColor(color);
|
461
|
-
this
|
461
|
+
this.#toggleBackgroundColorPicker(false);
|
462
462
|
this.bgColorPickerButton.toggled(false);
|
463
463
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.bringToFront();
|
464
464
|
}
|
@@ -5,23 +5,23 @@
|
|
5
5
|
import * as Common from '../../../../core/common/common.js';
|
6
6
|
|
7
7
|
export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
readonly #isNull: boolean;
|
9
|
+
#contrastRatio: number|null;
|
10
|
+
#contrastRatioAPCA: number|null;
|
11
11
|
private contrastRatioThresholds: Record<string, number>|null;
|
12
|
-
|
12
|
+
readonly #contrastRatioAPCAThreshold: number|null;
|
13
13
|
private fgColor: Common.Color.Legacy|null;
|
14
|
-
|
15
|
-
|
14
|
+
#bgColor: Common.Color.Legacy|null;
|
15
|
+
#colorFormat: Common.Color.Format|undefined;
|
16
16
|
constructor(contrastInfo: ContrastInfoType|null) {
|
17
17
|
super();
|
18
|
-
this
|
19
|
-
this
|
20
|
-
this
|
18
|
+
this.#isNull = true;
|
19
|
+
this.#contrastRatio = null;
|
20
|
+
this.#contrastRatioAPCA = null;
|
21
21
|
this.contrastRatioThresholds = null;
|
22
|
-
this
|
22
|
+
this.#contrastRatioAPCAThreshold = 0;
|
23
23
|
this.fgColor = null;
|
24
|
-
this
|
24
|
+
this.#bgColor = null;
|
25
25
|
|
26
26
|
if (!contrastInfo) {
|
27
27
|
return;
|
@@ -31,10 +31,10 @@ export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
31
31
|
return;
|
32
32
|
}
|
33
33
|
|
34
|
-
this
|
34
|
+
this.#isNull = false;
|
35
35
|
this.contrastRatioThresholds =
|
36
36
|
Common.ColorUtils.getContrastThreshold(contrastInfo.computedFontSize, contrastInfo.computedFontWeight);
|
37
|
-
this
|
37
|
+
this.#contrastRatioAPCAThreshold =
|
38
38
|
Common.ColorUtils.getAPCAThreshold(contrastInfo.computedFontSize, contrastInfo.computedFontWeight);
|
39
39
|
|
40
40
|
if (!contrastInfo.backgroundColors || contrastInfo.backgroundColors.length !== 1) {
|
@@ -43,23 +43,23 @@ export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
43
43
|
const bgColorText = contrastInfo.backgroundColors[0];
|
44
44
|
const bgColor = Common.Color.parse(bgColorText)?.asLegacyColor();
|
45
45
|
if (bgColor) {
|
46
|
-
this
|
46
|
+
this.#setBgColor(bgColor);
|
47
47
|
}
|
48
48
|
}
|
49
49
|
|
50
50
|
isNull(): boolean {
|
51
|
-
return this
|
51
|
+
return this.#isNull;
|
52
52
|
}
|
53
53
|
|
54
54
|
setColor(fgColor: Common.Color.Legacy, colorFormat?: Common.Color.Format): void {
|
55
55
|
this.fgColor = fgColor;
|
56
|
-
this
|
56
|
+
this.#colorFormat = colorFormat;
|
57
57
|
this.updateContrastRatio();
|
58
58
|
this.dispatchEventToListeners(Events.CONTRAST_INFO_UPDATED);
|
59
59
|
}
|
60
60
|
|
61
61
|
colorFormat(): Common.Color.Format|undefined {
|
62
|
-
return this
|
62
|
+
return this.#colorFormat;
|
63
63
|
}
|
64
64
|
|
65
65
|
color(): Common.Color.Legacy|null {
|
@@ -67,24 +67,24 @@ export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
67
67
|
}
|
68
68
|
|
69
69
|
contrastRatio(): number|null {
|
70
|
-
return this
|
70
|
+
return this.#contrastRatio;
|
71
71
|
}
|
72
72
|
|
73
73
|
contrastRatioAPCA(): number|null {
|
74
|
-
return this
|
74
|
+
return this.#contrastRatioAPCA;
|
75
75
|
}
|
76
76
|
|
77
77
|
contrastRatioAPCAThreshold(): number|null {
|
78
|
-
return this
|
78
|
+
return this.#contrastRatioAPCAThreshold;
|
79
79
|
}
|
80
80
|
|
81
81
|
setBgColor(bgColor: Common.Color.Legacy): void {
|
82
|
-
this
|
82
|
+
this.#setBgColor(bgColor);
|
83
83
|
this.dispatchEventToListeners(Events.CONTRAST_INFO_UPDATED);
|
84
84
|
}
|
85
85
|
|
86
|
-
|
87
|
-
this
|
86
|
+
#setBgColor(bgColor: Common.Color.Legacy): void {
|
87
|
+
this.#bgColor = bgColor;
|
88
88
|
|
89
89
|
if (!this.fgColor) {
|
90
90
|
return;
|
@@ -97,25 +97,23 @@ export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
97
97
|
// the unknown background is the same color as the text.
|
98
98
|
if (bgColor.hasAlpha()) {
|
99
99
|
const blendedRGBA = Common.ColorUtils.blendColors(bgColor.rgba(), fgRGBA);
|
100
|
-
this
|
100
|
+
this.#bgColor = new Common.Color.Legacy(blendedRGBA, Common.Color.Format.RGBA);
|
101
101
|
}
|
102
102
|
|
103
|
-
this
|
104
|
-
this.
|
105
|
-
Common.ColorUtils.contrastRatioAPCA(this.fgColor.rgba(), this.bgColorInternal.rgba());
|
103
|
+
this.#contrastRatio = Common.ColorUtils.contrastRatio(fgRGBA, this.#bgColor.rgba());
|
104
|
+
this.#contrastRatioAPCA = Common.ColorUtils.contrastRatioAPCA(this.fgColor.rgba(), this.#bgColor.rgba());
|
106
105
|
}
|
107
106
|
|
108
107
|
bgColor(): Common.Color.Legacy|null {
|
109
|
-
return this
|
108
|
+
return this.#bgColor;
|
110
109
|
}
|
111
110
|
|
112
111
|
private updateContrastRatio(): void {
|
113
|
-
if (!this
|
112
|
+
if (!this.#bgColor || !this.fgColor) {
|
114
113
|
return;
|
115
114
|
}
|
116
|
-
this
|
117
|
-
this.
|
118
|
-
Common.ColorUtils.contrastRatioAPCA(this.fgColor.rgba(), this.bgColorInternal.rgba());
|
115
|
+
this.#contrastRatio = Common.ColorUtils.contrastRatio(this.fgColor.rgba(), this.#bgColor.rgba());
|
116
|
+
this.#contrastRatioAPCA = Common.ColorUtils.contrastRatioAPCA(this.fgColor.rgba(), this.#bgColor.rgba());
|
119
117
|
}
|
120
118
|
|
121
119
|
contrastRatioThreshold(level: string): number|null {
|