chrome-devtools-frontend 1.0.1738725 → 1.0.1742811
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/rules/ui-and-widgets/ui-accessibility-and-semantic-html.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +44 -7
- package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-view-output-and-callback-contracts.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +1 -1
- package/.agents/skills/code-review/SKILL.md +23 -6
- package/.agents/skills/devtools-verification/SKILL.md +2 -1
- package/.agents/skills/migrate-chromium-test/SKILL.md +1 -0
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +27 -11
- package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +41 -23
- package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +12 -7
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +3 -0
- package/.agents/skills/ui-widgets/SKILL.md +22 -7
- package/.agents/skills/version-control/SKILL.md +10 -1
- package/.agents/skills/visual-regression-audit/SKILL.md +88 -0
- package/.gitallowed +2 -1
- package/.stylelintignore +1 -0
- package/.stylelintrc.json +5 -1
- package/AUTHORS +1 -0
- package/DIR_METADATA +2 -1
- package/PRESUBMIT_test.py +143 -0
- package/config/owner/INFRA_OWNERS +0 -1
- package/docs/contributing/infrastructure.md +2 -2
- package/docs/ui_engineering.md +14 -4
- package/eslint.config.mjs +119 -9
- package/front_end/application_tokens.css +0 -65
- package/front_end/core/host/AidaClient.ts +1 -1
- package/front_end/core/host/AidaClientTypes.ts +2 -0
- package/front_end/core/host/AidaErrors.ts +3 -3
- package/front_end/core/host/AidaGcaTranslation.ts +39 -0
- package/front_end/core/host/GcaClient.ts +32 -20
- package/front_end/core/host/GcaTypes.ts +4 -2
- package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
- package/front_end/core/i18n/DevToolsLocale.ts +0 -1
- package/front_end/core/sdk/DebuggerModel.ts +25 -13
- package/front_end/core/sdk/PreloadingModel.ts +2 -2
- package/front_end/core/sdk/RehydratingConnection.ts +59 -30
- package/front_end/core/sdk/SourceMap.ts +30 -3
- package/front_end/core/sdk/SourceMapRangeMappings.ts +57 -0
- package/front_end/core/sdk/StorageKeyManager.ts +0 -1
- package/front_end/core/sdk/Target.ts +6 -0
- package/front_end/core/sdk/TargetManager.ts +10 -4
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +5 -9
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +12 -2
- package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +159 -52
- package/front_end/entrypoints/inspector_main/outermostTargetSelector.css +77 -25
- package/front_end/entrypoints/main/MainImpl.ts +32 -15
- package/front_end/models/ai_assistance/AiAgent2.ts +95 -46
- package/front_end/models/ai_assistance/AiConversation.ts +1 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -2
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +3 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +5 -4
- package/front_end/models/ai_assistance/performance/AICallTree.ts +7 -9
- package/front_end/models/ai_assistance/performance/AIQueries.ts +4 -8
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +11 -1
- package/front_end/models/ai_assistance/skills/lighthouse.md +1 -0
- package/front_end/models/ai_assistance/skills/network.md +3 -4
- package/front_end/models/ai_assistance/skills/sources.md +1 -2
- package/front_end/models/ai_assistance/skills/styling.md +3 -4
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +11 -3
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +84 -23
- package/front_end/models/ai_assistance/tools/ListSources.ts +41 -13
- package/front_end/models/badges/Badge.ts +0 -1
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
- package/front_end/models/breakpoints/BreakpointManager.ts +2 -4
- package/front_end/models/breakpoints/RecurringPauseDetector.ts +140 -0
- package/front_end/models/breakpoints/breakpoints.ts +2 -1
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +2 -2
- package/front_end/models/persistence/Automapping.ts +0 -1
- package/front_end/models/trace/Processor.ts +16 -7
- package/front_end/models/trace/README.md +17 -1
- package/front_end/models/trace/extras/ThirdParties.ts +4 -6
- package/front_end/models/trace/extras/TraceFilter.ts +16 -8
- package/front_end/models/trace/extras/TraceTree.ts +159 -125
- package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +0 -5
- package/front_end/models/trace/handlers/MetaHandler.ts +3 -0
- package/front_end/models/trace/handlers/RendererHandler.ts +7 -6
- package/front_end/models/trace/handlers/SamplesHandler.ts +1 -1
- package/front_end/models/trace/handlers/types.ts +15 -0
- package/front_end/models/trace/helpers/Extensions.ts +1 -3
- package/front_end/models/trace/helpers/SamplesIntegrator.ts +155 -87
- package/front_end/models/trace/helpers/Trace.ts +19 -14
- package/front_end/models/trace/helpers/TreeHelpers.ts +38 -10
- package/front_end/models/trace/insights/SlowCSSSelector.ts +3 -3
- package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +19 -4
- package/front_end/models/trace/lantern/simulation/Simulator.ts +4 -1
- package/front_end/models/web_mcp/WebMCPModel.ts +19 -9
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +30 -3
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +2 -4
- package/front_end/panels/ai_assistance/components/chatMessage.css +1 -22
- package/front_end/panels/ai_assistance/components/chatView.css +0 -180
- package/front_end/panels/ai_assistance/components/exploreWidget.css +1 -19
- package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -1
- package/front_end/panels/ai_assistance/components/walkthroughView.css +0 -13
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +3 -2
- package/front_end/panels/animation/AnimationTimeline.ts +5 -3
- package/front_end/panels/animation/animationTimeline.css +10 -8
- package/front_end/panels/application/ApplicationPanelSidebar.ts +14 -11
- package/front_end/panels/application/ApplicationPanelTreeElement.ts +66 -3
- package/front_end/panels/application/ReportingApiView.ts +0 -1
- package/front_end/panels/application/SubAppsView.ts +0 -1
- package/front_end/panels/application/WebMCPTreeElement.ts +3 -6
- package/front_end/panels/application/WebMCPView.ts +30 -0
- package/front_end/panels/application/components/ReportsGrid.ts +0 -1
- package/front_end/panels/application/components/backForwardCacheView.css +1 -8
- package/front_end/panels/application/components/permissionsPolicySection.css +2 -2
- package/front_end/panels/application/components/protocolHandlersView.css +46 -39
- package/front_end/panels/application/components/trustTokensView.css +0 -4
- package/front_end/panels/application/cookieItemsView.css +0 -7
- package/front_end/panels/application/indexedDBViews.css +0 -6
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +0 -2
- package/front_end/panels/application/preloading/components/PreloadingString.ts +0 -1
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -5
- package/front_end/panels/application/preloading/components/preloadingGrid.css +0 -9
- package/front_end/panels/application/resourcesPanel.css +0 -48
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +2 -9
- package/front_end/panels/application/serviceWorkersView.css +5 -4
- package/front_end/panels/application/storageView.css +0 -5
- package/front_end/panels/application/webMCPView.css +17 -0
- package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +15 -20
- package/front_end/panels/changes/changesView.css +0 -5
- package/front_end/panels/common/ExtensionServer.ts +80 -10
- package/front_end/panels/console/ConsolePanel.ts +92 -18
- package/front_end/panels/console/consoleContextSelector.css +1 -8
- package/front_end/panels/console/consoleInsightTeaser.css +10 -17
- package/front_end/panels/console/consolePinPane.css +3 -1
- package/front_end/panels/console/consoleView.css +14 -18
- package/front_end/panels/coverage/coverageListView.css +0 -4
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -22
- package/front_end/panels/css_overview/cssOverviewStartView.css +0 -43
- package/front_end/panels/developer_resources/developerResourcesListView.css +0 -4
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +52 -45
- package/front_end/panels/elements/LayoutPane.ts +1 -3
- package/front_end/panels/elements/PropertiesWidget.ts +26 -8
- package/front_end/panels/elements/PropertyRenderer.ts +45 -21
- package/front_end/panels/elements/StandaloneStylesContainer.ts +6 -7
- package/front_end/panels/elements/StyleEditorWidget.ts +110 -63
- package/front_end/panels/elements/StylePropertiesSection.ts +18 -14
- package/front_end/panels/elements/StylePropertyTreeElement.ts +556 -527
- package/front_end/panels/elements/StylesContainer.ts +5 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +12 -15
- package/front_end/panels/elements/classesPaneWidget.css +3 -7
- package/front_end/panels/elements/components/CSSQuery.ts +6 -5
- package/front_end/panels/elements/components/CSSVariableValueView.ts +17 -4
- package/front_end/panels/elements/components/StylePropertyEditor.ts +178 -140
- package/front_end/panels/elements/components/cssQuery.css +1 -1
- package/front_end/panels/elements/components/stylePropertyEditor.css +60 -56
- package/front_end/panels/elements/layoutPane.css +2 -2
- package/front_end/panels/elements/metricsSidebarPane.css +7 -8
- package/front_end/panels/elements/platformFontsWidget.css +1 -1
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -12
- package/front_end/panels/elements/stylesSidebarPane.css +3 -5
- package/front_end/panels/emulation/deviceModeView.css +1 -1
- package/front_end/panels/event_listeners/EventListenersView.ts +9 -2
- package/front_end/panels/event_listeners/eventListenersView.css +1 -1
- package/front_end/panels/explain/components/consoleInsight.css +1 -7
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +88 -46
- package/front_end/panels/issues/AffectedHeavyAdView.ts +72 -43
- package/front_end/panels/issues/AffectedResourcesView.ts +81 -13
- package/front_end/panels/issues/GenericIssueDetailsView.ts +112 -32
- package/front_end/panels/issues/issues.ts +2 -0
- package/front_end/panels/issues/issuesTree.css +13 -43
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +1 -1
- package/front_end/panels/layer_viewer/layerDetailsView.css +1 -1
- package/front_end/panels/layer_viewer/paintProfiler.css +4 -3
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -6
- package/front_end/panels/lighthouse/lighthousePanel.css +0 -9
- package/front_end/panels/lighthouse/lighthouseStartView.css +5 -16
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +0 -1
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +1 -1
- package/front_end/panels/media/playerListView.css +1 -2
- package/front_end/panels/media/playerPropertiesView.css +1 -1
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +4 -4
- package/front_end/panels/network/NetworkLogView.ts +603 -582
- package/front_end/panels/network/RequestCookiesView.ts +0 -1
- package/front_end/panels/network/RequestTimingView.ts +16 -2
- package/front_end/panels/network/networkConfigView.css +3 -4
- package/front_end/panels/network/networkLogView.css +363 -377
- package/front_end/panels/network/networkPanel.css +1 -7
- package/front_end/panels/network/networkTimingTable.css +12 -27
- package/front_end/panels/network/networkWaterfallColumn.css +1 -1
- package/front_end/panels/network/requestConditionsDrawer.css +0 -4
- package/front_end/panels/network/requestCookiesView.css +7 -1
- package/front_end/panels/network/requestPayloadTree.css +0 -4
- package/front_end/panels/profiler/HeapProfileView.ts +1 -3
- package/front_end/panels/profiler/HeapSnapshotView.ts +0 -7
- package/front_end/panels/profiler/profilesPanel.css +0 -11
- package/front_end/panels/recorder/ControlButton.ts +1 -1
- package/front_end/panels/recorder/RecorderPanel.ts +1 -1
- package/front_end/panels/recorder/RecordingView.ts +32 -11
- package/front_end/panels/recorder/StepView.ts +31 -5
- package/front_end/panels/recorder/TimelineSection.ts +22 -6
- package/front_end/panels/recorder/controlButton.css +2 -9
- package/front_end/panels/recorder/createRecordingView.css +1 -1
- package/front_end/panels/recorder/recorderPanel.css +0 -9
- package/front_end/panels/recorder/recordingListView.css +4 -4
- package/front_end/panels/recorder/recordingView.css +44 -52
- package/front_end/panels/recorder/replaySection.css +2 -0
- package/front_end/panels/recorder/stepEditor.css +4 -4
- package/front_end/panels/recorder/stepView.css +47 -21
- package/front_end/panels/recorder/timelineSection.css +63 -83
- package/front_end/panels/screencast/ScreencastApp.ts +0 -1
- package/front_end/panels/search/searchView.css +1 -1
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/security/originView.css +2 -2
- package/front_end/panels/sensors/SensorsView.ts +273 -361
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +0 -1
- package/front_end/panels/settings/backendLinkingSettingsTab.css +7 -7
- package/front_end/panels/settings/components/syncSection.css +0 -1
- package/front_end/panels/settings/workspaceSettingsTab.css +0 -5
- package/front_end/panels/sources/CSSPlugin.ts +177 -98
- package/front_end/panels/sources/DebuggerPausedMessage.ts +100 -27
- package/front_end/panels/sources/NavigatorView.ts +926 -946
- package/front_end/panels/sources/SourcesPanel.ts +9 -2
- package/front_end/panels/sources/breakpointsView.css +6 -28
- package/front_end/panels/sources/components/HeadersView.css +2 -2
- package/front_end/panels/sources/debuggerPausedMessage.css +7 -0
- package/front_end/panels/sources/navigatorTree.css +7 -2
- package/front_end/panels/sources/sourcesNavigator.css +0 -9
- package/front_end/panels/sources/sourcesView.css +2 -1
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -10
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -0
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +18 -5
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +0 -10
- package/front_end/panels/timeline/ModificationsManager.ts +0 -1
- package/front_end/panels/timeline/ThreadAppender.ts +2 -6
- package/front_end/panels/timeline/TimelineController.ts +30 -26
- package/front_end/panels/timeline/TimelineDetailsView.ts +10 -9
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +4 -16
- package/front_end/panels/timeline/TimelineMiniMap.ts +132 -54
- package/front_end/panels/timeline/TimelinePanel.ts +2 -2
- package/front_end/panels/timeline/TimelineTreeView.ts +63 -50
- package/front_end/panels/timeline/TimelineUIUtils.ts +8 -10
- package/front_end/panels/timeline/components/DetailsView.ts +7 -14
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +0 -2
- package/front_end/panels/timeline/components/NetworkTrackWidget.ts +5 -1
- package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -6
- package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -12
- package/front_end/panels/timeline/components/interactionBreakdown.css +1 -1
- package/front_end/panels/timeline/components/layoutShiftDetails.css +2 -9
- package/front_end/panels/timeline/components/liveMetricsView.css +0 -16
- package/front_end/panels/timeline/components/metricCard.css +1 -5
- package/front_end/panels/timeline/components/networkRequestDetails.css +3 -3
- package/front_end/panels/timeline/components/networkRequestTooltip.css +6 -4
- package/front_end/panels/timeline/components/networkTrackWidget.css +1 -1
- package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +1 -1
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
- package/front_end/panels/timeline/docs/profile_calls.md +7 -9
- package/front_end/panels/timeline/timelineDetailsView.css +1 -12
- package/front_end/panels/timeline/timelineFlamechartPopover.css +0 -4
- package/front_end/panels/timeline/timelineMiniMap.css +1 -4
- package/front_end/panels/timeline/timelinePanel.css +0 -4
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
- package/front_end/panels/timeline/timelineTreeView.css +0 -12
- package/front_end/panels/timeline/utils/EntryNodes.ts +1 -1
- package/front_end/panels/webauthn/webauthnPane.css +2 -8
- package/front_end/panels/whats_new/ReleaseNoteText.ts +1 -1
- package/front_end/third_party/axe-core/README.chromium +2 -3
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +328 -11
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +907 -588
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +119 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts +120 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.d.ts +16 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js +5 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts +26 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +23 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +21 -14
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts +5 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js +4 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts +6 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js +158 -67
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js +28 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.js +19 -11
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +17 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Input.js +62 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.d.ts +29 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.js +60 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/NetworkEvents.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +9 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +24 -9
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js +16 -7
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.js +37 -20
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +10 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Navigation.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Navigation.js +18 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Navigation.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Request.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Request.js +24 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Request.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js +6 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExtensionTransport.js +30 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExtensionTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js +12 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js +40 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.d.ts +23 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.js +37 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkEventManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +74 -16
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +3 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +34 -23
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.d.ts +10 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.js +94 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ResponseBodyStream.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js +29 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/utils.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/utils.js +6 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/utils.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConsoleMessage.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts +4 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +34 -15
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +11 -7
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +10 -7
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/decorators.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +328 -11
- package/front_end/third_party/puppeteer/package/package.json +10 -8
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +118 -0
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +119 -0
- package/front_end/third_party/puppeteer/package/src/api/HTTPRequest.ts +25 -2
- package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +28 -0
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +65 -38
- package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +27 -7
- package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +43 -7
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserConnector.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +5 -1
- package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +38 -8
- package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +27 -12
- package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +19 -6
- package/front_end/third_party/puppeteer/package/src/bidi/Input.ts +72 -5
- package/front_end/third_party/puppeteer/package/src/bidi/NetworkEvents.ts +82 -0
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +37 -13
- package/front_end/third_party/puppeteer/package/src/bidi/Realm.ts +26 -14
- package/front_end/third_party/puppeteer/package/src/bidi/core/Browser.ts +43 -22
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +13 -5
- package/front_end/third_party/puppeteer/package/src/bidi/core/Navigation.ts +21 -1
- package/front_end/third_party/puppeteer/package/src/bidi/core/Request.ts +27 -5
- package/front_end/third_party/puppeteer/package/src/cdp/Binding.ts +6 -4
- package/front_end/third_party/puppeteer/package/src/cdp/ExtensionTransport.ts +31 -6
- package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +5 -0
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +18 -1
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +48 -0
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkEventManager.ts +58 -5
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +94 -14
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +50 -28
- package/front_end/third_party/puppeteer/package/src/cdp/ResponseBodyStream.ts +106 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +38 -3
- package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/cdp/utils.ts +6 -5
- package/front_end/third_party/puppeteer/package/src/common/ConsoleMessage.ts +5 -0
- package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +17 -8
- package/front_end/third_party/puppeteer/package/src/common/util.ts +32 -15
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +21 -13
- package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +10 -10
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/decorators.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +2 -0
- package/front_end/ui/components/adorners/adorner.css +1 -1
- package/front_end/ui/components/buttons/button.css +0 -28
- package/front_end/ui/components/buttons/textButton.css +1 -45
- package/front_end/ui/components/diff_view/diffView.css +0 -2
- package/front_end/ui/components/input/checkbox.css +3 -3
- package/front_end/ui/components/issue_counter/issueLinkIcon.css +2 -2
- package/front_end/ui/components/menus/Menu.ts +14 -0
- package/front_end/ui/components/menus/menu.css +2 -14
- package/front_end/ui/components/menus/menuItem.css +0 -4
- package/front_end/ui/components/request_link_icon/requestLinkIcon.css +2 -2
- package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
- package/front_end/ui/components/survey_link/surveyLink.css +3 -3
- package/front_end/ui/components/switch/switch.css +3 -2
- package/front_end/ui/components/text_editor/theme.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +29 -0
- package/front_end/ui/components/tree_outline/treeOutline.css +1 -24
- package/front_end/ui/legacy/ContextMenu.ts +5 -5
- package/front_end/ui/legacy/SoftContextMenu.ts +24 -8
- package/front_end/ui/legacy/Toolbar.ts +1 -1
- package/front_end/ui/legacy/Treeoutline.ts +31 -78
- package/front_end/ui/legacy/UIUtils.ts +9 -17
- package/front_end/ui/legacy/checkboxTextLabel.css +2 -44
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +39 -27
- package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -10
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +2 -6
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +34 -26
- package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +1 -0
- package/front_end/ui/legacy/components/inline_editor/cssShadowEditor.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/swatchPopover.css +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +83 -21
- package/front_end/ui/legacy/components/object_ui/objectPopover.css +0 -4
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +41 -14
- package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -9
- package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +2 -1
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +0 -5
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +6 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +95 -1
- package/front_end/ui/legacy/components/source_frame/imageView.css +2 -2
- package/front_end/ui/legacy/filter.css +7 -3
- package/front_end/ui/legacy/inspectorCommon.css +7 -81
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
- package/front_end/ui/legacy/listWidget.css +2 -2
- package/front_end/ui/legacy/progressIndicator.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +6 -10
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/front_end/ui/visual_logging/LoggingDriver.ts +4 -0
- package/front_end/ui/visual_logging/visual_logging.ts +1 -1
- package/inspector_overlay/common.ts +0 -3
- package/inspector_overlay/main.ts +1 -3
- package/inspector_overlay/tool_highlight.css +0 -7
- package/inspector_overlay/tool_highlight.ts +0 -1
- package/inspector_overlay/tool_source_order.css +0 -4
- package/package.json +1 -1
- package/front_end/generated/SupportedCSSProperties.ts +0 -9689
|
@@ -15,13 +15,14 @@ import * as Bindings from '../../models/bindings/bindings.js';
|
|
|
15
15
|
import * as Elements from '../../models/elements/elements.js';
|
|
16
16
|
import type * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
17
17
|
import * as Tooltips from '../../ui/components/tooltips/tooltips.js';
|
|
18
|
-
import {createIcon, Icon} from '../../ui/kit/kit.js';
|
|
18
|
+
import {createIcon, type Icon} from '../../ui/kit/kit.js';
|
|
19
19
|
import * as ColorPicker from '../../ui/legacy/components/color_picker/color_picker.js';
|
|
20
20
|
import * as InlineEditor from '../../ui/legacy/components/inline_editor/inline_editor.js';
|
|
21
21
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
22
22
|
import {
|
|
23
23
|
Directives,
|
|
24
24
|
html,
|
|
25
|
+
i18nTemplate as litI18nTemplate,
|
|
25
26
|
type LitTemplate,
|
|
26
27
|
nothing,
|
|
27
28
|
render,
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
ShadowSwatchPopoverHelper,
|
|
39
40
|
} from './ColorSwatchPopoverIcon.js';
|
|
40
41
|
import * as ElementsComponents from './components/components.js';
|
|
41
|
-
import {cssRuleValidatorsMap} from './CSSRuleValidator.js';
|
|
42
|
+
import {cssRuleValidatorsMap, type Hint} from './CSSRuleValidator.js';
|
|
42
43
|
import {CSSValueTraceView} from './CSSValueTraceView.js';
|
|
43
44
|
import {ElementsPanel} from './ElementsPanel.js';
|
|
44
45
|
import {
|
|
@@ -62,7 +63,7 @@ import {getCssDeclarationAsJavascriptProperty} from './StylePropertyUtils.js';
|
|
|
62
63
|
import type {StylesContainer} from './StylesContainer.js';
|
|
63
64
|
import {CSSPropertyPrompt, REGISTERED_PROPERTY_SECTION_NAME} from './StylesSidebarPane.js';
|
|
64
65
|
|
|
65
|
-
const {classMap, ref, until} = Directives;
|
|
66
|
+
const {classMap, ifDefined, ref, until} = Directives;
|
|
66
67
|
const {ifExpanded} = Tooltips.Tooltip;
|
|
67
68
|
const ASTUtils = SDK.CSSPropertyParser.ASTUtils;
|
|
68
69
|
const FlexboxEditor = ElementsComponents.StylePropertyEditor.FlexboxEditor;
|
|
@@ -113,9 +114,11 @@ const UIStrings = {
|
|
|
113
114
|
*/
|
|
114
115
|
viewComputedValue: 'View computed value',
|
|
115
116
|
/**
|
|
116
|
-
* @description Tooltip text for a style property overridden by an animation.
|
|
117
|
+
* @description Tooltip text for a style property overridden by an animation. The placeholder is a link that opens
|
|
118
|
+
* the Animations panel.
|
|
119
|
+
* @example {Open Animations panel} PH1
|
|
117
120
|
*/
|
|
118
|
-
overriddenByAnimation: 'Overridden by animation styles',
|
|
121
|
+
overriddenByAnimation: 'Overridden by animation styles. {PH1}',
|
|
119
122
|
/**
|
|
120
123
|
* @description Link text in the tooltip to open the Animations panel.
|
|
121
124
|
*/
|
|
@@ -193,6 +196,7 @@ const UIStrings = {
|
|
|
193
196
|
} as const;
|
|
194
197
|
const str_ = i18n.i18n.registerUIStrings('panels/elements/StylePropertyTreeElement.ts', UIStrings);
|
|
195
198
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
199
|
+
const i18nTemplate = litI18nTemplate.bind(undefined, str_);
|
|
196
200
|
const parentMap = new WeakMap<StylesContainer, StylePropertyTreeElement>();
|
|
197
201
|
|
|
198
202
|
interface StylePropertyTreeElementParams {
|
|
@@ -206,15 +210,34 @@ interface StylePropertyTreeElementParams {
|
|
|
206
210
|
newProperty: boolean;
|
|
207
211
|
}
|
|
208
212
|
|
|
213
|
+
export interface StylePropertyData {
|
|
214
|
+
property: SDK.CSSProperty.CSSProperty;
|
|
215
|
+
readonly tooltipIdFactory: Tooltips.Tooltip.IdFactory;
|
|
216
|
+
readonly lastCommittedProperty: {readonly name: string, readonly value: string};
|
|
217
|
+
editable(): boolean;
|
|
218
|
+
inherited(): boolean;
|
|
219
|
+
overloaded(): boolean;
|
|
220
|
+
parentShorthand(): StylePropertyData|null;
|
|
221
|
+
matchedStyles(): SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
222
|
+
stylesContainer(): StylesContainer;
|
|
223
|
+
section(): StylePropertiesSection;
|
|
224
|
+
getComputedStyles(): Map<string, string>|null;
|
|
225
|
+
getComputedStyleExtraFields(): Protocol.CSS.ComputedStyleExtraFields|null;
|
|
226
|
+
renderedPropertyText(): string;
|
|
227
|
+
updateTitle(): void;
|
|
228
|
+
applyStyleText(styleText: string, majorChange: boolean): Promise<void>;
|
|
229
|
+
carryOverCommittedProperty(previous: StylePropertyData): void;
|
|
230
|
+
setSiblingProperty(propertyName: string, value?: string): Promise<void>;
|
|
231
|
+
}
|
|
209
232
|
const EnvFunctionRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.EnvFunctionMatch> =
|
|
210
233
|
rendererBase(SDK.CSSPropertyParserMatchers.EnvFunctionMatch);
|
|
211
234
|
// clang-format off
|
|
212
235
|
export class EnvFunctionRenderer extends EnvFunctionRendererBase {
|
|
213
236
|
// clang-format on
|
|
214
|
-
constructor(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
237
|
+
constructor(readonly propertyData: StylePropertyData|null,
|
|
238
|
+
readonly matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
239
|
+
readonly computedStyles: Map<string, string>,
|
|
240
|
+
readonly computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null) {
|
|
218
241
|
super();
|
|
219
242
|
}
|
|
220
243
|
override render(match: SDK.CSSPropertyParserMatchers.EnvFunctionMatch, context: RenderingContext): LitTemplate {
|
|
@@ -229,9 +252,10 @@ export class EnvFunctionRenderer extends EnvFunctionRendererBase {
|
|
|
229
252
|
}
|
|
230
253
|
}
|
|
231
254
|
|
|
232
|
-
const func =
|
|
233
|
-
this.
|
|
234
|
-
|
|
255
|
+
const func = this.propertyData ?
|
|
256
|
+
getTracingTooltip('env', match.node, this.matchedStyles, this.computedStyles, this.computedStyleExtraFields,
|
|
257
|
+
context, this.propertyData.stylesContainer(), this.propertyData.tooltipIdFactory,
|
|
258
|
+
this.propertyData.property, this.propertyData.parentShorthand()?.property.name) :
|
|
235
259
|
'env';
|
|
236
260
|
const valueClass = classMap({'inactive-value': !match.varNameIsValid});
|
|
237
261
|
const fallbackClass = classMap({'inactive-value': match.varNameIsValid});
|
|
@@ -250,21 +274,21 @@ const FlexGridRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.FlexGridG
|
|
|
250
274
|
// clang-format off
|
|
251
275
|
export class FlexGridRenderer extends FlexGridRendererBase {
|
|
252
276
|
// clang-format on
|
|
253
|
-
readonly #
|
|
277
|
+
readonly #propertyData: StylePropertyData|null;
|
|
254
278
|
readonly #stylesContainer: StylesContainer;
|
|
255
|
-
constructor(stylesContainer: StylesContainer,
|
|
279
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null) {
|
|
256
280
|
super();
|
|
257
|
-
this.#
|
|
281
|
+
this.#propertyData = propertyData;
|
|
258
282
|
this.#stylesContainer = stylesContainer;
|
|
259
283
|
}
|
|
260
284
|
|
|
261
285
|
override render(match: SDK.CSSPropertyParserMatchers.FlexGridGridLanesMatch, context: RenderingContext): LitTemplate {
|
|
262
286
|
const children = Renderer.render(ASTUtils.siblings(ASTUtils.declValue(match.node)), context).nodes;
|
|
263
|
-
if (!this.#
|
|
287
|
+
if (!this.#propertyData?.editable()) {
|
|
264
288
|
return children;
|
|
265
289
|
}
|
|
266
290
|
const key =
|
|
267
|
-
`${this.#
|
|
291
|
+
`${this.#propertyData.section().getSectionIdx()}_${this.#propertyData.section().nextEditorTriggerButtonIdx++}`;
|
|
268
292
|
|
|
269
293
|
function getEditorClass(layoutType: SDK.CSSPropertyParserMatchers.LayoutType): typeof FlexboxEditor|
|
|
270
294
|
typeof GridEditor|typeof GridLanesEditor {
|
|
@@ -301,7 +325,7 @@ export class FlexGridRenderer extends FlexGridRendererBase {
|
|
|
301
325
|
}
|
|
302
326
|
|
|
303
327
|
const button = StyleEditorWidget.createTriggerButton(
|
|
304
|
-
this.#stylesContainer, this.#
|
|
328
|
+
this.#stylesContainer, this.#propertyData.section(), getEditorClass(match.layoutType),
|
|
305
329
|
getButtonTitle(match.layoutType), key, match.layoutType, () => {
|
|
306
330
|
Host.userMetrics.swatchActivated(getSwatchType(match.layoutType));
|
|
307
331
|
});
|
|
@@ -314,11 +338,11 @@ const CSSWideKeywordRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.CSS
|
|
|
314
338
|
// clang-format off
|
|
315
339
|
export class CSSWideKeywordRenderer extends CSSWideKeywordRendererBase {
|
|
316
340
|
// clang-format on
|
|
317
|
-
readonly #
|
|
341
|
+
readonly #propertyData: StylePropertyData|null;
|
|
318
342
|
readonly #stylesContainer: StylesContainer;
|
|
319
|
-
constructor(stylesContainer: StylesContainer,
|
|
343
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null) {
|
|
320
344
|
super();
|
|
321
|
-
this.#
|
|
345
|
+
this.#propertyData = propertyData;
|
|
322
346
|
this.#stylesContainer = stylesContainer;
|
|
323
347
|
}
|
|
324
348
|
|
|
@@ -330,10 +354,10 @@ export class CSSWideKeywordRenderer extends CSSWideKeywordRendererBase {
|
|
|
330
354
|
|
|
331
355
|
const swatch = html`<devtools-link-swatch .data=${{
|
|
332
356
|
text: match.text,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
357
|
+
tooltip: resolvedProperty ? undefined : {title: i18nString(UIStrings.sIsNotDefined, {PH1: match.text})},
|
|
358
|
+
isDefined: Boolean(resolvedProperty),
|
|
359
|
+
onLinkActivate: () => resolvedProperty && this.#stylesContainer.jumpToDeclaration(resolvedProperty),
|
|
360
|
+
jslogContext: 'css-wide-keyword-link',
|
|
337
361
|
}
|
|
338
362
|
}></devtools-link-swatch>`;
|
|
339
363
|
|
|
@@ -342,8 +366,8 @@ export class CSSWideKeywordRenderer extends CSSWideKeywordRendererBase {
|
|
|
342
366
|
const color = Common.Color.parse(context.matchedResult.getComputedText(match.node));
|
|
343
367
|
if (color) {
|
|
344
368
|
const colorSwatch =
|
|
345
|
-
new ColorRenderer(this.#stylesContainer, this.#
|
|
346
|
-
return this.#
|
|
369
|
+
new ColorRenderer(this.#stylesContainer, this.#propertyData).renderColorSwatch(color, match, context);
|
|
370
|
+
return this.#propertyData?.editable() ?
|
|
347
371
|
html`<devtools-widget ${widget(EditableContent)}>${colorSwatch}${swatch}</devtools-widget>` :
|
|
348
372
|
html`${colorSwatch}${swatch}`;
|
|
349
373
|
}
|
|
@@ -374,16 +398,15 @@ const VariableRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.VariableM
|
|
|
374
398
|
export class VariableRenderer extends VariableRendererBase {
|
|
375
399
|
// clang-format on
|
|
376
400
|
readonly #stylesContainer: StylesContainer;
|
|
377
|
-
readonly #
|
|
401
|
+
readonly #propertyData: StylePropertyData|null;
|
|
378
402
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
379
403
|
readonly #computedStyles: Map<string, string>;
|
|
380
404
|
readonly #computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null;
|
|
381
|
-
constructor(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null) {
|
|
405
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null,
|
|
406
|
+
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, computedStyles: Map<string, string>,
|
|
407
|
+
computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null) {
|
|
385
408
|
super();
|
|
386
|
-
this.#
|
|
409
|
+
this.#propertyData = propertyData;
|
|
387
410
|
this.#stylesContainer = stylesContainer;
|
|
388
411
|
this.#matchedStyles = matchedStyles;
|
|
389
412
|
this.#computedStyles = computedStyles;
|
|
@@ -391,7 +414,7 @@ export class VariableRenderer extends VariableRendererBase {
|
|
|
391
414
|
}
|
|
392
415
|
|
|
393
416
|
override render(match: SDK.CSSPropertyParserMatchers.VariableMatch, context: RenderingContext): LitTemplate {
|
|
394
|
-
if (this.#
|
|
417
|
+
if (this.#propertyData?.property.ownerStyle.parentRule instanceof SDK.CSSRule.CSSFunctionRule) {
|
|
395
418
|
return Renderer.render(ASTUtils.children(match.node), context).nodes;
|
|
396
419
|
}
|
|
397
420
|
|
|
@@ -407,9 +430,8 @@ export class VariableRenderer extends VariableRendererBase {
|
|
|
407
430
|
const {nodes, cssControls} = Renderer.renderValueNodes(
|
|
408
431
|
{name: declaration.name, value: declaration.value ?? ''},
|
|
409
432
|
substitution.cachedParsedValue(declaration.declaration, this.#matchedStyles, this.#computedStyles),
|
|
410
|
-
getPropertyRenderers(
|
|
411
|
-
|
|
412
|
-
this.#computedStyles, this.#computedStyleExtraFields),
|
|
433
|
+
getPropertyRenderers(declaration.name, declaration.style, this.#stylesContainer, this.#matchedStyles, null,
|
|
434
|
+
this.#computedStyles, this.#computedStyleExtraFields),
|
|
413
435
|
substitution);
|
|
414
436
|
cssControls.forEach((value, key) => value.forEach(control => context.addControl(key, control)));
|
|
415
437
|
return nodes;
|
|
@@ -421,9 +443,12 @@ export class VariableRenderer extends VariableRendererBase {
|
|
|
421
443
|
|
|
422
444
|
const renderedFallback = match.fallback ? Renderer.render(match.fallback, context) : undefined;
|
|
423
445
|
|
|
424
|
-
const varCall = this.#
|
|
425
|
-
'var', match.node, this.#matchedStyles, this.#computedStyles, this.#computedStyleExtraFields,
|
|
426
|
-
|
|
446
|
+
const varCall = this.#propertyData ?
|
|
447
|
+
getTracingTooltip('var', match.node, this.#matchedStyles, this.#computedStyles, this.#computedStyleExtraFields,
|
|
448
|
+
context, this.#stylesContainer, this.#propertyData.tooltipIdFactory,
|
|
449
|
+
this.#propertyData.property, this.#propertyData.parentShorthand()?.property.name) :
|
|
450
|
+
undefined;
|
|
451
|
+
const tooltipId = getTooltipId(this.#propertyData, 'custom-property-var');
|
|
427
452
|
const tooltip = tooltipId ? {tooltipId} : undefined;
|
|
428
453
|
// clang-format off
|
|
429
454
|
const varSwatch = html`<span
|
|
@@ -451,20 +476,21 @@ export class VariableRenderer extends VariableRendererBase {
|
|
|
451
476
|
return varSwatch;
|
|
452
477
|
}
|
|
453
478
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
479
|
+
const colorSwatch =
|
|
480
|
+
new ColorRenderer(this.#stylesContainer, this.#propertyData).renderColorSwatch(color, match, context);
|
|
481
|
+
context.addControl('color', colorSwatch);
|
|
457
482
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
483
|
+
if (fromFallback) {
|
|
484
|
+
renderedFallback?.cssControls.get('color')?.forEach(
|
|
485
|
+
innerSwatch =>
|
|
486
|
+
innerSwatch.addEventListener(InlineEditor.ColorSwatch.ColorChangedEvent.eventName, ev => {
|
|
487
|
+
colorSwatch.setColor(ev.data.color);
|
|
488
|
+
}));
|
|
489
|
+
}
|
|
464
490
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
491
|
+
return this.#propertyData?.editable() ?
|
|
492
|
+
html`<devtools-widget ${widget(EditableContent)}>${colorSwatch}${varSwatch}</devtools-widget>` :
|
|
493
|
+
html`${colorSwatch}${varSwatch}`;
|
|
468
494
|
}
|
|
469
495
|
}
|
|
470
496
|
|
|
@@ -474,18 +500,18 @@ const VariableNameRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.Varia
|
|
|
474
500
|
export class VariableNameRenderer extends VariableNameRendererBase {
|
|
475
501
|
// clang-format on
|
|
476
502
|
readonly #stylesContainer: StylesContainer;
|
|
477
|
-
readonly #
|
|
503
|
+
readonly #propertyData: StylePropertyData|null;
|
|
478
504
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
479
|
-
constructor(stylesContainer: StylesContainer,
|
|
505
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null,
|
|
480
506
|
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles) {
|
|
481
507
|
super();
|
|
482
|
-
this.#
|
|
508
|
+
this.#propertyData = propertyData;
|
|
483
509
|
this.#stylesContainer = stylesContainer;
|
|
484
510
|
this.#matchedStyles = matchedStyles;
|
|
485
511
|
}
|
|
486
512
|
|
|
487
513
|
override render(match: SDK.CSSPropertyParserMatchers.VariableNameMatch, _context: RenderingContext): LitTemplate {
|
|
488
|
-
if (this.#
|
|
514
|
+
if (this.#propertyData?.property.ownerStyle.parentRule instanceof SDK.CSSRule.CSSFunctionRule) {
|
|
489
515
|
return html`${match.text}`;
|
|
490
516
|
}
|
|
491
517
|
|
|
@@ -494,7 +520,7 @@ export class VariableNameRenderer extends VariableNameRendererBase {
|
|
|
494
520
|
const onLinkActivate = (name: string): void =>
|
|
495
521
|
handleVarDefinitionActivate(declaration ?? name, this.#stylesContainer);
|
|
496
522
|
|
|
497
|
-
const tooltipId = this.#
|
|
523
|
+
const tooltipId = getTooltipId(this.#propertyData, 'custom-property-var');
|
|
498
524
|
const tooltip = tooltipId ? {tooltipId} : undefined;
|
|
499
525
|
// clang-format off
|
|
500
526
|
return html`<devtools-link-swatch class=css-var-link .data=${{
|
|
@@ -520,16 +546,15 @@ const AttributeRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.Attribut
|
|
|
520
546
|
export class AttributeRenderer extends AttributeRendererBase {
|
|
521
547
|
// clang-format on
|
|
522
548
|
readonly #stylesContainer: StylesContainer;
|
|
523
|
-
readonly #
|
|
549
|
+
readonly #propertyData: StylePropertyData|null;
|
|
524
550
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
525
551
|
readonly #computedStyles: Map<string, string>;
|
|
526
552
|
readonly #computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null;
|
|
527
|
-
constructor(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null) {
|
|
553
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null,
|
|
554
|
+
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, computedStyles: Map<string, string>,
|
|
555
|
+
computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null) {
|
|
531
556
|
super();
|
|
532
|
-
this.#
|
|
557
|
+
this.#propertyData = propertyData;
|
|
533
558
|
this.#stylesContainer = stylesContainer;
|
|
534
559
|
this.#matchedStyles = matchedStyles;
|
|
535
560
|
this.#computedStyles = computedStyles;
|
|
@@ -537,7 +562,7 @@ export class AttributeRenderer extends AttributeRendererBase {
|
|
|
537
562
|
}
|
|
538
563
|
|
|
539
564
|
override render(match: SDK.CSSPropertyParserMatchers.AttributeMatch, context: RenderingContext): LitTemplate {
|
|
540
|
-
if (this.#
|
|
565
|
+
if (this.#propertyData?.property.ownerStyle.parentRule instanceof SDK.CSSRule.CSSFunctionRule) {
|
|
541
566
|
return Renderer.render(ASTUtils.children(match.node), context).nodes;
|
|
542
567
|
}
|
|
543
568
|
|
|
@@ -570,9 +595,8 @@ export class AttributeRenderer extends AttributeRendererBase {
|
|
|
570
595
|
return Renderer
|
|
571
596
|
.renderValueNodes(
|
|
572
597
|
{name: '--property', value: match.substitutionText}, matching,
|
|
573
|
-
getPropertyRenderers(
|
|
574
|
-
|
|
575
|
-
this.#computedStyleExtraFields),
|
|
598
|
+
getPropertyRenderers('--property', match.style, this.#stylesContainer, this.#matchedStyles, null,
|
|
599
|
+
this.#computedStyles, this.#computedStyleExtraFields),
|
|
576
600
|
substitution)
|
|
577
601
|
.nodes;
|
|
578
602
|
}
|
|
@@ -580,9 +604,12 @@ export class AttributeRenderer extends AttributeRendererBase {
|
|
|
580
604
|
|
|
581
605
|
const renderedFallback = match.fallback ? Renderer.render(match.fallback, context) : undefined;
|
|
582
606
|
|
|
583
|
-
const attrCall = this.#
|
|
584
|
-
'attr', match.node, this.#matchedStyles, this.#computedStyles, this.#computedStyleExtraFields,
|
|
585
|
-
|
|
607
|
+
const attrCall = this.#propertyData ?
|
|
608
|
+
getTracingTooltip('attr', match.node, this.#matchedStyles, this.#computedStyles, this.#computedStyleExtraFields,
|
|
609
|
+
context, this.#stylesContainer, this.#propertyData.tooltipIdFactory,
|
|
610
|
+
this.#propertyData.property, this.#propertyData.parentShorthand()?.property.name) :
|
|
611
|
+
undefined;
|
|
612
|
+
const tooltipId = attributeMissing ? undefined : getTooltipId(this.#propertyData, 'custom-attribute');
|
|
586
613
|
const tooltip = tooltipId ? {tooltipId} : undefined;
|
|
587
614
|
// clang-format off
|
|
588
615
|
const varSwatch = html`<span
|
|
@@ -609,7 +636,7 @@ export class AttributeRenderer extends AttributeRendererBase {
|
|
|
609
636
|
}
|
|
610
637
|
|
|
611
638
|
const colorSwatch =
|
|
612
|
-
new ColorRenderer(this.#stylesContainer, this.#
|
|
639
|
+
new ColorRenderer(this.#stylesContainer, this.#propertyData).renderColorSwatch(color, match, context);
|
|
613
640
|
context.addControl('color', colorSwatch);
|
|
614
641
|
|
|
615
642
|
if (fromFallback) {
|
|
@@ -619,7 +646,7 @@ export class AttributeRenderer extends AttributeRendererBase {
|
|
|
619
646
|
}));
|
|
620
647
|
}
|
|
621
648
|
|
|
622
|
-
return this.#
|
|
649
|
+
return this.#propertyData?.editable() ?
|
|
623
650
|
html`<devtools-widget ${widget(EditableContent)}>${colorSwatch}${varSwatch}</devtools-widget>` :
|
|
624
651
|
html`${colorSwatch}${varSwatch}`;
|
|
625
652
|
}
|
|
@@ -648,8 +675,8 @@ export class LinearGradientRenderer extends LinearGradientRendererBase {
|
|
|
648
675
|
if (angle instanceof InlineEditor.CSSAngle.CSSAngle) {
|
|
649
676
|
angle.updateProperty(context.matchedResult.getComputedText(match.node));
|
|
650
677
|
const args = ASTUtils.callArgs(match.node);
|
|
651
|
-
const angleNode = args[0]?.find(
|
|
652
|
-
|
|
678
|
+
const angleNode = args[0]?.find(node => context.matchedResult.getMatch(node) instanceof
|
|
679
|
+
SDK.CSSPropertyParserMatchers.AngleMatch);
|
|
653
680
|
const angleMatch = angleNode && context.matchedResult.getMatch(angleNode);
|
|
654
681
|
if (angleMatch) {
|
|
655
682
|
angle.addEventListener(InlineEditor.InlineEditorUtils.ValueChangedEvent.eventName, ev => {
|
|
@@ -667,10 +694,10 @@ const RelativeColorChannelRendererBase: RendererBase<SDK.CSSPropertyParserMatche
|
|
|
667
694
|
// clang-format off
|
|
668
695
|
export class RelativeColorChannelRenderer extends RelativeColorChannelRendererBase {
|
|
669
696
|
// clang-format on
|
|
670
|
-
readonly #
|
|
671
|
-
constructor(
|
|
697
|
+
readonly #propertyData: StylePropertyData|null;
|
|
698
|
+
constructor(propertyData: StylePropertyData|null) {
|
|
672
699
|
super();
|
|
673
|
-
this.#
|
|
700
|
+
this.#propertyData = propertyData;
|
|
674
701
|
}
|
|
675
702
|
override render(match: SDK.CSSPropertyParserMatchers.RelativeColorChannelMatch,
|
|
676
703
|
context: RenderingContext): LitTemplate {
|
|
@@ -690,7 +717,7 @@ export class RelativeColorChannelRenderer extends RelativeColorChannelRendererBa
|
|
|
690
717
|
return evaluation;
|
|
691
718
|
}
|
|
692
719
|
|
|
693
|
-
const tooltipId = this.#
|
|
720
|
+
const tooltipId = getTooltipId(this.#propertyData, 'relative-color-channel');
|
|
694
721
|
if (!tooltipId) {
|
|
695
722
|
return html`<span>${match.text}</span>`;
|
|
696
723
|
}
|
|
@@ -706,11 +733,11 @@ const ColorRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.ColorMatch>
|
|
|
706
733
|
// clang-format off
|
|
707
734
|
export class ColorRenderer extends ColorRendererBase {
|
|
708
735
|
// clang-format on
|
|
709
|
-
readonly #
|
|
736
|
+
readonly #propertyData: StylePropertyData|null;
|
|
710
737
|
readonly #stylesContainer: StylesContainer;
|
|
711
|
-
constructor(stylesContainer: StylesContainer,
|
|
738
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null) {
|
|
712
739
|
super();
|
|
713
|
-
this.#
|
|
740
|
+
this.#propertyData = propertyData;
|
|
714
741
|
this.#stylesContainer = stylesContainer;
|
|
715
742
|
}
|
|
716
743
|
|
|
@@ -730,10 +757,13 @@ export class ColorRenderer extends ColorRendererBase {
|
|
|
730
757
|
const renderingContext = childTracingContexts?.at(0)?.renderingContext(context) ?? context;
|
|
731
758
|
const {nodes, cssControls} = Renderer.render(args, renderingContext);
|
|
732
759
|
const valueChild = html`<span>${
|
|
733
|
-
this.#
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
760
|
+
this.#propertyData ?
|
|
761
|
+
getTracingTooltip(func, match.node, this.#propertyData.matchedStyles(),
|
|
762
|
+
this.#propertyData.getComputedStyles() ?? new Map(),
|
|
763
|
+
this.#propertyData.getComputedStyleExtraFields(), renderingContext, this.#stylesContainer,
|
|
764
|
+
this.#propertyData.tooltipIdFactory, this.#propertyData.property,
|
|
765
|
+
this.#propertyData.parentShorthand()?.property.name) :
|
|
766
|
+
func}${nodes}</span>`;
|
|
737
767
|
|
|
738
768
|
return {valueChild, cssControls, childTracingContexts};
|
|
739
769
|
}
|
|
@@ -797,7 +827,7 @@ export class ColorRenderer extends ColorRendererBase {
|
|
|
797
827
|
});
|
|
798
828
|
}
|
|
799
829
|
}
|
|
800
|
-
return this.#
|
|
830
|
+
return this.#propertyData?.editable() ?
|
|
801
831
|
html`<devtools-widget ${widget(EditableContent)}>${swatch}${valueChild}</devtools-widget>` :
|
|
802
832
|
html`${swatch}${valueChild}`;
|
|
803
833
|
}
|
|
@@ -806,7 +836,7 @@ export class ColorRenderer extends ColorRendererBase {
|
|
|
806
836
|
// to update the enclosing `EditableContent`, and the new text is recorded as the edit of `match`.
|
|
807
837
|
renderColorSwatch(color: Common.Color.Color|undefined, match: SDK.CSSPropertyParser.Match,
|
|
808
838
|
context: RenderingContext): InlineEditor.ColorSwatch.ColorSwatch {
|
|
809
|
-
const editable = this.#
|
|
839
|
+
const editable = this.#propertyData?.editable();
|
|
810
840
|
const shiftClickMessage = i18nString(UIStrings.shiftClickToChangeColorFormat);
|
|
811
841
|
const tooltip = editable ? i18nString(UIStrings.openColorPickerS, {PH1: shiftClickMessage}) : '';
|
|
812
842
|
|
|
@@ -816,18 +846,18 @@ export class ColorRenderer extends ColorRendererBase {
|
|
|
816
846
|
swatch.renderColor(color);
|
|
817
847
|
}
|
|
818
848
|
|
|
819
|
-
if (this.#
|
|
849
|
+
if (this.#propertyData?.editable()) {
|
|
820
850
|
swatch.slot = 'icon';
|
|
821
|
-
const
|
|
851
|
+
const propertyData = this.#propertyData;
|
|
822
852
|
const onColorChanged = (): void => {
|
|
823
|
-
void
|
|
853
|
+
void propertyData.applyStyleText(propertyData.renderedPropertyText(), false);
|
|
824
854
|
};
|
|
825
855
|
|
|
826
856
|
const onColorFormatChanged = (e: InlineEditor.ColorSwatch.ColorFormatChangedEvent): void => {
|
|
827
857
|
const text = e.data.color.getAuthoredText() ?? e.data.color.asString();
|
|
828
858
|
swatch.dispatchEvent(new ValueEditEvent(text));
|
|
829
859
|
context.recordEdit(match, text);
|
|
830
|
-
void
|
|
860
|
+
void propertyData.applyStyleText(propertyData.renderedPropertyText(), false);
|
|
831
861
|
};
|
|
832
862
|
|
|
833
863
|
swatch.addEventListener(InlineEditor.ColorSwatch.ClickEvent.eventName, () => {
|
|
@@ -837,14 +867,14 @@ export class ColorRenderer extends ColorRendererBase {
|
|
|
837
867
|
swatch.addEventListener(InlineEditor.ColorSwatch.ColorFormatChangedEvent.eventName, onColorFormatChanged);
|
|
838
868
|
|
|
839
869
|
const swatchIcon =
|
|
840
|
-
new ColorSwatchPopoverIcon(
|
|
870
|
+
new ColorSwatchPopoverIcon(propertyData, propertyData.stylesContainer().swatchPopoverHelper(), swatch);
|
|
841
871
|
swatchIcon.addEventListener(ColorSwatchPopoverIconEvents.COLOR_CHANGED, ev => {
|
|
842
872
|
const text = ev.data.getAuthoredText() ?? ev.data.asString();
|
|
843
873
|
swatch.dispatchEvent(new ValueEditEvent(text));
|
|
844
874
|
context.recordEdit(match, text);
|
|
845
875
|
swatch.setColor(ev.data);
|
|
846
876
|
});
|
|
847
|
-
if (
|
|
877
|
+
if (propertyData.property.name === 'color') {
|
|
848
878
|
void this.#addColorContrastInfo(swatchIcon);
|
|
849
879
|
}
|
|
850
880
|
}
|
|
@@ -868,14 +898,13 @@ const LightDarkColorRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.Lig
|
|
|
868
898
|
// clang-format off
|
|
869
899
|
export class LightDarkColorRenderer extends LightDarkColorRendererBase {
|
|
870
900
|
// clang-format on
|
|
871
|
-
readonly #
|
|
901
|
+
readonly #propertyData: StylePropertyData|null;
|
|
872
902
|
readonly #stylesContainer: StylesContainer;
|
|
873
903
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
874
|
-
constructor(
|
|
875
|
-
|
|
876
|
-
treeElement: StylePropertyTreeElement|null) {
|
|
904
|
+
constructor(stylesContainer: StylesContainer, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
905
|
+
propertyData: StylePropertyData|null) {
|
|
877
906
|
super();
|
|
878
|
-
this.#
|
|
907
|
+
this.#propertyData = propertyData;
|
|
879
908
|
this.#stylesContainer = stylesContainer;
|
|
880
909
|
this.#matchedStyles = matchedStyles;
|
|
881
910
|
}
|
|
@@ -906,12 +935,12 @@ export class LightDarkColorRenderer extends LightDarkColorRendererBase {
|
|
|
906
935
|
// Pass an undefined color here to insert a placeholder swatch that will be filled in from the async
|
|
907
936
|
// applyColorScheme below.
|
|
908
937
|
const colorSwatch =
|
|
909
|
-
new ColorRenderer(this.#stylesContainer, this.#
|
|
938
|
+
new ColorRenderer(this.#stylesContainer, this.#propertyData).renderColorSwatch(undefined, match, context);
|
|
910
939
|
context.addControl('color', colorSwatch);
|
|
911
940
|
const styledContent =
|
|
912
941
|
until(this.applyColorScheme(match, context, colorSwatch, light, dark, lightControls, darkControls), content);
|
|
913
942
|
|
|
914
|
-
return this.#
|
|
943
|
+
return this.#propertyData?.editable() ?
|
|
915
944
|
html`<devtools-widget ${widget(EditableContent)}>${colorSwatch}${styledContent}</devtools-widget>` :
|
|
916
945
|
html`${colorSwatch}${styledContent}`;
|
|
917
946
|
}
|
|
@@ -925,9 +954,8 @@ export class LightDarkColorRenderer extends LightDarkColorRendererBase {
|
|
|
925
954
|
}
|
|
926
955
|
|
|
927
956
|
const activeColorSwatches = (activeColor === match.light ? lightControls : darkControls).get('color');
|
|
928
|
-
activeColorSwatches?.forEach(
|
|
929
|
-
|
|
930
|
-
InlineEditor.ColorSwatch.ColorChangedEvent.eventName, ev => colorSwatch.setColor(ev.data.color)));
|
|
957
|
+
activeColorSwatches?.forEach(swatch => swatch.addEventListener(InlineEditor.ColorSwatch.ColorChangedEvent.eventName,
|
|
958
|
+
ev => colorSwatch.setColor(ev.data.color)));
|
|
931
959
|
const colorText = context.matchedResult.getComputedTextRange(activeColor[0], activeColor[activeColor.length - 1]);
|
|
932
960
|
const color = colorText && Common.Color.parse(colorText);
|
|
933
961
|
if (color) {
|
|
@@ -979,18 +1007,17 @@ export class ColorMixRenderer extends ColorMixRendererBase {
|
|
|
979
1007
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
980
1008
|
readonly #computedStyles: Map<string, string>;
|
|
981
1009
|
readonly #computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null;
|
|
982
|
-
readonly #
|
|
1010
|
+
readonly #propertyData: StylePropertyData|null;
|
|
983
1011
|
|
|
984
|
-
constructor(
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
treeElement: StylePropertyTreeElement|null) {
|
|
1012
|
+
constructor(stylesContainer: StylesContainer, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
1013
|
+
computedStyles: Map<string, string>, computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null,
|
|
1014
|
+
propertyData: StylePropertyData|null) {
|
|
988
1015
|
super();
|
|
989
1016
|
this.#stylesContainer = stylesContainer;
|
|
990
1017
|
this.#matchedStyles = matchedStyles;
|
|
991
1018
|
this.#computedStyles = computedStyles;
|
|
992
1019
|
this.#computedStyleExtraFields = computedStyleExtraFields;
|
|
993
|
-
this.#
|
|
1020
|
+
this.#propertyData = propertyData;
|
|
994
1021
|
}
|
|
995
1022
|
|
|
996
1023
|
override render(match: SDK.CSSPropertyParserMatchers.ColorMixMatch, context: RenderingContext): LitTemplate {
|
|
@@ -998,12 +1025,11 @@ export class ColorMixRenderer extends ColorMixRendererBase {
|
|
|
998
1025
|
if (node instanceof InlineEditor.ColorMixSwatch.ColorMixSwatch ||
|
|
999
1026
|
node instanceof InlineEditor.ColorSwatch.ColorSwatch) {
|
|
1000
1027
|
if (node instanceof InlineEditor.ColorSwatch.ColorSwatch) {
|
|
1001
|
-
node.addEventListener(
|
|
1002
|
-
|
|
1003
|
-
ev => onChange(ev.data.color.getAuthoredText() ?? ev.data.color.asString()));
|
|
1028
|
+
node.addEventListener(InlineEditor.ColorSwatch.ColorChangedEvent.eventName,
|
|
1029
|
+
ev => onChange(ev.data.color.getAuthoredText() ?? ev.data.color.asString()));
|
|
1004
1030
|
} else {
|
|
1005
|
-
node.addEventListener(
|
|
1006
|
-
|
|
1031
|
+
node.addEventListener(InlineEditor.ColorMixSwatch.ColorMixChangedEvent.eventName,
|
|
1032
|
+
ev => onChange(ev.data.text));
|
|
1007
1033
|
}
|
|
1008
1034
|
const color = node.getText();
|
|
1009
1035
|
if (color) {
|
|
@@ -1024,10 +1050,13 @@ export class ColorMixRenderer extends ColorMixRendererBase {
|
|
|
1024
1050
|
const color1 = Renderer.render(match.color1, color1RenderingContext);
|
|
1025
1051
|
const color2 = Renderer.render(match.color2, color2RenderingContext);
|
|
1026
1052
|
const contentChild = html`<span>${
|
|
1027
|
-
this.#
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1053
|
+
this.#propertyData ? getTracingTooltip('color-mix', match.node, this.#matchedStyles, this.#computedStyles,
|
|
1054
|
+
this.#computedStyleExtraFields, context, this.#stylesContainer,
|
|
1055
|
+
this.#propertyData.tooltipIdFactory, this.#propertyData.property,
|
|
1056
|
+
this.#propertyData.parentShorthand()?.property.name) :
|
|
1057
|
+
'color-mix'}(${
|
|
1058
|
+
match.space.length ? html`${Renderer.render(match.space, spaceRenderingContext).nodes}, ` :
|
|
1059
|
+
''}${color1.nodes}, ${color2.nodes})</span>`;
|
|
1031
1060
|
|
|
1032
1061
|
const color1Controls = color1.cssControls.get('color') ?? [];
|
|
1033
1062
|
const color2Controls = color2.cssControls.get('color') ?? [];
|
|
@@ -1087,7 +1116,7 @@ export class ColorMixRenderer extends ColorMixRendererBase {
|
|
|
1087
1116
|
return html`${swatch}${contentChild}`;
|
|
1088
1117
|
}
|
|
1089
1118
|
|
|
1090
|
-
const tooltipId = this.#
|
|
1119
|
+
const tooltipId = getTooltipId(this.#propertyData, 'color-mix');
|
|
1091
1120
|
if (!tooltipId) {
|
|
1092
1121
|
return html`${swatch}${contentChild}`;
|
|
1093
1122
|
}
|
|
@@ -1114,11 +1143,11 @@ const ContrastColorRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.Cont
|
|
|
1114
1143
|
// clang-format off
|
|
1115
1144
|
export class ContrastColorRenderer extends ContrastColorRendererBase {
|
|
1116
1145
|
// clang-format on
|
|
1117
|
-
readonly #
|
|
1146
|
+
readonly #propertyData: StylePropertyData|null;
|
|
1118
1147
|
readonly #stylesContainer: StylesContainer;
|
|
1119
|
-
constructor(stylesContainer: StylesContainer,
|
|
1148
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null) {
|
|
1120
1149
|
super();
|
|
1121
|
-
this.#
|
|
1150
|
+
this.#propertyData = propertyData;
|
|
1122
1151
|
this.#stylesContainer = stylesContainer;
|
|
1123
1152
|
}
|
|
1124
1153
|
|
|
@@ -1141,10 +1170,10 @@ export class ContrastColorRenderer extends ContrastColorRendererBase {
|
|
|
1141
1170
|
}
|
|
1142
1171
|
|
|
1143
1172
|
const colorSwatch =
|
|
1144
|
-
new ColorRenderer(this.#stylesContainer, this.#
|
|
1173
|
+
new ColorRenderer(this.#stylesContainer, this.#propertyData).renderColorSwatch(color, match, context);
|
|
1145
1174
|
context.addControl('color', colorSwatch);
|
|
1146
1175
|
|
|
1147
|
-
return this.#
|
|
1176
|
+
return this.#propertyData?.editable() ?
|
|
1148
1177
|
html`<devtools-widget ${widget(EditableContent)}>${colorSwatch}${content}</devtools-widget>` :
|
|
1149
1178
|
html`${colorSwatch}${content}`;
|
|
1150
1179
|
}
|
|
@@ -1155,15 +1184,15 @@ const AngleRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.AngleMatch>
|
|
|
1155
1184
|
// clang-format off
|
|
1156
1185
|
export class AngleRenderer extends AngleRendererBase {
|
|
1157
1186
|
// clang-format on
|
|
1158
|
-
readonly #
|
|
1159
|
-
constructor(
|
|
1187
|
+
readonly #propertyData: StylePropertyData|null;
|
|
1188
|
+
constructor(propertyData: StylePropertyData|null) {
|
|
1160
1189
|
super();
|
|
1161
|
-
this.#
|
|
1190
|
+
this.#propertyData = propertyData;
|
|
1162
1191
|
}
|
|
1163
1192
|
|
|
1164
1193
|
override render(match: SDK.CSSPropertyParserMatchers.AngleMatch, context: RenderingContext): LitTemplate {
|
|
1165
1194
|
const angleText = match.text;
|
|
1166
|
-
if (!this.#
|
|
1195
|
+
if (!this.#propertyData?.editable()) {
|
|
1167
1196
|
return html`${angleText}`;
|
|
1168
1197
|
}
|
|
1169
1198
|
// TODO(crbug.com/407750607): Render <devtools-css-angle> as a Lit template once cssControls is replaced.
|
|
@@ -1172,36 +1201,35 @@ export class AngleRenderer extends AngleRendererBase {
|
|
|
1172
1201
|
cssAngle.setAttribute('jslog', `${VisualLogging.showStyleEditor().track({click: true}).context('css-angle')}`);
|
|
1173
1202
|
cssAngle.data = {
|
|
1174
1203
|
angleText,
|
|
1175
|
-
containingPane:
|
|
1176
|
-
|
|
1177
|
-
HTMLElement),
|
|
1204
|
+
containingPane: (this.#propertyData.stylesContainer().element.enclosingNodeOrSelfWithClass(
|
|
1205
|
+
'style-panes-wrapper') as HTMLElement),
|
|
1178
1206
|
};
|
|
1179
1207
|
|
|
1180
|
-
const
|
|
1208
|
+
const propertyData = this.#propertyData;
|
|
1181
1209
|
cssAngle.addEventListener('popovertoggled', ({data}) => {
|
|
1182
|
-
const section =
|
|
1210
|
+
const section = propertyData.section();
|
|
1183
1211
|
if (!section) {
|
|
1184
1212
|
return;
|
|
1185
1213
|
}
|
|
1186
1214
|
|
|
1187
1215
|
if (data.open) {
|
|
1188
|
-
|
|
1189
|
-
|
|
1216
|
+
propertyData.stylesContainer().hideAllPopovers();
|
|
1217
|
+
propertyData.stylesContainer().activeCSSAngle = cssAngle;
|
|
1190
1218
|
Host.userMetrics.swatchActivated(Host.UserMetrics.SwatchType.ANGLE);
|
|
1191
1219
|
}
|
|
1192
1220
|
|
|
1193
1221
|
section.element.classList.toggle('has-open-popover', data.open);
|
|
1194
|
-
|
|
1222
|
+
propertyData.stylesContainer().setEditingStyle(data.open);
|
|
1195
1223
|
|
|
1196
1224
|
// Commit the value as a major change after the angle popover is closed.
|
|
1197
1225
|
if (!data.open) {
|
|
1198
|
-
void
|
|
1226
|
+
void propertyData.applyStyleText(propertyData.renderedPropertyText(), true);
|
|
1199
1227
|
}
|
|
1200
1228
|
});
|
|
1201
1229
|
cssAngle.addEventListener('valuechanged', async ({data}) => {
|
|
1202
1230
|
cssAngle.dispatchEvent(new ValueEditEvent(data.value));
|
|
1203
1231
|
context.recordEdit(match, data.value);
|
|
1204
|
-
await
|
|
1232
|
+
await propertyData.applyStyleText(propertyData.renderedPropertyText(), false);
|
|
1205
1233
|
});
|
|
1206
1234
|
cssAngle.addEventListener('unitchanged', ({data}) => {
|
|
1207
1235
|
cssAngle.dispatchEvent(new ValueEditEvent(data.value));
|
|
@@ -1242,8 +1270,8 @@ export class LinkableNameRenderer extends LinkableNameRendererBase {
|
|
|
1242
1270
|
jslogContext: 'css-font-palette',
|
|
1243
1271
|
metric: null,
|
|
1244
1272
|
ruleBlock: '', // Not used
|
|
1245
|
-
isDefined: Boolean(this.#matchedStyles.atRules().find(
|
|
1246
|
-
|
|
1273
|
+
isDefined: Boolean(this.#matchedStyles.atRules().find(ar => ar.type() === 'font-palette-values' &&
|
|
1274
|
+
ar.name()?.text === match.text)),
|
|
1247
1275
|
};
|
|
1248
1276
|
case SDK.CSSPropertyParserMatchers.LinkableNameProperties.LIST_STYLE:
|
|
1249
1277
|
case SDK.CSSPropertyParserMatchers.LinkableNameProperties.LIST_STYLE_TYPE:
|
|
@@ -1251,8 +1279,8 @@ export class LinkableNameRenderer extends LinkableNameRendererBase {
|
|
|
1251
1279
|
jslogContext: 'css-list-style-type',
|
|
1252
1280
|
metric: null,
|
|
1253
1281
|
ruleBlock: '', // Not used
|
|
1254
|
-
isDefined: Boolean(this.#matchedStyles.atRules().find(
|
|
1255
|
-
|
|
1282
|
+
isDefined: Boolean(this.#matchedStyles.atRules().find(ar => ar.type() === 'counter-style' &&
|
|
1283
|
+
ar.name()?.text === match.text)),
|
|
1256
1284
|
};
|
|
1257
1285
|
case SDK.CSSPropertyParserMatchers.LinkableNameProperties.POSITION_TRY:
|
|
1258
1286
|
case SDK.CSSPropertyParserMatchers.LinkableNameProperties.POSITION_TRY_FALLBACKS:
|
|
@@ -1317,20 +1345,20 @@ const BezierRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.BezierMatch
|
|
|
1317
1345
|
// clang-format off
|
|
1318
1346
|
export class BezierRenderer extends BezierRendererBase {
|
|
1319
1347
|
// clang-format on
|
|
1320
|
-
readonly #
|
|
1321
|
-
constructor(
|
|
1348
|
+
readonly #propertyData: StylePropertyData|null;
|
|
1349
|
+
constructor(propertyData: StylePropertyData|null) {
|
|
1322
1350
|
super();
|
|
1323
|
-
this.#
|
|
1351
|
+
this.#propertyData = propertyData;
|
|
1324
1352
|
}
|
|
1325
1353
|
override render(match: SDK.CSSPropertyParserMatchers.BezierMatch, context: RenderingContext): LitTemplate {
|
|
1326
1354
|
const nodes = match.node.name === 'CallExpression' ? Renderer.render(ASTUtils.children(match.node), context).nodes :
|
|
1327
1355
|
match.text;
|
|
1328
|
-
if (!this.#
|
|
1356
|
+
if (!this.#propertyData?.editable() ||
|
|
1329
1357
|
!InlineEditor.AnimationTimingModel.AnimationTimingModel.parse(
|
|
1330
1358
|
context.matchedResult.getComputedText(match.node))) {
|
|
1331
1359
|
return html`${nodes}`;
|
|
1332
1360
|
}
|
|
1333
|
-
const swatchPopoverHelper = this.#
|
|
1361
|
+
const swatchPopoverHelper = this.#propertyData.stylesContainer().swatchPopoverHelper();
|
|
1334
1362
|
const icon = createIcon('bezier-curve-filled', 'bezier-swatch-icon');
|
|
1335
1363
|
icon.slot = 'icon';
|
|
1336
1364
|
icon.setAttribute('jslog', `${VisualLogging.showStyleEditor('bezier')}`);
|
|
@@ -1338,7 +1366,7 @@ export class BezierRenderer extends BezierRendererBase {
|
|
|
1338
1366
|
icon.addEventListener('click', () => {
|
|
1339
1367
|
Host.userMetrics.swatchActivated(Host.UserMetrics.SwatchType.ANIMATION_TIMING);
|
|
1340
1368
|
});
|
|
1341
|
-
new BezierPopoverIcon({
|
|
1369
|
+
new BezierPopoverIcon({propertyData: this.#propertyData, swatchPopoverHelper, swatch: icon, match, context});
|
|
1342
1370
|
return html`<devtools-widget class="bezier-icon-and-text" ${widget(EditableContent)}>${icon}${
|
|
1343
1371
|
nodes}</devtools-widget>`;
|
|
1344
1372
|
}
|
|
@@ -1351,8 +1379,8 @@ export class AutoBaseRenderer extends AutoBaseRendererBase {
|
|
|
1351
1379
|
readonly #computedStyleExtraFields : Protocol.CSS.ComputedStyleExtraFields|null;
|
|
1352
1380
|
// clang-format on
|
|
1353
1381
|
|
|
1354
|
-
constructor(
|
|
1355
|
-
|
|
1382
|
+
constructor(computedStyle: Map<string, string>,
|
|
1383
|
+
computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null) {
|
|
1356
1384
|
super();
|
|
1357
1385
|
this.#computedStyleExtraFields = computedStyleExtraFields;
|
|
1358
1386
|
}
|
|
@@ -1406,8 +1434,8 @@ export class ShadowModel implements InlineEditor.CSSShadowEditor.CSSShadowModel
|
|
|
1406
1434
|
readonly #shadowType: SDK.CSSPropertyParserMatchers.ShadowType;
|
|
1407
1435
|
readonly #context: RenderingContext;
|
|
1408
1436
|
|
|
1409
|
-
constructor(
|
|
1410
|
-
|
|
1437
|
+
constructor(shadowType: SDK.CSSPropertyParserMatchers.ShadowType, properties: ShadowProperty[],
|
|
1438
|
+
context: RenderingContext) {
|
|
1411
1439
|
this.#shadowType = shadowType;
|
|
1412
1440
|
this.#properties = properties;
|
|
1413
1441
|
this.#context = context;
|
|
@@ -1597,7 +1625,7 @@ const SHADOW_WIDGET_DEFAULT_VIEW: ShadowWidgetView = (input, _output, target) =>
|
|
|
1597
1625
|
class ShadowWidget extends UI.Widget.Widget {
|
|
1598
1626
|
readonly #view: ShadowWidgetView;
|
|
1599
1627
|
#model?: ShadowModel;
|
|
1600
|
-
#
|
|
1628
|
+
#propertyData?: StylePropertyData;
|
|
1601
1629
|
#popoverHelper?: ShadowSwatchPopoverHelper;
|
|
1602
1630
|
|
|
1603
1631
|
constructor(element?: HTMLElement, view: ShadowWidgetView = SHADOW_WIDGET_DEFAULT_VIEW) {
|
|
@@ -1614,16 +1642,16 @@ class ShadowWidget extends UI.Widget.Widget {
|
|
|
1614
1642
|
this.performUpdate();
|
|
1615
1643
|
}
|
|
1616
1644
|
|
|
1617
|
-
set
|
|
1618
|
-
if (this.#
|
|
1645
|
+
set propertyData(propertyData: StylePropertyData) {
|
|
1646
|
+
if (this.#propertyData === propertyData) {
|
|
1619
1647
|
return;
|
|
1620
1648
|
}
|
|
1621
|
-
this.#
|
|
1649
|
+
this.#propertyData = propertyData;
|
|
1622
1650
|
this.#popoverHelper =
|
|
1623
|
-
new ShadowSwatchPopoverHelper(
|
|
1651
|
+
new ShadowSwatchPopoverHelper(propertyData, propertyData.stylesContainer().swatchPopoverHelper());
|
|
1624
1652
|
this.#popoverHelper.addEventListener(ShadowEvents.SHADOW_CHANGED, () => {
|
|
1625
1653
|
this.performUpdate();
|
|
1626
|
-
void
|
|
1654
|
+
void propertyData.applyStyleText(propertyData.renderedPropertyText(), false);
|
|
1627
1655
|
});
|
|
1628
1656
|
this.performUpdate();
|
|
1629
1657
|
}
|
|
@@ -1648,16 +1676,15 @@ const ShadowRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.ShadowMatch
|
|
|
1648
1676
|
rendererBase(SDK.CSSPropertyParserMatchers.ShadowMatch);
|
|
1649
1677
|
// clang-format off
|
|
1650
1678
|
export class ShadowRenderer extends ShadowRendererBase {
|
|
1651
|
-
readonly #
|
|
1679
|
+
readonly #propertyData: StylePropertyData|null;
|
|
1652
1680
|
// clang-format on
|
|
1653
|
-
constructor(
|
|
1681
|
+
constructor(propertyData: StylePropertyData|null) {
|
|
1654
1682
|
super();
|
|
1655
|
-
this.#
|
|
1683
|
+
this.#propertyData = propertyData;
|
|
1656
1684
|
}
|
|
1657
1685
|
|
|
1658
|
-
shadowModel(
|
|
1659
|
-
|
|
1660
|
-
context: RenderingContext): null|ShadowModel {
|
|
1686
|
+
shadowModel(shadow: CodeMirror.SyntaxNode[], shadowType: SDK.CSSPropertyParserMatchers.ShadowType,
|
|
1687
|
+
context: RenderingContext): null|ShadowModel {
|
|
1661
1688
|
const properties: Array<ShadowProperty|ShadowLengthProperty> = [];
|
|
1662
1689
|
const missingLengths: Array<ShadowLengthProperty['propertyType']> =
|
|
1663
1690
|
[ShadowPropertyType.SPREAD, ShadowPropertyType.BLUR, ShadowPropertyType.Y, ShadowPropertyType.X];
|
|
@@ -1672,9 +1699,8 @@ export class ShadowRenderer extends ShadowRendererBase {
|
|
|
1672
1699
|
source: CodeMirror.SyntaxNode,
|
|
1673
1700
|
match: SDK.CSSPropertyParser.Match | undefined,
|
|
1674
1701
|
expansionContext: RenderingContext | null,
|
|
1675
|
-
}> =
|
|
1676
|
-
|
|
1677
|
-
value => ({value, source: value, match: context.matchedResult.getMatch(value), expansionContext: null}));
|
|
1702
|
+
}> = shadow.map(value =>
|
|
1703
|
+
({value, source: value, match: context.matchedResult.getMatch(value), expansionContext: null}));
|
|
1678
1704
|
for (let item = queue.shift(); item; item = queue.shift()) {
|
|
1679
1705
|
const {value, source, match, expansionContext} = item;
|
|
1680
1706
|
const text = (expansionContext ?? context).ast.text(value);
|
|
@@ -1727,10 +1753,9 @@ export class ShadowRenderer extends ShadowRendererBase {
|
|
|
1727
1753
|
return null;
|
|
1728
1754
|
}
|
|
1729
1755
|
properties.push({value, source, propertyType: ShadowPropertyType.INSET, expansionContext});
|
|
1730
|
-
} else if (
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
match instanceof SDK.CSSPropertyParserMatchers.ContrastColorMatch) {
|
|
1756
|
+
} else if (match instanceof SDK.CSSPropertyParserMatchers.ColorMatch ||
|
|
1757
|
+
match instanceof SDK.CSSPropertyParserMatchers.ColorMixMatch ||
|
|
1758
|
+
match instanceof SDK.CSSPropertyParserMatchers.ContrastColorMatch) {
|
|
1734
1759
|
if (properties.find(({propertyType}) => propertyType === ShadowPropertyType.COLOR)) {
|
|
1735
1760
|
return null;
|
|
1736
1761
|
}
|
|
@@ -1767,7 +1792,7 @@ export class ShadowRenderer extends ShadowRendererBase {
|
|
|
1767
1792
|
result.push(document.createTextNode(', '));
|
|
1768
1793
|
}
|
|
1769
1794
|
|
|
1770
|
-
if (!model || !this.#
|
|
1795
|
+
if (!model || !this.#propertyData?.editable()) {
|
|
1771
1796
|
const {nodes} = Renderer.render(shadow, nestedContext);
|
|
1772
1797
|
result.push(nodes);
|
|
1773
1798
|
texts.push(() => nestedEdits.textRange(...ASTUtils.range(shadow)));
|
|
@@ -1775,7 +1800,7 @@ export class ShadowRenderer extends ShadowRendererBase {
|
|
|
1775
1800
|
}
|
|
1776
1801
|
|
|
1777
1802
|
result.push(
|
|
1778
|
-
html`<devtools-widget ${widget(ShadowWidget, {model,
|
|
1803
|
+
html`<devtools-widget ${widget(ShadowWidget, {model, propertyData: this.#propertyData})}></devtools-widget>`);
|
|
1779
1804
|
texts.push(() =>
|
|
1780
1805
|
isImportant ? `${model.text()} ${nestedEdits.textRange(isImportant, isImportant)}` : model.text());
|
|
1781
1806
|
|
|
@@ -1823,9 +1848,8 @@ export const SHORTHANDS_FOR_PERCENTAGES: Set<string> = new Set([
|
|
|
1823
1848
|
'padding-inline',
|
|
1824
1849
|
]);
|
|
1825
1850
|
|
|
1826
|
-
async function resolveValues(
|
|
1827
|
-
|
|
1828
|
-
context: RenderingContext, ...values: string[]): Promise<string[]|null|undefined> {
|
|
1851
|
+
async function resolveValues(stylesContainer: StylesContainer, propertyName: string, match: SDK.CSSPropertyParser.Match,
|
|
1852
|
+
context: RenderingContext, ...values: string[]): Promise<string[]|null|undefined> {
|
|
1829
1853
|
// We want to resolve values against the original property we're tracing and not the property we're substituting,
|
|
1830
1854
|
// so try to look up the original name.
|
|
1831
1855
|
propertyName = context.tracing?.propertyName ?? context.matchedResult.ast.propertyName ?? propertyName;
|
|
@@ -1849,12 +1873,12 @@ const LengthRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.LengthMatch
|
|
|
1849
1873
|
export class LengthRenderer extends LengthRendererBase {
|
|
1850
1874
|
// clang-format on
|
|
1851
1875
|
readonly #stylesContainer: StylesContainer;
|
|
1852
|
-
readonly #
|
|
1876
|
+
readonly #propertyData: StylePropertyData|null;
|
|
1853
1877
|
readonly #propertyName: string;
|
|
1854
|
-
constructor(stylesContainer: StylesContainer, propertyName: string,
|
|
1878
|
+
constructor(stylesContainer: StylesContainer, propertyName: string, propertyData: StylePropertyData|null) {
|
|
1855
1879
|
super();
|
|
1856
1880
|
this.#stylesContainer = stylesContainer;
|
|
1857
|
-
this.#
|
|
1881
|
+
this.#propertyData = propertyData;
|
|
1858
1882
|
this.#propertyName = propertyName;
|
|
1859
1883
|
}
|
|
1860
1884
|
|
|
@@ -1865,7 +1889,7 @@ export class LengthRenderer extends LengthRendererBase {
|
|
|
1865
1889
|
template,
|
|
1866
1890
|
asyncEvalCallback: () => this.getTooltipValue(match, context),
|
|
1867
1891
|
}));
|
|
1868
|
-
const tooltipId = this.#
|
|
1892
|
+
const tooltipId = getTooltipId(this.#propertyData, 'length');
|
|
1869
1893
|
if (evaluation || !tooltipId) {
|
|
1870
1894
|
return html`<span tabindex=-1>${evaluation ?? template}</span>`;
|
|
1871
1895
|
}
|
|
@@ -1897,18 +1921,17 @@ export class BaseFunctionRenderer extends BaseFunctionRendererBase {
|
|
|
1897
1921
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
1898
1922
|
readonly #computedStyles: Map<string, string>;
|
|
1899
1923
|
readonly #computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null;
|
|
1900
|
-
readonly #
|
|
1924
|
+
readonly #propertyData: StylePropertyData|null;
|
|
1901
1925
|
readonly #propertyName: string;
|
|
1902
|
-
constructor(
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
propertyName: string, treeElement: StylePropertyTreeElement|null) {
|
|
1926
|
+
constructor(stylesContainer: StylesContainer, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
1927
|
+
computedStyles: Map<string, string>, computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null,
|
|
1928
|
+
propertyName: string, propertyData: StylePropertyData|null) {
|
|
1906
1929
|
super();
|
|
1907
1930
|
this.#matchedStyles = matchedStyles;
|
|
1908
1931
|
this.#computedStyles = computedStyles;
|
|
1909
1932
|
this.#computedStyleExtraFields = computedStyleExtraFields;
|
|
1910
1933
|
this.#stylesContainer = stylesContainer;
|
|
1911
|
-
this.#
|
|
1934
|
+
this.#propertyData = propertyData;
|
|
1912
1935
|
this.#propertyName = propertyName;
|
|
1913
1936
|
}
|
|
1914
1937
|
|
|
@@ -1926,8 +1949,11 @@ export class BaseFunctionRenderer extends BaseFunctionRendererBase {
|
|
|
1926
1949
|
(arg, idx) =>
|
|
1927
1950
|
Renderer.render(arg, childTracingContexts ? childTracingContexts[idx].renderingContext(context) : context)
|
|
1928
1951
|
.nodes);
|
|
1929
|
-
const func = this.#
|
|
1930
|
-
|
|
1952
|
+
const func = this.#propertyData ?
|
|
1953
|
+
getTracingTooltip(match.func, match.node, this.#matchedStyles, this.#computedStyles,
|
|
1954
|
+
this.#computedStyleExtraFields, context, this.#stylesContainer,
|
|
1955
|
+
this.#propertyData.tooltipIdFactory, this.#propertyData.property,
|
|
1956
|
+
this.#propertyData.parentShorthand()?.property.name) :
|
|
1931
1957
|
match.func;
|
|
1932
1958
|
const args = this.#renderArgs(renderedArgs);
|
|
1933
1959
|
|
|
@@ -2100,6 +2126,24 @@ export class PositionAnchorRenderer extends PositionAnchorRendererBase {
|
|
|
2100
2126
|
}
|
|
2101
2127
|
}
|
|
2102
2128
|
|
|
2129
|
+
function findSiblingProperty(stylesContainer: StylesContainer, propertyData: StylePropertyData,
|
|
2130
|
+
propertyName: string): StylePropertyData|undefined {
|
|
2131
|
+
const resolvedProperty = propertyData.matchedStyles().resolveProperty(propertyName, propertyData.property.ownerStyle);
|
|
2132
|
+
const activeSection = propertyData.section();
|
|
2133
|
+
if (resolvedProperty) {
|
|
2134
|
+
const allSections = stylesContainer.allSections();
|
|
2135
|
+
const sections = !allSections.includes(activeSection) ? [activeSection, ...allSections] : allSections;
|
|
2136
|
+
for (const section of sections) {
|
|
2137
|
+
const found = section.findProperty(resolvedProperty);
|
|
2138
|
+
if (found) {
|
|
2139
|
+
return found;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
return activeSection.findProperty(propertyName);
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2103
2147
|
const PositionAreaRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.PositionAreaMatch> =
|
|
2104
2148
|
rendererBase(SDK.CSSPropertyParserMatchers.PositionAreaMatch);
|
|
2105
2149
|
// clang-format off
|
|
@@ -2107,58 +2151,28 @@ export class PositionAreaRenderer extends PositionAreaRendererBase {
|
|
|
2107
2151
|
// clang-format on
|
|
2108
2152
|
static #active?: {
|
|
2109
2153
|
editor: InlineEditor.PositionAreaEditor.PositionAreaEditor,
|
|
2110
|
-
|
|
2154
|
+
propertyData: StylePropertyData,
|
|
2111
2155
|
edit: (value: string) => void,
|
|
2112
2156
|
key?: string,
|
|
2113
2157
|
};
|
|
2114
2158
|
static readonly #EDITABLE_PROPERTIES: readonly string[] = ['align-self', 'justify-self'];
|
|
2115
|
-
readonly #
|
|
2159
|
+
readonly #propertyData: StylePropertyData|null;
|
|
2116
2160
|
readonly #stylesContainer: StylesContainer;
|
|
2117
|
-
constructor(stylesContainer: StylesContainer,
|
|
2161
|
+
constructor(stylesContainer: StylesContainer, propertyData: StylePropertyData|null) {
|
|
2118
2162
|
super();
|
|
2119
|
-
this.#
|
|
2163
|
+
this.#propertyData = propertyData;
|
|
2120
2164
|
this.#stylesContainer = stylesContainer;
|
|
2121
2165
|
}
|
|
2122
2166
|
|
|
2123
|
-
#findTreeElementForProperty(propertyName: string): StylePropertyTreeElement|undefined {
|
|
2124
|
-
const activeTreeElement = PositionAreaRenderer.#active?.treeElement;
|
|
2125
|
-
if (!activeTreeElement) {
|
|
2126
|
-
return undefined;
|
|
2127
|
-
}
|
|
2128
|
-
const matchedStyles = activeTreeElement.matchedStyles();
|
|
2129
|
-
const resolvedProperty = matchedStyles.resolveProperty(propertyName, activeTreeElement.property.ownerStyle);
|
|
2130
|
-
const activeSection = activeTreeElement.section();
|
|
2131
|
-
if (resolvedProperty) {
|
|
2132
|
-
const allSections = this.#stylesContainer.allSections();
|
|
2133
|
-
const sections =
|
|
2134
|
-
activeSection && !allSections.includes(activeSection) ? [activeSection, ...allSections] : allSections;
|
|
2135
|
-
for (const section of sections) {
|
|
2136
|
-
for (const child of section.propertiesTreeOutline?.rootElement().children() ?? []) {
|
|
2137
|
-
if (child instanceof StylePropertyTreeElement && child.property === resolvedProperty) {
|
|
2138
|
-
return child;
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2144
|
-
return this.#findPropertyInSection(activeSection, propertyName);
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
#findPropertyInSection(section: StylePropertiesSection|undefined, propertyName: string): StylePropertyTreeElement
|
|
2148
|
-
|undefined {
|
|
2149
|
-
return section?.propertiesTreeOutline?.rootElement().children().find(
|
|
2150
|
-
(child): child is StylePropertyTreeElement =>
|
|
2151
|
-
child instanceof StylePropertyTreeElement && child.property.name === propertyName);
|
|
2152
|
-
}
|
|
2153
2167
|
override render(match: SDK.CSSPropertyParserMatchers.PositionAreaMatch, context: RenderingContext): LitTemplate {
|
|
2154
2168
|
const children = Renderer.render(ASTUtils.siblings(ASTUtils.declValue(match.node)), context).nodes;
|
|
2155
2169
|
// The text of the match is the value as authored, which may contain comments or var()s that resolve to the area.
|
|
2156
|
-
if (!this.#
|
|
2170
|
+
if (!this.#propertyData?.editable() ||
|
|
2157
2171
|
!InlineEditor.PositionAreaEditor.parsePositionArea(context.matchedResult.getComputedPropertyValueText())) {
|
|
2158
2172
|
return html`${children}`;
|
|
2159
2173
|
}
|
|
2160
2174
|
|
|
2161
|
-
const section = this.#
|
|
2175
|
+
const section = this.#propertyData.section();
|
|
2162
2176
|
const key = section ? `${section.getSectionIdx()}_${section.nextEditorTriggerButtonIdx++}` : undefined;
|
|
2163
2177
|
|
|
2164
2178
|
let button: Element|undefined;
|
|
@@ -2166,14 +2180,14 @@ export class PositionAreaRenderer extends PositionAreaRendererBase {
|
|
|
2166
2180
|
button?.dispatchEvent(new ValueEditEvent(value));
|
|
2167
2181
|
context.recordEdit(match, value);
|
|
2168
2182
|
};
|
|
2169
|
-
const
|
|
2183
|
+
const propertyData = this.#propertyData;
|
|
2170
2184
|
const popoverHelper = this.#stylesContainer.swatchPopoverHelper();
|
|
2171
2185
|
const isActive =
|
|
2172
2186
|
Boolean(PositionAreaRenderer.#active && popoverHelper.isShowing(PositionAreaRenderer.#active.editor) &&
|
|
2173
2187
|
key !== undefined && PositionAreaRenderer.#active.key === key);
|
|
2174
2188
|
if (isActive && PositionAreaRenderer.#active) {
|
|
2175
|
-
|
|
2176
|
-
PositionAreaRenderer.#active.
|
|
2189
|
+
propertyData.carryOverCommittedProperty(PositionAreaRenderer.#active.propertyData);
|
|
2190
|
+
PositionAreaRenderer.#active.propertyData = propertyData;
|
|
2177
2191
|
PositionAreaRenderer.#active.edit = edit;
|
|
2178
2192
|
}
|
|
2179
2193
|
const onClick = (event: Event): void => {
|
|
@@ -2183,14 +2197,14 @@ export class PositionAreaRenderer extends PositionAreaRendererBase {
|
|
|
2183
2197
|
return;
|
|
2184
2198
|
}
|
|
2185
2199
|
const editor = new InlineEditor.PositionAreaEditor.PositionAreaEditor();
|
|
2186
|
-
const active = {editor, key,
|
|
2200
|
+
const active = {editor, key, propertyData, edit};
|
|
2187
2201
|
PositionAreaRenderer.#active = active;
|
|
2188
2202
|
const valueText = context.edits?.getEdit(match) ?? context.matchedResult.getComputedPropertyValueText();
|
|
2189
2203
|
editor.area = InlineEditor.PositionAreaEditor.parsePositionArea(valueText) ?? undefined;
|
|
2190
2204
|
|
|
2191
2205
|
const initialProperties = new Map<string, {value: string, section: StylePropertiesSection}>();
|
|
2192
2206
|
for (const propertyName of PositionAreaRenderer.#EDITABLE_PROPERTIES) {
|
|
2193
|
-
const target = this.#
|
|
2207
|
+
const target = findSiblingProperty(this.#stylesContainer, active.propertyData, propertyName);
|
|
2194
2208
|
if (target) {
|
|
2195
2209
|
initialProperties.set(propertyName, {
|
|
2196
2210
|
value: target.property.value,
|
|
@@ -2199,17 +2213,17 @@ export class PositionAreaRenderer extends PositionAreaRendererBase {
|
|
|
2199
2213
|
}
|
|
2200
2214
|
}
|
|
2201
2215
|
const updateProperty = (propertyName: string, computedStyle: Map<string, string>|null): void => {
|
|
2202
|
-
const matchedStyles = active.
|
|
2203
|
-
const resolved = matchedStyles.resolveProperty(propertyName, active.
|
|
2216
|
+
const matchedStyles = active.propertyData.matchedStyles();
|
|
2217
|
+
const resolved = matchedStyles.resolveProperty(propertyName, active.propertyData.property.ownerStyle);
|
|
2204
2218
|
const authored = resolved && !resolved.ownerStyle.parentRule?.isUserAgent() ? resolved.value : undefined;
|
|
2205
2219
|
const computed = computedStyle?.get(propertyName);
|
|
2206
2220
|
editor.setProperty(propertyName, authored, computed);
|
|
2207
2221
|
};
|
|
2208
2222
|
|
|
2209
2223
|
const updateEditorProperties = async(): Promise<void> => {
|
|
2210
|
-
active.
|
|
2211
|
-
updateProperty('align-self', active.
|
|
2212
|
-
updateProperty('justify-self', active.
|
|
2224
|
+
active.propertyData.matchedStyles().resetActiveProperties();
|
|
2225
|
+
updateProperty('align-self', active.propertyData.getComputedStyles());
|
|
2226
|
+
updateProperty('justify-self', active.propertyData.getComputedStyles());
|
|
2213
2227
|
const computedStyle = await this.#stylesContainer.computedStyleModel().fetchComputedStyle();
|
|
2214
2228
|
updateProperty('align-self', computedStyle?.computedStyle ?? null);
|
|
2215
2229
|
updateProperty('justify-self', computedStyle?.computedStyle ?? null);
|
|
@@ -2219,31 +2233,14 @@ export class PositionAreaRenderer extends PositionAreaRendererBase {
|
|
|
2219
2233
|
(changeEvent: Common.EventTarget.EventTargetEvent<InlineEditor.PositionAreaEditor.Area>): void => {
|
|
2220
2234
|
const area = InlineEditor.PositionAreaEditor.stringifyPositionArea(changeEvent.data);
|
|
2221
2235
|
active.edit(area);
|
|
2222
|
-
void active.
|
|
2236
|
+
void active.propertyData.applyStyleText(active.propertyData.renderedPropertyText(), false);
|
|
2223
2237
|
};
|
|
2224
2238
|
const onPropertyChanged =
|
|
2225
2239
|
async(changeEvent: Common.EventTarget.EventTargetEvent<InlineEditor.PositionAreaEditor.PropertyChangeEvent>):
|
|
2226
2240
|
Promise<void> => {
|
|
2227
|
-
const activeSection = active.treeElement.section();
|
|
2228
|
-
if (!activeSection) {
|
|
2229
|
-
return;
|
|
2230
|
-
}
|
|
2231
2241
|
const {propertyName, value} = changeEvent.data;
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
if (!target) {
|
|
2235
|
-
target = activeSection.addNewBlankProperty();
|
|
2236
|
-
target.property.name = propertyName;
|
|
2237
|
-
}
|
|
2238
|
-
target.property.value = value;
|
|
2239
|
-
target.updateTitle();
|
|
2240
|
-
await target.applyStyleText(target.renderedPropertyText(), false);
|
|
2241
|
-
this.#stylesContainer.refreshUpdate(activeSection, target, true);
|
|
2242
|
-
} else if (target) {
|
|
2243
|
-
await target.applyStyleText('', false);
|
|
2244
|
-
this.#stylesContainer.refreshUpdate(activeSection, target, true);
|
|
2245
|
-
}
|
|
2246
|
-
void updateEditorProperties();
|
|
2242
|
+
await active.propertyData.setSiblingProperty(propertyName, value);
|
|
2243
|
+
await updateEditorProperties();
|
|
2247
2244
|
};
|
|
2248
2245
|
editor.addEventListener(InlineEditor.PositionAreaEditor.Events.POSITION_AREA_CHANGED, onPositionAreaChanged);
|
|
2249
2246
|
editor.addEventListener(InlineEditor.PositionAreaEditor.Events.PROPERTY_CHANGED, onPropertyChanged);
|
|
@@ -2256,8 +2253,8 @@ export class PositionAreaRenderer extends PositionAreaRendererBase {
|
|
|
2256
2253
|
scrollerElement.addEventListener('scroll', onScroll, false);
|
|
2257
2254
|
}
|
|
2258
2255
|
|
|
2259
|
-
const originalPropertyText =
|
|
2260
|
-
this.#stylesContainer.setActiveProperty(
|
|
2256
|
+
const originalPropertyText = propertyData.property.propertyText;
|
|
2257
|
+
this.#stylesContainer.setActiveProperty(propertyData);
|
|
2261
2258
|
this.#stylesContainer.setEditingStyle(true);
|
|
2262
2259
|
|
|
2263
2260
|
popoverHelper.show(editor, button, commitEdit => {
|
|
@@ -2266,13 +2263,13 @@ export class PositionAreaRenderer extends PositionAreaRendererBase {
|
|
|
2266
2263
|
}
|
|
2267
2264
|
editor.removeEventListener(InlineEditor.PositionAreaEditor.Events.POSITION_AREA_CHANGED, onPositionAreaChanged);
|
|
2268
2265
|
editor.removeEventListener(InlineEditor.PositionAreaEditor.Events.PROPERTY_CHANGED, onPropertyChanged);
|
|
2269
|
-
const propertyText = commitEdit ? active.
|
|
2270
|
-
void active.
|
|
2271
|
-
const node = this.#stylesContainer.node() ?? active.
|
|
2266
|
+
const propertyText = commitEdit ? active.propertyData.renderedPropertyText() : originalPropertyText || '';
|
|
2267
|
+
void active.propertyData.applyStyleText(propertyText, true);
|
|
2268
|
+
const node = this.#stylesContainer.node() ?? active.propertyData.matchedStyles().node();
|
|
2272
2269
|
for (const propertyName of PositionAreaRenderer.#EDITABLE_PROPERTIES) {
|
|
2273
2270
|
const originalTarget = initialProperties.get(propertyName);
|
|
2274
|
-
const targetSection = originalTarget?.section ?? active.
|
|
2275
|
-
const target =
|
|
2271
|
+
const targetSection = originalTarget?.section ?? active.propertyData.section();
|
|
2272
|
+
const target = targetSection.findProperty(propertyName);
|
|
2276
2273
|
const oldValue = originalTarget?.value ?? '';
|
|
2277
2274
|
const newValue = target?.property.value ?? '';
|
|
2278
2275
|
const ruleHeader = targetSection.headerText();
|
|
@@ -2319,13 +2316,13 @@ const PositionTryRendererBase: RendererBase<SDK.CSSPropertyParserMatchers.Positi
|
|
|
2319
2316
|
// clang-format off
|
|
2320
2317
|
export class PositionTryRenderer extends PositionTryRendererBase {
|
|
2321
2318
|
readonly #matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
2322
|
-
readonly #
|
|
2319
|
+
readonly #propertyData: StylePropertyData|null;
|
|
2323
2320
|
// clang-format on
|
|
2324
2321
|
|
|
2325
|
-
constructor(matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
2322
|
+
constructor(matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, propertyData: StylePropertyData|null) {
|
|
2326
2323
|
super();
|
|
2327
2324
|
this.#matchedStyles = matchedStyles;
|
|
2328
|
-
this.#
|
|
2325
|
+
this.#propertyData = propertyData;
|
|
2329
2326
|
}
|
|
2330
2327
|
|
|
2331
2328
|
override render(match: SDK.CSSPropertyParserMatchers.PositionTryMatch, context: RenderingContext): LitTemplate {
|
|
@@ -2334,13 +2331,13 @@ export class PositionTryRenderer extends PositionTryRendererBase {
|
|
|
2334
2331
|
const {nodes} = Renderer.render(match.preamble, context);
|
|
2335
2332
|
content.push(nodes);
|
|
2336
2333
|
}
|
|
2337
|
-
const node = this.#
|
|
2338
|
-
|
|
2334
|
+
const node = this.#propertyData ? this.#matchedStyles.nodeForStyle(this.#propertyData.property.ownerStyle) :
|
|
2335
|
+
this.#matchedStyles.node();
|
|
2339
2336
|
const fallbackLabels: string[] = [];
|
|
2340
2337
|
for (const [i, fallback] of match.fallbacks.entries()) {
|
|
2341
2338
|
const important = fallback.find(node => node.name === 'Important');
|
|
2342
2339
|
const classes = classMap({
|
|
2343
|
-
'inactive-value': !this.#
|
|
2340
|
+
'inactive-value': !this.#propertyData?.inherited() && node === this.#matchedStyles.node() &&
|
|
2344
2341
|
i !== this.#matchedStyles.activePositionFallbackIndex(),
|
|
2345
2342
|
});
|
|
2346
2343
|
content.push(html`<span class=${classes}>${i > 0 ? ', ' : nothing}${
|
|
@@ -2351,8 +2348,8 @@ export class PositionTryRenderer extends PositionTryRendererBase {
|
|
|
2351
2348
|
fallbackLabels.push(
|
|
2352
2349
|
context.matchedResult.getComputedTextRange(fallback[0], fallback[fallback.length - 1]).trim());
|
|
2353
2350
|
}
|
|
2354
|
-
if (!this.#
|
|
2355
|
-
!this.#
|
|
2351
|
+
if (!this.#propertyData || this.#propertyData.overloaded() || this.#propertyData.inherited() ||
|
|
2352
|
+
!this.#propertyData.property.activeInStyle() || !node) {
|
|
2356
2353
|
return html`${content}`;
|
|
2357
2354
|
}
|
|
2358
2355
|
const cssModel = this.#matchedStyles.cssModel();
|
|
@@ -2396,46 +2393,217 @@ export class PositionTryRenderer extends PositionTryRendererBase {
|
|
|
2396
2393
|
}
|
|
2397
2394
|
}
|
|
2398
2395
|
|
|
2396
|
+
// Returns an id for <devtools-tooltips> that's stable across re-rendering of property values but unique across
|
|
2397
|
+
// sections and across switches between different nodes.
|
|
2398
|
+
function getTooltipId(propertyData: StylePropertyData|null, key: string): string|undefined;
|
|
2399
|
+
function getTooltipId(tooltipIdFactory: Tooltips.Tooltip.IdFactory, key: string, property: SDK.CSSProperty.CSSProperty,
|
|
2400
|
+
shorthandName?: string): string;
|
|
2401
|
+
function getTooltipId(tooltipIdFactoryOrPropertyData: Tooltips.Tooltip.IdFactory|StylePropertyData|null, key: string,
|
|
2402
|
+
property?: SDK.CSSProperty.CSSProperty, shorthandName?: string): string|undefined {
|
|
2403
|
+
if (!tooltipIdFactoryOrPropertyData) {
|
|
2404
|
+
return undefined;
|
|
2405
|
+
}
|
|
2406
|
+
if (!(tooltipIdFactoryOrPropertyData instanceof Tooltips.Tooltip.IdFactory)) {
|
|
2407
|
+
const propertyData = tooltipIdFactoryOrPropertyData;
|
|
2408
|
+
return getTooltipId(propertyData.tooltipIdFactory, key, propertyData.property,
|
|
2409
|
+
propertyData.parentShorthand()?.property.name);
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
if (!property) {
|
|
2413
|
+
return undefined;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
// Longhands expanded from a shorthand also count preceding occurrences of the shorthand.
|
|
2417
|
+
const propertyNameForCounting = shorthandName ?? property.name;
|
|
2418
|
+
const ownIndex = property.ownerStyle.allProperties().indexOf(property);
|
|
2419
|
+
const propertyCount = property.ownerStyle.allProperties().reduce<number>(
|
|
2420
|
+
(value, other, index) =>
|
|
2421
|
+
index < ownIndex && (other.name === property.name || other.name === propertyNameForCounting) ? value + 1 :
|
|
2422
|
+
value,
|
|
2423
|
+
0);
|
|
2424
|
+
return tooltipIdFactoryOrPropertyData.keyed(key, propertyCount);
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
function getInvalidPropertyMessage(property: SDK.CSSProperty.CSSProperty): Platform.UIString.LocalizedString {
|
|
2428
|
+
return SDK.CSSMetadata.cssMetadata().isCSSPropertyName(property.name) ? i18nString(UIStrings.invalidPropertyValue) :
|
|
2429
|
+
i18nString(UIStrings.unknownPropertyName);
|
|
2430
|
+
}
|
|
2431
|
+
function getLinkableFunction(functionName: string, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
2432
|
+
property: SDK.CSSProperty.CSSProperty, stylesContainer: StylesContainer): LitTemplate {
|
|
2433
|
+
const {registeredFunction, treeScopeDistance} = matchedStyles.getRegisteredFunction(functionName, property);
|
|
2434
|
+
const isDefined = Boolean(registeredFunction);
|
|
2435
|
+
return html`<devtools-link-swatch .data=${{
|
|
2436
|
+
jslogContext: 'css-function',
|
|
2437
|
+
text: functionName,
|
|
2438
|
+
tooltip: isDefined ? undefined : {title: i18nString(UIStrings.sIsNotDefined, {PH1: functionName})},
|
|
2439
|
+
isDefined,
|
|
2440
|
+
onLinkActivate: (): void => {
|
|
2441
|
+
if (!registeredFunction) {
|
|
2442
|
+
return;
|
|
2443
|
+
}
|
|
2444
|
+
stylesContainer.jumpToFunctionDefinition(registeredFunction, treeScopeDistance);
|
|
2445
|
+
},
|
|
2446
|
+
} as InlineEditor.LinkSwatch.LinkSwatchRenderData}></devtools-link-swatch>`;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
function getTracingTooltip(
|
|
2450
|
+
functionName: string, node: CodeMirror.SyntaxNode, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
2451
|
+
computedStyles: Map<string, string>, computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null,
|
|
2452
|
+
context: RenderingContext, stylesContainer: StylesContainer, tooltipIdFactory: Tooltips.Tooltip.IdFactory,
|
|
2453
|
+
styleProperty: SDK.CSSProperty.CSSProperty, shorthandName: string|undefined): TemplateResult {
|
|
2454
|
+
if (context.tracing || !context.property) {
|
|
2455
|
+
return html`${functionName}`;
|
|
2456
|
+
}
|
|
2457
|
+
const text = context.ast.text(node);
|
|
2458
|
+
const expandPercentagesInShorthands = context.matchedResult.getLonghandValuesCount() > 1;
|
|
2459
|
+
const shorthandPositionOffset = context.matchedResult.getComputedLonghandName(node);
|
|
2460
|
+
const {property} = context;
|
|
2461
|
+
const tooltipId = getTooltipId(tooltipIdFactory, `${functionName}-trace`, styleProperty, shorthandName);
|
|
2462
|
+
// clang-format off
|
|
2463
|
+
return html`
|
|
2464
|
+
<span tabIndex=-1 class=tracing-anchor aria-details=${tooltipId}>${functionName.startsWith('--')
|
|
2465
|
+
? getLinkableFunction(functionName, matchedStyles, context.property, stylesContainer)
|
|
2466
|
+
: functionName}</span>
|
|
2467
|
+
<devtools-tooltip
|
|
2468
|
+
id=${tooltipId}
|
|
2469
|
+
use-hotkey
|
|
2470
|
+
variant=rich
|
|
2471
|
+
jslogContext=elements.css-value-trace
|
|
2472
|
+
@beforetoggle=${function(this: Tooltips.Tooltip.Tooltip, e: ToggleEvent) {
|
|
2473
|
+
if (e.newState === 'open') {
|
|
2474
|
+
void (this.querySelector('devtools-widget') as UI.Widget.WidgetElement<CSSValueTraceView>| null)
|
|
2475
|
+
?.getWidget()
|
|
2476
|
+
?.showTrace(
|
|
2477
|
+
property, text, matchedStyles, computedStyles,
|
|
2478
|
+
getPropertyRenderers(property.name,
|
|
2479
|
+
property.ownerStyle, stylesContainer, matchedStyles, null, computedStyles, computedStyleExtraFields),
|
|
2480
|
+
expandPercentagesInShorthands, shorthandPositionOffset, this.openedViaHotkey);
|
|
2481
|
+
}
|
|
2482
|
+
}}
|
|
2483
|
+
@toggle=${function(this: Tooltips.Tooltip.Tooltip, e: ToggleEvent) {
|
|
2484
|
+
if (e.newState !== 'open') {
|
|
2485
|
+
(this.querySelector('devtools-widget') as UI.Widget.WidgetElement<CSSValueTraceView>| null)
|
|
2486
|
+
?.getWidget()
|
|
2487
|
+
?.resetPendingFocus();
|
|
2488
|
+
}
|
|
2489
|
+
}}>
|
|
2490
|
+
<devtools-widget
|
|
2491
|
+
@keydown=${(e: KeyboardEvent) => {
|
|
2492
|
+
const maybeTooltip = (e.target as Element).parentElement ;
|
|
2493
|
+
if (!(maybeTooltip instanceof Tooltips.Tooltip.Tooltip)) {
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
if (e.key === 'Escape' || (e.altKey && e.key === 'ArrowDown')){
|
|
2497
|
+
maybeTooltip.hideTooltip();
|
|
2498
|
+
maybeTooltip.anchor?.focus();
|
|
2499
|
+
e.consume(true);
|
|
2500
|
+
}
|
|
2501
|
+
}}
|
|
2502
|
+
${widget(CSSValueTraceView)}>
|
|
2503
|
+
</devtools-widget>
|
|
2504
|
+
</devtools-tooltip>`;
|
|
2505
|
+
// clang-format on
|
|
2506
|
+
}
|
|
2399
2507
|
export function getPropertyRenderers(
|
|
2400
2508
|
propertyName: string, style: SDK.CSSStyleDeclaration.CSSStyleDeclaration, stylesContainer: StylesContainer,
|
|
2401
|
-
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
2509
|
+
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, propertyData: StylePropertyData|null,
|
|
2402
2510
|
computedStyles: Map<string, string>, computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null):
|
|
2403
2511
|
Array<MatchRenderer<SDK.CSSPropertyParser.Match>> {
|
|
2404
2512
|
return [
|
|
2405
|
-
new VariableRenderer(stylesContainer,
|
|
2406
|
-
new VariableNameRenderer(stylesContainer,
|
|
2407
|
-
new ColorRenderer(stylesContainer,
|
|
2408
|
-
new ColorMixRenderer(stylesContainer, matchedStyles, computedStyles, computedStyleExtraFields,
|
|
2409
|
-
new ContrastColorRenderer(stylesContainer,
|
|
2513
|
+
new VariableRenderer(stylesContainer, propertyData, matchedStyles, computedStyles, computedStyleExtraFields),
|
|
2514
|
+
new VariableNameRenderer(stylesContainer, propertyData, matchedStyles),
|
|
2515
|
+
new ColorRenderer(stylesContainer, propertyData),
|
|
2516
|
+
new ColorMixRenderer(stylesContainer, matchedStyles, computedStyles, computedStyleExtraFields, propertyData),
|
|
2517
|
+
new ContrastColorRenderer(stylesContainer, propertyData),
|
|
2410
2518
|
new URLRenderer(style.parentRule, stylesContainer.node()),
|
|
2411
|
-
new AngleRenderer(
|
|
2519
|
+
new AngleRenderer(propertyData),
|
|
2412
2520
|
new LinkableNameRenderer(matchedStyles, stylesContainer),
|
|
2413
|
-
new BezierRenderer(
|
|
2521
|
+
new BezierRenderer(propertyData),
|
|
2414
2522
|
new StringRenderer(),
|
|
2415
|
-
new ShadowRenderer(
|
|
2416
|
-
new CSSWideKeywordRenderer(stylesContainer,
|
|
2417
|
-
new LightDarkColorRenderer(stylesContainer, matchedStyles,
|
|
2523
|
+
new ShadowRenderer(propertyData),
|
|
2524
|
+
new CSSWideKeywordRenderer(stylesContainer, propertyData),
|
|
2525
|
+
new LightDarkColorRenderer(stylesContainer, matchedStyles, propertyData),
|
|
2418
2526
|
new GridTemplateRenderer(),
|
|
2419
2527
|
new LinearGradientRenderer(),
|
|
2420
2528
|
new AnchorFunctionRenderer(stylesContainer),
|
|
2421
2529
|
new PositionAnchorRenderer(stylesContainer),
|
|
2422
|
-
new FlexGridRenderer(stylesContainer,
|
|
2423
|
-
new PositionAreaRenderer(stylesContainer,
|
|
2424
|
-
new EnvFunctionRenderer(
|
|
2425
|
-
new PositionTryRenderer(matchedStyles,
|
|
2426
|
-
new LengthRenderer(stylesContainer, propertyName,
|
|
2530
|
+
new FlexGridRenderer(stylesContainer, propertyData),
|
|
2531
|
+
new PositionAreaRenderer(stylesContainer, propertyData),
|
|
2532
|
+
new EnvFunctionRenderer(propertyData, matchedStyles, computedStyles, computedStyleExtraFields),
|
|
2533
|
+
new PositionTryRenderer(matchedStyles, propertyData),
|
|
2534
|
+
new LengthRenderer(stylesContainer, propertyName, propertyData),
|
|
2427
2535
|
new MathFunctionRenderer(stylesContainer, matchedStyles, computedStyles, computedStyleExtraFields, propertyName,
|
|
2428
|
-
|
|
2536
|
+
propertyData),
|
|
2429
2537
|
new CustomFunctionRenderer(stylesContainer, matchedStyles, computedStyles, computedStyleExtraFields, propertyName,
|
|
2430
|
-
|
|
2538
|
+
propertyData),
|
|
2431
2539
|
new AutoBaseRenderer(computedStyles, computedStyleExtraFields),
|
|
2432
2540
|
new BinOpRenderer(),
|
|
2433
|
-
new RelativeColorChannelRenderer(
|
|
2434
|
-
new AttributeRenderer(stylesContainer,
|
|
2541
|
+
new RelativeColorChannelRenderer(propertyData),
|
|
2542
|
+
new AttributeRenderer(stylesContainer, propertyData, matchedStyles, computedStyles, computedStyleExtraFields),
|
|
2435
2543
|
];
|
|
2436
2544
|
}
|
|
2437
2545
|
|
|
2438
|
-
|
|
2546
|
+
function exclamationMarkTemplate(
|
|
2547
|
+
propertyData: StylePropertyData,
|
|
2548
|
+
details: ElementsComponents.CSSVariableValueView.RegisteredPropertyDetails|null): LitTemplate {
|
|
2549
|
+
const tooltipId = details ? getTooltipId(propertyData.tooltipIdFactory, 'property-warning', propertyData.property,
|
|
2550
|
+
propertyData.parentShorthand()?.property.name) :
|
|
2551
|
+
undefined;
|
|
2552
|
+
// clang-format off
|
|
2553
|
+
return html`<span><span
|
|
2554
|
+
class="exclamation-mark"
|
|
2555
|
+
tabindex="-1"
|
|
2556
|
+
title=${ifDefined(details ? undefined : getInvalidPropertyMessage(propertyData.property))}
|
|
2557
|
+
aria-details=${ifDefined(tooltipId)}></span>${details && tooltipId ? html`<devtools-tooltip
|
|
2558
|
+
id=${tooltipId}
|
|
2559
|
+
variant="rich"
|
|
2560
|
+
jslogContext="elements.invalid-property-decl-popover">${
|
|
2561
|
+
widget(ElementsComponents.CSSVariableValueView.CSSVariableParserError, {details})
|
|
2562
|
+
}</devtools-tooltip>` : nothing}</span>`;
|
|
2563
|
+
// clang-format on
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
function authoringHintTemplate(propertyData: StylePropertyData, hint: Hint): LitTemplate {
|
|
2567
|
+
const tooltipId = getTooltipId(propertyData.tooltipIdFactory, 'css-hint', propertyData.property,
|
|
2568
|
+
propertyData.parentShorthand()?.property.name);
|
|
2569
|
+
// clang-format off
|
|
2570
|
+
return html`<span class="hint-wrapper"><devtools-icon
|
|
2571
|
+
name="info"
|
|
2572
|
+
class="hint small"
|
|
2573
|
+
tabindex="-1"
|
|
2574
|
+
aria-details=${tooltipId}></devtools-icon></span><devtools-tooltip
|
|
2575
|
+
id=${tooltipId}
|
|
2576
|
+
variant="rich"
|
|
2577
|
+
padding="large"
|
|
2578
|
+
jslogContext="elements.css-hint">${
|
|
2579
|
+
widget(ElementsComponents.CSSHintDetailsView.CSSHintDetailsView, {authoringHint: hint})
|
|
2580
|
+
}</devtools-tooltip>`;
|
|
2581
|
+
// clang-format on
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
function animationOverrideHintTemplate(propertyData: StylePropertyData): LitTemplate {
|
|
2585
|
+
const tooltipId = getTooltipId(propertyData.tooltipIdFactory, 'animation-override-hint', propertyData.property,
|
|
2586
|
+
propertyData.parentShorthand()?.property.name);
|
|
2587
|
+
// clang-format off
|
|
2588
|
+
return html`<span class="animation-override-hint-wrapper hint-wrapper"><devtools-icon
|
|
2589
|
+
name="info"
|
|
2590
|
+
class="hint small"
|
|
2591
|
+
tabindex="-1"
|
|
2592
|
+
aria-details=${tooltipId}></devtools-icon></span><devtools-tooltip
|
|
2593
|
+
id=${tooltipId}
|
|
2594
|
+
variant="rich"
|
|
2595
|
+
padding="large"
|
|
2596
|
+
jslogContext="elements.css-animation-hint"><div class="animation-override-hint">${
|
|
2597
|
+
i18nTemplate(UIStrings.overriddenByAnimation, {PH1: html`<devtools-link
|
|
2598
|
+
jslogContext="open-in-animations-panel"
|
|
2599
|
+
@click=${(event: Event) => {
|
|
2600
|
+
event.preventDefault();
|
|
2601
|
+
void UI.ViewManager.ViewManager.instance().showView('animations');
|
|
2602
|
+
}}>${i18nString(UIStrings.openAnimationsPanel)}</devtools-link>`})}</div></devtools-tooltip>`;
|
|
2603
|
+
// clang-format on
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement implements StylePropertyData {
|
|
2439
2607
|
private readonly style: SDK.CSSStyleDeclaration.CSSStyleDeclaration;
|
|
2440
2608
|
#matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles;
|
|
2441
2609
|
property: SDK.CSSProperty.CSSProperty;
|
|
@@ -2459,13 +2627,13 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2459
2627
|
private computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null = null;
|
|
2460
2628
|
private contextForTest!: Context|undefined;
|
|
2461
2629
|
#gridNames: Set<string>|undefined = undefined;
|
|
2462
|
-
|
|
2630
|
+
readonly tooltipIdFactory: Tooltips.Tooltip.IdFactory;
|
|
2463
2631
|
// The changes that renderers made to the text of the value since it was rendered. Only available if the value was
|
|
2464
2632
|
// parsed.
|
|
2465
2633
|
#edits: ValueUpdateTracking|undefined;
|
|
2466
2634
|
// Stores the last committed property so incremental live previews and
|
|
2467
2635
|
// in-place mutations of `this.property` don't overwrite the baseline for change tracking.
|
|
2468
|
-
#lastCommittedProperty: {name: string, value: string};
|
|
2636
|
+
#lastCommittedProperty: {readonly name: string, readonly value: string};
|
|
2469
2637
|
|
|
2470
2638
|
#lazyRender?: boolean;
|
|
2471
2639
|
|
|
@@ -2484,6 +2652,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2484
2652
|
this.selectable = false;
|
|
2485
2653
|
this.#stylesContainer = stylesContainer;
|
|
2486
2654
|
this.#parentSection = section;
|
|
2655
|
+
this.tooltipIdFactory = section.sectionTooltipIdFactory.subfactory('swatch-tooltip', this.name);
|
|
2487
2656
|
this.isShorthand = isShorthand;
|
|
2488
2657
|
this.newProperty = newProperty;
|
|
2489
2658
|
this.#lastCommittedProperty = {
|
|
@@ -2505,9 +2674,31 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2505
2674
|
super.onunbind();
|
|
2506
2675
|
}
|
|
2507
2676
|
|
|
2508
|
-
|
|
2509
|
-
this.#lastCommittedProperty
|
|
2677
|
+
get lastCommittedProperty(): {readonly name: string, readonly value: string} {
|
|
2678
|
+
return this.#lastCommittedProperty;
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
carryOverCommittedProperty(previous: StylePropertyData): void {
|
|
2682
|
+
this.#lastCommittedProperty = previous.lastCommittedProperty;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
async setSiblingProperty(propertyName: string, value?: string): Promise<void> {
|
|
2686
|
+
let target = findSiblingProperty(this.#stylesContainer, this, propertyName);
|
|
2687
|
+
if (value) {
|
|
2688
|
+
if (!target) {
|
|
2689
|
+
target = this.#parentSection.addNewBlankProperty();
|
|
2690
|
+
target.property.name = propertyName;
|
|
2691
|
+
}
|
|
2692
|
+
target.property.value = value;
|
|
2693
|
+
target.updateTitle();
|
|
2694
|
+
await target.applyStyleText(target.renderedPropertyText(), false);
|
|
2695
|
+
this.#stylesContainer.refreshUpdate(target.section(), target, true);
|
|
2696
|
+
} else if (target) {
|
|
2697
|
+
await target.applyStyleText('', false);
|
|
2698
|
+
this.#stylesContainer.refreshUpdate(target.section(), target, true);
|
|
2699
|
+
}
|
|
2510
2700
|
}
|
|
2701
|
+
|
|
2511
2702
|
async gridNames(): Promise<Set<string>> {
|
|
2512
2703
|
if (!SDK.CSSMetadata.cssMetadata().isGridNameAwareProperty(this.name)) {
|
|
2513
2704
|
return new Set();
|
|
@@ -2536,8 +2727,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2536
2727
|
?.flatMap(row => row.substring(1, row.length - 1).split(/\s+/).filter(cell => !cell.match(/^\.*$/))));
|
|
2537
2728
|
}
|
|
2538
2729
|
if (SDK.CSSMetadata.cssMetadata().isGridColumnNameAwareProperty(this.name)) {
|
|
2539
|
-
return new Set(getNames(
|
|
2540
|
-
|
|
2730
|
+
return new Set(getNames('grid-template-columns',
|
|
2731
|
+
node => node.name === 'ValueName' && node.parent?.name === 'BracketedValue'));
|
|
2541
2732
|
}
|
|
2542
2733
|
return new Set(
|
|
2543
2734
|
getNames('grid-template-rows', node => node.name === 'ValueName' && node.parent?.name === 'BracketedValue'));
|
|
@@ -2553,6 +2744,10 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2553
2744
|
return this.parent instanceof StylePropertyTreeElement && this.parent.isShorthand ? this.parent : null;
|
|
2554
2745
|
}
|
|
2555
2746
|
|
|
2747
|
+
parentShorthand(): StylePropertyData|null {
|
|
2748
|
+
return this.getLonghand();
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2556
2751
|
editable(): boolean {
|
|
2557
2752
|
const hasSourceData = Boolean(this.style.styleSheetId && this.style.range);
|
|
2558
2753
|
return !this.getLonghand() && hasSourceData;
|
|
@@ -2894,7 +3089,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2894
3089
|
}
|
|
2895
3090
|
|
|
2896
3091
|
#updateTitle(): void {
|
|
2897
|
-
this
|
|
3092
|
+
this.tooltipIdFactory.clearKeys();
|
|
2898
3093
|
this.updateState();
|
|
2899
3094
|
if (this.isExpandable()) {
|
|
2900
3095
|
this.expandElement = createIcon('triangle-right', 'expand-icon');
|
|
@@ -2902,9 +3097,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2902
3097
|
}
|
|
2903
3098
|
|
|
2904
3099
|
const renderers = this.property.parsedOk ?
|
|
2905
|
-
getPropertyRenderers(
|
|
2906
|
-
|
|
2907
|
-
this.getComputedStyles() ?? new Map(), this.getComputedStyleExtraFields()) :
|
|
3100
|
+
getPropertyRenderers(this.name, this.style, this.#stylesContainer, this.#matchedStyles, this,
|
|
3101
|
+
this.getComputedStyles() ?? new Map(), this.getComputedStyleExtraFields()) :
|
|
2908
3102
|
[];
|
|
2909
3103
|
|
|
2910
3104
|
const existingDocWidget =
|
|
@@ -2926,9 +3120,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2926
3120
|
}
|
|
2927
3121
|
|
|
2928
3122
|
const indent = Common.Settings.Settings.instance().resolve(SDK.SDKSettings.textEditorIndentSettingDescriptor).get();
|
|
2929
|
-
UI.UIUtils.createTextChild(
|
|
2930
|
-
|
|
2931
|
-
indent.repeat(this.section().nestingLevel + 1) + (this.property.disabled ? '/* ' : ''));
|
|
3123
|
+
UI.UIUtils.createTextChild(this.listItemElement.createChild('span', 'styles-clipboard-only'),
|
|
3124
|
+
indent.repeat(this.section().nestingLevel + 1) + (this.property.disabled ? '/* ' : ''));
|
|
2932
3125
|
this.listItemElement.appendChild(this.nameElement);
|
|
2933
3126
|
|
|
2934
3127
|
if (this.property.name.startsWith('--') &&
|
|
@@ -2937,7 +3130,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2937
3130
|
contents.variableName = this.property.name;
|
|
2938
3131
|
contents.value = this.#matchedStyles.computeCSSVariable(this.style, this.property.name)?.value;
|
|
2939
3132
|
contents.details = this.#stylesContainer.getRegisteredPropertyDetails(this.matchedStyles(), this.property.name);
|
|
2940
|
-
const tooltipId =
|
|
3133
|
+
const tooltipId =
|
|
3134
|
+
getTooltipId(this.tooltipIdFactory, 'custom-property-decl', this.property, this.getLonghand()?.name);
|
|
2941
3135
|
this.nameElement.setAttribute('aria-details', tooltipId);
|
|
2942
3136
|
const tooltip = new Tooltips.Tooltip.Tooltip(
|
|
2943
3137
|
{anchor: this.nameElement, variant: 'rich', id: tooltipId, jslogContext: 'elements.css-var'});
|
|
@@ -2951,7 +3145,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2951
3145
|
} else if (Common.Settings.Settings.instance()
|
|
2952
3146
|
.resolve(SettingsUI.ElementsSettings.showCSSPropertyDocumentationOnHoverSettingDescriptor)
|
|
2953
3147
|
.get()) {
|
|
2954
|
-
const tooltipId = this.
|
|
3148
|
+
const tooltipId = getTooltipId(this.tooltipIdFactory, 'property-doc', this.property, this.getLonghand()?.name);
|
|
2955
3149
|
this.nameElement.setAttribute('aria-details', tooltipId);
|
|
2956
3150
|
const tooltip = new Tooltips.Tooltip.Tooltip({
|
|
2957
3151
|
anchor: this.nameElement,
|
|
@@ -3045,156 +3239,44 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3045
3239
|
this.listItemElement.insertBefore(enabledCheckboxElement, this.listItemElement.firstChild);
|
|
3046
3240
|
}
|
|
3047
3241
|
|
|
3048
|
-
|
|
3049
|
-
this.valueElement
|
|
3050
|
-
this.nameElement
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
return;
|
|
3055
|
-
}
|
|
3056
|
-
if (event.key !== Platform.KeyboardUtilities.ENTER_KEY && event.key !== ' ') {
|
|
3057
|
-
return;
|
|
3058
|
-
}
|
|
3059
|
-
if (this === that.valueElement) {
|
|
3060
|
-
that.startEditingValue();
|
|
3242
|
+
// The name and the value each start their own edit when the user presses Enter or Space on them.
|
|
3243
|
+
const valueElement = this.valueElement;
|
|
3244
|
+
const nameElement = this.nameElement;
|
|
3245
|
+
valueElement.addEventListener('keydown', event => {
|
|
3246
|
+
if (isStartEditingKey(valueElement, event)) {
|
|
3247
|
+
this.startEditingValue();
|
|
3061
3248
|
event.consume(true);
|
|
3062
|
-
}
|
|
3063
|
-
|
|
3249
|
+
}
|
|
3250
|
+
});
|
|
3251
|
+
nameElement.addEventListener('keydown', event => {
|
|
3252
|
+
if (isStartEditingKey(nameElement, event)) {
|
|
3253
|
+
this.startEditingName();
|
|
3064
3254
|
event.consume(true);
|
|
3065
3255
|
}
|
|
3256
|
+
});
|
|
3257
|
+
|
|
3258
|
+
function isStartEditingKey(element: HTMLElement, event: KeyboardEvent): boolean {
|
|
3259
|
+
if (UI.UIUtils.isBeingEdited(element)) {
|
|
3260
|
+
return false;
|
|
3261
|
+
}
|
|
3262
|
+
return !event.isComposing && Platform.KeyboardUtilities.isEnterOrSpaceKey(event);
|
|
3066
3263
|
}
|
|
3067
3264
|
}
|
|
3068
3265
|
|
|
3069
3266
|
createExclamationMark(property: SDK.CSSProperty.CSSProperty,
|
|
3070
|
-
|
|
3071
|
-
null):
|
|
3072
|
-
const
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3078
|
-
i18nString(UIStrings.unknownPropertyName);
|
|
3079
|
-
if (title === null) {
|
|
3080
|
-
UI.Tooltip.Tooltip.install(exclamationElement, invalidMessage);
|
|
3081
|
-
} else {
|
|
3082
|
-
const tooltipId = this.getTooltipId('property-warning');
|
|
3083
|
-
exclamationElement.setAttribute('aria-describedby', tooltipId);
|
|
3084
|
-
const tooltip = new Tooltips.Tooltip.Tooltip({
|
|
3085
|
-
anchor: exclamationElement,
|
|
3086
|
-
variant: 'simple',
|
|
3087
|
-
id: tooltipId,
|
|
3088
|
-
jslogContext: 'elements.invalid-property-decl-popover',
|
|
3089
|
-
});
|
|
3090
|
-
if (title instanceof UI.Widget.Widget) {
|
|
3091
|
-
title.show(tooltip, undefined, /* suppressOrphanWidgetError= */ true);
|
|
3092
|
-
} else {
|
|
3093
|
-
tooltip.appendChild(title);
|
|
3094
|
-
}
|
|
3095
|
-
container.appendChild(tooltip);
|
|
3096
|
-
}
|
|
3097
|
-
const invalidString =
|
|
3098
|
-
i18nString(UIStrings.invalidString, {PH1: invalidMessage, PH2: property.name, PH3: property.value});
|
|
3267
|
+
details: ElementsComponents.CSSVariableValueView.RegisteredPropertyDetails|
|
|
3268
|
+
null): DocumentFragment {
|
|
3269
|
+
const fragment = document.createDocumentFragment();
|
|
3270
|
+
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
3271
|
+
render(exclamationMarkTemplate(this, details), fragment);
|
|
3272
|
+
|
|
3273
|
+
const invalidString = i18nString(
|
|
3274
|
+
UIStrings.invalidString, {PH1: getInvalidPropertyMessage(property), PH2: property.name, PH3: property.value});
|
|
3099
3275
|
|
|
3100
3276
|
// Storing the invalidString for future screen reader support when editing the property
|
|
3101
3277
|
property.setDisplayedStringForInvalidProperty(invalidString);
|
|
3102
3278
|
|
|
3103
|
-
return
|
|
3104
|
-
}
|
|
3105
|
-
|
|
3106
|
-
#getLinkableFunction(
|
|
3107
|
-
functionName: string, matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles,
|
|
3108
|
-
property: SDK.CSSProperty.CSSProperty): InlineEditor.LinkSwatch.LinkSwatch {
|
|
3109
|
-
const swatch = new InlineEditor.LinkSwatch.LinkSwatch();
|
|
3110
|
-
const {registeredFunction, treeScopeDistance} = matchedStyles.getRegisteredFunction(functionName, property);
|
|
3111
|
-
const isDefined = Boolean(registeredFunction);
|
|
3112
|
-
swatch.data = {
|
|
3113
|
-
jslogContext: 'css-function',
|
|
3114
|
-
text: functionName,
|
|
3115
|
-
tooltip: isDefined ? undefined : {title: i18nString(UIStrings.sIsNotDefined, {PH1: functionName})},
|
|
3116
|
-
isDefined,
|
|
3117
|
-
onLinkActivate: (): void => {
|
|
3118
|
-
if (!registeredFunction) {
|
|
3119
|
-
return;
|
|
3120
|
-
}
|
|
3121
|
-
this.#stylesContainer.jumpToFunctionDefinition(registeredFunction, treeScopeDistance);
|
|
3122
|
-
},
|
|
3123
|
-
};
|
|
3124
|
-
return swatch;
|
|
3125
|
-
}
|
|
3126
|
-
|
|
3127
|
-
getTracingTooltip(functionName: string, node: CodeMirror.SyntaxNode,
|
|
3128
|
-
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, computedStyles: Map<string, string>,
|
|
3129
|
-
computedStyleExtraFields: Protocol.CSS.ComputedStyleExtraFields|null,
|
|
3130
|
-
context: RenderingContext): TemplateResult {
|
|
3131
|
-
if (context.tracing || !context.property) {
|
|
3132
|
-
return html`${functionName}`;
|
|
3133
|
-
}
|
|
3134
|
-
const text = context.ast.text(node);
|
|
3135
|
-
const expandPercentagesInShorthands = context.matchedResult.getLonghandValuesCount() > 1;
|
|
3136
|
-
const shorthandPositionOffset = context.matchedResult.getComputedLonghandName(node);
|
|
3137
|
-
const {property} = context;
|
|
3138
|
-
const stylesContainer = this.stylesContainer();
|
|
3139
|
-
const tooltipId = this.getTooltipId(`${functionName}-trace`);
|
|
3140
|
-
// clang-format off
|
|
3141
|
-
return html`
|
|
3142
|
-
<span tabIndex=-1 class=tracing-anchor aria-details=${tooltipId}>${functionName.startsWith('--') ? this.#getLinkableFunction(functionName, matchedStyles, context.property) : functionName}</span>
|
|
3143
|
-
<devtools-tooltip
|
|
3144
|
-
id=${tooltipId}
|
|
3145
|
-
use-hotkey
|
|
3146
|
-
variant=rich
|
|
3147
|
-
jslogContext=elements.css-value-trace
|
|
3148
|
-
@beforetoggle=${function(this: Tooltips.Tooltip.Tooltip, e: ToggleEvent) {
|
|
3149
|
-
if (e.newState === 'open') {
|
|
3150
|
-
void (this.querySelector('devtools-widget') as UI.Widget.WidgetElement<CSSValueTraceView>| null)
|
|
3151
|
-
?.getWidget()
|
|
3152
|
-
?.showTrace(
|
|
3153
|
-
property, text, matchedStyles, computedStyles,
|
|
3154
|
-
getPropertyRenderers(property.name,
|
|
3155
|
-
property.ownerStyle, stylesContainer, matchedStyles, null, computedStyles, computedStyleExtraFields),
|
|
3156
|
-
expandPercentagesInShorthands, shorthandPositionOffset, this.openedViaHotkey);
|
|
3157
|
-
}
|
|
3158
|
-
}}
|
|
3159
|
-
@toggle=${function(this: Tooltips.Tooltip.Tooltip, e: ToggleEvent) {
|
|
3160
|
-
if (e.newState !== 'open') {
|
|
3161
|
-
(this.querySelector('devtools-widget') as UI.Widget.WidgetElement<CSSValueTraceView>| null)
|
|
3162
|
-
?.getWidget()
|
|
3163
|
-
?.resetPendingFocus();
|
|
3164
|
-
}
|
|
3165
|
-
}}>
|
|
3166
|
-
<devtools-widget
|
|
3167
|
-
@keydown=${(e: KeyboardEvent) => {
|
|
3168
|
-
const maybeTooltip = (e.target as Element).parentElement ;
|
|
3169
|
-
if (!(maybeTooltip instanceof Tooltips.Tooltip.Tooltip)) {
|
|
3170
|
-
return;
|
|
3171
|
-
}
|
|
3172
|
-
if (e.key === 'Escape' || (e.altKey && e.key === 'ArrowDown')){
|
|
3173
|
-
maybeTooltip.hideTooltip();
|
|
3174
|
-
maybeTooltip.anchor?.focus();
|
|
3175
|
-
e.consume(true);
|
|
3176
|
-
}
|
|
3177
|
-
}}
|
|
3178
|
-
${widget(CSSValueTraceView)}>
|
|
3179
|
-
</devtools-widget>
|
|
3180
|
-
</devtools-tooltip>`;
|
|
3181
|
-
// clang-format on
|
|
3182
|
-
}
|
|
3183
|
-
|
|
3184
|
-
// Returns an id for <devtools-tooltips> that's stable across re-rendering of property values but unique across
|
|
3185
|
-
// sections and across switches between different nodes.
|
|
3186
|
-
getTooltipId(key: string): string {
|
|
3187
|
-
const sectionId = this.section().sectionTooltipIdPrefix;
|
|
3188
|
-
const tooltipKeyCount = this.#tooltipKeyCounts.get(key) ?? 0;
|
|
3189
|
-
this.#tooltipKeyCounts.set(key, tooltipKeyCount + 1);
|
|
3190
|
-
const propertyNameForCounting = this.getLonghand()?.name ?? this.name;
|
|
3191
|
-
const ownIndex = this.style.allProperties().indexOf(this.property);
|
|
3192
|
-
const propertyCount = this.style.allProperties().reduce<number>(
|
|
3193
|
-
(value, property, index) =>
|
|
3194
|
-
index < ownIndex && (property.name === this.name || property.name === propertyNameForCounting) ? value + 1 :
|
|
3195
|
-
value,
|
|
3196
|
-
0);
|
|
3197
|
-
return `swatch-tooltip-${sectionId}-${this.name}-${propertyCount}-${key}-${tooltipKeyCount}`;
|
|
3279
|
+
return fragment;
|
|
3198
3280
|
}
|
|
3199
3281
|
|
|
3200
3282
|
updateAuthoringHint(): void {
|
|
@@ -3219,28 +3301,14 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3219
3301
|
|
|
3220
3302
|
const localName = this.node()?.localName();
|
|
3221
3303
|
for (const validator of cssRuleValidatorsMap.get(propertyName) || []) {
|
|
3222
|
-
const hint = validator.getHint(
|
|
3223
|
-
|
|
3224
|
-
localName?.toLowerCase(), fontFaces);
|
|
3304
|
+
const hint = validator.getHint(propertyName, this.computedStyles || undefined,
|
|
3305
|
+
this.parentsComputedStyles || undefined, localName?.toLowerCase(), fontFaces);
|
|
3225
3306
|
if (hint) {
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
hintIcon.classList.add('hint', 'small');
|
|
3231
|
-
hintIcon.tabIndex = -1;
|
|
3232
|
-
wrapper.append(hintIcon);
|
|
3233
|
-
this.listItemElement.append(wrapper);
|
|
3307
|
+
const fragment = document.createDocumentFragment();
|
|
3308
|
+
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
3309
|
+
render(authoringHintTemplate(this, hint), fragment);
|
|
3310
|
+
this.listItemElement.append(fragment);
|
|
3234
3311
|
this.listItemElement.classList.add('inactive-property');
|
|
3235
|
-
const tooltipId = this.getTooltipId('css-hint');
|
|
3236
|
-
hintIcon.setAttribute('aria-details', tooltipId);
|
|
3237
|
-
const tooltip = new Tooltips.Tooltip.Tooltip(
|
|
3238
|
-
{anchor: hintIcon, variant: 'rich', padding: 'large', id: tooltipId, jslogContext: 'elements.css-hint'});
|
|
3239
|
-
const hintDetailsView = new ElementsComponents.CSSHintDetailsView.CSSHintDetailsView();
|
|
3240
|
-
hintDetailsView.authoringHint = hint;
|
|
3241
|
-
hintDetailsView.markAsRoot();
|
|
3242
|
-
hintDetailsView.show(tooltip);
|
|
3243
|
-
this.listItemElement.appendChild(tooltip);
|
|
3244
3312
|
break;
|
|
3245
3313
|
}
|
|
3246
3314
|
}
|
|
@@ -3259,44 +3327,10 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3259
3327
|
return;
|
|
3260
3328
|
}
|
|
3261
3329
|
|
|
3262
|
-
const
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
hintIcon.classList.add('hint', 'small');
|
|
3267
|
-
hintIcon.tabIndex = -1;
|
|
3268
|
-
|
|
3269
|
-
wrapper.append(hintIcon);
|
|
3270
|
-
this.listItemElement.append(wrapper);
|
|
3271
|
-
|
|
3272
|
-
const tooltipId = this.getTooltipId('animation-override-hint');
|
|
3273
|
-
hintIcon.setAttribute('aria-details', tooltipId);
|
|
3274
|
-
|
|
3275
|
-
const tooltip = new Tooltips.Tooltip.Tooltip({
|
|
3276
|
-
anchor: hintIcon,
|
|
3277
|
-
variant: 'rich',
|
|
3278
|
-
padding: 'large',
|
|
3279
|
-
id: tooltipId,
|
|
3280
|
-
jslogContext: 'elements.css-animation-hint',
|
|
3281
|
-
});
|
|
3282
|
-
const message = i18nString(UIStrings.overriddenByAnimation);
|
|
3283
|
-
const content = document.createElement('div');
|
|
3284
|
-
content.classList.add('animation-override-hint');
|
|
3285
|
-
content.textContent = message;
|
|
3286
|
-
|
|
3287
|
-
const link = document.createElement('devtools-link');
|
|
3288
|
-
link.textContent = i18nString(UIStrings.openAnimationsPanel);
|
|
3289
|
-
link.jslogContext = 'open-in-animations-panel';
|
|
3290
|
-
link.addEventListener('click', event => {
|
|
3291
|
-
event.preventDefault();
|
|
3292
|
-
void UI.ViewManager.ViewManager.instance().showView('animations');
|
|
3293
|
-
});
|
|
3294
|
-
|
|
3295
|
-
content.appendChild(document.createTextNode(' '));
|
|
3296
|
-
content.appendChild(link);
|
|
3297
|
-
tooltip.appendChild(content);
|
|
3298
|
-
|
|
3299
|
-
this.listItemElement.appendChild(tooltip);
|
|
3330
|
+
const fragment = document.createDocumentFragment();
|
|
3331
|
+
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
3332
|
+
render(animationOverrideHintTemplate(this), fragment);
|
|
3333
|
+
this.listItemElement.append(fragment);
|
|
3300
3334
|
}
|
|
3301
3335
|
|
|
3302
3336
|
private overriddenByAnimation(): boolean {
|
|
@@ -3368,8 +3402,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3368
3402
|
}, {checked: !this.property.disabled, jslogContext: 'toggle-property-and-continue-editing'});
|
|
3369
3403
|
}
|
|
3370
3404
|
const revealCallback = this.navigateToSource.bind(this) as () => void;
|
|
3371
|
-
contextMenu.defaultSection().appendItem(
|
|
3372
|
-
|
|
3405
|
+
contextMenu.defaultSection().appendItem(i18nString(UIStrings.openInSourcesPanel), revealCallback,
|
|
3406
|
+
{jslogContext: 'reveal-in-sources-panel'});
|
|
3373
3407
|
void contextMenu.show();
|
|
3374
3408
|
}
|
|
3375
3409
|
|
|
@@ -3404,18 +3438,18 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3404
3438
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(ruleText);
|
|
3405
3439
|
}, {jslogContext: 'copy-rule'});
|
|
3406
3440
|
|
|
3407
|
-
contextMenu.headerSection().appendItem(
|
|
3408
|
-
|
|
3409
|
-
|
|
3441
|
+
contextMenu.headerSection().appendItem(i18nString(UIStrings.copyCssDeclarationAsJs),
|
|
3442
|
+
this.copyCssDeclarationAsJs.bind(this),
|
|
3443
|
+
{jslogContext: 'copy-css-declaration-as-js'});
|
|
3410
3444
|
|
|
3411
3445
|
contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyAllDeclarations), () => {
|
|
3412
3446
|
const allDeclarationText = this.#parentSection.formatLeadingProperties().allDeclarationText;
|
|
3413
3447
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(allDeclarationText);
|
|
3414
3448
|
}, {jslogContext: 'copy-all-declarations'});
|
|
3415
3449
|
|
|
3416
|
-
contextMenu.clipboardSection().appendItem(
|
|
3417
|
-
|
|
3418
|
-
|
|
3450
|
+
contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyAllCssDeclarationsAsJs),
|
|
3451
|
+
this.copyAllCssDeclarationAsJs.bind(this),
|
|
3452
|
+
{jslogContext: 'copy-all-css-declarations-as-js'});
|
|
3419
3453
|
|
|
3420
3454
|
contextMenu.footerSection().appendItem(i18nString(UIStrings.viewComputedValue), () => {
|
|
3421
3455
|
void this.viewComputedValue();
|
|
@@ -3622,13 +3656,11 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3622
3656
|
if ((keyboardEvent.key === 'Enter' && !keyboardEvent.shiftKey) ||
|
|
3623
3657
|
(context.isEditingName && keyboardEvent.key === ' ')) {
|
|
3624
3658
|
result = 'forward';
|
|
3625
|
-
} else if (
|
|
3626
|
-
|
|
3627
|
-
keyboardEvent.key === Platform.KeyboardUtilities.ESCAPE_KEY) {
|
|
3659
|
+
} else if (keyboardEvent.keyCode === UI.KeyboardShortcut.Keys.Esc.code ||
|
|
3660
|
+
keyboardEvent.key === Platform.KeyboardUtilities.ESCAPE_KEY) {
|
|
3628
3661
|
result = 'cancel';
|
|
3629
|
-
} else if (
|
|
3630
|
-
|
|
3631
|
-
keyboardEvent.keyCode === UI.KeyboardShortcut.Keys.Backspace.code) {
|
|
3662
|
+
} else if (!context.isEditingName && this.newProperty &&
|
|
3663
|
+
keyboardEvent.keyCode === UI.KeyboardShortcut.Keys.Backspace.code) {
|
|
3632
3664
|
// For a new property, when Backspace is pressed at the beginning of new property value, move back to the property name.
|
|
3633
3665
|
const selection = target.getComponentSelection();
|
|
3634
3666
|
if (selection && selection.isCollapsed && !selection.focusOffset) {
|
|
@@ -3879,9 +3911,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3879
3911
|
let propertyText;
|
|
3880
3912
|
if (nameValueEntered) {
|
|
3881
3913
|
propertyText = this.nameElement.textContent;
|
|
3882
|
-
} else if (
|
|
3883
|
-
|
|
3884
|
-
(this.newProperty && Platform.StringUtilities.isWhitespace(this.valueElement.textContent || ''))) {
|
|
3914
|
+
} else if (blankInput ||
|
|
3915
|
+
(this.newProperty && Platform.StringUtilities.isWhitespace(this.valueElement.textContent || ''))) {
|
|
3885
3916
|
propertyText = '';
|
|
3886
3917
|
} else if (isEditingName) {
|
|
3887
3918
|
propertyText = userInput + ': ' + this.property.value;
|
|
@@ -3905,9 +3936,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
3905
3936
|
/**
|
|
3906
3937
|
* The Callback to start editing the next/previous property/selector.
|
|
3907
3938
|
*/
|
|
3908
|
-
function moveToNextCallback(
|
|
3909
|
-
|
|
3910
|
-
section: StylePropertiesSection): void {
|
|
3939
|
+
function moveToNextCallback(this: StylePropertyTreeElement, alreadyNew: boolean, valueChanged: boolean,
|
|
3940
|
+
section: StylePropertiesSection): void {
|
|
3911
3941
|
if (!moveDirection) {
|
|
3912
3942
|
this.#stylesContainer.resetFocus();
|
|
3913
3943
|
return;
|
|
@@ -4012,8 +4042,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
4012
4042
|
return this.applyStyleThrottler.schedule(this.innerApplyStyleText.bind(this, styleText, majorChange, property));
|
|
4013
4043
|
}
|
|
4014
4044
|
|
|
4015
|
-
private async innerApplyStyleText(
|
|
4016
|
-
|
|
4045
|
+
private async innerApplyStyleText(styleText: string, majorChange: boolean,
|
|
4046
|
+
property?: SDK.CSSProperty.CSSProperty|null): Promise<void> {
|
|
4017
4047
|
// this.property might have been nulled at the end of the last innerApplyStyleText.
|
|
4018
4048
|
if (!this.treeOutline || !this.property) {
|
|
4019
4049
|
return;
|
|
@@ -4186,9 +4216,8 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
4186
4216
|
}
|
|
4187
4217
|
|
|
4188
4218
|
export class GhostStylePropertyTreeElement extends StylePropertyTreeElement {
|
|
4189
|
-
constructor(
|
|
4190
|
-
|
|
4191
|
-
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, property: SDK.CSSProperty.CSSProperty) {
|
|
4219
|
+
constructor(stylesContainer: StylesContainer, section: StylePropertiesSection,
|
|
4220
|
+
matchedStyles: SDK.CSSMatchedStyles.CSSMatchedStyles, property: SDK.CSSProperty.CSSProperty) {
|
|
4192
4221
|
super({
|
|
4193
4222
|
stylesContainer,
|
|
4194
4223
|
section,
|