chrome-devtools-frontend 1.0.1726686 → 1.0.1730971
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/tests/test-strict-assertions-and-literal-expectations.md +1 -1
- package/.agents/rules/tests/test-view-and-presenter-isolation.md +1 -1
- 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 +2 -2
- package/.agents/rules/ui-and-widgets/ui-declarative-child-widget-composition.md +5 -5
- package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-localization-and-uistrings-hygiene.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-modern-component-and-encapsulation-standards.md +3 -3
- package/.agents/rules/ui-and-widgets/ui-pure-view-and-presenter-separation.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-reactive-widget-update-lifecycle.md +2 -2
- 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 +2 -2
- package/.agents/skills/code-review/SKILL.md +63 -12
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +38 -10
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +1 -0
- package/.agents/skills/ui-widgets/SKILL.md +8 -2
- package/.agents/skills/write-ai-eval-test/SKILL.md +106 -0
- package/AUTHORS +2 -0
- package/DIR_METADATA +1 -2
- package/README.md +48 -26
- package/config/typescript/tsconfig.base.json +1 -0
- package/config/typescript/tsconfig.eslint.json +1 -0
- package/docs/contributing/changes.md +25 -0
- package/docs/ui_engineering.md +13 -4
- package/eslint.config.mjs +323 -41
- package/front_end/core/common/Color.ts +7 -7
- package/front_end/core/common/ParsedURL.ts +3 -3
- package/front_end/core/common/ResolverBase.ts +3 -3
- package/front_end/core/common/SegmentedRange.ts +3 -3
- package/front_end/core/common/SimpleHistoryManager.ts +14 -14
- package/front_end/core/common/Trie.ts +3 -3
- package/front_end/core/common/VersionController.ts +7 -7
- package/front_end/core/host/InspectorFrontendHost.ts +2 -2
- package/front_end/core/host/InspectorFrontendHostAPI.ts +9 -1
- package/front_end/core/host/InspectorFrontendHostStub.ts +1 -1
- package/front_end/core/host/UserMetrics.ts +4 -0
- package/front_end/core/host/UserMetricsEnums.ts +2 -1
- package/front_end/core/platform/StringUtilities.ts +54 -13
- package/front_end/core/platform/node/HostRuntime.ts +13 -7
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +4 -5
- package/front_end/core/root/Runtime.ts +5 -0
- package/front_end/core/sdk/AccessibilityModel.ts +5 -5
- package/front_end/core/sdk/AnimationModel.ts +17 -19
- package/front_end/core/sdk/CPUProfilerModel.ts +3 -3
- package/front_end/core/sdk/CPUThrottlingManager.ts +7 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +73 -13
- package/front_end/core/sdk/CSSMetadata.ts +7 -7
- package/front_end/core/sdk/CSSModel.ts +33 -33
- package/front_end/core/sdk/CSSProperty.ts +5 -5
- package/front_end/core/sdk/CSSRule.ts +6 -6
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +4 -4
- package/front_end/core/sdk/Connections.ts +16 -16
- package/front_end/core/sdk/ConsoleModel.ts +44 -47
- package/front_end/core/sdk/CookieParser.ts +11 -11
- package/front_end/core/sdk/EmulationModel.ts +35 -36
- package/front_end/core/sdk/EventBreakpointsModel.ts +11 -11
- package/front_end/core/sdk/FrameManager.ts +16 -16
- package/front_end/core/sdk/IsolateManager.ts +2 -2
- package/front_end/core/sdk/IssuesModel.ts +2 -2
- package/front_end/core/sdk/OverlayModel.ts +19 -19
- package/front_end/core/sdk/PageResourceLoader.ts +14 -16
- package/front_end/core/sdk/RemoteObject.ts +9 -9
- package/front_end/core/sdk/Resource.ts +2 -2
- package/front_end/core/sdk/RuntimeModel.ts +7 -7
- package/front_end/core/sdk/Script.ts +6 -6
- package/front_end/core/sdk/ServiceWorkerManager.ts +36 -10
- package/front_end/core/sdk/SourceMap.ts +18 -20
- package/front_end/core/sdk/SourceMapManager.ts +2 -2
- package/front_end/core/sdk/TargetManager.ts +2 -2
- package/front_end/devtools_compatibility.js +7 -3
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +2 -2
- package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +203 -115
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/SupportedCSSProperties.ts +1 -3
- package/front_end/generated/protocol.ts +1 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +36 -12
- package/front_end/models/ai_assistance/AiConversation.ts +8 -2
- package/front_end/models/ai_assistance/agents/AiAgent.ts +137 -62
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +2 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +149 -2
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +269 -42
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +3 -0
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +9 -0
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +13 -2
- package/front_end/models/ai_assistance/tools/RunLighthouse.ts +23 -7
- package/front_end/models/ai_assistance/tools/Tool.ts +7 -5
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +22 -24
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +60 -60
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +24 -24
- package/front_end/models/bindings/DefaultScriptMapping.ts +8 -8
- package/front_end/models/bindings/FileUtils.ts +13 -13
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +3 -3
- package/front_end/models/bindings/ResourceScriptMapping.ts +23 -23
- package/front_end/models/comment_manager/CommentManager.ts +3 -3
- package/front_end/models/comment_manager/CommentThread.ts +50 -5
- package/front_end/models/cpu_profile/CPUProfileDataModel.ts +14 -14
- package/front_end/models/cpu_profile/ProfileTreeModel.ts +4 -4
- package/front_end/models/elements/StyleChanges.ts +38 -0
- package/front_end/models/emulation/EmulatedDevices.ts +12 -12
- package/front_end/models/har/HARFormat.ts +4 -4
- package/front_end/models/javascript_metadata/NativeFunctions.ts +5 -1
- package/front_end/models/lighthouse/LighthouseReporterTypes.ts +57 -3
- package/front_end/models/lighthouse/RunTypes.ts +9 -1
- package/front_end/models/logs/LogManager.ts +2 -2
- package/front_end/models/persistence/AutomaticFileSystemManager.ts +3 -0
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +24 -24
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +6 -0
- package/front_end/models/persistence/NetworkPersistenceManager.ts +8 -3
- package/front_end/models/trace/LanternComputationData.ts +37 -11
- package/front_end/models/trace/Processor.ts +2 -1
- package/front_end/models/trace/extras/TraceTree.ts +36 -10
- package/front_end/models/trace/handlers/InitiatorsHandler.ts +27 -34
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +2 -6
- package/front_end/models/trace/handlers/SamplesHandler.ts +9 -6
- package/front_end/models/workspace/FileManager.ts +6 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +4 -4
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +8 -1
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +15 -17
- package/front_end/panels/accessibility/AccessibilitySubPane.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -5
- package/front_end/panels/ai_assistance/ExternalHandler.ts +10 -1
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +27 -22
- package/front_end/panels/ai_assistance/components/DisabledWidget.ts +19 -23
- package/front_end/panels/ai_assistance/components/ExploreWidget.ts +2 -2
- package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +23 -9
- package/front_end/panels/ai_assistance/components/chatInput.css +1 -1
- package/front_end/panels/animation/AnimationTimeline.ts +37 -17
- package/front_end/panels/animation/animationTimeline.css +19 -3
- package/front_end/panels/application/AppManifestView.ts +1 -2
- package/front_end/panels/application/ApplicationPanelSidebar.ts +143 -128
- package/front_end/panels/application/DOMStorageItemsView.ts +14 -14
- package/front_end/panels/application/DeviceBoundSessionsView.ts +10 -13
- package/front_end/panels/application/ExtensionStorageItemsView.ts +3 -4
- package/front_end/panels/application/IndexedDBViews.ts +8 -4
- package/front_end/panels/application/KeyValueStorageItemsView.ts +4 -5
- package/front_end/panels/application/PrivateVerificationTokensView.ts +53 -0
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +12 -8
- package/front_end/panels/application/ServiceWorkersView.ts +1 -2
- package/front_end/panels/application/StorageItemsToolbar.ts +3 -3
- package/front_end/panels/application/StorageView.ts +2 -2
- package/front_end/panels/application/WebMCPView.ts +91 -109
- package/front_end/panels/application/application.ts +2 -0
- package/front_end/panels/application/components/StorageMetadataView.ts +6 -6
- package/front_end/panels/application/preloading/PreloadingView.ts +70 -37
- package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +3 -3
- package/front_end/panels/application/preloading/components/PreloadingGrid.ts +12 -0
- package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +10 -11
- package/front_end/panels/application/privateVerificationTokensView.css +20 -0
- package/front_end/panels/application/serviceWorkersView.css +2 -2
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +24 -24
- package/front_end/panels/changes/ChangesSidebar.ts +5 -5
- package/front_end/panels/changes/ChangesView.ts +10 -11
- package/front_end/panels/comments/CommentsPane.ts +292 -102
- package/front_end/panels/comments/commentsPane.css +93 -12
- package/front_end/panels/common/CommentThreadWidget.ts +69 -0
- package/front_end/panels/common/CommentsOverlayWidget.ts +108 -29
- package/front_end/panels/common/CommentsStatusBarPill.ts +17 -6
- package/front_end/panels/common/DOMLinkifier.ts +37 -12
- package/front_end/panels/common/ExtensionPanel.ts +13 -4
- package/front_end/panels/common/ExtensionServer.ts +27 -3
- package/front_end/panels/common/PersistenceUtils.ts +3 -3
- package/front_end/panels/common/commentThreadWidget.css +25 -1
- package/front_end/panels/common/common-meta.ts +10 -0
- package/front_end/panels/console/ConsolePinPane.ts +13 -15
- package/front_end/panels/console/ConsolePrompt.ts +173 -95
- package/front_end/panels/console/ConsoleSidebar.ts +2 -2
- package/front_end/panels/console/ConsoleView.ts +75 -79
- package/front_end/panels/console/ConsoleViewMessage.ts +52 -4
- package/front_end/panels/console/SymbolizedErrorWidget.ts +8 -4
- package/front_end/panels/console/consolePrompt.css +1 -1
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/console_counters/WarningErrorCounter.ts +3 -4
- package/front_end/panels/coverage/CoverageListView.ts +2 -2
- package/front_end/panels/coverage/CoverageView.ts +20 -5
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +4 -3
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewStartView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewUnusedDeclarations.ts +8 -8
- package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +2 -3
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +4 -5
- package/front_end/panels/elements/AccessibilityTreeUtils.ts +6 -7
- package/front_end/panels/elements/CSSValueTraceView.ts +3 -3
- package/front_end/panels/elements/ClassesPaneWidget.ts +1 -2
- package/front_end/panels/elements/ComputedStyleWidget.ts +15 -14
- package/front_end/panels/elements/DOMTreeElementWidget.ts +5 -4
- package/front_end/panels/elements/DOMTreeWidget.ts +2 -1
- package/front_end/panels/elements/ElementStatePaneWidget.ts +2 -2
- package/front_end/panels/elements/ElementsPanel.ts +1 -0
- package/front_end/panels/elements/EventListenersWidget.ts +2 -2
- package/front_end/panels/elements/LayoutPane.ts +2 -2
- package/front_end/panels/elements/PlatformFontsWidget.ts +3 -3
- package/front_end/panels/elements/PropertiesWidget.ts +9 -10
- package/front_end/panels/elements/PropertyRenderer.ts +72 -11
- package/front_end/panels/elements/StandaloneStylesContainer.ts +5 -10
- package/front_end/panels/elements/StyleEditorWidget.ts +30 -16
- package/front_end/panels/elements/StylePropertiesSection.ts +93 -44
- package/front_end/panels/elements/StylePropertyTreeElement.ts +230 -302
- package/front_end/panels/elements/StylesContainer.ts +2 -3
- package/front_end/panels/elements/StylesSidebarPane.ts +4 -13
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +66 -37
- package/front_end/panels/elements/components/CSSHintDetailsView.ts +51 -41
- package/front_end/panels/elements/components/CSSPropertyDocsView.ts +75 -65
- package/front_end/panels/elements/components/CSSQuery.ts +112 -74
- package/front_end/panels/elements/components/CSSVariableValueView.ts +109 -68
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +64 -45
- package/front_end/panels/elements/components/ElementsTreeExpandButton.ts +35 -28
- package/front_end/panels/elements/components/QueryContainer.ts +104 -74
- package/front_end/panels/elements/components/accessibilityTreeNode.css +22 -20
- package/front_end/panels/elements/components/computedStyleProperty.css +2 -0
- package/front_end/panels/elements/components/cssHintDetailsView.css +23 -21
- package/front_end/panels/elements/components/cssPropertyDocsView.css +38 -36
- package/front_end/panels/elements/components/cssVariableValueView.css +42 -40
- package/front_end/panels/elements/components/elementsTreeExpandButton.css +5 -2
- package/front_end/panels/elements/components/queryContainer.css +23 -21
- package/front_end/panels/elements/stylesSidebarPane.css +3 -3
- package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -2
- package/front_end/panels/emulation/InspectedPagePlaceholder.ts +2 -2
- package/front_end/panels/emulation/MediaQueryInspector.ts +9 -10
- package/front_end/panels/emulation/mediaQueryInspector.css +1 -1
- package/front_end/panels/event_listeners/EventListenersView.ts +2 -2
- package/front_end/panels/issues/AffectedCookiesView.ts +144 -101
- package/front_end/panels/issues/AffectedDescendantsWithinSelectElementView.ts +83 -31
- package/front_end/panels/issues/AffectedDirectivesView.ts +218 -135
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +84 -34
- package/front_end/panels/issues/AffectedElementsView.ts +86 -23
- package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +2 -2
- package/front_end/panels/issues/AffectedMetadataAllowedSitesView.ts +2 -2
- package/front_end/panels/issues/AffectedPartitioningBlobURLView.ts +36 -11
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +135 -58
- package/front_end/panels/issues/AffectedSourcesView.ts +49 -28
- package/front_end/panels/issues/AffectedTrackingSitesView.ts +3 -4
- package/front_end/panels/issues/CorsIssueDetailsView.ts +490 -269
- package/front_end/panels/issues/GenericIssueDetailsView.ts +2 -2
- package/front_end/panels/issues/IssueKindView.ts +63 -48
- package/front_end/panels/issues/IssueView.ts +14 -18
- package/front_end/panels/issues/components/ElementsPanelLink.ts +70 -34
- package/front_end/panels/issues/components/HideIssuesMenu.ts +56 -32
- package/front_end/panels/issues/components/elementsPanelLink.css +10 -6
- package/front_end/panels/issues/components/hideIssuesMenu.css +16 -14
- package/front_end/panels/issues/issues.ts +2 -0
- package/front_end/panels/issues/issuesTree.css +4 -4
- package/front_end/panels/lighthouse/LighthouseController.ts +6 -6
- package/front_end/panels/lighthouse/LighthouseStatusView.ts +12 -13
- package/front_end/panels/lighthouse/lighthouseStartView.css +1 -1
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +159 -161
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorView.ts +228 -0
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +32 -41
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +2 -2
- package/front_end/panels/linear_memory_inspector/linear_memory_inspector.ts +2 -0
- package/front_end/panels/media/EventDisplayTable.ts +2 -2
- package/front_end/panels/media/MainView.ts +132 -66
- package/front_end/panels/media/PlayerDetailView.ts +32 -14
- package/front_end/panels/media/PlayerListView.ts +83 -23
- package/front_end/panels/media/PlayerPropertiesView.ts +2 -2
- package/front_end/panels/media/TickingFlameChart.ts +153 -63
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +2 -2
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +615 -464
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +43 -0
- package/front_end/panels/network/EventSourceMessagesView.ts +3 -3
- package/front_end/panels/network/NetworkConfigView.ts +6 -2
- package/front_end/panels/network/NetworkDataGridNode.ts +2 -1
- package/front_end/panels/network/NetworkItemView.ts +27 -26
- package/front_end/panels/network/NetworkManageCustomHeadersView.ts +236 -97
- package/front_end/panels/network/NetworkOverview.ts +8 -10
- package/front_end/panels/network/RequestConditionsDrawer.ts +8 -4
- package/front_end/panels/network/RequestDeviceBoundSessionsView.ts +2 -4
- package/front_end/panels/network/RequestHTMLView.ts +26 -7
- package/front_end/panels/network/RequestHeadersView.ts +2 -2
- package/front_end/panels/network/RequestInitiatorView.ts +21 -22
- package/front_end/panels/network/RequestPayloadView.ts +2 -16
- package/front_end/panels/network/RequestPreviewView.ts +5 -5
- package/front_end/panels/network/RequestTimingView.ts +6 -6
- package/front_end/panels/network/ResourceDirectSocketChunkView.ts +5 -6
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +4 -3
- package/front_end/panels/network/ShowMoreDetailsWidget.ts +11 -12
- package/front_end/panels/network/SignedExchangeInfoView.ts +2 -2
- package/front_end/panels/network/networkLogView.css +2 -2
- package/front_end/panels/network/networkManageCustomHeadersView.css +27 -6
- package/front_end/panels/network/requestConditionsDrawer.css +1 -1
- package/front_end/panels/network/requestInitiatorView.css +5 -3
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -2
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +1 -2
- package/front_end/panels/profiler/HeapTimelineOverview.ts +77 -15
- package/front_end/panels/profiler/IsolateSelector.ts +258 -187
- package/front_end/panels/profiler/ProfileLauncherView.ts +7 -29
- package/front_end/panels/profiler/profileLauncherView.css +6 -1
- package/front_end/panels/protocol_monitor/JSONEditor.ts +4 -5
- package/front_end/panels/recorder/ControlButton.ts +1 -1
- package/front_end/panels/recorder/RecordingListView.ts +2 -4
- package/front_end/panels/recorder/RecordingView.ts +1 -2
- package/front_end/panels/recorder/SelectorPicker.ts +2 -4
- package/front_end/panels/recorder/StepView.ts +24 -10
- package/front_end/panels/recorder/TimelineSection.ts +1 -1
- package/front_end/panels/recorder/recordingView.css +1 -1
- package/front_end/panels/screencast/ScreencastApp.ts +1 -1
- package/front_end/panels/search/SearchResultsPane.ts +11 -12
- package/front_end/panels/search/SearchView.ts +8 -10
- package/front_end/panels/security/SecurityPanel.ts +1 -8
- package/front_end/panels/security/SecurityPanelSidebar.ts +2 -2
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -2
- package/front_end/panels/settings/AISettingsTab.ts +1 -1
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +34 -20
- package/front_end/panels/settings/EditFileSystemView.ts +2 -2
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +375 -197
- package/front_end/panels/settings/KeybindsSettingsTab.ts +570 -414
- package/front_end/panels/settings/SettingsScreen.ts +312 -114
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -2
- package/front_end/panels/settings/aiSettingsTab.css +1 -4
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +924 -578
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +9 -2
- package/front_end/panels/settings/emulation/devicesSettingsTab.css +39 -0
- package/front_end/panels/settings/frameworkIgnoreListSettingsTab.css +37 -8
- package/front_end/panels/settings/settingsScreen.css +0 -24
- package/front_end/panels/sources/BreakpointEditDialog.ts +9 -6
- package/front_end/panels/sources/BreakpointsView.ts +25 -4
- package/front_end/panels/sources/CallStackSidebarPane.ts +7 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -0
- package/front_end/panels/sources/GoToLineQuickOpen.ts +8 -8
- package/front_end/panels/sources/NavigatorView.ts +521 -439
- package/front_end/panels/sources/PersistenceActions.ts +11 -12
- package/front_end/panels/sources/ProfilePlugin.ts +28 -17
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -4
- package/front_end/panels/sources/SourcesNavigator.ts +9 -9
- package/front_end/panels/sources/SourcesPanel.ts +2 -2
- package/front_end/panels/sources/SourcesView.ts +3 -3
- package/front_end/panels/sources/ThreadsSidebarPane.ts +2 -2
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -2
- package/front_end/panels/sources/components/HeadersView.ts +1 -2
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +5 -6
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +73 -34
- package/front_end/panels/timeline/IsolateSelector.ts +25 -37
- package/front_end/panels/timeline/StatusDialog.ts +5 -7
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +10 -13
- package/front_end/panels/timeline/TimelineDetailsView.ts +40 -21
- package/front_end/panels/timeline/TimelineEventOverview.ts +130 -34
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +1 -1
- package/front_end/panels/timeline/TimelineMiniMap.ts +255 -103
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +19 -11
- package/front_end/panels/timeline/TimelinePanel.ts +1 -0
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +11 -12
- package/front_end/panels/timeline/TimelineTreeView.ts +240 -122
- package/front_end/panels/timeline/TimelineUIUtils.ts +12 -0
- package/front_end/panels/timeline/components/BreadcrumbsUI.ts +5 -4
- package/front_end/panels/timeline/components/DetailsView.ts +97 -65
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +2 -2
- package/front_end/panels/timeline/components/MetricCard.ts +2 -2
- package/front_end/panels/timeline/components/NetworkRequestDetails.ts +11 -12
- package/front_end/panels/timeline/components/NetworkTrackWidget.ts +57 -50
- package/front_end/panels/timeline/components/RelatedInsightChips.ts +2 -2
- package/front_end/panels/timeline/components/Sidebar.ts +161 -109
- package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +33 -12
- package/front_end/panels/timeline/components/SidebarInsightsTab.ts +3 -0
- package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +11 -11
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +6 -7
- package/front_end/panels/timeline/components/networkTrackWidget.css +24 -22
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
- package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +15 -10
- package/front_end/panels/timeline/overlays/components/entryLabelOverlay.css +1 -1
- package/front_end/panels/timeline/timelinePanel.css +5 -0
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
- package/front_end/panels/web_audio/WebAudioView.ts +2 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/legacy-javascript/README.chromium +2 -2
- package/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +2 -2
- package/front_end/third_party/legacy-javascript/package.json +1 -1
- package/front_end/third_party/lighthouse/README.chromium +2 -2
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1983 -2022
- package/front_end/third_party/lighthouse/locales/ar-XB.json +157 -142
- package/front_end/third_party/lighthouse/locales/ar.json +157 -142
- package/front_end/third_party/lighthouse/locales/bg.json +154 -139
- package/front_end/third_party/lighthouse/locales/ca.json +157 -142
- package/front_end/third_party/lighthouse/locales/cs.json +148 -133
- package/front_end/third_party/lighthouse/locales/da.json +153 -138
- package/front_end/third_party/lighthouse/locales/de.json +152 -137
- package/front_end/third_party/lighthouse/locales/el.json +153 -138
- package/front_end/third_party/lighthouse/locales/en-GB.json +160 -145
- package/front_end/third_party/lighthouse/locales/en-US.json +239 -218
- package/front_end/third_party/lighthouse/locales/en-XL.json +239 -218
- package/front_end/third_party/lighthouse/locales/es-419.json +150 -135
- package/front_end/third_party/lighthouse/locales/es.json +149 -134
- package/front_end/third_party/lighthouse/locales/fi.json +151 -136
- package/front_end/third_party/lighthouse/locales/fil.json +154 -139
- package/front_end/third_party/lighthouse/locales/fr.json +150 -135
- package/front_end/third_party/lighthouse/locales/he.json +160 -145
- package/front_end/third_party/lighthouse/locales/hi.json +156 -141
- package/front_end/third_party/lighthouse/locales/hr.json +154 -139
- package/front_end/third_party/lighthouse/locales/hu.json +111 -96
- package/front_end/third_party/lighthouse/locales/id.json +153 -138
- package/front_end/third_party/lighthouse/locales/it.json +153 -138
- package/front_end/third_party/lighthouse/locales/ja.json +150 -135
- package/front_end/third_party/lighthouse/locales/ko.json +42 -27
- package/front_end/third_party/lighthouse/locales/lt.json +152 -137
- package/front_end/third_party/lighthouse/locales/lv.json +93 -78
- package/front_end/third_party/lighthouse/locales/nl.json +149 -134
- package/front_end/third_party/lighthouse/locales/no.json +152 -137
- package/front_end/third_party/lighthouse/locales/pl.json +153 -138
- package/front_end/third_party/lighthouse/locales/pt-PT.json +152 -137
- package/front_end/third_party/lighthouse/locales/pt.json +157 -142
- package/front_end/third_party/lighthouse/locales/ro.json +149 -134
- package/front_end/third_party/lighthouse/locales/ru.json +76 -61
- package/front_end/third_party/lighthouse/locales/sk.json +153 -138
- package/front_end/third_party/lighthouse/locales/sl.json +149 -134
- package/front_end/third_party/lighthouse/locales/sr-Latn.json +151 -136
- package/front_end/third_party/lighthouse/locales/sr.json +151 -136
- package/front_end/third_party/lighthouse/locales/sv.json +152 -137
- package/front_end/third_party/lighthouse/locales/ta.json +156 -141
- package/front_end/third_party/lighthouse/locales/te.json +157 -142
- package/front_end/third_party/lighthouse/locales/th.json +111 -96
- package/front_end/third_party/lighthouse/locales/tr.json +153 -138
- package/front_end/third_party/lighthouse/locales/uk.json +149 -134
- package/front_end/third_party/lighthouse/locales/vi.json +162 -147
- package/front_end/third_party/lighthouse/locales/zh-HK.json +150 -135
- package/front_end/third_party/lighthouse/locales/zh-TW.json +154 -139
- package/front_end/third_party/lighthouse/locales/zh.json +152 -137
- package/front_end/third_party/lighthouse/report/bundle.d.ts +9 -8
- package/front_end/third_party/lighthouse/report/bundle.js +10 -10
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +2 -7
- package/front_end/tsconfig.compatibility.json +1 -0
- package/front_end/tsconfig.json +3 -2
- package/front_end/ui/components/dialogs/TypeToAllowDialog.ts +0 -2
- package/front_end/ui/components/dialogs/typeToAllowDialog.css +0 -4
- package/front_end/ui/components/icon_button/fileSourceIcon.css +1 -1
- package/front_end/ui/components/input/textInput.css +1 -1
- package/front_end/ui/components/lists/List.ts +26 -14
- package/front_end/ui/components/menus/menus.ts +0 -2
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +351 -138
- package/front_end/ui/components/survey_link/surveyLink.css +3 -3
- package/front_end/ui/components/switch/switch.css +6 -6
- package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +2 -3
- package/front_end/ui/components/text_editor/TextEditor.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +53 -4
- package/front_end/ui/components/tree_outline/treeOutline.css +7 -7
- package/front_end/ui/helpers/OpenInNewTab.ts +8 -3
- package/front_end/ui/legacy/EmptyWidget.ts +4 -4
- package/front_end/ui/legacy/ForwardedInputEventHandler.ts +2 -2
- package/front_end/ui/legacy/GlassPane.ts +1 -1
- package/front_end/ui/legacy/KeyboardShortcut.ts +7 -7
- package/front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts +2 -2
- package/front_end/ui/legacy/TabbedPane.ts +198 -66
- package/front_end/ui/legacy/TargetCrashedScreen.ts +2 -2
- package/front_end/ui/legacy/UIUtils.ts +71 -68
- package/front_end/ui/legacy/View.ts +7 -4
- package/front_end/ui/legacy/ViewManager.ts +49 -37
- package/front_end/ui/legacy/Widget.ts +32 -12
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +2 -3
- package/front_end/ui/legacy/components/inline_editor/AnimationTimingUI.ts +8 -8
- package/front_end/ui/legacy/components/inline_editor/BezierUI.ts +8 -9
- package/front_end/ui/legacy/components/inline_editor/LinkSwatch.ts +2 -2
- package/front_end/ui/legacy/components/inline_editor/cssAngleEditor.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/cssAngleSwatch.css +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +45 -11
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +10 -12
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +102 -29
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +148 -122
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +20 -14
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +1 -1
- package/front_end/ui/legacy/components/source_frame/FontView.ts +29 -5
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +79 -12
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +20 -2
- package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +2 -2
- package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +6 -10
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +11 -11
- package/front_end/ui/legacy/components/source_frame/fontView.css +7 -0
- package/front_end/ui/legacy/components/source_frame/imageView.css +7 -0
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +14 -3
- package/front_end/ui/legacy/components/utils/Linkifier.ts +126 -2
- package/front_end/ui/legacy/emptyWidget.css +2 -1
- package/front_end/ui/legacy/inspectorCommon.css +3 -3
- package/front_end/ui/legacy/smallBubble.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +6 -0
- package/front_end/ui/lit/Directives.ts +35 -18
- package/front_end/ui/lit/lit.ts +0 -2
- package/front_end/ui/lit/render.ts +0 -7
- package/front_end/ui/visual_logging/KnownContextValues.ts +5 -0
- package/package.json +1 -1
- package/vpython.toml +8 -0
- package/vpython.toml.uv.lock +3 -0
- package/.agents/skills/review-models-core/SKILL.md +0 -73
- package/.agents/skills/review-tests/SKILL.md +0 -67
- package/.agents/skills/review-ui-widgets/SKILL.md +0 -115
- package/front_end/generated/ARIAProperties.ts +0 -2686
- package/front_end/ui/components/menus/README.md +0 -119
- package/front_end/ui/components/menus/SelectMenu.ts +0 -473
- package/front_end/ui/components/menus/selectMenu.css +0 -54
- package/front_end/ui/components/menus/selectMenuButton.css +0 -108
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
5
|
|
|
6
6
|
import '../../ui/components/spinners/spinners.js';
|
|
7
|
+
import '../../ui/kit/kit.js';
|
|
7
8
|
|
|
8
9
|
import * as Common from '../../core/common/common.js';
|
|
9
10
|
import * as Host from '../../core/host/host.js';
|
|
@@ -16,7 +17,6 @@ import * as Bindings from '../../models/bindings/bindings.js';
|
|
|
16
17
|
import * as Persistence from '../../models/persistence/persistence.js';
|
|
17
18
|
import * as Workspace from '../../models/workspace/workspace.js';
|
|
18
19
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
19
|
-
import {createIcon} from '../../ui/kit/kit.js';
|
|
20
20
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
21
21
|
import * as Lit from '../../ui/lit/lit.js';
|
|
22
22
|
import * as SettingsUI from '../../ui/settings/settings.js';
|
|
@@ -211,6 +211,113 @@ export const DEFAULT_VIEW: View = (input, _output, target): void => {
|
|
|
211
211
|
// clang-format on
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
+
export function iconTypeForNodeType(type: string): string {
|
|
215
|
+
switch (type) {
|
|
216
|
+
case Types.Domain:
|
|
217
|
+
return 'cloud';
|
|
218
|
+
case Types.Frame:
|
|
219
|
+
return 'frame';
|
|
220
|
+
case Types.Worker:
|
|
221
|
+
return 'gears';
|
|
222
|
+
case Types.Authored:
|
|
223
|
+
return 'code';
|
|
224
|
+
case Types.Deployed:
|
|
225
|
+
return 'deployed';
|
|
226
|
+
case Types.AutomaticFileSystem:
|
|
227
|
+
return 'folder-asterisk';
|
|
228
|
+
}
|
|
229
|
+
return 'folder';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function contextForNodeType(type: string): string {
|
|
233
|
+
switch (type) {
|
|
234
|
+
case Types.Domain:
|
|
235
|
+
return 'domain';
|
|
236
|
+
case Types.Frame:
|
|
237
|
+
return 'frame';
|
|
238
|
+
case Types.Worker:
|
|
239
|
+
return 'worker';
|
|
240
|
+
case Types.Authored:
|
|
241
|
+
return 'authored';
|
|
242
|
+
case Types.Deployed:
|
|
243
|
+
return 'deployed';
|
|
244
|
+
}
|
|
245
|
+
return 'folder';
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function renderFolderLeadingIcon(type: string): Lit.TemplateResult {
|
|
249
|
+
return html`<devtools-icon name=${iconTypeForNodeType(type)}></devtools-icon>`;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function renderSourceTrailingIcons(uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
253
|
+
onSelectSource: (uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
254
|
+
focusSource: boolean) => void): Lit.TemplateResult[] {
|
|
255
|
+
if (!UI.ActionRegistry.ActionRegistry.instance().hasAction('drjones.sources-floating-button')) {
|
|
256
|
+
return [];
|
|
257
|
+
}
|
|
258
|
+
if (!uiSourceCode.contentType().isTextType() ||
|
|
259
|
+
Snippets.ScriptSnippetFileSystem.isSnippetsUISourceCode(uiSourceCode)) {
|
|
260
|
+
return [];
|
|
261
|
+
}
|
|
262
|
+
const action = UI.ActionRegistry.ActionRegistry.instance().getAction('drjones.sources-floating-button');
|
|
263
|
+
const icon = AiAssistance.AiUtils.getIconName();
|
|
264
|
+
// clang-format off
|
|
265
|
+
return [html`<span class="ai-button-container">
|
|
266
|
+
<devtools-floating-button
|
|
267
|
+
.iconName=${icon}
|
|
268
|
+
.title=${action.title()}
|
|
269
|
+
.jslogContext=${'ask-ai'}
|
|
270
|
+
@click=${{
|
|
271
|
+
handleEvent: (ev: Event) => {
|
|
272
|
+
ev.stopPropagation();
|
|
273
|
+
onSelectSource(uiSourceCode, false);
|
|
274
|
+
void action.execute();
|
|
275
|
+
},
|
|
276
|
+
capture: true,
|
|
277
|
+
}}
|
|
278
|
+
@mousedown=${{
|
|
279
|
+
handleEvent: (ev: Event) => {
|
|
280
|
+
ev.stopPropagation();
|
|
281
|
+
},
|
|
282
|
+
capture: true,
|
|
283
|
+
}}
|
|
284
|
+
></devtools-floating-button>
|
|
285
|
+
</span>`];
|
|
286
|
+
// clang-format on
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export function renderGroupTrailingIcons(project: Workspace.Workspace.Project|null): Lit.TemplateResult[] {
|
|
290
|
+
if (!(project instanceof Persistence.AutomaticFileSystemWorkspaceBinding.FileSystem)) {
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
const {automaticFileSystem, automaticFileSystemManager} = project;
|
|
294
|
+
switch (automaticFileSystem?.state) {
|
|
295
|
+
case 'connecting': {
|
|
296
|
+
// clang-format off
|
|
297
|
+
return [html`<devtools-spinner></devtools-spinner>`];
|
|
298
|
+
// clang-format on
|
|
299
|
+
}
|
|
300
|
+
case 'disconnected': {
|
|
301
|
+
// clang-format off
|
|
302
|
+
return [html`<devtools-button
|
|
303
|
+
.data=${{
|
|
304
|
+
variant: Buttons.Button.Variant.OUTLINED,
|
|
305
|
+
size: Buttons.Button.Size.MICRO,
|
|
306
|
+
title: i18nString(UIStrings.connectFolderToWorkspace),
|
|
307
|
+
jslogContext: 'automatic-workspace-folders.connect',
|
|
308
|
+
} as Buttons.Button.ButtonData}
|
|
309
|
+
@click=${async (event: Event) => {
|
|
310
|
+
event.consume();
|
|
311
|
+
await automaticFileSystemManager.connectAutomaticFileSystem(
|
|
312
|
+
/* addIfMissing= */ true);
|
|
313
|
+
}}
|
|
314
|
+
>${i18nString(UIStrings.connect)}</devtools-button>`];
|
|
315
|
+
// clang-format on
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return [];
|
|
319
|
+
}
|
|
320
|
+
|
|
214
321
|
export const enum Events {
|
|
215
322
|
UI_SOURCE_CODE_ADDED = 'ui-source-code-added',
|
|
216
323
|
SOURCE_SELECTED = 'source-selected',
|
|
@@ -253,6 +360,9 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
253
360
|
private groupByAuthored?: boolean;
|
|
254
361
|
private groupByDomain?: boolean;
|
|
255
362
|
private groupByFolder?: boolean;
|
|
363
|
+
private selectedNode: NavigatorTreeNode|null = null;
|
|
364
|
+
private expandedNodes = new WeakSet<NavigatorTreeNode>();
|
|
365
|
+
private readonly treeElementNodes = new WeakMap<UI.TreeOutline.TreeElement, NavigatorTreeNode>();
|
|
256
366
|
#view: View;
|
|
257
367
|
|
|
258
368
|
constructor(
|
|
@@ -268,11 +378,28 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
268
378
|
this.scriptsTree.registerRequiredCSS(navigatorTreeStyles);
|
|
269
379
|
|
|
270
380
|
this.scriptsTree.setHideOverflow(true);
|
|
271
|
-
this.scriptsTree.setComparator(
|
|
381
|
+
this.scriptsTree.setComparator(this.treeElementsCompare.bind(this));
|
|
272
382
|
this.scriptsTree.setFocusable(false);
|
|
273
383
|
this.setDefaultFocusedElement(this.scriptsTree.element);
|
|
274
384
|
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementAttached, () => this.requestUpdate());
|
|
275
385
|
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementsDetached, () => this.requestUpdate());
|
|
386
|
+
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementSelected, event => {
|
|
387
|
+
const node = this.nodeForTreeElement(event.data);
|
|
388
|
+
this.selectedNode = node ?? null;
|
|
389
|
+
});
|
|
390
|
+
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementExpanded, event => {
|
|
391
|
+
const node = this.nodeForTreeElement(event.data);
|
|
392
|
+
if (node) {
|
|
393
|
+
this.expandedNodes.add(node);
|
|
394
|
+
node.populate();
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementCollapsed, event => {
|
|
398
|
+
const node = this.nodeForTreeElement(event.data);
|
|
399
|
+
if (node) {
|
|
400
|
+
this.expandedNodes.delete(node);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
276
403
|
|
|
277
404
|
this.uiSourceCodeNodes = new Platform.MapUtilities.Multimap();
|
|
278
405
|
this.subfolderNodes = new Map();
|
|
@@ -359,16 +486,14 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
359
486
|
this.requestUpdate();
|
|
360
487
|
}
|
|
361
488
|
|
|
362
|
-
private static
|
|
363
|
-
if (
|
|
489
|
+
private static nodeOrder(node: NavigatorTreeNode): number {
|
|
490
|
+
if (node.boostOrder) {
|
|
364
491
|
return 0;
|
|
365
492
|
}
|
|
366
493
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (actualElement.uiSourceCode) {
|
|
371
|
-
const contentType = actualElement.uiSourceCode.contentType();
|
|
494
|
+
let order = TYPE_ORDERS.get(node.type) || 0;
|
|
495
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
496
|
+
const contentType = node.uiSourceCode().contentType();
|
|
372
497
|
if (contentType.isDocument()) {
|
|
373
498
|
order += 3;
|
|
374
499
|
} else if (contentType.isScript()) {
|
|
@@ -383,6 +508,19 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
383
508
|
return order;
|
|
384
509
|
}
|
|
385
510
|
|
|
511
|
+
static compareNodes(node1: NavigatorTreeNode, node2: NavigatorTreeNode): number {
|
|
512
|
+
const order1 = NavigatorView.nodeOrder(node1);
|
|
513
|
+
const order2 = NavigatorView.nodeOrder(node2);
|
|
514
|
+
|
|
515
|
+
if (order1 > order2) {
|
|
516
|
+
return 1;
|
|
517
|
+
}
|
|
518
|
+
if (order1 < order2) {
|
|
519
|
+
return -1;
|
|
520
|
+
}
|
|
521
|
+
return 0;
|
|
522
|
+
}
|
|
523
|
+
|
|
386
524
|
static appendSearchItem(contextMenu: UI.ContextMenu.ContextMenu, path: string): void {
|
|
387
525
|
const searchLabel = path ? i18nString(UIStrings.searchInFolder) : i18nString(UIStrings.searchInAllFiles);
|
|
388
526
|
const searchSources = new SearchSources(path && `file:${path}`);
|
|
@@ -391,16 +529,15 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
391
529
|
{jslogContext: path ? 'search-in-folder' : 'search-in-all-files'});
|
|
392
530
|
}
|
|
393
531
|
|
|
394
|
-
private
|
|
395
|
-
|
|
396
|
-
const
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return -1;
|
|
532
|
+
private treeElementsCompare(treeElement1: UI.TreeOutline.TreeElement,
|
|
533
|
+
treeElement2: UI.TreeOutline.TreeElement): number {
|
|
534
|
+
const node1 = this.nodeForTreeElement(treeElement1);
|
|
535
|
+
const node2 = this.nodeForTreeElement(treeElement2);
|
|
536
|
+
if (node1 && node2) {
|
|
537
|
+
const order = NavigatorView.compareNodes(node1, node2);
|
|
538
|
+
if (order !== 0) {
|
|
539
|
+
return order;
|
|
540
|
+
}
|
|
404
541
|
}
|
|
405
542
|
return Platform.StringUtilities.naturalOrderComparator(treeElement1.titleAsText(), treeElement2.titleAsText());
|
|
406
543
|
}
|
|
@@ -471,6 +608,52 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
471
608
|
this.scriptsTree.focus();
|
|
472
609
|
}
|
|
473
610
|
|
|
611
|
+
selectNode(node: NavigatorTreeNode, omitFocus?: boolean, selectedByUser?: boolean): void {
|
|
612
|
+
node.treeNode().select(omitFocus, selectedByUser);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
expandNode(node: NavigatorTreeNode): void {
|
|
616
|
+
node.treeNode().expand();
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
collapseNode(node: NavigatorTreeNode): void {
|
|
620
|
+
node.treeNode().collapse();
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
isNodeExpanded(node: NavigatorTreeNode): boolean {
|
|
624
|
+
return this.expandedNodes.has(node);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
isNodeSelected(node: NavigatorTreeNode): boolean {
|
|
628
|
+
return this.selectedNode === node;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
setNodeSelected(node: NavigatorTreeNode): void {
|
|
632
|
+
this.selectedNode = node;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
setNodeExpanded(node: NavigatorTreeNode): void {
|
|
636
|
+
this.expandedNodes.add(node);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
setNodeForTreeElement(treeElement: UI.TreeOutline.TreeElement, node: NavigatorTreeNode): void {
|
|
640
|
+
this.treeElementNodes.set(treeElement, node);
|
|
641
|
+
if (node instanceof NavigatorFolderTreeNode || node instanceof NavigatorGroupTreeNode) {
|
|
642
|
+
node.updateTooltip(treeElement);
|
|
643
|
+
UI.ARIAUtils.setLabel(treeElement.listItemElement, `${treeElement.title}, ${node.type}`);
|
|
644
|
+
}
|
|
645
|
+
if (treeElement.selected) {
|
|
646
|
+
this.setNodeSelected(node);
|
|
647
|
+
}
|
|
648
|
+
if (treeElement.expanded) {
|
|
649
|
+
this.setNodeExpanded(node);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
nodeForTreeElement(treeElement: UI.TreeOutline.TreeElement): NavigatorTreeNode|undefined {
|
|
654
|
+
return this.treeElementNodes.get(treeElement);
|
|
655
|
+
}
|
|
656
|
+
|
|
474
657
|
/**
|
|
475
658
|
* Central place to add elements to the tree to
|
|
476
659
|
* enable focus if the tree has elements
|
|
@@ -486,6 +669,9 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
486
669
|
*/
|
|
487
670
|
removeChild(parent: UI.TreeOutline.TreeElement, child: UI.TreeOutline.TreeElement): void {
|
|
488
671
|
parent.removeChild(child);
|
|
672
|
+
if (!this.scriptsTree.selectedTreeElement) {
|
|
673
|
+
this.selectedNode = null;
|
|
674
|
+
}
|
|
489
675
|
if (this.scriptsTree.rootElement().childCount() === 0) {
|
|
490
676
|
this.scriptsTree.setFocusable(false);
|
|
491
677
|
}
|
|
@@ -659,8 +845,8 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
659
845
|
// TODO(einbinder) remove this code after crbug.com/964075 is fixed
|
|
660
846
|
private selectDefaultTreeNode(): void {
|
|
661
847
|
const children = this.rootNode.children();
|
|
662
|
-
if (children.length && !this.
|
|
663
|
-
children[0]
|
|
848
|
+
if (children.length && !this.selectedNode) {
|
|
849
|
+
this.selectNode(children[0], true /* omitFocus */, false /* selectedByUser */);
|
|
664
850
|
}
|
|
665
851
|
}
|
|
666
852
|
|
|
@@ -787,11 +973,11 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
787
973
|
domainNode = new NavigatorGroupTreeNode(
|
|
788
974
|
this, project, projectOrigin, Types.Domain, this.computeProjectDisplayName(target, projectOrigin));
|
|
789
975
|
if (frame && projectOrigin === Common.ParsedURL.ParsedURL.extractOrigin(frame.url)) {
|
|
790
|
-
|
|
976
|
+
domainNode.boostOrder = true;
|
|
791
977
|
}
|
|
792
978
|
frameNode.appendChild(domainNode);
|
|
793
979
|
if (isAuthored && this.groupByAuthored) {
|
|
794
|
-
|
|
980
|
+
this.expandNode(domainNode);
|
|
795
981
|
}
|
|
796
982
|
return domainNode;
|
|
797
983
|
}
|
|
@@ -808,28 +994,18 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
808
994
|
return frameNode;
|
|
809
995
|
}
|
|
810
996
|
|
|
811
|
-
frameNode =
|
|
812
|
-
|
|
813
|
-
frameNode.setHoverCallback(hoverCallback);
|
|
997
|
+
frameNode = new NavigatorGroupTreeNode(this, project, target.id() + ':' + frame.id, Types.Frame,
|
|
998
|
+
frame.displayName(), undefined, frame);
|
|
814
999
|
this.frameNodes.set(frame, frameNode);
|
|
815
1000
|
|
|
816
1001
|
const parentFrame = frame.parentFrame();
|
|
1002
|
+
if (!parentFrame) {
|
|
1003
|
+
frameNode.boostOrder = true;
|
|
1004
|
+
}
|
|
817
1005
|
this.frameNode(project, parentFrame ? parentFrame.resourceTreeModel().target() : target, parentFrame, isAuthored)
|
|
818
1006
|
.appendChild(frameNode);
|
|
819
1007
|
if (!parentFrame) {
|
|
820
|
-
|
|
821
|
-
frameNode.treeNode().expand();
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
function hoverCallback(hovered: boolean): void {
|
|
825
|
-
if (hovered) {
|
|
826
|
-
const overlayModel = target.model(SDK.OverlayModel.OverlayModel);
|
|
827
|
-
if (overlayModel && frame) {
|
|
828
|
-
overlayModel.highlightFrame(frame.id);
|
|
829
|
-
}
|
|
830
|
-
} else {
|
|
831
|
-
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight(SDK.TargetManager.TargetManager.instance());
|
|
832
|
-
}
|
|
1008
|
+
this.expandNode(frameNode);
|
|
833
1009
|
}
|
|
834
1010
|
return frameNode;
|
|
835
1011
|
}
|
|
@@ -842,7 +1018,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
842
1018
|
this, null, 'group:Authored', Types.Authored, i18nString(UIStrings.authored),
|
|
843
1019
|
i18nString(UIStrings.authoredTooltip));
|
|
844
1020
|
this.rootNode.appendChild(this.authoredNode);
|
|
845
|
-
this.
|
|
1021
|
+
this.expandNode(this.authoredNode);
|
|
846
1022
|
}
|
|
847
1023
|
return this.authoredNode;
|
|
848
1024
|
}
|
|
@@ -924,15 +1100,16 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
924
1100
|
if (!node) {
|
|
925
1101
|
return null;
|
|
926
1102
|
}
|
|
927
|
-
if (this.
|
|
1103
|
+
if (this.selectedNode) {
|
|
928
1104
|
// If the tree outline is being marked as "being edited" (i.e. we're renaming a file
|
|
929
1105
|
// or choosing the name for a new snippet), we shall not proceed with revealing here,
|
|
930
1106
|
// as that will steal focus from the input widget and thus cancel editing. The
|
|
931
1107
|
// test/e2e/snippets/breakpoint.test.ts exercises this.
|
|
932
|
-
if (UI.UIUtils.isBeingEdited(this.scriptsTree.
|
|
1108
|
+
if (UI.UIUtils.isBeingEdited(this.scriptsTree.element)) {
|
|
933
1109
|
return null;
|
|
934
1110
|
}
|
|
935
|
-
this.
|
|
1111
|
+
this.selectedNode.treeNode().deselect();
|
|
1112
|
+
this.selectedNode = null;
|
|
936
1113
|
}
|
|
937
1114
|
// TODO(dgozman): figure out revealing multiple.
|
|
938
1115
|
node.reveal(select);
|
|
@@ -945,12 +1122,9 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
945
1122
|
}
|
|
946
1123
|
|
|
947
1124
|
#isUISourceCodeOrAnyAncestorSelected(node: NavigatorUISourceCodeTreeNode): boolean {
|
|
948
|
-
const selectedTreeElement =
|
|
949
|
-
(this.scriptsTree.selectedTreeElement as NavigatorSourceTreeElement | NavigatorFolderTreeElement | null);
|
|
950
|
-
const selectedNode = selectedTreeElement?.node;
|
|
951
1125
|
let currentNode: NavigatorTreeNode|null = node;
|
|
952
1126
|
while (currentNode) {
|
|
953
|
-
if (currentNode === selectedNode) {
|
|
1127
|
+
if (currentNode === this.selectedNode) {
|
|
954
1128
|
return true;
|
|
955
1129
|
}
|
|
956
1130
|
currentNode = currentNode.parent;
|
|
@@ -1040,6 +1214,8 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1040
1214
|
|
|
1041
1215
|
this.scriptsTree.removeChildren();
|
|
1042
1216
|
this.scriptsTree.setFocusable(false);
|
|
1217
|
+
this.selectedNode = null;
|
|
1218
|
+
this.expandedNodes = new WeakSet();
|
|
1043
1219
|
this.uiSourceCodeNodes.clear();
|
|
1044
1220
|
this.subfolderNodes.clear();
|
|
1045
1221
|
this.frameNodes.clear();
|
|
@@ -1053,12 +1229,11 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1053
1229
|
}
|
|
1054
1230
|
|
|
1055
1231
|
private async renameShortcut(): Promise<boolean> {
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
if (!node?.uiSourceCode()?.canRename()) {
|
|
1232
|
+
if (!(this.selectedNode instanceof NavigatorUISourceCodeTreeNode) ||
|
|
1233
|
+
!this.selectedNode.uiSourceCode().canRename()) {
|
|
1059
1234
|
return false;
|
|
1060
1235
|
}
|
|
1061
|
-
this.rename(
|
|
1236
|
+
this.rename(this.selectedNode, false);
|
|
1062
1237
|
return true;
|
|
1063
1238
|
}
|
|
1064
1239
|
|
|
@@ -1099,6 +1274,22 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1099
1274
|
}
|
|
1100
1275
|
}
|
|
1101
1276
|
|
|
1277
|
+
fileDragStarted(node: NavigatorUISourceCodeTreeNode, event: DragEvent): void {
|
|
1278
|
+
if (!event.dataTransfer) {
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
event.dataTransfer.setData('text/plain', node.uiSourceCode().url());
|
|
1282
|
+
event.dataTransfer.effectAllowed = 'copy';
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
shouldRenameOnMouseDown(node: NavigatorUISourceCodeTreeNode): boolean {
|
|
1286
|
+
if (!node.uiSourceCode().canRename() || !node.treeElement) {
|
|
1287
|
+
return false;
|
|
1288
|
+
}
|
|
1289
|
+
return this.selectedNode === node && this.scriptsTree.element.hasFocus() &&
|
|
1290
|
+
!UI.UIUtils.isBeingEdited(this.scriptsTree.element);
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1102
1293
|
handleFileContextMenu(event: Event, node: NavigatorUISourceCodeTreeNode): void {
|
|
1103
1294
|
const uiSourceCode = node.uiSourceCode();
|
|
1104
1295
|
if (Snippets.ScriptSnippetFileSystem.isSnippetsUISourceCode(uiSourceCode)) {
|
|
@@ -1201,8 +1392,22 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1201
1392
|
return this.findTopNonMergedNode(node.parent);
|
|
1202
1393
|
}
|
|
1203
1394
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1395
|
+
folderHovered(node: NavigatorTreeNode, hovered: boolean): void {
|
|
1396
|
+
if (node instanceof NavigatorGroupTreeNode && node.frame) {
|
|
1397
|
+
if (hovered) {
|
|
1398
|
+
const overlayModel = node.frame.resourceTreeModel().target().model(SDK.OverlayModel.OverlayModel);
|
|
1399
|
+
if (overlayModel) {
|
|
1400
|
+
overlayModel.highlightFrame(node.frame.id);
|
|
1401
|
+
}
|
|
1402
|
+
} else {
|
|
1403
|
+
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight(SDK.TargetManager.TargetManager.instance());
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
handleFolderContextMenu(event: Event, node: NavigatorFolderTreeNode|NavigatorGroupTreeNode): void {
|
|
1409
|
+
const path =
|
|
1410
|
+
node instanceof NavigatorFolderTreeNode ? node.folderPath : Platform.DevToolsPath.EmptyEncodedPathString;
|
|
1206
1411
|
const project = node.project || null;
|
|
1207
1412
|
|
|
1208
1413
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
@@ -1227,7 +1432,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1227
1432
|
this.handleContextMenuCreate(project, path, undefined);
|
|
1228
1433
|
}, {jslogContext: 'new-file'});
|
|
1229
1434
|
}
|
|
1230
|
-
} else if (node.origin && node.folderPath) {
|
|
1435
|
+
} else if (node instanceof NavigatorFolderTreeNode && node.origin && node.folderPath) {
|
|
1231
1436
|
const url = Common.ParsedURL.ParsedURL.concatenate(node.origin, '/', node.folderPath);
|
|
1232
1437
|
const options = {
|
|
1233
1438
|
isContentScript: node.recursiveProperties.exclusivelyContentScripts || false,
|
|
@@ -1389,284 +1594,6 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1389
1594
|
}
|
|
1390
1595
|
}
|
|
1391
1596
|
|
|
1392
|
-
const boostOrderForNode = new WeakSet<UI.TreeOutline.TreeElement>();
|
|
1393
|
-
|
|
1394
|
-
export class NavigatorFolderTreeElement extends UI.TreeOutline.TreeElement {
|
|
1395
|
-
private readonly nodeType: string;
|
|
1396
|
-
private readonly navigatorView: NavigatorView;
|
|
1397
|
-
private hoverCallback: ((arg0: boolean) => void)|undefined;
|
|
1398
|
-
node!: NavigatorTreeNode;
|
|
1399
|
-
private hovered?: boolean;
|
|
1400
|
-
private isIgnoreListed?: boolean;
|
|
1401
|
-
|
|
1402
|
-
constructor(
|
|
1403
|
-
navigatorView: NavigatorView, type: string, title: string, hoverCallback?: ((arg0: boolean) => void),
|
|
1404
|
-
expandable = true) {
|
|
1405
|
-
super('', expandable, NavigatorFolderTreeElement.#contextForType(type));
|
|
1406
|
-
this.listItemElement.classList.add('navigator-' + type + '-tree-item', 'navigator-folder-tree-item');
|
|
1407
|
-
UI.ARIAUtils.setLabel(this.listItemElement, `${title}, ${type}`);
|
|
1408
|
-
this.nodeType = type;
|
|
1409
|
-
this.title = title;
|
|
1410
|
-
this.tooltip = title;
|
|
1411
|
-
this.navigatorView = navigatorView;
|
|
1412
|
-
this.hoverCallback = hoverCallback;
|
|
1413
|
-
|
|
1414
|
-
let iconType = 'folder';
|
|
1415
|
-
|
|
1416
|
-
if (type === Types.Domain) {
|
|
1417
|
-
iconType = 'cloud';
|
|
1418
|
-
} else if (type === Types.Frame) {
|
|
1419
|
-
iconType = 'frame';
|
|
1420
|
-
} else if (type === Types.Worker) {
|
|
1421
|
-
iconType = 'gears';
|
|
1422
|
-
} else if (type === Types.Authored) {
|
|
1423
|
-
iconType = 'code';
|
|
1424
|
-
} else if (type === Types.Deployed) {
|
|
1425
|
-
iconType = 'deployed';
|
|
1426
|
-
} else if (type === Types.AutomaticFileSystem) {
|
|
1427
|
-
iconType = 'folder-asterisk';
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
const icon = createIcon(iconType);
|
|
1431
|
-
this.setLeadingIcons([icon]);
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
override async onpopulate(): Promise<void> {
|
|
1435
|
-
this.node.populate();
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
override onattach(): void {
|
|
1439
|
-
this.collapse();
|
|
1440
|
-
this.node.onattach();
|
|
1441
|
-
this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), false);
|
|
1442
|
-
this.listItemElement.addEventListener('mousemove', this.mouseMove.bind(this), false);
|
|
1443
|
-
this.listItemElement.addEventListener('mouseleave', this.mouseLeave.bind(this), false);
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
setIgnoreListed(isIgnoreListed: boolean): void {
|
|
1447
|
-
if (this.isIgnoreListed !== isIgnoreListed) {
|
|
1448
|
-
this.isIgnoreListed = isIgnoreListed;
|
|
1449
|
-
this.listItemElement.classList.toggle('is-ignore-listed', isIgnoreListed);
|
|
1450
|
-
this.updateTooltip();
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
setFromSourceMap(isFromSourceMap: boolean): void {
|
|
1455
|
-
this.listItemElement.classList.toggle('is-from-source-map', isFromSourceMap);
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
setNode(node: NavigatorTreeNode): void {
|
|
1459
|
-
this.node = node;
|
|
1460
|
-
this.updateTooltip();
|
|
1461
|
-
UI.ARIAUtils.setLabel(this.listItemElement, `${this.title}, ${this.nodeType}`);
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
private updateTooltip(): void {
|
|
1465
|
-
if (this.node.tooltip) {
|
|
1466
|
-
this.tooltip = this.node.tooltip;
|
|
1467
|
-
} else {
|
|
1468
|
-
const paths = [];
|
|
1469
|
-
let currentNode: NavigatorTreeNode|null = this.node;
|
|
1470
|
-
while (currentNode && !currentNode.isRoot() && currentNode.type === this.node.type) {
|
|
1471
|
-
paths.push(currentNode.title);
|
|
1472
|
-
currentNode = currentNode.parent;
|
|
1473
|
-
}
|
|
1474
|
-
paths.reverse();
|
|
1475
|
-
let tooltip = paths.join('/');
|
|
1476
|
-
if (this.isIgnoreListed) {
|
|
1477
|
-
tooltip = i18nString(UIStrings.sIgnoreListed, {PH1: tooltip});
|
|
1478
|
-
}
|
|
1479
|
-
this.tooltip = tooltip;
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
private handleContextMenuEvent(event: Event): void {
|
|
1484
|
-
if (!this.node) {
|
|
1485
|
-
return;
|
|
1486
|
-
}
|
|
1487
|
-
this.select();
|
|
1488
|
-
this.navigatorView.handleFolderContextMenu(event, this.node as NavigatorFolderTreeNode);
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
private mouseMove(_event: Event): void {
|
|
1492
|
-
if (this.hovered || !this.hoverCallback) {
|
|
1493
|
-
return;
|
|
1494
|
-
}
|
|
1495
|
-
this.hovered = true;
|
|
1496
|
-
this.hoverCallback(true);
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
private mouseLeave(_event: Event): void {
|
|
1500
|
-
if (!this.hoverCallback) {
|
|
1501
|
-
return;
|
|
1502
|
-
}
|
|
1503
|
-
this.hovered = false;
|
|
1504
|
-
this.hoverCallback(false);
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
static #contextForType(type: string): string {
|
|
1508
|
-
switch (type) {
|
|
1509
|
-
case Types.Domain:
|
|
1510
|
-
return 'domain';
|
|
1511
|
-
case Types.Frame:
|
|
1512
|
-
return 'frame';
|
|
1513
|
-
case Types.Worker:
|
|
1514
|
-
return 'worker';
|
|
1515
|
-
case Types.Authored:
|
|
1516
|
-
return 'authored';
|
|
1517
|
-
case Types.Deployed:
|
|
1518
|
-
return 'deployed';
|
|
1519
|
-
}
|
|
1520
|
-
return 'folder';
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
export class NavigatorSourceTreeElement extends UI.TreeOutline.TreeElement {
|
|
1525
|
-
readonly nodeType: string;
|
|
1526
|
-
readonly node: NavigatorUISourceCodeTreeNode;
|
|
1527
|
-
private readonly navigatorView: NavigatorView;
|
|
1528
|
-
#uiSourceCode: Workspace.UISourceCode.UISourceCode;
|
|
1529
|
-
|
|
1530
|
-
constructor(
|
|
1531
|
-
navigatorView: NavigatorView, uiSourceCode: Workspace.UISourceCode.UISourceCode, title: string,
|
|
1532
|
-
node: NavigatorUISourceCodeTreeNode) {
|
|
1533
|
-
super('', false, uiSourceCode.contentType().name());
|
|
1534
|
-
this.nodeType = Types.File;
|
|
1535
|
-
this.node = node;
|
|
1536
|
-
this.title = title;
|
|
1537
|
-
this.listItemElement.classList.add(
|
|
1538
|
-
'navigator-' + uiSourceCode.contentType().name() + '-tree-item', 'navigator-file-tree-item');
|
|
1539
|
-
this.tooltip = uiSourceCode.url();
|
|
1540
|
-
UI.ARIAUtils.setLabel(this.listItemElement, `${uiSourceCode.name()}, ${this.nodeType}`);
|
|
1541
|
-
window.dispatchEvent(new CustomEvent('source-tree-file-added',
|
|
1542
|
-
{bubbles: true, cancelable: true, detail: uiSourceCode.fullDisplayName()}));
|
|
1543
|
-
this.navigatorView = navigatorView;
|
|
1544
|
-
this.#uiSourceCode = uiSourceCode;
|
|
1545
|
-
this.updateIcon();
|
|
1546
|
-
(this.titleElement as HTMLElement).setAttribute('jslog', `${VisualLogging.value('title').track({change: true})}`);
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
updateIcon(): void {
|
|
1550
|
-
const icon = PanelUtils.getIconForSourceFile(this.#uiSourceCode);
|
|
1551
|
-
this.setLeadingIcons([icon]);
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
updateAccessibleName(): void {
|
|
1555
|
-
UI.ARIAUtils.setLabel(this.listItemElement, `${this.#uiSourceCode.name()}, ${this.nodeType}`);
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
private createAiButton(): void {
|
|
1559
|
-
if (!UI.ActionRegistry.ActionRegistry.instance().hasAction('drjones.sources-floating-button')) {
|
|
1560
|
-
return;
|
|
1561
|
-
}
|
|
1562
|
-
if (!this.uiSourceCode.contentType().isTextType() ||
|
|
1563
|
-
Snippets.ScriptSnippetFileSystem.isSnippetsUISourceCode(this.uiSourceCode)) {
|
|
1564
|
-
return;
|
|
1565
|
-
}
|
|
1566
|
-
const action = UI.ActionRegistry.ActionRegistry.instance().getAction('drjones.sources-floating-button');
|
|
1567
|
-
const icon = AiAssistance.AiUtils.getIconName();
|
|
1568
|
-
// clang-format off
|
|
1569
|
-
this.setTrailingIcons([
|
|
1570
|
-
html`<span class="ai-button-container">
|
|
1571
|
-
<devtools-floating-button
|
|
1572
|
-
.iconName=${icon}
|
|
1573
|
-
.title=${action.title()}
|
|
1574
|
-
.jslogContext=${'ask-ai'}
|
|
1575
|
-
@click=${{
|
|
1576
|
-
handleEvent: (ev: Event) => {
|
|
1577
|
-
ev.stopPropagation();
|
|
1578
|
-
this.navigatorView.sourceSelected(this.uiSourceCode, false);
|
|
1579
|
-
void action.execute();
|
|
1580
|
-
},
|
|
1581
|
-
capture: true,
|
|
1582
|
-
}}
|
|
1583
|
-
@mousedown=${{
|
|
1584
|
-
handleEvent: (ev: Event) => {
|
|
1585
|
-
ev.stopPropagation();
|
|
1586
|
-
},
|
|
1587
|
-
capture: true,
|
|
1588
|
-
}}
|
|
1589
|
-
></devtools-floating-button>
|
|
1590
|
-
</span>`,
|
|
1591
|
-
]);
|
|
1592
|
-
// clang-format on
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
get uiSourceCode(): Workspace.UISourceCode.UISourceCode {
|
|
1596
|
-
return this.#uiSourceCode;
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
override onattach(): void {
|
|
1600
|
-
this.listItemElement.draggable = true;
|
|
1601
|
-
this.listItemElement.addEventListener('click', this.onclick.bind(this), false);
|
|
1602
|
-
this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), false);
|
|
1603
|
-
this.listItemElement.addEventListener('dragstart', this.ondragstart.bind(this), false);
|
|
1604
|
-
this.createAiButton();
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
private shouldRenameOnMouseDown(): boolean {
|
|
1608
|
-
if (!this.#uiSourceCode.canRename()) {
|
|
1609
|
-
return false;
|
|
1610
|
-
}
|
|
1611
|
-
if (!this.treeOutline) {
|
|
1612
|
-
return false;
|
|
1613
|
-
}
|
|
1614
|
-
const isSelected = this === this.treeOutline.selectedTreeElement;
|
|
1615
|
-
return isSelected && this.treeOutline.element.hasFocus() && !UI.UIUtils.isBeingEdited(this.treeOutline.element);
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
override selectOnMouseDown(event: MouseEvent): void {
|
|
1619
|
-
if (event.which !== 1 || !this.shouldRenameOnMouseDown()) {
|
|
1620
|
-
super.selectOnMouseDown(event);
|
|
1621
|
-
return;
|
|
1622
|
-
}
|
|
1623
|
-
window.setTimeout(rename.bind(this), 300);
|
|
1624
|
-
|
|
1625
|
-
function rename(this: NavigatorSourceTreeElement): void {
|
|
1626
|
-
if (this.shouldRenameOnMouseDown()) {
|
|
1627
|
-
this.navigatorView.rename(this.node, false);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
private ondragstart(event: DragEvent): void {
|
|
1633
|
-
if (!event.dataTransfer) {
|
|
1634
|
-
return;
|
|
1635
|
-
}
|
|
1636
|
-
event.dataTransfer.setData('text/plain', this.#uiSourceCode.url());
|
|
1637
|
-
event.dataTransfer.effectAllowed = 'copy';
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
override onspace(): boolean {
|
|
1641
|
-
this.navigatorView.sourceSelected(this.uiSourceCode, true);
|
|
1642
|
-
return true;
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
private onclick(_event: Event): void {
|
|
1646
|
-
this.navigatorView.sourceSelected(this.uiSourceCode, false);
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
override ondblclick(event: Event): boolean {
|
|
1650
|
-
const middleClick = (event as MouseEvent).button === 1;
|
|
1651
|
-
this.navigatorView.sourceSelected(this.uiSourceCode, !middleClick);
|
|
1652
|
-
return false;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
override onenter(): boolean {
|
|
1656
|
-
this.navigatorView.sourceSelected(this.uiSourceCode, true);
|
|
1657
|
-
return true;
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
override ondelete(): boolean {
|
|
1661
|
-
return true;
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
private handleContextMenuEvent(event: Event): void {
|
|
1665
|
-
this.select();
|
|
1666
|
-
this.navigatorView.handleFileContextMenu(event, this.node);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
1597
|
export interface NavigatorRecursiveTreeNodeProperties {
|
|
1671
1598
|
exclusivelySourceMapped: boolean|null;
|
|
1672
1599
|
exclusivelyIgnored: boolean|null;
|
|
@@ -1678,6 +1605,8 @@ export class NavigatorTreeNode {
|
|
|
1678
1605
|
id: string;
|
|
1679
1606
|
protected navigatorView: NavigatorView;
|
|
1680
1607
|
type: string;
|
|
1608
|
+
boostOrder = false;
|
|
1609
|
+
hasMappedFiles = false;
|
|
1681
1610
|
private populated: boolean;
|
|
1682
1611
|
isMerged: boolean;
|
|
1683
1612
|
parent!: NavigatorTreeNode|null;
|
|
@@ -1704,6 +1633,77 @@ export class NavigatorTreeNode {
|
|
|
1704
1633
|
};
|
|
1705
1634
|
}
|
|
1706
1635
|
|
|
1636
|
+
computedTooltip(): string {
|
|
1637
|
+
if (this.tooltip) {
|
|
1638
|
+
return this.tooltip;
|
|
1639
|
+
}
|
|
1640
|
+
const paths = [];
|
|
1641
|
+
let currentNode: NavigatorTreeNode|null = this;
|
|
1642
|
+
while (currentNode && !currentNode.isRoot() && currentNode.type === this.type) {
|
|
1643
|
+
paths.push(currentNode.title);
|
|
1644
|
+
currentNode = currentNode.parent;
|
|
1645
|
+
}
|
|
1646
|
+
paths.reverse();
|
|
1647
|
+
let tooltip = paths.join('/');
|
|
1648
|
+
if (Boolean(this.recursiveProperties.exclusivelyIgnored)) {
|
|
1649
|
+
tooltip = i18nString(UIStrings.sIgnoreListed, {PH1: tooltip});
|
|
1650
|
+
}
|
|
1651
|
+
return tooltip;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
updateTooltip(treeElement?: UI.TreeOutline.TreeElement): void {
|
|
1655
|
+
if (!treeElement) {
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
let tooltip = this.computedTooltip();
|
|
1659
|
+
if (treeElement.listItemElement.classList.contains('is-ignore-listed') &&
|
|
1660
|
+
!this.recursiveProperties.exclusivelyIgnored) {
|
|
1661
|
+
tooltip = i18nString(UIStrings.sIgnoreListed, {PH1: tooltip});
|
|
1662
|
+
}
|
|
1663
|
+
treeElement.tooltip = tooltip;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
protected createFolderTreeElement(title: string, node: NavigatorTreeNode,
|
|
1667
|
+
expandable = true): UI.TreeOutline.TreeElement {
|
|
1668
|
+
const treeElement = new UI.TreeOutline.TreeElement('', expandable, contextForNodeType(this.type));
|
|
1669
|
+
treeElement.listItemElement.classList.add('navigator-' + this.type + '-tree-item', 'navigator-folder-tree-item');
|
|
1670
|
+
treeElement.title = title;
|
|
1671
|
+
treeElement.tooltip = title;
|
|
1672
|
+
treeElement.setLeadingIcons([renderFolderLeadingIcon(this.type)]);
|
|
1673
|
+
this.navigatorView.setNodeForTreeElement(treeElement, node);
|
|
1674
|
+
treeElement.onattach = () => {
|
|
1675
|
+
treeElement.collapse();
|
|
1676
|
+
this.navigatorView.nodeForTreeElement(treeElement)?.onattach();
|
|
1677
|
+
};
|
|
1678
|
+
let hovered = false;
|
|
1679
|
+
treeElement.listItemElement.addEventListener('contextmenu', (event: Event) => {
|
|
1680
|
+
const activeNode = this.navigatorView.nodeForTreeElement(treeElement);
|
|
1681
|
+
if (!activeNode ||
|
|
1682
|
+
!(activeNode instanceof NavigatorFolderTreeNode || activeNode instanceof NavigatorGroupTreeNode)) {
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
this.navigatorView.selectNode(activeNode);
|
|
1686
|
+
this.navigatorView.handleFolderContextMenu(event, activeNode);
|
|
1687
|
+
}, false);
|
|
1688
|
+
treeElement.listItemElement.addEventListener('mousemove', (_event: Event) => {
|
|
1689
|
+
const activeNode = this.navigatorView.nodeForTreeElement(treeElement);
|
|
1690
|
+
if (hovered || !activeNode) {
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
hovered = true;
|
|
1694
|
+
this.navigatorView.folderHovered(activeNode, true);
|
|
1695
|
+
}, false);
|
|
1696
|
+
treeElement.listItemElement.addEventListener('mouseleave', (_event: Event) => {
|
|
1697
|
+
const activeNode = this.navigatorView.nodeForTreeElement(treeElement);
|
|
1698
|
+
if (!activeNode) {
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
hovered = false;
|
|
1702
|
+
this.navigatorView.folderHovered(activeNode, false);
|
|
1703
|
+
}, false);
|
|
1704
|
+
return treeElement;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
1707
|
treeNode(): UI.TreeOutline.TreeElement {
|
|
1708
1708
|
throw new Error('Not implemented');
|
|
1709
1709
|
}
|
|
@@ -1837,7 +1837,7 @@ export class NavigatorRootTreeNode extends NavigatorTreeNode {
|
|
|
1837
1837
|
|
|
1838
1838
|
export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
1839
1839
|
#uiSourceCode: Workspace.UISourceCode.UISourceCode;
|
|
1840
|
-
treeElement:
|
|
1840
|
+
treeElement: UI.TreeOutline.TreeElement|null;
|
|
1841
1841
|
private eventListeners: Common.EventTarget.EventDescriptor[];
|
|
1842
1842
|
readonly #frame: SDK.ResourceTreeModel.ResourceTreeFrame|null;
|
|
1843
1843
|
constructor(
|
|
@@ -1855,6 +1855,7 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
1855
1855
|
this.recursiveProperties.exclusivelyContentScripts =
|
|
1856
1856
|
uiSourceCode.project().type() === Workspace.Workspace.projectTypes.ContentScripts;
|
|
1857
1857
|
}
|
|
1858
|
+
this.updateTitle();
|
|
1858
1859
|
}
|
|
1859
1860
|
|
|
1860
1861
|
frame(): SDK.ResourceTreeModel.ResourceTreeFrame|null {
|
|
@@ -1865,12 +1866,94 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
1865
1866
|
return this.#uiSourceCode;
|
|
1866
1867
|
}
|
|
1867
1868
|
|
|
1869
|
+
updateIcon(): void {
|
|
1870
|
+
if (!this.treeElement) {
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
const icon = PanelUtils.getIconForSourceFile(this.#uiSourceCode);
|
|
1874
|
+
this.treeElement.setLeadingIcons([icon]);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
updateAccessibleName(): void {
|
|
1878
|
+
if (!this.treeElement) {
|
|
1879
|
+
return;
|
|
1880
|
+
}
|
|
1881
|
+
UI.ARIAUtils.setLabel(this.treeElement.listItemElement, `${this.#uiSourceCode.name()}, ${this.type}`);
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
updateTrailingIcons(): void {
|
|
1885
|
+
if (!this.treeElement) {
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
const trailingIcons = renderSourceTrailingIcons(
|
|
1889
|
+
this.#uiSourceCode,
|
|
1890
|
+
(uiSourceCode, focusSource) => this.navigatorView.sourceSelected(uiSourceCode, focusSource));
|
|
1891
|
+
this.treeElement.setTrailingIcons(trailingIcons);
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
override onattach(): void {
|
|
1895
|
+
this.updateTrailingIcons();
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1868
1898
|
override treeNode(): UI.TreeOutline.TreeElement {
|
|
1869
1899
|
if (this.treeElement) {
|
|
1870
1900
|
return this.treeElement;
|
|
1871
1901
|
}
|
|
1872
1902
|
|
|
1873
|
-
this.treeElement = new
|
|
1903
|
+
this.treeElement = new UI.TreeOutline.TreeElement('', false, this.#uiSourceCode.contentType().name());
|
|
1904
|
+
this.treeElement.listItemElement.classList.add(
|
|
1905
|
+
'navigator-' + this.#uiSourceCode.contentType().name() + '-tree-item', 'navigator-file-tree-item');
|
|
1906
|
+
this.treeElement.listItemElement.draggable = true;
|
|
1907
|
+
(this.treeElement.titleElement as HTMLElement).setAttribute('jslog', `${VisualLogging.value('title').track({
|
|
1908
|
+
change: true,
|
|
1909
|
+
})}`);
|
|
1910
|
+
this.navigatorView.setNodeForTreeElement(this.treeElement, this);
|
|
1911
|
+
|
|
1912
|
+
const treeElement = this.treeElement;
|
|
1913
|
+
treeElement.selectOnMouseDown = (event: MouseEvent) => {
|
|
1914
|
+
if (event.which !== 1 || !this.navigatorView.shouldRenameOnMouseDown(this)) {
|
|
1915
|
+
UI.TreeOutline.TreeElement.prototype.selectOnMouseDown.call(treeElement, event);
|
|
1916
|
+
return;
|
|
1917
|
+
}
|
|
1918
|
+
window.setTimeout(() => {
|
|
1919
|
+
if (this.navigatorView.shouldRenameOnMouseDown(this)) {
|
|
1920
|
+
this.navigatorView.rename(this, false);
|
|
1921
|
+
}
|
|
1922
|
+
}, 300);
|
|
1923
|
+
};
|
|
1924
|
+
treeElement.onspace = () => {
|
|
1925
|
+
this.navigatorView.sourceSelected(this.#uiSourceCode, true);
|
|
1926
|
+
return true;
|
|
1927
|
+
};
|
|
1928
|
+
treeElement.ondblclick = (event: Event) => {
|
|
1929
|
+
const middleClick = (event as MouseEvent).button === 1;
|
|
1930
|
+
this.navigatorView.sourceSelected(this.#uiSourceCode, !middleClick);
|
|
1931
|
+
return false;
|
|
1932
|
+
};
|
|
1933
|
+
treeElement.onenter = () => {
|
|
1934
|
+
this.navigatorView.sourceSelected(this.#uiSourceCode, true);
|
|
1935
|
+
return true;
|
|
1936
|
+
};
|
|
1937
|
+
treeElement.ondelete = () => true;
|
|
1938
|
+
|
|
1939
|
+
treeElement.onattach = () => {
|
|
1940
|
+
this.onattach();
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1943
|
+
treeElement.listItemElement.addEventListener('click', () => {
|
|
1944
|
+
this.navigatorView.sourceSelected(this.#uiSourceCode, false);
|
|
1945
|
+
}, false);
|
|
1946
|
+
treeElement.listItemElement.addEventListener('contextmenu', (event: Event) => {
|
|
1947
|
+
this.navigatorView.selectNode(this);
|
|
1948
|
+
this.navigatorView.handleFileContextMenu(event, this);
|
|
1949
|
+
}, false);
|
|
1950
|
+
treeElement.listItemElement.addEventListener('dragstart', (event: DragEvent) => {
|
|
1951
|
+
this.navigatorView.fileDragStarted(this, event);
|
|
1952
|
+
}, false);
|
|
1953
|
+
|
|
1954
|
+
window.dispatchEvent(new CustomEvent(
|
|
1955
|
+
'source-tree-file-added', {bubbles: true, cancelable: true, detail: this.#uiSourceCode.fullDisplayName()}));
|
|
1956
|
+
|
|
1874
1957
|
this.updateTitle();
|
|
1875
1958
|
|
|
1876
1959
|
const updateTitleBound = this.updateTitle.bind(this, undefined);
|
|
@@ -1882,27 +1965,34 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
1882
1965
|
return this.treeElement;
|
|
1883
1966
|
}
|
|
1884
1967
|
|
|
1968
|
+
private updateTreeElement(): void {
|
|
1969
|
+
if (!this.treeElement) {
|
|
1970
|
+
return;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
this.treeElement.title = this.title;
|
|
1974
|
+
this.updateIcon();
|
|
1975
|
+
this.updateTrailingIcons();
|
|
1976
|
+
|
|
1977
|
+
this.treeElement.listItemElement.classList.toggle('is-ignore-listed',
|
|
1978
|
+
Boolean(this.recursiveProperties.exclusivelyIgnored));
|
|
1979
|
+
|
|
1980
|
+
this.treeElement.tooltip = this.tooltip ?? '';
|
|
1981
|
+
this.updateAccessibleName();
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1885
1984
|
override updateTitle(ignoreIsDirty?: boolean): void {
|
|
1886
1985
|
const isIgnoreListed =
|
|
1887
1986
|
Workspace.IgnoreListManager.IgnoreListManager.instance().isUserOrSourceMapIgnoreListedUISourceCode(
|
|
1888
1987
|
this.#uiSourceCode);
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
if (!this.treeElement) {
|
|
1894
|
-
return;
|
|
1895
|
-
}
|
|
1988
|
+
this.recursiveProperties.exclusivelyIgnored =
|
|
1989
|
+
(this.#uiSourceCode.contentType().isScript() || isIgnoreListed) ? isIgnoreListed : null;
|
|
1896
1990
|
|
|
1897
1991
|
let titleText = this.#uiSourceCode.displayName();
|
|
1898
1992
|
if (!ignoreIsDirty && this.#uiSourceCode.isDirty()) {
|
|
1899
1993
|
titleText = '*' + titleText;
|
|
1900
1994
|
}
|
|
1901
|
-
|
|
1902
|
-
this.treeElement.title = titleText;
|
|
1903
|
-
this.treeElement.updateIcon();
|
|
1904
|
-
|
|
1905
|
-
this.treeElement.listItemElement.classList.toggle('is-ignore-listed', isIgnoreListed);
|
|
1995
|
+
this.title = titleText;
|
|
1906
1996
|
|
|
1907
1997
|
let tooltip: string = this.#uiSourceCode.url();
|
|
1908
1998
|
if (this.#uiSourceCode.contentType().isFromSourceMap()) {
|
|
@@ -1911,11 +2001,10 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
1911
2001
|
if (isIgnoreListed) {
|
|
1912
2002
|
tooltip = i18nString(UIStrings.sIgnoreListed, {PH1: tooltip});
|
|
1913
2003
|
}
|
|
1914
|
-
|
|
1915
|
-
this.treeElement.tooltip = tooltip;
|
|
1916
|
-
this.treeElement.updateAccessibleName();
|
|
2004
|
+
this.tooltip = tooltip;
|
|
1917
2005
|
|
|
1918
2006
|
this.updateId('UISourceCode:' + this.#uiSourceCode.canonicalScriptId());
|
|
2007
|
+
this.updateTreeElement();
|
|
1919
2008
|
}
|
|
1920
2009
|
|
|
1921
2010
|
override hasChildren(): boolean {
|
|
@@ -1929,12 +2018,12 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
1929
2018
|
reveal(select?: boolean): void {
|
|
1930
2019
|
if (this.parent) {
|
|
1931
2020
|
this.parent.populate();
|
|
1932
|
-
this.
|
|
2021
|
+
this.navigatorView.expandNode(this.parent);
|
|
1933
2022
|
}
|
|
1934
2023
|
if (this.treeElement) {
|
|
1935
2024
|
this.treeElement.reveal(true);
|
|
1936
2025
|
if (select) {
|
|
1937
|
-
this.
|
|
2026
|
+
this.navigatorView.selectNode(this, true);
|
|
1938
2027
|
}
|
|
1939
2028
|
}
|
|
1940
2029
|
}
|
|
@@ -1978,7 +2067,7 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
1978
2067
|
if (parent) {
|
|
1979
2068
|
parent.removeChild(this.treeElement);
|
|
1980
2069
|
parent.appendChild(this.treeElement);
|
|
1981
|
-
this.
|
|
2070
|
+
this.navigatorView.selectNode(this);
|
|
1982
2071
|
}
|
|
1983
2072
|
}
|
|
1984
2073
|
afterEditing(true);
|
|
@@ -2003,7 +2092,7 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2003
2092
|
readonly folderPath: Platform.DevToolsPath.EncodedPathString;
|
|
2004
2093
|
readonly origin: Platform.DevToolsPath.UrlString;
|
|
2005
2094
|
override title: string;
|
|
2006
|
-
treeElement
|
|
2095
|
+
treeElement: UI.TreeOutline.TreeElement|null = null;
|
|
2007
2096
|
constructor(
|
|
2008
2097
|
navigatorView: NavigatorView, project: Workspace.Workspace.Project|null, id: string, type: string,
|
|
2009
2098
|
folderPath: Platform.DevToolsPath.EncodedPathString, title: string, origin: Platform.DevToolsPath.UrlString) {
|
|
@@ -2023,6 +2112,39 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2023
2112
|
return this.treeElement;
|
|
2024
2113
|
}
|
|
2025
2114
|
|
|
2115
|
+
private computeHasMappedFiles(): boolean {
|
|
2116
|
+
if (!this.project || this.project.type() !== Workspace.Workspace.projectTypes.FileSystem) {
|
|
2117
|
+
return false;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
const absoluteFileSystemPath = Common.ParsedURL.ParsedURL.concatenate(
|
|
2121
|
+
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemPath(
|
|
2122
|
+
this.project.id() as Platform.DevToolsPath.UrlString),
|
|
2123
|
+
'/', this.folderPath);
|
|
2124
|
+
const isOverrides =
|
|
2125
|
+
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemType(this.project) === 'overrides';
|
|
2126
|
+
return isOverrides ?
|
|
2127
|
+
Common.Settings.Settings.instance()
|
|
2128
|
+
.resolve(Persistence.NetworkPersistenceManager.persistenceNetworkOverridesEnabledSettingDescriptor)
|
|
2129
|
+
.get() :
|
|
2130
|
+
Persistence.Persistence.PersistenceImpl.instance().filePathHasBindings(absoluteFileSystemPath);
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
private updateTreeElement(): void {
|
|
2134
|
+
if (!this.treeElement) {
|
|
2135
|
+
return;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
this.treeElement.listItemElement.classList.toggle('is-from-source-map',
|
|
2139
|
+
Boolean(this.recursiveProperties.exclusivelySourceMapped));
|
|
2140
|
+
this.treeElement.listItemElement.classList.toggle('is-ignore-listed',
|
|
2141
|
+
Boolean(this.recursiveProperties.exclusivelyIgnored));
|
|
2142
|
+
this.treeElement.listItemElement.classList.toggle('has-mapped-files', this.hasMappedFiles);
|
|
2143
|
+
|
|
2144
|
+
const activeNode = this.navigatorView.nodeForTreeElement(this.treeElement) ?? this;
|
|
2145
|
+
activeNode.updateTooltip(this.treeElement);
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2026
2148
|
override updateTitle(): void {
|
|
2027
2149
|
let propName: keyof NavigatorRecursiveTreeNodeProperties;
|
|
2028
2150
|
for (propName in this.recursiveProperties) {
|
|
@@ -2038,39 +2160,17 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2038
2160
|
this.recursiveProperties[propName] = propValue;
|
|
2039
2161
|
}
|
|
2040
2162
|
|
|
2041
|
-
|
|
2042
|
-
return;
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
this.treeElement.setFromSourceMap(this.recursiveProperties.exclusivelySourceMapped || false);
|
|
2046
|
-
this.treeElement.setIgnoreListed(this.recursiveProperties.exclusivelyIgnored || false);
|
|
2163
|
+
this.hasMappedFiles = this.computeHasMappedFiles();
|
|
2047
2164
|
|
|
2048
|
-
|
|
2049
|
-
return;
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
const absoluteFileSystemPath = Common.ParsedURL.ParsedURL.concatenate(
|
|
2053
|
-
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemPath(
|
|
2054
|
-
this.project.id() as Platform.DevToolsPath.UrlString),
|
|
2055
|
-
'/', this.folderPath);
|
|
2056
|
-
const isOverrides =
|
|
2057
|
-
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemType(this.project) === 'overrides';
|
|
2058
|
-
const hasMappedFiles = isOverrides ?
|
|
2059
|
-
Common.Settings.Settings.instance()
|
|
2060
|
-
.resolve(Persistence.NetworkPersistenceManager.persistenceNetworkOverridesEnabledSettingDescriptor)
|
|
2061
|
-
.get() :
|
|
2062
|
-
Persistence.Persistence.PersistenceImpl.instance().filePathHasBindings(absoluteFileSystemPath);
|
|
2063
|
-
this.treeElement.listItemElement.classList.toggle('has-mapped-files', hasMappedFiles);
|
|
2165
|
+
this.updateTreeElement();
|
|
2064
2166
|
}
|
|
2065
2167
|
|
|
2066
|
-
private createTreeElement(title: string, node: NavigatorTreeNode):
|
|
2067
|
-
|
|
2068
|
-
treeElement.setNode(node);
|
|
2069
|
-
return treeElement;
|
|
2168
|
+
private createTreeElement(title: string, node: NavigatorTreeNode): UI.TreeOutline.TreeElement {
|
|
2169
|
+
return this.createFolderTreeElement(title, node);
|
|
2070
2170
|
}
|
|
2071
2171
|
|
|
2072
2172
|
override wasPopulated(): void {
|
|
2073
|
-
if (this.treeElement
|
|
2173
|
+
if (!this.treeElement || this.navigatorView.nodeForTreeElement(this.treeElement) !== this) {
|
|
2074
2174
|
return;
|
|
2075
2175
|
}
|
|
2076
2176
|
this.addChildrenRecursive();
|
|
@@ -2103,7 +2203,7 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2103
2203
|
this.treeElement.title = this.treeElement.title + '/' + node.title;
|
|
2104
2204
|
(node as NavigatorFolderTreeNode).treeElement = this.treeElement;
|
|
2105
2205
|
node.updateTitle();
|
|
2106
|
-
this.
|
|
2206
|
+
this.navigatorView.setNodeForTreeElement(this.treeElement, node);
|
|
2107
2207
|
return;
|
|
2108
2208
|
}
|
|
2109
2209
|
|
|
@@ -2135,7 +2235,7 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2135
2235
|
|
|
2136
2236
|
if (!this.isPopulated()) {
|
|
2137
2237
|
this.treeElement.title = titleText;
|
|
2138
|
-
this.
|
|
2238
|
+
this.navigatorView.setNodeForTreeElement(this.treeElement, this);
|
|
2139
2239
|
for (let i = 0; i < nodes.length; ++i) {
|
|
2140
2240
|
(nodes[i] as NavigatorFolderTreeNode).treeElement = null;
|
|
2141
2241
|
nodes[i].isMerged = false;
|
|
@@ -2153,14 +2253,16 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2153
2253
|
this.navigatorView.appendChild(oldTreeElement.parent, treeElement);
|
|
2154
2254
|
}
|
|
2155
2255
|
|
|
2156
|
-
|
|
2256
|
+
const oldTreeElementNode = this.navigatorView.nodeForTreeElement(oldTreeElement);
|
|
2257
|
+
const wasExpanded = Boolean(oldTreeElementNode && this.navigatorView.isNodeExpanded(oldTreeElementNode));
|
|
2157
2258
|
oldTreeElement.title = nodes.map(node => node.title).join('/');
|
|
2259
|
+
this.navigatorView.setNodeForTreeElement(oldTreeElement, nodes[nodes.length - 1]);
|
|
2158
2260
|
if (oldTreeElement.parent) {
|
|
2159
2261
|
this.navigatorView.removeChild(oldTreeElement.parent, oldTreeElement);
|
|
2160
2262
|
}
|
|
2161
2263
|
this.navigatorView.appendChild(this.treeElement, oldTreeElement);
|
|
2162
|
-
if (
|
|
2163
|
-
|
|
2264
|
+
if (wasExpanded) {
|
|
2265
|
+
this.navigatorView.expandNode(this);
|
|
2164
2266
|
}
|
|
2165
2267
|
this.updateTitle();
|
|
2166
2268
|
}
|
|
@@ -2179,96 +2281,76 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2179
2281
|
}
|
|
2180
2282
|
|
|
2181
2283
|
export class NavigatorGroupTreeNode extends NavigatorTreeNode {
|
|
2182
|
-
|
|
2284
|
+
readonly project: Workspace.Workspace.Project|null;
|
|
2183
2285
|
override title: string;
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
constructor(
|
|
2187
|
-
|
|
2188
|
-
tooltip?: string) {
|
|
2286
|
+
readonly frame?: SDK.ResourceTreeModel.ResourceTreeFrame;
|
|
2287
|
+
treeElement?: UI.TreeOutline.TreeElement;
|
|
2288
|
+
constructor(navigatorView: NavigatorView, project: Workspace.Workspace.Project|null, id: string, type: string,
|
|
2289
|
+
title: string, tooltip?: string, frame?: SDK.ResourceTreeModel.ResourceTreeFrame) {
|
|
2189
2290
|
super(navigatorView, id, type, tooltip);
|
|
2190
2291
|
this.project = project;
|
|
2191
2292
|
this.title = title;
|
|
2293
|
+
this.frame = frame;
|
|
2192
2294
|
this.populate();
|
|
2193
2295
|
}
|
|
2194
2296
|
|
|
2195
|
-
setHoverCallback(hoverCallback: (arg0: boolean) => void): void {
|
|
2196
|
-
this.hoverCallback = hoverCallback;
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
2297
|
override treeNode(): UI.TreeOutline.TreeElement {
|
|
2200
2298
|
if (this.treeElement) {
|
|
2201
2299
|
return this.treeElement;
|
|
2202
2300
|
}
|
|
2203
2301
|
const expandable = !(this.project instanceof Persistence.AutomaticFileSystemWorkspaceBinding.FileSystem);
|
|
2204
|
-
this.treeElement =
|
|
2205
|
-
|
|
2206
|
-
this.treeElement.setNode(this);
|
|
2207
|
-
if (this.project instanceof Persistence.AutomaticFileSystemWorkspaceBinding.FileSystem) {
|
|
2208
|
-
const {automaticFileSystem, automaticFileSystemManager} = this.project;
|
|
2209
|
-
switch (automaticFileSystem?.state) {
|
|
2210
|
-
case 'connecting': {
|
|
2211
|
-
// clang-format off
|
|
2212
|
-
this.treeElement.setTrailingIcons([
|
|
2213
|
-
html`<devtools-spinner></devtools-spinner>`,
|
|
2214
|
-
]);
|
|
2215
|
-
// clang-format on
|
|
2216
|
-
break;
|
|
2217
|
-
}
|
|
2218
|
-
case 'disconnected': {
|
|
2219
|
-
// clang-format off
|
|
2220
|
-
this.treeElement.setTrailingIcons([
|
|
2221
|
-
html`<devtools-button
|
|
2222
|
-
.data=${{
|
|
2223
|
-
variant: Buttons.Button.Variant.OUTLINED,
|
|
2224
|
-
size: Buttons.Button.Size.MICRO,
|
|
2225
|
-
title: i18nString(UIStrings.connectFolderToWorkspace),
|
|
2226
|
-
jslogContext: 'automatic-workspace-folders.connect',
|
|
2227
|
-
} as Buttons.Button.ButtonData}
|
|
2228
|
-
@click=${async (event: Event) => {
|
|
2229
|
-
event.consume();
|
|
2230
|
-
await automaticFileSystemManager.connectAutomaticFileSystem(
|
|
2231
|
-
/* addIfMissing= */ true);
|
|
2232
|
-
}}
|
|
2233
|
-
>${i18nString(UIStrings.connect)}</devtools-button>`,
|
|
2234
|
-
]);
|
|
2235
|
-
// clang-format on
|
|
2236
|
-
break;
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2302
|
+
this.treeElement = this.createFolderTreeElement(this.title, this, expandable);
|
|
2303
|
+
this.updateTrailingIcons();
|
|
2240
2304
|
return this.treeElement;
|
|
2241
2305
|
}
|
|
2242
2306
|
|
|
2307
|
+
updateTrailingIcons(): void {
|
|
2308
|
+
if (!this.treeElement) {
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
const trailingIcons = renderGroupTrailingIcons(this.project);
|
|
2312
|
+
this.treeElement.setTrailingIcons(trailingIcons);
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2243
2315
|
override onattach(): void {
|
|
2244
2316
|
this.updateTitle();
|
|
2245
2317
|
}
|
|
2246
2318
|
|
|
2247
|
-
|
|
2248
|
-
if (!this.
|
|
2249
|
-
return;
|
|
2319
|
+
private computeHasMappedFiles(): boolean {
|
|
2320
|
+
if (!this.project || this.project.type() !== Workspace.Workspace.projectTypes.FileSystem) {
|
|
2321
|
+
return false;
|
|
2250
2322
|
}
|
|
2251
2323
|
const fileSystemPath = Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemPath(
|
|
2252
2324
|
this.project.id() as Platform.DevToolsPath.UrlString);
|
|
2253
|
-
const wasActive = this.treeElement.listItemElement.classList.contains('has-mapped-files');
|
|
2254
2325
|
const isOverrides =
|
|
2255
2326
|
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemType(this.project) === 'overrides';
|
|
2256
|
-
|
|
2327
|
+
return isOverrides ?
|
|
2257
2328
|
Common.Settings.Settings.instance()
|
|
2258
2329
|
.resolve(Persistence.NetworkPersistenceManager.persistenceNetworkOverridesEnabledSettingDescriptor)
|
|
2259
2330
|
.get() :
|
|
2260
2331
|
Persistence.Persistence.PersistenceImpl.instance().filePathHasBindings(fileSystemPath);
|
|
2261
|
-
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
override updateTitle(): void {
|
|
2335
|
+
this.hasMappedFiles = this.computeHasMappedFiles();
|
|
2336
|
+
|
|
2337
|
+
this.updateTrailingIcons();
|
|
2338
|
+
if (!this.treeElement || !this.project || this.project.type() !== Workspace.Workspace.projectTypes.FileSystem) {
|
|
2262
2339
|
return;
|
|
2263
2340
|
}
|
|
2341
|
+
const wasActive = this.treeElement.listItemElement.classList.contains('has-mapped-files');
|
|
2342
|
+
const isActive = this.hasMappedFiles;
|
|
2264
2343
|
this.treeElement.listItemElement.classList.toggle('has-mapped-files', isActive);
|
|
2344
|
+
if (wasActive === isActive) {
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2265
2347
|
if (this.treeElement.childrenListElement.hasFocus()) {
|
|
2266
2348
|
return;
|
|
2267
2349
|
}
|
|
2268
2350
|
if (isActive) {
|
|
2269
|
-
this.
|
|
2351
|
+
this.navigatorView.expandNode(this);
|
|
2270
2352
|
} else {
|
|
2271
|
-
this.
|
|
2353
|
+
this.navigatorView.collapseNode(this);
|
|
2272
2354
|
}
|
|
2273
2355
|
}
|
|
2274
2356
|
|