chrome-devtools-frontend 1.0.1739869 → 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 +2 -0
- 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 +1 -18
- package/front_end/application_tokens.css +0 -35
- 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/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/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/TraceTree.ts +69 -72
- package/front_end/models/trace/handlers/MetaHandler.ts +3 -0
- package/front_end/models/trace/handlers/types.ts +15 -0
- package/front_end/models/trace/helpers/Trace.ts +5 -3
- 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/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/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 +0 -7
- 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/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 +13 -17
- 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 +14 -5
- package/front_end/panels/elements/StylePropertyTreeElement.ts +529 -518
- package/front_end/panels/elements/StylesContainer.ts +5 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +12 -15
- 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 +6 -7
- package/front_end/panels/elements/platformFontsWidget.css +1 -1
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -6
- package/front_end/panels/elements/stylesSidebarPane.css +3 -4
- 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 -2
- package/front_end/panels/issues/issuesTree.css +6 -43
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +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/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/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 +2 -2
- package/front_end/panels/network/NetworkLogView.ts +594 -580
- package/front_end/panels/network/RequestCookiesView.ts +0 -1
- package/front_end/panels/network/networkConfigView.css +1 -2
- package/front_end/panels/network/networkLogView.css +363 -364
- package/front_end/panels/network/networkPanel.css +1 -5
- package/front_end/panels/network/networkTimingTable.css +1 -1
- 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/recorder/RecorderPanel.ts +1 -1
- package/front_end/panels/recorder/RecordingView.ts +10 -10
- package/front_end/panels/recorder/StepView.ts +5 -4
- package/front_end/panels/recorder/createRecordingView.css +1 -1
- package/front_end/panels/recorder/recorderPanel.css +0 -8
- package/front_end/panels/recorder/recordingListView.css +4 -4
- package/front_end/panels/recorder/recordingView.css +12 -20
- package/front_end/panels/recorder/stepEditor.css +4 -4
- package/front_end/panels/recorder/stepView.css +31 -9
- package/front_end/panels/recorder/timelineSection.css +4 -0
- package/front_end/panels/screencast/ScreencastApp.ts +0 -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 -346
- 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 -29
- 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/watchExpressionsSidebarPane.css +0 -10
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -0
- 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/TimelinePanel.ts +2 -2
- package/front_end/panels/timeline/TimelineTreeView.ts +38 -41
- package/front_end/panels/timeline/TimelineUIUtils.ts +8 -10
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +0 -2
- 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 -2
- 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 -4
- package/front_end/panels/timeline/components/networkRequestTooltip.css +6 -4
- package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +1 -1
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -2
- 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 +1 -7
- package/front_end/panels/whats_new/ReleaseNoteText.ts +1 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- 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/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 +3 -3
- package/front_end/ui/components/tree_outline/treeOutline.css +0 -23
- 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 +49 -1
- package/front_end/ui/legacy/components/object_ui/objectPopover.css +0 -4
- 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/filter.css +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +6 -28
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
- package/front_end/ui/legacy/listWidget.css +1 -1
- package/front_end/ui/legacy/progressIndicator.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +6 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -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_source_order.css +0 -4
- package/package.json +1 -1
- package/front_end/generated/SupportedCSSProperties.ts +0 -9705
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2012 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
4
|
|
|
6
5
|
import '../../ui/components/spinners/spinners.js';
|
|
7
6
|
import '../../ui/kit/kit.js';
|
|
@@ -18,7 +17,15 @@ import * as Persistence from '../../models/persistence/persistence.js';
|
|
|
18
17
|
import * as Workspace from '../../models/workspace/workspace.js';
|
|
19
18
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
20
19
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
21
|
-
import
|
|
20
|
+
import {
|
|
21
|
+
CustomDirectives,
|
|
22
|
+
Directive,
|
|
23
|
+
Directives,
|
|
24
|
+
html,
|
|
25
|
+
nothing,
|
|
26
|
+
render,
|
|
27
|
+
type TemplateResult,
|
|
28
|
+
} from '../../ui/lit/lit.js';
|
|
22
29
|
import * as SettingsUI from '../../ui/settings/settings.js';
|
|
23
30
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
24
31
|
import * as Snippets from '../snippets/snippets.js';
|
|
@@ -28,7 +35,9 @@ import navigatorTreeStyles from './navigatorTree.css.js';
|
|
|
28
35
|
import navigatorViewStyles from './navigatorView.css.js';
|
|
29
36
|
import {SearchSources} from './SearchSourcesView.js';
|
|
30
37
|
|
|
31
|
-
const {
|
|
38
|
+
const {classMap, repeat} = Directives;
|
|
39
|
+
const {widget} = UI.Widget;
|
|
40
|
+
const on = Directive.directive(CustomDirectives.InterceptBindingDirective);
|
|
32
41
|
|
|
33
42
|
const UIStrings = {
|
|
34
43
|
/**
|
|
@@ -186,31 +195,6 @@ const TYPE_ORDERS = new Map([
|
|
|
186
195
|
[Types.FileSystem, 100],
|
|
187
196
|
]);
|
|
188
197
|
|
|
189
|
-
export interface ViewInput {
|
|
190
|
-
treeElement: HTMLElement;
|
|
191
|
-
showTree: boolean;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
195
|
-
|
|
196
|
-
export const DEFAULT_VIEW: View = (input, _output, target): void => {
|
|
197
|
-
const showPlaceholder = !input.showTree;
|
|
198
|
-
// clang-format off
|
|
199
|
-
render(
|
|
200
|
-
html`
|
|
201
|
-
<style>${navigatorViewStyles}</style>
|
|
202
|
-
<slot name="header"></slot>
|
|
203
|
-
<div class="vbox flex-auto" ?hidden=${!showPlaceholder}>
|
|
204
|
-
<slot name="placeholder"></slot>
|
|
205
|
-
</div>
|
|
206
|
-
<div class="vbox flex-auto" ?hidden=${showPlaceholder}>
|
|
207
|
-
${input.treeElement}
|
|
208
|
-
</div>
|
|
209
|
-
`,
|
|
210
|
-
target);
|
|
211
|
-
// clang-format on
|
|
212
|
-
};
|
|
213
|
-
|
|
214
198
|
export function iconTypeForNodeType(type: string): string {
|
|
215
199
|
switch (type) {
|
|
216
200
|
case Types.Domain:
|
|
@@ -245,13 +229,13 @@ export function contextForNodeType(type: string): string {
|
|
|
245
229
|
return 'folder';
|
|
246
230
|
}
|
|
247
231
|
|
|
248
|
-
export function renderFolderLeadingIcon(type: string):
|
|
232
|
+
export function renderFolderLeadingIcon(type: string): TemplateResult {
|
|
249
233
|
return html`<devtools-icon name=${iconTypeForNodeType(type)}></devtools-icon>`;
|
|
250
234
|
}
|
|
251
235
|
|
|
252
236
|
export function renderSourceTrailingIcons(uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
253
237
|
onSelectSource: (uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
254
|
-
focusSource: boolean) => void):
|
|
238
|
+
focusSource: boolean) => void): TemplateResult[] {
|
|
255
239
|
if (!UI.ActionRegistry.ActionRegistry.instance().hasAction('drjones.sources-floating-button')) {
|
|
256
240
|
return [];
|
|
257
241
|
}
|
|
@@ -267,26 +251,20 @@ export function renderSourceTrailingIcons(uiSourceCode: Workspace.UISourceCode.U
|
|
|
267
251
|
.iconName=${icon}
|
|
268
252
|
.title=${action.title()}
|
|
269
253
|
.jslogContext=${'ask-ai'}
|
|
270
|
-
@click=${{
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
void action.execute();
|
|
275
|
-
},
|
|
276
|
-
capture: true,
|
|
254
|
+
@click=${(ev: Event) => {
|
|
255
|
+
ev.stopPropagation();
|
|
256
|
+
onSelectSource(uiSourceCode, false);
|
|
257
|
+
void action.execute();
|
|
277
258
|
}}
|
|
278
|
-
@mousedown=${{
|
|
279
|
-
|
|
280
|
-
ev.stopPropagation();
|
|
281
|
-
},
|
|
282
|
-
capture: true,
|
|
259
|
+
@mousedown=${(ev: Event) => {
|
|
260
|
+
ev.stopPropagation();
|
|
283
261
|
}}
|
|
284
262
|
></devtools-floating-button>
|
|
285
263
|
</span>`];
|
|
286
264
|
// clang-format on
|
|
287
265
|
}
|
|
288
266
|
|
|
289
|
-
export function renderGroupTrailingIcons(project: Workspace.Workspace.Project|null):
|
|
267
|
+
export function renderGroupTrailingIcons(project: Workspace.Workspace.Project|null): TemplateResult[] {
|
|
290
268
|
if (!(project instanceof Persistence.AutomaticFileSystemWorkspaceBinding.FileSystem)) {
|
|
291
269
|
return [];
|
|
292
270
|
}
|
|
@@ -318,6 +296,59 @@ export function renderGroupTrailingIcons(project: Workspace.Workspace.Project|nu
|
|
|
318
296
|
return [];
|
|
319
297
|
}
|
|
320
298
|
|
|
299
|
+
export interface ViewInput {
|
|
300
|
+
nodes: readonly NavigatorTreeNode[];
|
|
301
|
+
expandedNodes: WeakSet<NavigatorTreeNode>;
|
|
302
|
+
selectedNode: NavigatorTreeNode|null;
|
|
303
|
+
onExpand: (node: NavigatorTreeNode, expanded: boolean) => void;
|
|
304
|
+
onSelect: (node: NavigatorTreeNode, selectedByUser?: boolean) => void;
|
|
305
|
+
onDoubleClick: (node: NavigatorTreeNode, middleClick: boolean) => void;
|
|
306
|
+
onContextMenu: (node: NavigatorTreeNode, contextMenu: UI.ContextMenu.ContextMenu) => void;
|
|
307
|
+
onHover: (node: NavigatorTreeNode, hovered: boolean) => void;
|
|
308
|
+
onMouseDown: (node: NavigatorTreeNode) => void;
|
|
309
|
+
onSelectSource: (uiSourceCode: Workspace.UISourceCode.UISourceCode, focusSource: boolean) => void;
|
|
310
|
+
onCommitRename: (node: NavigatorUISourceCodeTreeNode, newTitle: string) => void;
|
|
311
|
+
onCancelRename: (node: NavigatorUISourceCodeTreeNode) => void;
|
|
312
|
+
showTree: boolean;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
316
|
+
|
|
317
|
+
function nodeAriaLabel(node: NavigatorTreeNode): string {
|
|
318
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
319
|
+
return `${node.uiSourceCode().name()}, ${node.type}`;
|
|
320
|
+
}
|
|
321
|
+
return `${node.mergedTitle()}, ${node.type}`;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function renderLeadingIcon(node: NavigatorTreeNode): TemplateResult {
|
|
325
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
326
|
+
const icon = PanelUtils.getIconForSourceFile(node.uiSourceCode());
|
|
327
|
+
const binding = Persistence.Persistence.PersistenceImpl.instance().binding(node.uiSourceCode());
|
|
328
|
+
const networkPersistenceManager = Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance();
|
|
329
|
+
const isHeaderOverride = networkPersistenceManager.isActiveHeaderOverrides(node.uiSourceCode());
|
|
330
|
+
const hasDotBadge = Boolean(binding || isHeaderOverride);
|
|
331
|
+
const isDotPurple =
|
|
332
|
+
Boolean(binding ? networkPersistenceManager.project() === binding.fileSystem.project() : isHeaderOverride);
|
|
333
|
+
const badge = hasDotBadge ? (isDotPurple ? 'purple' : 'green') : 'none';
|
|
334
|
+
return html`<span class="leading-icons icons-container" data-badge=${badge}>${icon}</span>`;
|
|
335
|
+
}
|
|
336
|
+
const icon = renderFolderLeadingIcon(node.type);
|
|
337
|
+
return html`<span class="leading-icons icons-container">${icon}</span>`;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function renderTrailingIcons(node: NavigatorTreeNode, input: ViewInput): TemplateResult|typeof nothing {
|
|
341
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
342
|
+
const trailing = renderSourceTrailingIcons(node.uiSourceCode(), input.onSelectSource);
|
|
343
|
+
return trailing.length > 0 ? html`<span class="trailing-icons icons-container">${trailing}</span>` : nothing;
|
|
344
|
+
}
|
|
345
|
+
if (node instanceof NavigatorGroupTreeNode) {
|
|
346
|
+
const trailing = renderGroupTrailingIcons(node.project);
|
|
347
|
+
return trailing.length > 0 ? html`<span class="trailing-icons icons-container">${trailing}</span>` : nothing;
|
|
348
|
+
}
|
|
349
|
+
return nothing;
|
|
350
|
+
}
|
|
351
|
+
|
|
321
352
|
export interface NavigatorSourceTitleViewInput {
|
|
322
353
|
title: string;
|
|
323
354
|
editing: boolean;
|
|
@@ -402,27 +433,139 @@ export class NavigatorSourceTitleWidget extends UI.Widget.Widget {
|
|
|
402
433
|
}
|
|
403
434
|
}
|
|
404
435
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
436
|
+
const TITLE_JSLOG = `${VisualLogging.value('title').track({change: true})}`;
|
|
437
|
+
|
|
438
|
+
function renderTitle(node: NavigatorTreeNode, input: ViewInput): TemplateResult {
|
|
439
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
440
|
+
return html`<span title=${node.computedTooltip()} class="tree-element-title" jslog=${TITLE_JSLOG}>
|
|
441
|
+
<devtools-widget ${widget(NavigatorSourceTitleWidget, {
|
|
442
|
+
title: node.title,
|
|
443
|
+
editing: node.isEditing,
|
|
444
|
+
onCommit: (detail: string) => input.onCommitRename(node, detail),
|
|
445
|
+
onCancel: () => input.onCancelRename(node),
|
|
446
|
+
})}></devtools-widget>
|
|
447
|
+
</span>`;
|
|
448
|
+
}
|
|
449
|
+
return html`<span title=${node.computedTooltip()} class="tree-element-title" data-title=${node.mergedTitle()}>${
|
|
450
|
+
node.mergedTitle()}</span>`;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function renderNode(node: NavigatorTreeNode, input: ViewInput): TemplateResult {
|
|
454
|
+
const children = node.effectiveChildren();
|
|
455
|
+
const isExpandable = node instanceof NavigatorFolderTreeNode ||
|
|
456
|
+
(node instanceof NavigatorGroupTreeNode &&
|
|
457
|
+
!(node.project instanceof Persistence.AutomaticFileSystemWorkspaceBinding.FileSystem)) ||
|
|
458
|
+
children.length > 0;
|
|
459
|
+
const isExpanded = input.expandedNodes.has(node) ||
|
|
460
|
+
(node instanceof NavigatorFolderTreeNode && input.expandedNodes.has(node.mergedLeafNode()));
|
|
461
|
+
const isSelected = (input.selectedNode === node ||
|
|
462
|
+
(node instanceof NavigatorFolderTreeNode && input.selectedNode === node.mergedLeafNode())) &&
|
|
463
|
+
!(node instanceof NavigatorUISourceCodeTreeNode && node.isEditing);
|
|
464
|
+
|
|
465
|
+
const classes = {
|
|
466
|
+
'navigator-folder-tree-item': node instanceof NavigatorFolderTreeNode || node instanceof NavigatorGroupTreeNode,
|
|
467
|
+
'navigator-file-tree-item': node instanceof NavigatorUISourceCodeTreeNode,
|
|
468
|
+
['navigator-' + node.type + '-tree-item']: true,
|
|
469
|
+
'is-from-source-map': Boolean(node.recursiveProperties.exclusivelySourceMapped),
|
|
470
|
+
'is-ignore-listed': Boolean(node.recursiveProperties.exclusivelyIgnored),
|
|
471
|
+
'has-mapped-files': node.hasMappedFiles,
|
|
472
|
+
selected: isSelected,
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
// clang-format off
|
|
476
|
+
return html`
|
|
477
|
+
<li role="treeitem"
|
|
478
|
+
data-title=${node.title}
|
|
479
|
+
data-node-id=${node.id}
|
|
480
|
+
class=${classMap(classes)}
|
|
481
|
+
?open=${isExpanded}
|
|
482
|
+
?selected=${isSelected}
|
|
483
|
+
aria-label=${nodeAriaLabel(node)}
|
|
484
|
+
jslog=${VisualLogging.treeItem(node instanceof NavigatorUISourceCodeTreeNode ? node.uiSourceCode().contentType().name() : contextForNodeType(node.type)).track({click: true})}
|
|
485
|
+
draggable=${node instanceof NavigatorUISourceCodeTreeNode ? 'true' : 'false'}
|
|
486
|
+
@expand=${on((e: UI.TreeOutline.TreeViewElement.ExpandEvent) => input.onExpand(node, e.detail.expanded))}
|
|
487
|
+
@select=${on((e: UI.TreeOutline.TreeViewElement.SelectEvent) => input.onSelect(node, Boolean(e.detail?.selectedByUser)))}
|
|
488
|
+
@enter=${on(() => {
|
|
489
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
490
|
+
input.onSelectSource(node.uiSourceCode(), true);
|
|
491
|
+
}
|
|
492
|
+
})}
|
|
493
|
+
@keydown=${on((e: KeyboardEvent) => {
|
|
494
|
+
if (e.key === ' ' && node instanceof NavigatorUISourceCodeTreeNode && !node.isEditing) {
|
|
495
|
+
e.consume(true);
|
|
496
|
+
input.onSelectSource(node.uiSourceCode(), true);
|
|
497
|
+
}
|
|
498
|
+
})}
|
|
499
|
+
@click=${on((e: MouseEvent) => {
|
|
500
|
+
if (node instanceof NavigatorUISourceCodeTreeNode && e.button === 0) {
|
|
501
|
+
input.onSelectSource(node.uiSourceCode(), false);
|
|
502
|
+
}
|
|
503
|
+
})}
|
|
504
|
+
@dblclick=${on((e: MouseEvent) => input.onDoubleClick(node, e.button === 1))}
|
|
505
|
+
@contextmenu=${on((e: Event) => input.onContextMenu(node, new UI.ContextMenu.ContextMenu(e)))}
|
|
506
|
+
@dragstart=${on((e: DragEvent) => {
|
|
507
|
+
if (node instanceof NavigatorUISourceCodeTreeNode && e.dataTransfer) {
|
|
508
|
+
e.dataTransfer.setData('text/plain', node.uiSourceCode().url());
|
|
509
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
510
|
+
}
|
|
511
|
+
})}
|
|
512
|
+
@mousedown=${on((e: MouseEvent) => {
|
|
513
|
+
if (e.button === 0) {
|
|
514
|
+
input.onMouseDown(node);
|
|
515
|
+
}
|
|
516
|
+
})}
|
|
517
|
+
@mousemove=${on(() => input.onHover(node, true))}
|
|
518
|
+
@mouseleave=${on(() => input.onHover(node, false))}
|
|
519
|
+
>
|
|
520
|
+
${renderLeadingIcon(node)}
|
|
521
|
+
${renderTitle(node, input)}
|
|
522
|
+
${renderTrailingIcons(node, input)}
|
|
523
|
+
${isExpandable ? html`
|
|
524
|
+
<ul role="group">
|
|
525
|
+
${renderNodes(children, input)}
|
|
526
|
+
</ul>
|
|
527
|
+
` : nothing}
|
|
528
|
+
</li>
|
|
529
|
+
`;
|
|
530
|
+
// clang-format on
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function renderNodes(nodes: readonly NavigatorTreeNode[], input: ViewInput): TemplateResult {
|
|
534
|
+
return html`${repeat(nodes, node => node.id, node => renderNode(node, input))}`;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function onTreeKeyDown(input: ViewInput, event: KeyboardEvent): void {
|
|
538
|
+
if (event.key === ' ' && input.selectedNode instanceof NavigatorUISourceCodeTreeNode &&
|
|
539
|
+
!input.selectedNode.isEditing) {
|
|
540
|
+
event.consume(true);
|
|
541
|
+
input.onSelectSource(input.selectedNode.uiSourceCode(), true);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export const DEFAULT_VIEW: View = (input, _output, target): void => {
|
|
546
|
+
const showPlaceholder = !input.showTree;
|
|
547
|
+
// clang-format off
|
|
548
|
+
render(
|
|
549
|
+
html`
|
|
550
|
+
<style>${navigatorViewStyles}</style>
|
|
551
|
+
<slot name="header"></slot>
|
|
552
|
+
<div class="vbox flex-auto" ?hidden=${!showPlaceholder}>
|
|
553
|
+
<slot name="placeholder"></slot>
|
|
554
|
+
</div>
|
|
555
|
+
<div class="vbox flex-auto" ?hidden=${showPlaceholder}>
|
|
556
|
+
<devtools-tree autofocus navigation-variant hide-overflow
|
|
557
|
+
@keydown=${(e: KeyboardEvent) => onTreeKeyDown(input, e)}
|
|
558
|
+
.template=${html`
|
|
559
|
+
<style>${navigatorTreeStyles}</style>
|
|
560
|
+
<ul role="tree">
|
|
561
|
+
${renderNodes(input.nodes, input)}
|
|
562
|
+
</ul>
|
|
563
|
+
`}></devtools-tree>
|
|
564
|
+
</div>
|
|
565
|
+
`,
|
|
566
|
+
target);
|
|
567
|
+
// clang-format on
|
|
568
|
+
};
|
|
426
569
|
|
|
427
570
|
export const enum Events {
|
|
428
571
|
UI_SOURCE_CODE_ADDED = 'ui-source-code-added',
|
|
@@ -443,115 +586,266 @@ const NavigatorViewBase: Common.ObjectWrapper.EventMixin<EventTypes, typeof UI.W
|
|
|
443
586
|
Common.ObjectWrapper.eventMixin(UI.Widget.VBox);
|
|
444
587
|
|
|
445
588
|
export class NavigatorView extends NavigatorViewBase implements SDK.TargetManager.Observer {
|
|
446
|
-
static override readonly INJECT: readonly[typeof Bindings.NetworkProject.NetworkProjectManager
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
589
|
+
static override readonly INJECT: readonly[typeof Bindings.NetworkProject.NetworkProjectManager,
|
|
590
|
+
typeof Workspace.Workspace.WorkspaceImpl,
|
|
591
|
+
typeof Workspace.IgnoreListManager.IgnoreListManager,
|
|
592
|
+
typeof Persistence.Persistence.PersistenceImpl,
|
|
593
|
+
typeof Persistence.NetworkPersistenceManager.NetworkPersistenceManager,
|
|
594
|
+
typeof SDK.TargetManager.TargetManager,
|
|
595
|
+
typeof Common.Settings.Settings,
|
|
596
|
+
] =
|
|
597
|
+
[
|
|
598
|
+
Bindings.NetworkProject.NetworkProjectManager,
|
|
599
|
+
Workspace.Workspace.WorkspaceImpl,
|
|
600
|
+
Workspace.IgnoreListManager.IgnoreListManager,
|
|
601
|
+
Persistence.Persistence.PersistenceImpl,
|
|
602
|
+
Persistence.NetworkPersistenceManager.NetworkPersistenceManager,
|
|
603
|
+
SDK.TargetManager.TargetManager,
|
|
604
|
+
Common.Settings.Settings,
|
|
605
|
+
] as const;
|
|
606
|
+
|
|
607
|
+
readonly #uiSourceCodeNodes:
|
|
451
608
|
Platform.MapUtilities.Multimap<Workspace.UISourceCode.UISourceCode, NavigatorUISourceCodeTreeNode>;
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
609
|
+
readonly #subfolderNodes: Map<string, NavigatorFolderTreeNode>;
|
|
610
|
+
readonly rootNode: NavigatorRootTreeNode;
|
|
611
|
+
readonly #frameNodes: Map<SDK.ResourceTreeModel.ResourceTreeFrame, NavigatorGroupTreeNode>;
|
|
612
|
+
#authoredNode?: NavigatorGroupTreeNode;
|
|
613
|
+
#deployedNode?: NavigatorGroupTreeNode;
|
|
614
|
+
#navigatorGroupByFolderSetting: Common.Settings.Setting<boolean>;
|
|
615
|
+
#navigatorJustMyCodeSetting: Common.Settings.Setting<boolean>;
|
|
616
|
+
#navigatorGroupByAuthoredSetting?: Common.Settings.Setting<boolean>;
|
|
460
617
|
#navigatorGroupByAuthoredChangeListener?: () => void;
|
|
461
618
|
#enableAuthoredGrouping = false;
|
|
462
619
|
#projectFilter?: (project: Workspace.Workspace.Project) => boolean;
|
|
463
|
-
#workspace
|
|
464
|
-
#
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
620
|
+
#workspace: Workspace.Workspace.WorkspaceImpl;
|
|
621
|
+
#subscribed = false;
|
|
622
|
+
#needsRegroup = false;
|
|
623
|
+
#prevJustMyCode?: boolean;
|
|
624
|
+
readonly #groupingChangedListener = this.#groupingChanged.bind(this);
|
|
625
|
+
readonly #ignoreListChangedListener = this.#ignoreListChanged.bind(this);
|
|
626
|
+
readonly #networkProjectManager: Bindings.NetworkProject.NetworkProjectManager;
|
|
627
|
+
readonly #ignoreListManager: Workspace.IgnoreListManager.IgnoreListManager;
|
|
628
|
+
readonly #persistence: Persistence.Persistence.PersistenceImpl;
|
|
629
|
+
readonly #networkPersistenceManager: Persistence.NetworkPersistenceManager.NetworkPersistenceManager;
|
|
630
|
+
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
631
|
+
readonly #settings: Common.Settings.Settings;
|
|
632
|
+
#groupByFrame?: boolean;
|
|
633
|
+
#groupByAuthored?: boolean;
|
|
634
|
+
#groupByDomain?: boolean;
|
|
635
|
+
#groupByFolder?: boolean;
|
|
636
|
+
#selectedNode: NavigatorTreeNode|null = null;
|
|
637
|
+
#expandedNodes = new WeakSet<NavigatorTreeNode>();
|
|
472
638
|
#renamingNode: NavigatorUISourceCodeTreeNode|null = null;
|
|
473
639
|
#view: View;
|
|
474
640
|
|
|
475
641
|
constructor(
|
|
476
642
|
element?: HTMLElement,
|
|
477
|
-
[
|
|
478
|
-
|
|
643
|
+
[
|
|
644
|
+
networkProjectManager = Bindings.NetworkProject.NetworkProjectManager.instance(),
|
|
645
|
+
workspace = Workspace.Workspace.WorkspaceImpl.instance(),
|
|
646
|
+
ignoreListManager = Workspace.IgnoreListManager.IgnoreListManager.instance(),
|
|
647
|
+
persistence = Persistence.Persistence.PersistenceImpl.instance(),
|
|
648
|
+
networkPersistenceManager = Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance(),
|
|
649
|
+
targetManager = SDK.TargetManager.TargetManager.instance(),
|
|
650
|
+
settings = Common.Settings.Settings.instance(),
|
|
651
|
+
]: Partial<UI.Widget.WidgetDependencies<typeof NavigatorView>> = [],
|
|
479
652
|
view: View = DEFAULT_VIEW,
|
|
480
653
|
) {
|
|
481
654
|
super(element, {useShadowDom: true});
|
|
482
655
|
this.#view = view;
|
|
656
|
+
this.#networkProjectManager = networkProjectManager;
|
|
657
|
+
this.#workspace = workspace;
|
|
658
|
+
this.#ignoreListManager = ignoreListManager;
|
|
659
|
+
this.#persistence = persistence;
|
|
660
|
+
this.#networkPersistenceManager = networkPersistenceManager;
|
|
661
|
+
this.#targetManager = targetManager;
|
|
662
|
+
this.#settings = settings;
|
|
483
663
|
|
|
484
|
-
this
|
|
485
|
-
this
|
|
486
|
-
|
|
487
|
-
this.scriptsTree.setHideOverflow(true);
|
|
488
|
-
this.scriptsTree.setComparator(this.treeElementsCompare.bind(this));
|
|
489
|
-
this.scriptsTree.setFocusable(false);
|
|
490
|
-
this.setDefaultFocusedElement(this.scriptsTree.element);
|
|
491
|
-
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementAttached, () => this.requestUpdate());
|
|
492
|
-
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementsDetached, () => this.requestUpdate());
|
|
493
|
-
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementSelected, event => {
|
|
494
|
-
const node = this.nodeForTreeElement(event.data);
|
|
495
|
-
this.selectedNode = node ?? null;
|
|
496
|
-
});
|
|
497
|
-
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementExpanded, event => {
|
|
498
|
-
const node = this.nodeForTreeElement(event.data);
|
|
499
|
-
if (node) {
|
|
500
|
-
this.expandedNodes.add(node);
|
|
501
|
-
node.populate();
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
this.scriptsTree.addEventListener(UI.TreeOutline.Events.ElementCollapsed, event => {
|
|
505
|
-
const node = this.nodeForTreeElement(event.data);
|
|
506
|
-
if (node) {
|
|
507
|
-
this.expandedNodes.delete(node);
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
this.uiSourceCodeNodes = new Platform.MapUtilities.Multimap();
|
|
512
|
-
this.subfolderNodes = new Map();
|
|
664
|
+
this.#uiSourceCodeNodes = new Platform.MapUtilities.Multimap();
|
|
665
|
+
this.#subfolderNodes = new Map();
|
|
513
666
|
|
|
514
667
|
this.rootNode = new NavigatorRootTreeNode(this);
|
|
515
668
|
this.rootNode.populate();
|
|
516
669
|
|
|
517
|
-
this
|
|
670
|
+
this.#frameNodes = new Map();
|
|
518
671
|
UI.ShortcutRegistry.ShortcutRegistry.instance().addShortcutListener(
|
|
519
|
-
this.contentElement, {'sources.rename': this
|
|
672
|
+
this.contentElement, {'sources.rename': this.#renameShortcut.bind(this)});
|
|
520
673
|
|
|
521
|
-
this
|
|
522
|
-
|
|
523
|
-
this
|
|
524
|
-
|
|
525
|
-
Common.Settings.Settings.instance().resolve(SettingsUI.SourcesSettings.navigatorJustMyCodeSettingDescriptor);
|
|
526
|
-
this.navigatorJustMyCodeSetting.addChangeListener(this.groupingChanged.bind(this));
|
|
674
|
+
this.#navigatorGroupByFolderSetting =
|
|
675
|
+
this.#settings.resolve(SettingsUI.SourcesSettings.navigatorGroupByFolderSettingDescriptor);
|
|
676
|
+
this.#navigatorJustMyCodeSetting =
|
|
677
|
+
this.#settings.resolve(SettingsUI.SourcesSettings.navigatorJustMyCodeSettingDescriptor);
|
|
527
678
|
|
|
528
|
-
|
|
679
|
+
this.#initGrouping();
|
|
680
|
+
this.requestUpdate();
|
|
681
|
+
}
|
|
529
682
|
|
|
530
|
-
|
|
683
|
+
get ignoreListManager(): Workspace.IgnoreListManager.IgnoreListManager {
|
|
684
|
+
return this.#ignoreListManager;
|
|
685
|
+
}
|
|
531
686
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
this.#onRequestsForHeaderOverridesFileChanged, this);
|
|
539
|
-
SDK.TargetManager.TargetManager.instance().addEventListener(
|
|
540
|
-
SDK.TargetManager.Events.NAME_CHANGED, this.targetNameChanged, this);
|
|
541
|
-
|
|
542
|
-
SDK.TargetManager.TargetManager.instance().observeTargets(this);
|
|
543
|
-
networkProjectManager.addEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_ADDED,
|
|
544
|
-
this.frameAttributionAdded, this);
|
|
545
|
-
networkProjectManager.addEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_REMOVED,
|
|
546
|
-
this.frameAttributionRemoved, this);
|
|
547
|
-
this.requestUpdate();
|
|
687
|
+
get persistence(): Persistence.Persistence.PersistenceImpl {
|
|
688
|
+
return this.#persistence;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
get settings(): Common.Settings.Settings {
|
|
692
|
+
return this.#settings;
|
|
548
693
|
}
|
|
549
694
|
|
|
550
695
|
override wasShown(): void {
|
|
551
696
|
super.wasShown();
|
|
697
|
+
this.#subscribe();
|
|
552
698
|
this.requestUpdate();
|
|
553
699
|
}
|
|
554
700
|
|
|
701
|
+
override willHide(): void {
|
|
702
|
+
super.willHide();
|
|
703
|
+
this.#unsubscribe();
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
#subscribe(): void {
|
|
707
|
+
if (this.#subscribed) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
this.#subscribed = true;
|
|
711
|
+
|
|
712
|
+
this.#navigatorGroupByFolderSetting.addChangeListener(this.#groupingChangedListener);
|
|
713
|
+
this.#navigatorJustMyCodeSetting.addChangeListener(this.#groupingChangedListener);
|
|
714
|
+
if (this.#navigatorGroupByAuthoredSetting && this.#navigatorGroupByAuthoredChangeListener) {
|
|
715
|
+
this.#navigatorGroupByAuthoredSetting.addChangeListener(this.#navigatorGroupByAuthoredChangeListener);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
this.#ignoreListManager.addChangeListener(this.#ignoreListChangedListener);
|
|
719
|
+
|
|
720
|
+
this.#persistence.addEventListener(Persistence.Persistence.Events.BindingCreated, this.#onBindingChanged, this);
|
|
721
|
+
this.#persistence.addEventListener(Persistence.Persistence.Events.BindingRemoved, this.#onBindingChanged, this);
|
|
722
|
+
|
|
723
|
+
this.#networkPersistenceManager.addEventListener(
|
|
724
|
+
Persistence.NetworkPersistenceManager.Events.REQUEST_FOR_HEADER_OVERRIDES_FILE_CHANGED,
|
|
725
|
+
this.#onRequestsForHeaderOverridesFileChanged, this);
|
|
726
|
+
|
|
727
|
+
this.#targetManager.addEventListener(SDK.TargetManager.Events.NAME_CHANGED, this.#targetNameChanged, this);
|
|
728
|
+
this.#targetManager.observeTargets(this);
|
|
729
|
+
|
|
730
|
+
this.#networkProjectManager.addEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_ADDED,
|
|
731
|
+
this.#frameAttributionAdded, this);
|
|
732
|
+
this.#networkProjectManager.addEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_REMOVED,
|
|
733
|
+
this.#frameAttributionRemoved, this);
|
|
734
|
+
|
|
735
|
+
const prevGroupByFolder = this.#groupByFolder;
|
|
736
|
+
const prevGroupByDomain = this.#groupByDomain;
|
|
737
|
+
const prevGroupByAuthored = this.#groupByAuthored;
|
|
738
|
+
const prevJustMyCode = this.#prevJustMyCode;
|
|
739
|
+
this.#initGrouping();
|
|
740
|
+
const groupingChanged = prevGroupByFolder !== this.#groupByFolder || prevGroupByDomain !== this.#groupByDomain ||
|
|
741
|
+
prevGroupByAuthored !== this.#groupByAuthored || prevJustMyCode !== this.#prevJustMyCode;
|
|
742
|
+
if (groupingChanged || this.#needsRegroup) {
|
|
743
|
+
this.#needsRegroup = false;
|
|
744
|
+
this.#groupingChanged();
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
this.#resetWorkspace(this.#workspace);
|
|
749
|
+
|
|
750
|
+
const current = new Set(this.#workspace.uiSourceCodes());
|
|
751
|
+
const workspaceProjects = new Set(this.#workspace.projects());
|
|
752
|
+
const toRemove: Workspace.UISourceCode.UISourceCode[] = [];
|
|
753
|
+
for (const uiSourceCode of this.#uiSourceCodeNodes.keys()) {
|
|
754
|
+
if (!current.has(uiSourceCode) || !workspaceProjects.has(uiSourceCode.project()) ||
|
|
755
|
+
!this.#acceptsUISourceCode(uiSourceCode) ||
|
|
756
|
+
(this.#navigatorJustMyCodeSetting.get() &&
|
|
757
|
+
this.#ignoreListManager.isUserOrSourceMapIgnoreListedUISourceCode(uiSourceCode))) {
|
|
758
|
+
toRemove.push(uiSourceCode);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (toRemove.length > 0) {
|
|
762
|
+
this.#removeUISourceCodes(toRemove);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
const rootOrDeployed = this.#rootOrDeployedNode();
|
|
766
|
+
for (const child of [...rootOrDeployed.children()]) {
|
|
767
|
+
if (child instanceof NavigatorGroupTreeNode && child.project && !workspaceProjects.has(child.project)) {
|
|
768
|
+
this.removeProject(child.project);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
for (const uiSourceCode of current) {
|
|
773
|
+
if (!this.#uiSourceCodeNodes.has(uiSourceCode)) {
|
|
774
|
+
this.#addUISourceCode(uiSourceCode);
|
|
775
|
+
} else {
|
|
776
|
+
const frames = Bindings.NetworkProject.NetworkProject.framesForUISourceCode(uiSourceCode);
|
|
777
|
+
const desiredFrames =
|
|
778
|
+
new Set<SDK.ResourceTreeModel.ResourceTreeFrame|null>(frames.length > 0 ? frames : [null]);
|
|
779
|
+
for (const node of [...this.#uiSourceCodeNodes.get(uiSourceCode)]) {
|
|
780
|
+
if (!desiredFrames.has(node.frame())) {
|
|
781
|
+
this.#removeUISourceCodeNode(node);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
const existingFrames = new Set(Array.from(this.#uiSourceCodeNodes.get(uiSourceCode), node => node.frame()));
|
|
785
|
+
for (const frame of desiredFrames) {
|
|
786
|
+
if (!existingFrames.has(frame)) {
|
|
787
|
+
this.#addUISourceCodeNode(uiSourceCode, frame);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
if (this.#targetManager) {
|
|
794
|
+
const liveTargets = new Set(this.#targetManager.targets());
|
|
795
|
+
const scopeTarget = this.#targetManager.scopeTarget();
|
|
796
|
+
for (const child of [...rootOrDeployed.children()]) {
|
|
797
|
+
if (child.id.startsWith('target:')) {
|
|
798
|
+
const targetId = child.id.slice('target:'.length);
|
|
799
|
+
const target = this.#targetManager.targetById(targetId);
|
|
800
|
+
if (!target || !liveTargets.has(target) || target === scopeTarget) {
|
|
801
|
+
rootOrDeployed.removeChild(child);
|
|
802
|
+
} else {
|
|
803
|
+
child.setTitle(target.name());
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
this.rootNode.updateTitleRecursive();
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
#unsubscribe(): void {
|
|
813
|
+
if (!this.#subscribed) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
this.#subscribed = false;
|
|
817
|
+
|
|
818
|
+
this.#navigatorGroupByFolderSetting.removeChangeListener(this.#groupingChangedListener);
|
|
819
|
+
this.#navigatorJustMyCodeSetting.removeChangeListener(this.#groupingChangedListener);
|
|
820
|
+
if (this.#navigatorGroupByAuthoredSetting && this.#navigatorGroupByAuthoredChangeListener) {
|
|
821
|
+
this.#navigatorGroupByAuthoredSetting.removeChangeListener(this.#navigatorGroupByAuthoredChangeListener);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
this.#ignoreListManager.removeChangeListener(this.#ignoreListChangedListener);
|
|
825
|
+
|
|
826
|
+
this.#persistence.removeEventListener(Persistence.Persistence.Events.BindingCreated, this.#onBindingChanged, this);
|
|
827
|
+
this.#persistence.removeEventListener(Persistence.Persistence.Events.BindingRemoved, this.#onBindingChanged, this);
|
|
828
|
+
|
|
829
|
+
this.#networkPersistenceManager.removeEventListener(
|
|
830
|
+
Persistence.NetworkPersistenceManager.Events.REQUEST_FOR_HEADER_OVERRIDES_FILE_CHANGED,
|
|
831
|
+
this.#onRequestsForHeaderOverridesFileChanged, this);
|
|
832
|
+
|
|
833
|
+
this.#targetManager.removeEventListener(SDK.TargetManager.Events.NAME_CHANGED, this.#targetNameChanged, this);
|
|
834
|
+
this.#targetManager.unobserveTargets(this);
|
|
835
|
+
|
|
836
|
+
this.#networkProjectManager.removeEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_ADDED,
|
|
837
|
+
this.#frameAttributionAdded, this);
|
|
838
|
+
this.#networkProjectManager.removeEventListener(Bindings.NetworkProject.Events.FRAME_ATTRIBUTION_REMOVED,
|
|
839
|
+
this.#frameAttributionRemoved, this);
|
|
840
|
+
|
|
841
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.UISourceCodeAdded, this.#uiSourceCodeAddedCallback,
|
|
842
|
+
this);
|
|
843
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.UISourceCodeRemoved,
|
|
844
|
+
this.#uiSourceCodeRemovedCallback, this);
|
|
845
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectAdded, this.#projectAddedCallback, this);
|
|
846
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectRemoved, this.#projectRemovedCallback, this);
|
|
847
|
+
}
|
|
848
|
+
|
|
555
849
|
get enableAuthoredGrouping(): boolean {
|
|
556
850
|
return this.#enableAuthoredGrouping;
|
|
557
851
|
}
|
|
@@ -561,19 +855,26 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
561
855
|
return;
|
|
562
856
|
}
|
|
563
857
|
this.#enableAuthoredGrouping = enableAuthoredGrouping;
|
|
564
|
-
if (this
|
|
565
|
-
this
|
|
566
|
-
this
|
|
858
|
+
if (this.#navigatorGroupByAuthoredSetting && this.#navigatorGroupByAuthoredChangeListener) {
|
|
859
|
+
this.#navigatorGroupByAuthoredSetting.removeChangeListener(this.#navigatorGroupByAuthoredChangeListener);
|
|
860
|
+
this.#navigatorGroupByAuthoredSetting = undefined;
|
|
567
861
|
this.#navigatorGroupByAuthoredChangeListener = undefined;
|
|
568
862
|
}
|
|
569
863
|
if (enableAuthoredGrouping) {
|
|
570
|
-
this
|
|
571
|
-
SettingsUI.SourcesSettings.navigatorGroupByAuthoredSettingDescriptor);
|
|
572
|
-
this.#navigatorGroupByAuthoredChangeListener = this
|
|
573
|
-
|
|
864
|
+
this.#navigatorGroupByAuthoredSetting =
|
|
865
|
+
this.#settings.resolve(SettingsUI.SourcesSettings.navigatorGroupByAuthoredSettingDescriptor);
|
|
866
|
+
this.#navigatorGroupByAuthoredChangeListener = this.#groupingChanged.bind(this);
|
|
867
|
+
if (this.#subscribed) {
|
|
868
|
+
this.#navigatorGroupByAuthoredSetting.addChangeListener(this.#navigatorGroupByAuthoredChangeListener);
|
|
869
|
+
}
|
|
574
870
|
}
|
|
575
|
-
if (
|
|
576
|
-
this
|
|
871
|
+
if (Boolean(this.#groupByAuthored) !== Boolean(this.#navigatorGroupByAuthoredSetting?.get())) {
|
|
872
|
+
if (this.#subscribed) {
|
|
873
|
+
this.#initGrouping();
|
|
874
|
+
this.#groupingChanged();
|
|
875
|
+
} else {
|
|
876
|
+
this.#needsRegroup = true;
|
|
877
|
+
}
|
|
577
878
|
}
|
|
578
879
|
this.requestUpdate();
|
|
579
880
|
}
|
|
@@ -587,13 +888,15 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
587
888
|
return;
|
|
588
889
|
}
|
|
589
890
|
this.#projectFilter = projectFilter;
|
|
590
|
-
if (this.#
|
|
591
|
-
this
|
|
891
|
+
if (this.#subscribed) {
|
|
892
|
+
this.#groupingChanged();
|
|
893
|
+
} else {
|
|
894
|
+
this.#needsRegroup = true;
|
|
592
895
|
}
|
|
593
896
|
this.requestUpdate();
|
|
594
897
|
}
|
|
595
898
|
|
|
596
|
-
|
|
899
|
+
static #nodeOrder(node: NavigatorTreeNode): number {
|
|
597
900
|
if (node.boostOrder) {
|
|
598
901
|
return 0;
|
|
599
902
|
}
|
|
@@ -616,8 +919,8 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
616
919
|
}
|
|
617
920
|
|
|
618
921
|
static compareNodes(node1: NavigatorTreeNode, node2: NavigatorTreeNode): number {
|
|
619
|
-
const order1 = NavigatorView
|
|
620
|
-
const order2 = NavigatorView
|
|
922
|
+
const order1 = NavigatorView.#nodeOrder(node1);
|
|
923
|
+
const order2 = NavigatorView.#nodeOrder(node2);
|
|
621
924
|
|
|
622
925
|
if (order1 > order2) {
|
|
623
926
|
return 1;
|
|
@@ -636,46 +939,37 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
636
939
|
{jslogContext: path ? 'search-in-folder' : 'search-in-all-files'});
|
|
637
940
|
}
|
|
638
941
|
|
|
639
|
-
private treeElementsCompare(treeElement1: UI.TreeOutline.TreeElement,
|
|
640
|
-
treeElement2: UI.TreeOutline.TreeElement): number {
|
|
641
|
-
const node1 = this.nodeForTreeElement(treeElement1);
|
|
642
|
-
const node2 = this.nodeForTreeElement(treeElement2);
|
|
643
|
-
if (node1 && node2) {
|
|
644
|
-
const order1 = NavigatorView.nodeOrder(node1);
|
|
645
|
-
const order2 = NavigatorView.nodeOrder(node2);
|
|
646
|
-
if (order1 !== order2) {
|
|
647
|
-
return order1 > order2 ? 1 : -1;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
return Platform.StringUtilities.naturalOrderComparator(treeElement1.titleAsText(), treeElement2.titleAsText());
|
|
651
|
-
}
|
|
652
|
-
|
|
653
942
|
override performUpdate(): void {
|
|
654
|
-
|
|
655
|
-
this.#initialized = true;
|
|
656
|
-
this.initGrouping();
|
|
657
|
-
this.resetWorkspace(this.#workspace);
|
|
658
|
-
this.#workspace.uiSourceCodes().forEach(this.addUISourceCode.bind(this));
|
|
659
|
-
}
|
|
943
|
+
const nodes = this.rootNode.effectiveChildren();
|
|
660
944
|
this.#view({
|
|
661
|
-
|
|
662
|
-
|
|
945
|
+
nodes,
|
|
946
|
+
expandedNodes: this.#expandedNodes,
|
|
947
|
+
selectedNode: this.#selectedNode,
|
|
948
|
+
onExpand: this.#onExpand.bind(this),
|
|
949
|
+
onSelect: this.#onSelect.bind(this),
|
|
950
|
+
onDoubleClick: this.#onDoubleClick.bind(this),
|
|
951
|
+
onContextMenu: this.#onContextMenu.bind(this),
|
|
952
|
+
onHover: this.#onHover.bind(this),
|
|
953
|
+
onMouseDown: this.#onMouseDown.bind(this),
|
|
954
|
+
onSelectSource: this.sourceSelected.bind(this),
|
|
955
|
+
onCommitRename: this.#onCommitRename.bind(this),
|
|
956
|
+
onCancelRename: this.#onCancelRename.bind(this),
|
|
957
|
+
showTree: nodes.length > 0,
|
|
663
958
|
},
|
|
664
959
|
undefined, this.contentElement);
|
|
665
960
|
}
|
|
666
961
|
|
|
667
|
-
|
|
668
|
-
void {
|
|
962
|
+
#onBindingChanged(event: Common.EventTarget.EventTargetEvent<Persistence.Persistence.PersistenceBinding>): void {
|
|
669
963
|
const binding = event.data;
|
|
670
964
|
|
|
671
965
|
let isFromSourceMap = false;
|
|
672
966
|
// Update UISourceCode titles.
|
|
673
|
-
const networkNodes = this
|
|
967
|
+
const networkNodes = this.#uiSourceCodeNodes.get(binding.network);
|
|
674
968
|
for (const networkNode of networkNodes) {
|
|
675
969
|
networkNode.updateTitle();
|
|
676
970
|
isFromSourceMap ||= networkNode.uiSourceCode().contentType().isFromSourceMap();
|
|
677
971
|
}
|
|
678
|
-
const fileSystemNodes = this
|
|
972
|
+
const fileSystemNodes = this.#uiSourceCodeNodes.get(binding.fileSystem);
|
|
679
973
|
for (const fileSystemNode of fileSystemNodes) {
|
|
680
974
|
fileSystemNode.updateTitle();
|
|
681
975
|
isFromSourceMap ||= fileSystemNode.uiSourceCode().contentType().isFromSourceMap();
|
|
@@ -687,9 +981,9 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
687
981
|
let folderPath = Platform.DevToolsPath.EmptyEncodedPathString;
|
|
688
982
|
for (let i = 0; i < pathTokens.length - 1; ++i) {
|
|
689
983
|
folderPath = Common.ParsedURL.ParsedURL.concatenate(folderPath, pathTokens[i]);
|
|
690
|
-
const folderId = this
|
|
691
|
-
|
|
692
|
-
const folderNode = this
|
|
984
|
+
const folderId = this.#folderNodeId(binding.fileSystem.project(), null, null, binding.fileSystem.origin(),
|
|
985
|
+
isFromSourceMap, folderPath);
|
|
986
|
+
const folderNode = this.#subfolderNodes.get(folderId);
|
|
693
987
|
if (folderNode) {
|
|
694
988
|
folderNode.updateTitle();
|
|
695
989
|
}
|
|
@@ -697,7 +991,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
697
991
|
}
|
|
698
992
|
|
|
699
993
|
// Update fileSystem root title.
|
|
700
|
-
const fileSystemRoot = this
|
|
994
|
+
const fileSystemRoot = this.#rootOrDeployedNode().child(binding.fileSystem.project().id());
|
|
701
995
|
if (fileSystemRoot) {
|
|
702
996
|
fileSystemRoot.updateTitle();
|
|
703
997
|
}
|
|
@@ -706,120 +1000,172 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
706
1000
|
#onRequestsForHeaderOverridesFileChanged(
|
|
707
1001
|
event: Common.EventTarget.EventTargetEvent<Workspace.UISourceCode.UISourceCode>): void {
|
|
708
1002
|
const headersFileUiSourceCode = event.data;
|
|
709
|
-
const networkNodes = this
|
|
1003
|
+
const networkNodes = this.#uiSourceCodeNodes.get(headersFileUiSourceCode);
|
|
710
1004
|
for (const networkNode of networkNodes) {
|
|
711
1005
|
networkNode.updateTitle();
|
|
712
1006
|
}
|
|
713
1007
|
}
|
|
714
1008
|
|
|
715
|
-
|
|
716
|
-
this
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
selectNode(node: NavigatorTreeNode, omitFocus?: boolean, selectedByUser?: boolean): void {
|
|
720
|
-
node.treeNode().select(omitFocus, selectedByUser);
|
|
1009
|
+
selectNode(node: NavigatorTreeNode): void {
|
|
1010
|
+
this.#selectedNode = node;
|
|
1011
|
+
this.requestUpdate();
|
|
721
1012
|
}
|
|
722
1013
|
|
|
723
1014
|
expandNode(node: NavigatorTreeNode): void {
|
|
724
|
-
node.
|
|
1015
|
+
const leaf = node instanceof NavigatorFolderTreeNode ? node.mergedLeafNode() : node;
|
|
1016
|
+
this.#expandedNodes.add(node);
|
|
1017
|
+
this.#expandedNodes.add(leaf);
|
|
1018
|
+
node.populate();
|
|
1019
|
+
leaf.populate();
|
|
1020
|
+
this.requestUpdate();
|
|
725
1021
|
}
|
|
726
1022
|
|
|
727
1023
|
collapseNode(node: NavigatorTreeNode): void {
|
|
728
|
-
node.
|
|
1024
|
+
const leaf = node instanceof NavigatorFolderTreeNode ? node.mergedLeafNode() : node;
|
|
1025
|
+
this.#expandedNodes.delete(node);
|
|
1026
|
+
this.#expandedNodes.delete(leaf);
|
|
1027
|
+
this.requestUpdate();
|
|
729
1028
|
}
|
|
730
1029
|
|
|
731
1030
|
isNodeExpanded(node: NavigatorTreeNode): boolean {
|
|
732
|
-
return this
|
|
1031
|
+
return this.#expandedNodes.has(node);
|
|
733
1032
|
}
|
|
734
1033
|
|
|
735
1034
|
isNodeSelected(node: NavigatorTreeNode): boolean {
|
|
736
|
-
return this
|
|
1035
|
+
return this.#selectedNode === node;
|
|
737
1036
|
}
|
|
738
1037
|
|
|
739
1038
|
setNodeSelected(node: NavigatorTreeNode): void {
|
|
740
|
-
this
|
|
1039
|
+
this.#selectedNode = node;
|
|
741
1040
|
}
|
|
742
1041
|
|
|
743
1042
|
setNodeExpanded(node: NavigatorTreeNode): void {
|
|
744
|
-
this
|
|
1043
|
+
this.#expandedNodes.add(node);
|
|
745
1044
|
}
|
|
746
1045
|
|
|
747
|
-
|
|
748
|
-
this
|
|
749
|
-
|
|
750
|
-
node
|
|
751
|
-
|
|
1046
|
+
isNodeSelectedOrDescendant(node: NavigatorTreeNode): boolean {
|
|
1047
|
+
let curr: NavigatorTreeNode|null = this.#selectedNode;
|
|
1048
|
+
while (curr) {
|
|
1049
|
+
if (curr === node) {
|
|
1050
|
+
return true;
|
|
1051
|
+
}
|
|
1052
|
+
curr = curr.parent;
|
|
752
1053
|
}
|
|
753
|
-
|
|
754
|
-
|
|
1054
|
+
return false;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
deselectIfDescendant(node: NavigatorTreeNode): void {
|
|
1058
|
+
if (this.isNodeSelectedOrDescendant(node)) {
|
|
1059
|
+
this.#selectedNode = null;
|
|
755
1060
|
}
|
|
756
|
-
|
|
757
|
-
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
#onExpand(node: NavigatorTreeNode, expanded: boolean): void {
|
|
1064
|
+
const leaf = node instanceof NavigatorFolderTreeNode ? node.mergedLeafNode() : node;
|
|
1065
|
+
if (expanded) {
|
|
1066
|
+
this.#expandedNodes.add(node);
|
|
1067
|
+
this.#expandedNodes.add(leaf);
|
|
1068
|
+
node.populate();
|
|
1069
|
+
leaf.populate();
|
|
1070
|
+
} else {
|
|
1071
|
+
this.#expandedNodes.delete(node);
|
|
1072
|
+
this.#expandedNodes.delete(leaf);
|
|
758
1073
|
}
|
|
1074
|
+
this.requestUpdate();
|
|
759
1075
|
}
|
|
760
1076
|
|
|
761
|
-
|
|
762
|
-
|
|
1077
|
+
#onSelect(node: NavigatorTreeNode, selectedByUser?: boolean): void {
|
|
1078
|
+
if (!selectedByUser && this.#selectedNode !== null) {
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
if (node instanceof NavigatorFolderTreeNode) {
|
|
1082
|
+
this.#selectedNode = node.mergedLeafNode();
|
|
1083
|
+
} else {
|
|
1084
|
+
this.#selectedNode = node;
|
|
1085
|
+
}
|
|
763
1086
|
}
|
|
764
1087
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
appendChild(parent: UI.TreeOutline.TreeElement, child: UI.TreeOutline.TreeElement): void {
|
|
770
|
-
this.scriptsTree.setFocusable(true);
|
|
771
|
-
parent.appendChild(child);
|
|
1088
|
+
#onDoubleClick(node: NavigatorTreeNode, middleClick: boolean): void {
|
|
1089
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
1090
|
+
this.sourceSelected(node.uiSourceCode(), !middleClick);
|
|
1091
|
+
}
|
|
772
1092
|
}
|
|
773
1093
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
1094
|
+
#onContextMenu(node: NavigatorTreeNode, contextMenu: UI.ContextMenu.ContextMenu): void {
|
|
1095
|
+
this.selectNode(node);
|
|
1096
|
+
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
1097
|
+
this.handleFileContextMenu(contextMenu, node);
|
|
1098
|
+
} else if (node instanceof NavigatorFolderTreeNode || node instanceof NavigatorGroupTreeNode) {
|
|
1099
|
+
this.handleFolderContextMenu(contextMenu, node);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
#onHover(node: NavigatorTreeNode, hovered: boolean): void {
|
|
1104
|
+
if (node instanceof NavigatorFolderTreeNode || node instanceof NavigatorGroupTreeNode) {
|
|
1105
|
+
this.folderHovered(node, hovered);
|
|
782
1106
|
}
|
|
783
|
-
|
|
784
|
-
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
#onMouseDown(node: NavigatorTreeNode): void {
|
|
1110
|
+
if (!(node instanceof NavigatorUISourceCodeTreeNode)) {
|
|
1111
|
+
return;
|
|
785
1112
|
}
|
|
1113
|
+
if (!this.shouldRenameOnMouseDown(node)) {
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
setTimeout(() => {
|
|
1117
|
+
if (this.shouldRenameOnMouseDown(node)) {
|
|
1118
|
+
this.rename(node, false);
|
|
1119
|
+
}
|
|
1120
|
+
}, 300);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
#onCommitRename(node: NavigatorUISourceCodeTreeNode, newTitle: string): void {
|
|
1124
|
+
void node.commitRename(newTitle);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
#onCancelRename(node: NavigatorUISourceCodeTreeNode): void {
|
|
1128
|
+
node.cancelRename();
|
|
786
1129
|
}
|
|
787
1130
|
|
|
788
|
-
|
|
1131
|
+
#resetWorkspace(workspace: Workspace.Workspace.WorkspaceImpl): void {
|
|
789
1132
|
// Clear old event listeners first.
|
|
790
|
-
if (this.#workspace) {
|
|
791
|
-
this.#workspace.removeEventListener(
|
|
792
|
-
|
|
793
|
-
this.#workspace.removeEventListener(
|
|
794
|
-
|
|
795
|
-
this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectAdded, this
|
|
796
|
-
this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectRemoved, this
|
|
1133
|
+
if (this.#subscribed && this.#workspace) {
|
|
1134
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.UISourceCodeAdded, this.#uiSourceCodeAddedCallback,
|
|
1135
|
+
this);
|
|
1136
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.UISourceCodeRemoved,
|
|
1137
|
+
this.#uiSourceCodeRemovedCallback, this);
|
|
1138
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectAdded, this.#projectAddedCallback, this);
|
|
1139
|
+
this.#workspace.removeEventListener(Workspace.Workspace.Events.ProjectRemoved, this.#projectRemovedCallback,
|
|
1140
|
+
this);
|
|
797
1141
|
}
|
|
798
1142
|
|
|
799
1143
|
this.#workspace = workspace;
|
|
800
|
-
this.#
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
1144
|
+
if (this.#subscribed) {
|
|
1145
|
+
this.#workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdded, this.#uiSourceCodeAddedCallback,
|
|
1146
|
+
this);
|
|
1147
|
+
this.#workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeRemoved,
|
|
1148
|
+
this.#uiSourceCodeRemovedCallback, this);
|
|
1149
|
+
this.#workspace.addEventListener(Workspace.Workspace.Events.ProjectAdded, this.#projectAddedCallback, this);
|
|
1150
|
+
this.#workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved, this.#projectRemovedCallback, this);
|
|
1151
|
+
}
|
|
1152
|
+
this.#workspace.projects().forEach(this.#projectAdded.bind(this));
|
|
1153
|
+
this.#computeUniqueFileSystemProjectNames();
|
|
808
1154
|
}
|
|
809
1155
|
|
|
810
|
-
|
|
1156
|
+
#projectAddedCallback(event: Common.EventTarget.EventTargetEvent<Workspace.Workspace.Project>): void {
|
|
811
1157
|
const project = event.data;
|
|
812
|
-
this
|
|
1158
|
+
this.#projectAdded(project);
|
|
813
1159
|
if (project.type() === Workspace.Workspace.projectTypes.FileSystem) {
|
|
814
|
-
this
|
|
1160
|
+
this.#computeUniqueFileSystemProjectNames();
|
|
815
1161
|
}
|
|
816
1162
|
}
|
|
817
1163
|
|
|
818
|
-
|
|
1164
|
+
#projectRemovedCallback(event: Common.EventTarget.EventTargetEvent<Workspace.Workspace.Project>): void {
|
|
819
1165
|
const project = event.data;
|
|
820
1166
|
this.removeProject(project);
|
|
821
1167
|
if (project.type() === Workspace.Workspace.projectTypes.FileSystem) {
|
|
822
|
-
this
|
|
1168
|
+
this.#computeUniqueFileSystemProjectNames();
|
|
823
1169
|
}
|
|
824
1170
|
}
|
|
825
1171
|
|
|
@@ -830,44 +1176,43 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
830
1176
|
return !project.isServiceProject();
|
|
831
1177
|
}
|
|
832
1178
|
|
|
833
|
-
|
|
834
|
-
|
|
1179
|
+
#frameAttributionAdded(event: Common.EventTarget.EventTargetEvent<Bindings.NetworkProject.FrameAttributionEvent>):
|
|
1180
|
+
void {
|
|
835
1181
|
const {uiSourceCode} = event.data;
|
|
836
|
-
if (!this
|
|
1182
|
+
if (!this.#acceptsUISourceCode(uiSourceCode)) {
|
|
837
1183
|
return;
|
|
838
1184
|
}
|
|
839
1185
|
|
|
840
1186
|
const addedFrame = (event.data.frame as SDK.ResourceTreeModel.ResourceTreeFrame | null);
|
|
841
1187
|
// This event does not happen for UISourceCodes without initial attribution.
|
|
842
|
-
this
|
|
1188
|
+
this.#addUISourceCodeNode(uiSourceCode, addedFrame);
|
|
843
1189
|
}
|
|
844
1190
|
|
|
845
|
-
|
|
846
|
-
|
|
1191
|
+
#frameAttributionRemoved(event: Common.EventTarget.EventTargetEvent<Bindings.NetworkProject.FrameAttributionEvent>):
|
|
1192
|
+
void {
|
|
847
1193
|
const {uiSourceCode} = event.data;
|
|
848
|
-
if (!this
|
|
1194
|
+
if (!this.#acceptsUISourceCode(uiSourceCode)) {
|
|
849
1195
|
return;
|
|
850
1196
|
}
|
|
851
1197
|
|
|
852
1198
|
const removedFrame = (event.data.frame as SDK.ResourceTreeModel.ResourceTreeFrame | null);
|
|
853
|
-
const node = Array.from(this
|
|
1199
|
+
const node = Array.from(this.#uiSourceCodeNodes.get(uiSourceCode)).find(node => node.frame() === removedFrame);
|
|
854
1200
|
if (node) {
|
|
855
|
-
this
|
|
1201
|
+
this.#removeUISourceCodeNode(node);
|
|
856
1202
|
}
|
|
857
1203
|
}
|
|
858
1204
|
|
|
859
|
-
|
|
1205
|
+
#acceptsUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): boolean {
|
|
860
1206
|
return this.acceptProject(uiSourceCode.project());
|
|
861
1207
|
}
|
|
862
1208
|
|
|
863
|
-
|
|
864
|
-
if (this
|
|
865
|
-
|
|
866
|
-
uiSourceCode)) {
|
|
1209
|
+
#addUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): void {
|
|
1210
|
+
if (this.#navigatorJustMyCodeSetting.get() &&
|
|
1211
|
+
this.#ignoreListManager.isUserOrSourceMapIgnoreListedUISourceCode(uiSourceCode)) {
|
|
867
1212
|
return;
|
|
868
1213
|
}
|
|
869
1214
|
|
|
870
|
-
if (!this
|
|
1215
|
+
if (!this.#acceptsUISourceCode(uiSourceCode)) {
|
|
871
1216
|
return;
|
|
872
1217
|
}
|
|
873
1218
|
|
|
@@ -878,16 +1223,16 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
878
1223
|
const frames = Bindings.NetworkProject.NetworkProject.framesForUISourceCode(uiSourceCode);
|
|
879
1224
|
if (frames.length) {
|
|
880
1225
|
for (const frame of frames) {
|
|
881
|
-
this
|
|
1226
|
+
this.#addUISourceCodeNode(uiSourceCode, frame);
|
|
882
1227
|
}
|
|
883
1228
|
} else {
|
|
884
|
-
this
|
|
1229
|
+
this.#addUISourceCodeNode(uiSourceCode, null);
|
|
885
1230
|
}
|
|
886
1231
|
this.dispatchEventToListeners(Events.UI_SOURCE_CODE_ADDED, uiSourceCode);
|
|
887
1232
|
}
|
|
888
1233
|
|
|
889
|
-
|
|
890
|
-
|
|
1234
|
+
#addUISourceCodeNode(uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
1235
|
+
frame: SDK.ResourceTreeModel.ResourceTreeFrame|null): void {
|
|
891
1236
|
const isFromSourceMap = uiSourceCode.contentType().isFromSourceMap();
|
|
892
1237
|
let path;
|
|
893
1238
|
if (uiSourceCode.project().type() === Workspace.Workspace.projectTypes.FileSystem) {
|
|
@@ -900,39 +1245,37 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
900
1245
|
const project = uiSourceCode.project();
|
|
901
1246
|
const target = Bindings.NetworkProject.NetworkProject.targetForUISourceCode(uiSourceCode);
|
|
902
1247
|
const folderNode =
|
|
903
|
-
this
|
|
1248
|
+
this.#folderNode(uiSourceCode, project, target, frame, uiSourceCode.origin(), path, isFromSourceMap);
|
|
904
1249
|
const uiSourceCodeNode = new NavigatorUISourceCodeTreeNode(this, uiSourceCode, frame);
|
|
905
1250
|
const existingNode = folderNode.child(uiSourceCodeNode.id);
|
|
906
1251
|
if (existingNode && existingNode instanceof NavigatorUISourceCodeTreeNode) {
|
|
907
|
-
this
|
|
1252
|
+
this.#uiSourceCodeNodes.set(uiSourceCode, existingNode);
|
|
908
1253
|
} else {
|
|
909
1254
|
folderNode.appendChild(uiSourceCodeNode);
|
|
910
|
-
this
|
|
1255
|
+
this.#uiSourceCodeNodes.set(uiSourceCode, uiSourceCodeNode);
|
|
911
1256
|
uiSourceCodeNode.updateTitleBubbleUp();
|
|
912
1257
|
}
|
|
913
|
-
this
|
|
1258
|
+
this.#selectDefaultTreeNode();
|
|
914
1259
|
}
|
|
915
1260
|
|
|
916
|
-
|
|
917
|
-
void {
|
|
1261
|
+
#uiSourceCodeAddedCallback(event: Common.EventTarget.EventTargetEvent<Workspace.UISourceCode.UISourceCode>): void {
|
|
918
1262
|
const uiSourceCode = event.data;
|
|
919
|
-
this
|
|
1263
|
+
this.#addUISourceCode(uiSourceCode);
|
|
920
1264
|
}
|
|
921
1265
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
this.removeUISourceCodes([event.data]);
|
|
1266
|
+
#uiSourceCodeRemovedCallback(event: Common.EventTarget.EventTargetEvent<Workspace.UISourceCode.UISourceCode>): void {
|
|
1267
|
+
this.#removeUISourceCodes([event.data]);
|
|
925
1268
|
}
|
|
926
1269
|
|
|
927
1270
|
tryAddProject(project: Workspace.Workspace.Project): void {
|
|
928
|
-
this
|
|
1271
|
+
this.#projectAdded(project);
|
|
929
1272
|
for (const uiSourceCode of project.uiSourceCodes()) {
|
|
930
|
-
this
|
|
1273
|
+
this.#addUISourceCode(uiSourceCode);
|
|
931
1274
|
}
|
|
932
1275
|
}
|
|
933
1276
|
|
|
934
|
-
|
|
935
|
-
const rootOrDeployed = this
|
|
1277
|
+
#projectAdded(project: Workspace.Workspace.Project): void {
|
|
1278
|
+
const rootOrDeployed = this.#rootOrDeployedNode();
|
|
936
1279
|
const FILE_SYSTEM_TYPES = [
|
|
937
1280
|
Workspace.Workspace.projectTypes.ConnectableFileSystem,
|
|
938
1281
|
Workspace.Workspace.projectTypes.FileSystem,
|
|
@@ -947,18 +1290,17 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
947
1290
|
Types.AutomaticFileSystem :
|
|
948
1291
|
Types.FileSystem;
|
|
949
1292
|
rootOrDeployed.appendChild(new NavigatorGroupTreeNode(this, project, project.id(), type, project.displayName()));
|
|
950
|
-
this
|
|
1293
|
+
this.#selectDefaultTreeNode();
|
|
951
1294
|
}
|
|
952
1295
|
|
|
953
|
-
|
|
954
|
-
private selectDefaultTreeNode(): void {
|
|
1296
|
+
#selectDefaultTreeNode(): void {
|
|
955
1297
|
const children = this.rootNode.children();
|
|
956
|
-
if (children.length && !this
|
|
957
|
-
this.selectNode(children[0]
|
|
1298
|
+
if (children.length && !this.#selectedNode) {
|
|
1299
|
+
this.selectNode(children[0]);
|
|
958
1300
|
}
|
|
959
1301
|
}
|
|
960
1302
|
|
|
961
|
-
|
|
1303
|
+
#computeUniqueFileSystemProjectNames(): void {
|
|
962
1304
|
const fileSystemProjects = this.#workspace.projectsForType(Workspace.Workspace.projectTypes.FileSystem);
|
|
963
1305
|
if (!fileSystemProjects.length) {
|
|
964
1306
|
return;
|
|
@@ -973,7 +1315,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
973
1315
|
reversedIndex.add(reversedPathParts);
|
|
974
1316
|
}
|
|
975
1317
|
|
|
976
|
-
const rootOrDeployed = this
|
|
1318
|
+
const rootOrDeployed = this.#rootOrDeployedNode();
|
|
977
1319
|
|
|
978
1320
|
for (let i = 0; i < fileSystemProjects.length; ++i) {
|
|
979
1321
|
const reversedPath = reversedPaths[i];
|
|
@@ -993,26 +1335,22 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
993
1335
|
}
|
|
994
1336
|
|
|
995
1337
|
removeProject(project: Workspace.Workspace.Project): void {
|
|
996
|
-
this
|
|
1338
|
+
this.#removeUISourceCodes(project.uiSourceCodes());
|
|
997
1339
|
if (project.type() !== Workspace.Workspace.projectTypes.ConnectableFileSystem &&
|
|
998
1340
|
project.type() !== Workspace.Workspace.projectTypes.FileSystem) {
|
|
999
1341
|
return;
|
|
1000
1342
|
}
|
|
1001
|
-
const fileSystemNode = this.rootNode.child(project.id());
|
|
1002
|
-
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
this.rootNode.removeChild(fileSystemNode);
|
|
1343
|
+
const fileSystemNode = this.#rootOrDeployedNode().child(project.id()) ?? this.rootNode.child(project.id());
|
|
1344
|
+
fileSystemNode?.parent?.removeChild(fileSystemNode);
|
|
1006
1345
|
}
|
|
1007
1346
|
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
path: Platform.DevToolsPath.EncodedPathString): string {
|
|
1347
|
+
#folderNodeId(project: Workspace.Workspace.Project, target: SDK.Target.Target|null,
|
|
1348
|
+
frame: SDK.ResourceTreeModel.ResourceTreeFrame|null, projectOrigin: string, isFromSourceMap: boolean,
|
|
1349
|
+
path: Platform.DevToolsPath.EncodedPathString): string {
|
|
1012
1350
|
const projectId = project.type() === Workspace.Workspace.projectTypes.FileSystem ? project.id() : '';
|
|
1013
|
-
let targetId = target && !(this
|
|
1014
|
-
let frameId = this
|
|
1015
|
-
if (this
|
|
1351
|
+
let targetId = target && !(this.#groupByAuthored && isFromSourceMap) ? target.id() : '';
|
|
1352
|
+
let frameId = this.#groupByFrame && frame ? frame.id : '';
|
|
1353
|
+
if (this.#groupByAuthored) {
|
|
1016
1354
|
if (isFromSourceMap) {
|
|
1017
1355
|
targetId = 'Authored';
|
|
1018
1356
|
frameId = '';
|
|
@@ -1023,35 +1361,34 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1023
1361
|
return targetId + ':' + projectId + ':' + frameId + ':' + projectOrigin + ':' + path;
|
|
1024
1362
|
}
|
|
1025
1363
|
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
fromSourceMap: boolean): NavigatorTreeNode {
|
|
1364
|
+
#folderNode(uiSourceCode: Workspace.UISourceCode.UISourceCode, project: Workspace.Workspace.Project,
|
|
1365
|
+
target: SDK.Target.Target|null, frame: SDK.ResourceTreeModel.ResourceTreeFrame|null,
|
|
1366
|
+
projectOrigin: Platform.DevToolsPath.UrlString, path: Platform.DevToolsPath.EncodedPathString[],
|
|
1367
|
+
fromSourceMap: boolean): NavigatorTreeNode {
|
|
1031
1368
|
if (Snippets.ScriptSnippetFileSystem.isSnippetsUISourceCode(uiSourceCode)) {
|
|
1032
1369
|
return this.rootNode;
|
|
1033
1370
|
}
|
|
1034
1371
|
|
|
1035
|
-
if (target && !this
|
|
1036
|
-
return this
|
|
1372
|
+
if (target && !this.#groupByFolder && !fromSourceMap) {
|
|
1373
|
+
return this.#domainNode(uiSourceCode, project, target, frame, projectOrigin);
|
|
1037
1374
|
}
|
|
1038
1375
|
|
|
1039
1376
|
const folderPath = Common.ParsedURL.ParsedURL.join(path, '/');
|
|
1040
|
-
const folderId = this
|
|
1041
|
-
let folderNode = this
|
|
1377
|
+
const folderId = this.#folderNodeId(project, target, frame, projectOrigin, fromSourceMap, folderPath);
|
|
1378
|
+
let folderNode = this.#subfolderNodes.get(folderId);
|
|
1042
1379
|
if (folderNode) {
|
|
1043
1380
|
return folderNode;
|
|
1044
1381
|
}
|
|
1045
1382
|
|
|
1046
1383
|
if (!path.length) {
|
|
1047
1384
|
if (target) {
|
|
1048
|
-
return this
|
|
1385
|
+
return this.#domainNode(uiSourceCode, project, target, frame, projectOrigin);
|
|
1049
1386
|
}
|
|
1050
|
-
return this
|
|
1387
|
+
return this.#rootOrDeployedNode().child(project.id()) as NavigatorTreeNode;
|
|
1051
1388
|
}
|
|
1052
1389
|
|
|
1053
1390
|
const parentNode =
|
|
1054
|
-
this
|
|
1391
|
+
this.#folderNode(uiSourceCode, project, target, frame, projectOrigin, path.slice(0, -1), fromSourceMap);
|
|
1055
1392
|
let type: string = Types.NetworkFolder;
|
|
1056
1393
|
if (project.type() === Workspace.Workspace.projectTypes.FileSystem) {
|
|
1057
1394
|
type = Types.FileSystemFolder;
|
|
@@ -1059,18 +1396,17 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1059
1396
|
const name = Common.ParsedURL.ParsedURL.encodedPathToRawPathString(path[path.length - 1]);
|
|
1060
1397
|
|
|
1061
1398
|
folderNode = new NavigatorFolderTreeNode(this, project, folderId, type, folderPath, name, projectOrigin);
|
|
1062
|
-
this
|
|
1399
|
+
this.#subfolderNodes.set(folderId, folderNode);
|
|
1063
1400
|
parentNode.appendChild(folderNode);
|
|
1064
1401
|
return folderNode;
|
|
1065
1402
|
}
|
|
1066
1403
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
projectOrigin: string): NavigatorTreeNode {
|
|
1404
|
+
#domainNode(uiSourceCode: Workspace.UISourceCode.UISourceCode, project: Workspace.Workspace.Project,
|
|
1405
|
+
target: SDK.Target.Target, frame: SDK.ResourceTreeModel.ResourceTreeFrame|null,
|
|
1406
|
+
projectOrigin: string): NavigatorTreeNode {
|
|
1071
1407
|
const isAuthored = uiSourceCode.contentType().isFromSourceMap();
|
|
1072
|
-
const frameNode = this
|
|
1073
|
-
if (!this
|
|
1408
|
+
const frameNode = this.#frameNode(project, target, frame, isAuthored);
|
|
1409
|
+
if (!this.#groupByDomain) {
|
|
1074
1410
|
return frameNode;
|
|
1075
1411
|
}
|
|
1076
1412
|
let domainNode = frameNode.child(projectOrigin);
|
|
@@ -1078,39 +1414,38 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1078
1414
|
return domainNode;
|
|
1079
1415
|
}
|
|
1080
1416
|
|
|
1081
|
-
domainNode = new NavigatorGroupTreeNode(
|
|
1082
|
-
|
|
1417
|
+
domainNode = new NavigatorGroupTreeNode(this, project, projectOrigin, Types.Domain,
|
|
1418
|
+
this.#computeProjectDisplayName(target, projectOrigin));
|
|
1083
1419
|
if (frame && projectOrigin === Common.ParsedURL.ParsedURL.extractOrigin(frame.url)) {
|
|
1084
1420
|
domainNode.boostOrder = true;
|
|
1085
1421
|
}
|
|
1086
1422
|
frameNode.appendChild(domainNode);
|
|
1087
|
-
if (isAuthored && this
|
|
1423
|
+
if (isAuthored && this.#groupByAuthored) {
|
|
1088
1424
|
this.expandNode(domainNode);
|
|
1089
1425
|
}
|
|
1090
1426
|
return domainNode;
|
|
1091
1427
|
}
|
|
1092
1428
|
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
return this.targetNode(project, target, isAuthored);
|
|
1429
|
+
#frameNode(project: Workspace.Workspace.Project, target: SDK.Target.Target,
|
|
1430
|
+
frame: SDK.ResourceTreeModel.ResourceTreeFrame|null, isAuthored: boolean): NavigatorTreeNode {
|
|
1431
|
+
if (!this.#groupByFrame || !frame || (this.#groupByAuthored && isAuthored)) {
|
|
1432
|
+
return this.#targetNode(project, target, isAuthored);
|
|
1098
1433
|
}
|
|
1099
1434
|
|
|
1100
|
-
let frameNode = this
|
|
1435
|
+
let frameNode = this.#frameNodes.get(frame);
|
|
1101
1436
|
if (frameNode) {
|
|
1102
1437
|
return frameNode;
|
|
1103
1438
|
}
|
|
1104
1439
|
|
|
1105
1440
|
frameNode = new NavigatorGroupTreeNode(this, project, target.id() + ':' + frame.id, Types.Frame,
|
|
1106
1441
|
frame.displayName(), undefined, frame);
|
|
1107
|
-
this
|
|
1442
|
+
this.#frameNodes.set(frame, frameNode);
|
|
1108
1443
|
|
|
1109
1444
|
const parentFrame = frame.parentFrame();
|
|
1110
1445
|
if (!parentFrame) {
|
|
1111
1446
|
frameNode.boostOrder = true;
|
|
1112
1447
|
}
|
|
1113
|
-
this
|
|
1448
|
+
this.#frameNode(project, parentFrame ? parentFrame.resourceTreeModel().target() : target, parentFrame, isAuthored)
|
|
1114
1449
|
.appendChild(frameNode);
|
|
1115
1450
|
if (!parentFrame) {
|
|
1116
1451
|
this.expandNode(frameNode);
|
|
@@ -1118,21 +1453,20 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1118
1453
|
return frameNode;
|
|
1119
1454
|
}
|
|
1120
1455
|
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
this.
|
|
1129
|
-
this.expandNode(this.authoredNode);
|
|
1456
|
+
#targetNode(project: Workspace.Workspace.Project, target: SDK.Target.Target, isAuthored: boolean): NavigatorTreeNode {
|
|
1457
|
+
if (this.#groupByAuthored && isAuthored) {
|
|
1458
|
+
if (!this.#authoredNode) {
|
|
1459
|
+
this.#authoredNode =
|
|
1460
|
+
new NavigatorGroupTreeNode(this, null, 'group:Authored', Types.Authored, i18nString(UIStrings.authored),
|
|
1461
|
+
i18nString(UIStrings.authoredTooltip));
|
|
1462
|
+
this.rootNode.appendChild(this.#authoredNode);
|
|
1463
|
+
this.expandNode(this.#authoredNode);
|
|
1130
1464
|
}
|
|
1131
|
-
return this
|
|
1465
|
+
return this.#authoredNode;
|
|
1132
1466
|
}
|
|
1133
1467
|
|
|
1134
|
-
const rootOrDeployed = this
|
|
1135
|
-
if (target ===
|
|
1468
|
+
const rootOrDeployed = this.#rootOrDeployedNode();
|
|
1469
|
+
if (target === this.#targetManager.scopeTarget()) {
|
|
1136
1470
|
return rootOrDeployed;
|
|
1137
1471
|
}
|
|
1138
1472
|
|
|
@@ -1146,20 +1480,20 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1146
1480
|
return targetNode;
|
|
1147
1481
|
}
|
|
1148
1482
|
|
|
1149
|
-
|
|
1150
|
-
if (this
|
|
1151
|
-
if (!this
|
|
1152
|
-
this
|
|
1153
|
-
this, null, 'group:Deployed', Types.Deployed, i18nString(UIStrings.deployed),
|
|
1154
|
-
|
|
1155
|
-
this.rootNode.appendChild(this
|
|
1483
|
+
#rootOrDeployedNode(): NavigatorTreeNode {
|
|
1484
|
+
if (this.#groupByAuthored) {
|
|
1485
|
+
if (!this.#deployedNode) {
|
|
1486
|
+
this.#deployedNode =
|
|
1487
|
+
new NavigatorGroupTreeNode(this, null, 'group:Deployed', Types.Deployed, i18nString(UIStrings.deployed),
|
|
1488
|
+
i18nString(UIStrings.deployedTooltip));
|
|
1489
|
+
this.rootNode.appendChild(this.#deployedNode);
|
|
1156
1490
|
}
|
|
1157
|
-
return this
|
|
1491
|
+
return this.#deployedNode;
|
|
1158
1492
|
}
|
|
1159
1493
|
return this.rootNode;
|
|
1160
1494
|
}
|
|
1161
1495
|
|
|
1162
|
-
|
|
1496
|
+
#computeProjectDisplayName(target: SDK.Target.Target, projectOrigin: string): string {
|
|
1163
1497
|
const runtimeModel = target.model(SDK.RuntimeModel.RuntimeModel);
|
|
1164
1498
|
const executionContexts = runtimeModel ? runtimeModel.executionContexts() : [];
|
|
1165
1499
|
|
|
@@ -1200,7 +1534,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1200
1534
|
|
|
1201
1535
|
revealUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode, select?: boolean): NavigatorUISourceCodeTreeNode
|
|
1202
1536
|
|null {
|
|
1203
|
-
const nodes = this
|
|
1537
|
+
const nodes = this.#uiSourceCodeNodes.get(uiSourceCode);
|
|
1204
1538
|
if (nodes.size === 0) {
|
|
1205
1539
|
return null;
|
|
1206
1540
|
}
|
|
@@ -1208,7 +1542,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1208
1542
|
if (!node) {
|
|
1209
1543
|
return null;
|
|
1210
1544
|
}
|
|
1211
|
-
if (this
|
|
1545
|
+
if (this.#selectedNode) {
|
|
1212
1546
|
// If a file is currently being renamed (or choosing the name for a new snippet),
|
|
1213
1547
|
// we shall not proceed with revealing here, as that will steal focus from the
|
|
1214
1548
|
// input widget and thus cancel editing. The test/e2e/snippets/breakpoint.test.ts
|
|
@@ -1216,8 +1550,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1216
1550
|
if (this.isRenaming()) {
|
|
1217
1551
|
return null;
|
|
1218
1552
|
}
|
|
1219
|
-
this
|
|
1220
|
-
this.selectedNode = null;
|
|
1553
|
+
this.#selectedNode = null;
|
|
1221
1554
|
}
|
|
1222
1555
|
// TODO(dgozman): figure out revealing multiple.
|
|
1223
1556
|
node.reveal(select);
|
|
@@ -1232,7 +1565,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1232
1565
|
#isUISourceCodeOrAnyAncestorSelected(node: NavigatorUISourceCodeTreeNode): boolean {
|
|
1233
1566
|
let currentNode: NavigatorTreeNode|null = node;
|
|
1234
1567
|
while (currentNode) {
|
|
1235
|
-
if (currentNode === this
|
|
1568
|
+
if (currentNode === this.#selectedNode) {
|
|
1236
1569
|
return true;
|
|
1237
1570
|
}
|
|
1238
1571
|
currentNode = currentNode.parent;
|
|
@@ -1243,13 +1576,13 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1243
1576
|
return false;
|
|
1244
1577
|
}
|
|
1245
1578
|
|
|
1246
|
-
|
|
1579
|
+
#removeUISourceCodes(uiSourceCodes: Iterable<Workspace.UISourceCode.UISourceCode>): void {
|
|
1247
1580
|
const nodesWithSelectionOnPath: NavigatorUISourceCodeTreeNode[] = [];
|
|
1248
1581
|
// First we remove source codes without any selection on their path to root, and only then
|
|
1249
1582
|
// the ones with selection. This to avoid layout work associated with moving the selection
|
|
1250
1583
|
// around (crbug.com/1409025).
|
|
1251
1584
|
for (const uiSourceCode of uiSourceCodes) {
|
|
1252
|
-
const nodes = this
|
|
1585
|
+
const nodes = this.#uiSourceCodeNodes.get(uiSourceCode);
|
|
1253
1586
|
for (const node of nodes) {
|
|
1254
1587
|
if (this.#isUISourceCodeOrAnyAncestorSelected(node)) {
|
|
1255
1588
|
nodesWithSelectionOnPath.push(node);
|
|
@@ -1261,9 +1594,13 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1261
1594
|
nodesWithSelectionOnPath.forEach(this.removeUISourceCodeNode.bind(this));
|
|
1262
1595
|
}
|
|
1263
1596
|
|
|
1264
|
-
|
|
1597
|
+
removeUISourceCodeNode(node: NavigatorUISourceCodeTreeNode): void {
|
|
1598
|
+
this.#removeUISourceCodeNode(node);
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
#removeUISourceCodeNode(node: NavigatorUISourceCodeTreeNode): void {
|
|
1265
1602
|
const uiSourceCode = node.uiSourceCode();
|
|
1266
|
-
this
|
|
1603
|
+
this.#uiSourceCodeNodes.delete(uiSourceCode, node);
|
|
1267
1604
|
const project = uiSourceCode.project();
|
|
1268
1605
|
const target = Bindings.NetworkProject.NetworkProject.targetForUISourceCode(uiSourceCode);
|
|
1269
1606
|
let frame = node.frame();
|
|
@@ -1280,7 +1617,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1280
1617
|
if (!parentNode) {
|
|
1281
1618
|
break;
|
|
1282
1619
|
}
|
|
1283
|
-
if ((parentNode === this.rootNode || parentNode === this
|
|
1620
|
+
if ((parentNode === this.rootNode || parentNode === this.#deployedNode) &&
|
|
1284
1621
|
project.type() === Workspace.Workspace.projectTypes.FileSystem) {
|
|
1285
1622
|
break;
|
|
1286
1623
|
}
|
|
@@ -1292,23 +1629,22 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1292
1629
|
break;
|
|
1293
1630
|
}
|
|
1294
1631
|
if (currentNode.type === Types.Frame) {
|
|
1295
|
-
this
|
|
1296
|
-
|
|
1297
|
-
Boolean(this.groupByAuthored) && uiSourceCode.contentType().isFromSourceMap());
|
|
1632
|
+
this.#discardFrame(frame as SDK.ResourceTreeModel.ResourceTreeFrame,
|
|
1633
|
+
Boolean(this.#groupByAuthored) && uiSourceCode.contentType().isFromSourceMap());
|
|
1298
1634
|
frame = (frame as SDK.ResourceTreeModel.ResourceTreeFrame).parentFrame();
|
|
1299
1635
|
} else {
|
|
1300
|
-
const folderId = this
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
this
|
|
1636
|
+
const folderId = this.#folderNodeId(project, target, frame, uiSourceCode.origin(),
|
|
1637
|
+
uiSourceCode.contentType().isFromSourceMap(),
|
|
1638
|
+
currentNode instanceof NavigatorFolderTreeNode && currentNode.folderPath ||
|
|
1639
|
+
Platform.DevToolsPath.EmptyEncodedPathString);
|
|
1640
|
+
this.#subfolderNodes.delete(folderId);
|
|
1305
1641
|
parentNode.removeChild(currentNode);
|
|
1306
1642
|
}
|
|
1307
1643
|
|
|
1308
|
-
if (currentNode === this
|
|
1309
|
-
this
|
|
1310
|
-
} else if (currentNode === this
|
|
1311
|
-
this
|
|
1644
|
+
if (currentNode === this.#authoredNode) {
|
|
1645
|
+
this.#authoredNode = undefined;
|
|
1646
|
+
} else if (currentNode === this.#deployedNode) {
|
|
1647
|
+
this.#deployedNode = undefined;
|
|
1312
1648
|
}
|
|
1313
1649
|
|
|
1314
1650
|
currentNode = parentNode;
|
|
@@ -1316,39 +1652,37 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1316
1652
|
}
|
|
1317
1653
|
|
|
1318
1654
|
reset(tearDownOnly?: boolean): void {
|
|
1319
|
-
for (const node of this
|
|
1655
|
+
for (const node of this.#uiSourceCodeNodes.valuesArray()) {
|
|
1320
1656
|
node.dispose();
|
|
1321
1657
|
}
|
|
1322
1658
|
|
|
1323
|
-
this
|
|
1324
|
-
this.scriptsTree.setFocusable(false);
|
|
1325
|
-
this.selectedNode = null;
|
|
1659
|
+
this.#selectedNode = null;
|
|
1326
1660
|
this.#renamingNode = null;
|
|
1327
|
-
this
|
|
1328
|
-
this
|
|
1329
|
-
this
|
|
1330
|
-
this
|
|
1661
|
+
this.#expandedNodes = new WeakSet();
|
|
1662
|
+
this.#uiSourceCodeNodes.clear();
|
|
1663
|
+
this.#subfolderNodes.clear();
|
|
1664
|
+
this.#frameNodes.clear();
|
|
1331
1665
|
this.rootNode.reset();
|
|
1332
|
-
this
|
|
1333
|
-
this
|
|
1666
|
+
this.#authoredNode = undefined;
|
|
1667
|
+
this.#deployedNode = undefined;
|
|
1334
1668
|
if (!tearDownOnly) {
|
|
1335
1669
|
// Reset the workspace to repopulate filesystem folders.
|
|
1336
|
-
this
|
|
1670
|
+
this.#resetWorkspace(this.#workspace);
|
|
1337
1671
|
}
|
|
1672
|
+
this.requestUpdate();
|
|
1338
1673
|
}
|
|
1339
1674
|
|
|
1340
|
-
|
|
1341
|
-
if (!(this
|
|
1342
|
-
!this
|
|
1675
|
+
async #renameShortcut(): Promise<boolean> {
|
|
1676
|
+
if (!(this.#selectedNode instanceof NavigatorUISourceCodeTreeNode) ||
|
|
1677
|
+
!this.#selectedNode.uiSourceCode().canRename()) {
|
|
1343
1678
|
return false;
|
|
1344
1679
|
}
|
|
1345
|
-
this.rename(this
|
|
1680
|
+
this.rename(this.#selectedNode, false);
|
|
1346
1681
|
return true;
|
|
1347
1682
|
}
|
|
1348
1683
|
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
uiSourceCode?: Workspace.UISourceCode.UISourceCode): void {
|
|
1684
|
+
#handleContextMenuCreate(project: Workspace.Workspace.Project, path: Platform.DevToolsPath.EncodedPathString,
|
|
1685
|
+
uiSourceCode?: Workspace.UISourceCode.UISourceCode): void {
|
|
1352
1686
|
if (uiSourceCode) {
|
|
1353
1687
|
const relativePath = Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.relativePath(uiSourceCode);
|
|
1354
1688
|
relativePath.pop();
|
|
@@ -1357,12 +1691,12 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1357
1691
|
void this.create(project, path, uiSourceCode);
|
|
1358
1692
|
}
|
|
1359
1693
|
|
|
1360
|
-
|
|
1694
|
+
#handleContextMenuRename(node: NavigatorUISourceCodeTreeNode): void {
|
|
1361
1695
|
this.rename(node, false);
|
|
1362
1696
|
}
|
|
1363
1697
|
|
|
1364
|
-
|
|
1365
|
-
|
|
1698
|
+
async #handleContextMenuExclude(project: Workspace.Workspace.Project,
|
|
1699
|
+
path: Platform.DevToolsPath.EncodedPathString): Promise<void> {
|
|
1366
1700
|
const shouldExclude = await UI.UIUtils.ConfirmDialog.show(
|
|
1367
1701
|
i18nString(UIStrings.folderWillNotBeShown), i18nString(UIStrings.excludeThisFolder), undefined,
|
|
1368
1702
|
{jslogContext: 'exclude-folder-confirmation'});
|
|
@@ -1374,7 +1708,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1374
1708
|
}
|
|
1375
1709
|
}
|
|
1376
1710
|
|
|
1377
|
-
|
|
1711
|
+
async #handleContextMenuDelete(uiSourceCode: Workspace.UISourceCode.UISourceCode): Promise<void> {
|
|
1378
1712
|
const shouldDelete = await UI.UIUtils.ConfirmDialog.show(
|
|
1379
1713
|
i18nString(UIStrings.actionCannotBeUndone), i18nString(UIStrings.deleteThisFile), undefined,
|
|
1380
1714
|
{jslogContext: 'delete-file-confirmation'});
|
|
@@ -1383,19 +1717,11 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1383
1717
|
}
|
|
1384
1718
|
}
|
|
1385
1719
|
|
|
1386
|
-
fileDragStarted(node: NavigatorUISourceCodeTreeNode, event: DragEvent): void {
|
|
1387
|
-
if (!event.dataTransfer) {
|
|
1388
|
-
return;
|
|
1389
|
-
}
|
|
1390
|
-
event.dataTransfer.setData('text/plain', node.uiSourceCode().url());
|
|
1391
|
-
event.dataTransfer.effectAllowed = 'copy';
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
1720
|
shouldRenameOnMouseDown(node: NavigatorUISourceCodeTreeNode): boolean {
|
|
1395
|
-
if (!node.uiSourceCode().canRename()
|
|
1721
|
+
if (!node.uiSourceCode().canRename()) {
|
|
1396
1722
|
return false;
|
|
1397
1723
|
}
|
|
1398
|
-
return this
|
|
1724
|
+
return this.#selectedNode === node && this.contentElement.hasFocus() && !this.isRenaming();
|
|
1399
1725
|
}
|
|
1400
1726
|
|
|
1401
1727
|
startRenamingNode(node: NavigatorUISourceCodeTreeNode): void {
|
|
@@ -1423,7 +1749,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1423
1749
|
contextMenu.editSection().appendItem(i18nString(UIStrings.remove),
|
|
1424
1750
|
() => uiSourceCode.project().deleteFile(uiSourceCode),
|
|
1425
1751
|
{jslogContext: 'remove'});
|
|
1426
|
-
contextMenu.saveSection().appendItem(i18nString(UIStrings.saveAs), this
|
|
1752
|
+
contextMenu.saveSection().appendItem(i18nString(UIStrings.saveAs), this.#handleSaveAs.bind(this, uiSourceCode),
|
|
1427
1753
|
{jslogContext: 'save-as'});
|
|
1428
1754
|
void contextMenu.show();
|
|
1429
1755
|
return;
|
|
@@ -1433,21 +1759,21 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1433
1759
|
|
|
1434
1760
|
const project = uiSourceCode.project();
|
|
1435
1761
|
if (project.type() === Workspace.Workspace.projectTypes.FileSystem) {
|
|
1436
|
-
contextMenu.editSection().appendItem(
|
|
1437
|
-
|
|
1762
|
+
contextMenu.editSection().appendItem(i18nString(UIStrings.rename), this.#handleContextMenuRename.bind(this, node),
|
|
1763
|
+
{jslogContext: 'rename'});
|
|
1438
1764
|
contextMenu.editSection().appendItem(
|
|
1439
1765
|
i18nString(UIStrings.makeACopy),
|
|
1440
|
-
this
|
|
1766
|
+
this.#handleContextMenuCreate.bind(this, project, Platform.DevToolsPath.EmptyEncodedPathString, uiSourceCode),
|
|
1441
1767
|
{jslogContext: 'make-a-copy'});
|
|
1442
|
-
contextMenu.editSection().appendItem(
|
|
1443
|
-
|
|
1444
|
-
|
|
1768
|
+
contextMenu.editSection().appendItem(i18nString(UIStrings.delete),
|
|
1769
|
+
this.#handleContextMenuDelete.bind(this, uiSourceCode),
|
|
1770
|
+
{jslogContext: 'delete'});
|
|
1445
1771
|
}
|
|
1446
1772
|
|
|
1447
1773
|
void contextMenu.show();
|
|
1448
1774
|
}
|
|
1449
1775
|
|
|
1450
|
-
|
|
1776
|
+
async #handleSaveAs(uiSourceCode: Workspace.UISourceCode.UISourceCode): Promise<void> {
|
|
1451
1777
|
uiSourceCode.commitWorkingCopy();
|
|
1452
1778
|
const contentData = await uiSourceCode.requestContentData();
|
|
1453
1779
|
if (TextUtils.ContentData.ContentData.isError(contentData)) {
|
|
@@ -1455,30 +1781,30 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1455
1781
|
Common.Console.Console.instance().error(i18nString(UIStrings.saveAsFailed), /* show=*/ false);
|
|
1456
1782
|
return;
|
|
1457
1783
|
}
|
|
1458
|
-
await Workspace.FileManager.FileManager.instance().save(this
|
|
1784
|
+
await Workspace.FileManager.FileManager.instance().save(this.#addJSExtension(uiSourceCode.url()), contentData,
|
|
1459
1785
|
/* forceSaveAs=*/ true);
|
|
1460
1786
|
Workspace.FileManager.FileManager.instance().close(uiSourceCode.url());
|
|
1461
1787
|
}
|
|
1462
1788
|
|
|
1463
|
-
|
|
1789
|
+
#addJSExtension(url: Platform.DevToolsPath.UrlString): Platform.DevToolsPath.UrlString {
|
|
1464
1790
|
return Common.ParsedURL.ParsedURL.concatenate(url, '.js');
|
|
1465
1791
|
}
|
|
1466
1792
|
|
|
1467
|
-
|
|
1793
|
+
async #handleDeleteFolder(node: NavigatorTreeNode): Promise<void> {
|
|
1468
1794
|
const shouldRemove = await UI.UIUtils.ConfirmDialog.show(
|
|
1469
1795
|
i18nString(UIStrings.actionCannotBeUndone), i18nString(UIStrings.deleteFolder), undefined,
|
|
1470
1796
|
{jslogContext: 'delete-folder-confirmation'});
|
|
1471
1797
|
if (shouldRemove) {
|
|
1472
1798
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.OverrideTabDeleteFolderContextMenu);
|
|
1473
|
-
const topNode = this
|
|
1474
|
-
await this
|
|
1475
|
-
await this
|
|
1799
|
+
const topNode = this.#findTopNonMergedNode(node);
|
|
1800
|
+
await this.#removeUISourceCodeFromProject(topNode);
|
|
1801
|
+
await this.#deleteDirectoryRecursively(topNode);
|
|
1476
1802
|
}
|
|
1477
1803
|
}
|
|
1478
1804
|
|
|
1479
|
-
|
|
1805
|
+
async #removeUISourceCodeFromProject(node: NavigatorTreeNode): Promise<void> {
|
|
1480
1806
|
node.children().slice(0).forEach(async child => {
|
|
1481
|
-
await this
|
|
1807
|
+
await this.#removeUISourceCodeFromProject(child);
|
|
1482
1808
|
});
|
|
1483
1809
|
|
|
1484
1810
|
if (node instanceof NavigatorUISourceCodeTreeNode) {
|
|
@@ -1486,17 +1812,15 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1486
1812
|
}
|
|
1487
1813
|
}
|
|
1488
1814
|
|
|
1489
|
-
|
|
1815
|
+
async #deleteDirectoryRecursively(node: NavigatorTreeNode): Promise<void> {
|
|
1490
1816
|
if (!(node instanceof NavigatorFolderTreeNode)) {
|
|
1491
1817
|
return;
|
|
1492
1818
|
}
|
|
1493
1819
|
|
|
1494
|
-
await
|
|
1495
|
-
.project()
|
|
1496
|
-
?.deleteDirectoryRecursively(node.folderPath);
|
|
1820
|
+
await this.#networkPersistenceManager.project()?.deleteDirectoryRecursively(node.folderPath);
|
|
1497
1821
|
}
|
|
1498
1822
|
|
|
1499
|
-
|
|
1823
|
+
#findTopNonMergedNode(node: NavigatorTreeNode): NavigatorTreeNode {
|
|
1500
1824
|
// multiple folder nodes can be merged into one if it only contains one file
|
|
1501
1825
|
// e.g. the folder of "abc.com/assets/css/button.css" can be "abc.com/assets/css"
|
|
1502
1826
|
// find the top non-merged node (abc.com) recursively
|
|
@@ -1509,7 +1833,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1509
1833
|
return node;
|
|
1510
1834
|
}
|
|
1511
1835
|
|
|
1512
|
-
return this
|
|
1836
|
+
return this.#findTopNonMergedNode(node.parent);
|
|
1513
1837
|
}
|
|
1514
1838
|
|
|
1515
1839
|
folderHovered(node: NavigatorTreeNode, hovered: boolean): void {
|
|
@@ -1520,7 +1844,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1520
1844
|
overlayModel.highlightFrame(node.frame.id);
|
|
1521
1845
|
}
|
|
1522
1846
|
} else {
|
|
1523
|
-
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight(
|
|
1847
|
+
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight(this.#targetManager);
|
|
1524
1848
|
}
|
|
1525
1849
|
}
|
|
1526
1850
|
}
|
|
@@ -1550,7 +1874,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1550
1874
|
{jslogContext: 'open-folder'});
|
|
1551
1875
|
if (project.canCreateFile()) {
|
|
1552
1876
|
contextMenu.defaultSection().appendItem(i18nString(UIStrings.newFile), () => {
|
|
1553
|
-
this
|
|
1877
|
+
this.#handleContextMenuCreate(project, path, undefined);
|
|
1554
1878
|
}, {jslogContext: 'new-file'});
|
|
1555
1879
|
}
|
|
1556
1880
|
} else if (activeNode instanceof NavigatorFolderTreeNode && activeNode.origin && activeNode.folderPath) {
|
|
@@ -1560,16 +1884,16 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1560
1884
|
isKnownThirdParty: activeNode.recursiveProperties.exclusivelyThirdParty || false,
|
|
1561
1885
|
isCurrentlyIgnoreListed: activeNode.recursiveProperties.exclusivelyIgnored || false,
|
|
1562
1886
|
};
|
|
1563
|
-
for (const {text, callback, jslogContext} of
|
|
1564
|
-
|
|
1887
|
+
for (const {text, callback, jslogContext} of this.#ignoreListManager.getIgnoreListFolderContextMenuItems(
|
|
1888
|
+
url, options)) {
|
|
1565
1889
|
contextMenu.defaultSection().appendItem(text, callback, {jslogContext});
|
|
1566
1890
|
}
|
|
1567
1891
|
}
|
|
1568
1892
|
|
|
1569
1893
|
if (project.canExcludeFolder(path)) {
|
|
1570
|
-
contextMenu.defaultSection().appendItem(
|
|
1571
|
-
|
|
1572
|
-
|
|
1894
|
+
contextMenu.defaultSection().appendItem(i18nString(UIStrings.excludeFolder),
|
|
1895
|
+
this.#handleContextMenuExclude.bind(this, project, path),
|
|
1896
|
+
{jslogContext: 'exclude-folder'});
|
|
1573
1897
|
}
|
|
1574
1898
|
|
|
1575
1899
|
if (project.type() === Workspace.Workspace.projectTypes.ConnectableFileSystem) {
|
|
@@ -1601,7 +1925,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1601
1925
|
}
|
|
1602
1926
|
} else if (!(activeNode instanceof NavigatorGroupTreeNode)) {
|
|
1603
1927
|
contextMenu.defaultSection().appendItem(
|
|
1604
|
-
i18nString(UIStrings.delete), this
|
|
1928
|
+
i18nString(UIStrings.delete), this.#handleDeleteFolder.bind(this, activeNode), {jslogContext: 'delete'});
|
|
1605
1929
|
}
|
|
1606
1930
|
}
|
|
1607
1931
|
|
|
@@ -1618,7 +1942,7 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1618
1942
|
}
|
|
1619
1943
|
if (!committed) {
|
|
1620
1944
|
uiSourceCode.remove();
|
|
1621
|
-
} else if (
|
|
1945
|
+
} else if (this.contentElement.hasFocus()) {
|
|
1622
1946
|
this.sourceSelected(uiSourceCode, true);
|
|
1623
1947
|
}
|
|
1624
1948
|
}
|
|
@@ -1644,54 +1968,55 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1644
1968
|
}
|
|
1645
1969
|
}
|
|
1646
1970
|
|
|
1647
|
-
|
|
1971
|
+
#groupingChanged(): void {
|
|
1648
1972
|
this.reset(true);
|
|
1649
|
-
this
|
|
1973
|
+
this.#initGrouping();
|
|
1650
1974
|
// Reset the workspace to repopulate filesystem folders.
|
|
1651
|
-
this
|
|
1652
|
-
this.#workspace.uiSourceCodes().forEach(this
|
|
1975
|
+
this.#resetWorkspace(this.#workspace);
|
|
1976
|
+
this.#workspace.uiSourceCodes().forEach(this.#addUISourceCode.bind(this));
|
|
1653
1977
|
}
|
|
1654
1978
|
|
|
1655
|
-
|
|
1656
|
-
if (this
|
|
1657
|
-
this
|
|
1979
|
+
#ignoreListChanged(): void {
|
|
1980
|
+
if (this.#navigatorJustMyCodeSetting.get()) {
|
|
1981
|
+
this.#groupingChanged();
|
|
1658
1982
|
} else {
|
|
1659
1983
|
this.rootNode.updateTitleRecursive();
|
|
1660
1984
|
}
|
|
1661
1985
|
}
|
|
1662
1986
|
|
|
1663
|
-
|
|
1664
|
-
this
|
|
1665
|
-
this
|
|
1666
|
-
this
|
|
1667
|
-
if (this
|
|
1668
|
-
this
|
|
1987
|
+
#initGrouping(): void {
|
|
1988
|
+
this.#groupByFrame = true;
|
|
1989
|
+
this.#groupByDomain = this.#navigatorGroupByFolderSetting.get();
|
|
1990
|
+
this.#groupByFolder = this.#groupByDomain;
|
|
1991
|
+
if (this.#navigatorGroupByAuthoredSetting) {
|
|
1992
|
+
this.#groupByAuthored = this.#navigatorGroupByAuthoredSetting.get();
|
|
1669
1993
|
} else {
|
|
1670
|
-
this
|
|
1994
|
+
this.#groupByAuthored = false;
|
|
1671
1995
|
}
|
|
1996
|
+
this.#prevJustMyCode = this.#navigatorJustMyCodeSetting.get();
|
|
1672
1997
|
}
|
|
1673
1998
|
|
|
1674
|
-
protected resetForTest(): void {
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
if (
|
|
1683
|
-
this
|
|
1684
|
-
return;
|
|
1999
|
+
protected resetForTest(groupBy?: {frame?: boolean, domain?: boolean, folder?: boolean}): void {
|
|
2000
|
+
if (groupBy) {
|
|
2001
|
+
if (typeof groupBy.frame === 'boolean') {
|
|
2002
|
+
this.#groupByFrame = groupBy.frame;
|
|
2003
|
+
}
|
|
2004
|
+
if (typeof groupBy.domain === 'boolean') {
|
|
2005
|
+
this.#groupByDomain = groupBy.domain;
|
|
2006
|
+
}
|
|
2007
|
+
if (typeof groupBy.folder === 'boolean') {
|
|
2008
|
+
this.#groupByFolder = groupBy.folder;
|
|
1685
2009
|
}
|
|
1686
|
-
current = current.parent;
|
|
1687
2010
|
}
|
|
2011
|
+
this.reset();
|
|
2012
|
+
this.#workspace.uiSourceCodes().forEach(this.#addUISourceCode.bind(this));
|
|
1688
2013
|
}
|
|
1689
2014
|
|
|
1690
|
-
|
|
2015
|
+
#discardFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame, isAuthored: boolean): void {
|
|
1691
2016
|
if (isAuthored) {
|
|
1692
2017
|
return;
|
|
1693
2018
|
}
|
|
1694
|
-
const node = this
|
|
2019
|
+
const node = this.#frameNodes.get(frame);
|
|
1695
2020
|
if (!node) {
|
|
1696
2021
|
return;
|
|
1697
2022
|
}
|
|
@@ -1699,9 +2024,9 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1699
2024
|
if (node.parent) {
|
|
1700
2025
|
node.parent.removeChild(node);
|
|
1701
2026
|
}
|
|
1702
|
-
this
|
|
2027
|
+
this.#frameNodes.delete(frame);
|
|
1703
2028
|
for (const child of frame.childFrames) {
|
|
1704
|
-
this
|
|
2029
|
+
this.#discardFrame(child, isAuthored);
|
|
1705
2030
|
}
|
|
1706
2031
|
}
|
|
1707
2032
|
|
|
@@ -1709,16 +2034,16 @@ export class NavigatorView extends NavigatorViewBase implements SDK.TargetManage
|
|
|
1709
2034
|
}
|
|
1710
2035
|
|
|
1711
2036
|
targetRemoved(target: SDK.Target.Target): void {
|
|
1712
|
-
const rootOrDeployed = this
|
|
2037
|
+
const rootOrDeployed = this.#rootOrDeployedNode();
|
|
1713
2038
|
const targetNode = rootOrDeployed.child('target:' + target.id());
|
|
1714
2039
|
if (targetNode) {
|
|
1715
2040
|
rootOrDeployed.removeChild(targetNode);
|
|
1716
2041
|
}
|
|
1717
2042
|
}
|
|
1718
2043
|
|
|
1719
|
-
|
|
2044
|
+
#targetNameChanged(event: Common.EventTarget.EventTargetEvent<SDK.Target.Target>): void {
|
|
1720
2045
|
const target = event.data;
|
|
1721
|
-
const targetNode = this
|
|
2046
|
+
const targetNode = this.#rootOrDeployedNode().child('target:' + target.id());
|
|
1722
2047
|
if (targetNode) {
|
|
1723
2048
|
targetNode.setTitle(target.name());
|
|
1724
2049
|
}
|
|
@@ -1738,8 +2063,16 @@ export class NavigatorTreeNode {
|
|
|
1738
2063
|
type: string;
|
|
1739
2064
|
boostOrder = false;
|
|
1740
2065
|
hasMappedFiles = false;
|
|
1741
|
-
|
|
1742
|
-
isMerged
|
|
2066
|
+
#populated = false;
|
|
2067
|
+
isMerged = false;
|
|
2068
|
+
|
|
2069
|
+
mergedTitle(): string {
|
|
2070
|
+
return this.title;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
effectiveChildren(): NavigatorTreeNode[] {
|
|
2074
|
+
return this.#children.filter(node => !node.isMerged);
|
|
2075
|
+
}
|
|
1743
2076
|
parent!: NavigatorTreeNode|null;
|
|
1744
2077
|
title!: string;
|
|
1745
2078
|
tooltip?: string;
|
|
@@ -1755,8 +2088,6 @@ export class NavigatorTreeNode {
|
|
|
1755
2088
|
this.type = type;
|
|
1756
2089
|
this.tooltip = tooltip;
|
|
1757
2090
|
|
|
1758
|
-
this.populated = false;
|
|
1759
|
-
this.isMerged = false;
|
|
1760
2091
|
this.recursiveProperties = {
|
|
1761
2092
|
exclusivelySourceMapped: null,
|
|
1762
2093
|
exclusivelyIgnored: null,
|
|
@@ -1765,18 +2096,14 @@ export class NavigatorTreeNode {
|
|
|
1765
2096
|
};
|
|
1766
2097
|
}
|
|
1767
2098
|
|
|
1768
|
-
mergedTitle(): string {
|
|
1769
|
-
return this.title;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
effectiveChildren(): NavigatorTreeNode[] {
|
|
1773
|
-
return this.#children.filter(node => !node.isMerged);
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
2099
|
isDisposed(): boolean {
|
|
1777
2100
|
return this.#disposed;
|
|
1778
2101
|
}
|
|
1779
2102
|
|
|
2103
|
+
dispose(): void {
|
|
2104
|
+
this.#disposed = true;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
1780
2107
|
computedTooltip(): string {
|
|
1781
2108
|
if (this.tooltip) {
|
|
1782
2109
|
return this.tooltip;
|
|
@@ -1795,67 +2122,6 @@ export class NavigatorTreeNode {
|
|
|
1795
2122
|
return tooltip;
|
|
1796
2123
|
}
|
|
1797
2124
|
|
|
1798
|
-
updateTooltip(treeElement?: UI.TreeOutline.TreeElement): void {
|
|
1799
|
-
if (!treeElement) {
|
|
1800
|
-
return;
|
|
1801
|
-
}
|
|
1802
|
-
let tooltip = this.computedTooltip();
|
|
1803
|
-
if (treeElement.listItemElement.classList.contains('is-ignore-listed') &&
|
|
1804
|
-
!this.recursiveProperties.exclusivelyIgnored) {
|
|
1805
|
-
tooltip = i18nString(UIStrings.sIgnoreListed, {PH1: tooltip});
|
|
1806
|
-
}
|
|
1807
|
-
treeElement.tooltip = tooltip;
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
protected createFolderTreeElement(title: string, node: NavigatorTreeNode,
|
|
1811
|
-
expandable = true): UI.TreeOutline.TreeElement {
|
|
1812
|
-
const treeElement = new UI.TreeOutline.TreeElement('', expandable, contextForNodeType(this.type));
|
|
1813
|
-
treeElement.listItemElement.classList.add('navigator-' + this.type + '-tree-item', 'navigator-folder-tree-item');
|
|
1814
|
-
treeElement.title = title;
|
|
1815
|
-
treeElement.tooltip = title;
|
|
1816
|
-
treeElement.setLeadingIcons([renderFolderLeadingIcon(this.type)]);
|
|
1817
|
-
this.navigatorView.setNodeForTreeElement(treeElement, node);
|
|
1818
|
-
treeElement.onattach = () => {
|
|
1819
|
-
treeElement.collapse();
|
|
1820
|
-
this.navigatorView.nodeForTreeElement(treeElement)?.onattach();
|
|
1821
|
-
};
|
|
1822
|
-
let hovered = false;
|
|
1823
|
-
treeElement.listItemElement.addEventListener('contextmenu', (event: Event) => {
|
|
1824
|
-
const activeNode = this.navigatorView.nodeForTreeElement(treeElement);
|
|
1825
|
-
if (!activeNode ||
|
|
1826
|
-
!(activeNode instanceof NavigatorFolderTreeNode || activeNode instanceof NavigatorGroupTreeNode)) {
|
|
1827
|
-
return;
|
|
1828
|
-
}
|
|
1829
|
-
this.navigatorView.selectNode(activeNode);
|
|
1830
|
-
this.navigatorView.handleFolderContextMenu(new UI.ContextMenu.ContextMenu(event), activeNode);
|
|
1831
|
-
}, false);
|
|
1832
|
-
treeElement.listItemElement.addEventListener('mousemove', (_event: Event) => {
|
|
1833
|
-
const activeNode = this.navigatorView.nodeForTreeElement(treeElement);
|
|
1834
|
-
if (hovered || !activeNode) {
|
|
1835
|
-
return;
|
|
1836
|
-
}
|
|
1837
|
-
hovered = true;
|
|
1838
|
-
this.navigatorView.folderHovered(activeNode, true);
|
|
1839
|
-
}, false);
|
|
1840
|
-
treeElement.listItemElement.addEventListener('mouseleave', (_event: Event) => {
|
|
1841
|
-
const activeNode = this.navigatorView.nodeForTreeElement(treeElement);
|
|
1842
|
-
if (!activeNode) {
|
|
1843
|
-
return;
|
|
1844
|
-
}
|
|
1845
|
-
hovered = false;
|
|
1846
|
-
this.navigatorView.folderHovered(activeNode, false);
|
|
1847
|
-
}, false);
|
|
1848
|
-
return treeElement;
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
treeNode(): UI.TreeOutline.TreeElement {
|
|
1852
|
-
throw new Error('Not implemented');
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
dispose(): void {
|
|
1856
|
-
this.#disposed = true;
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
2125
|
updateTitle(): void {
|
|
1860
2126
|
}
|
|
1861
2127
|
|
|
@@ -1895,31 +2161,23 @@ export class NavigatorTreeNode {
|
|
|
1895
2161
|
if (this.parent) {
|
|
1896
2162
|
this.parent.populate();
|
|
1897
2163
|
}
|
|
1898
|
-
this
|
|
2164
|
+
this.#populated = true;
|
|
1899
2165
|
this.wasPopulated();
|
|
1900
2166
|
}
|
|
1901
2167
|
|
|
1902
2168
|
wasPopulated(): void {
|
|
1903
|
-
|
|
1904
|
-
for (let i = 0; i < children.length; ++i) {
|
|
1905
|
-
this.navigatorView.appendChild(this.treeNode(), (children[i].treeNode()));
|
|
1906
|
-
}
|
|
2169
|
+
this.navigatorView.requestUpdate();
|
|
1907
2170
|
}
|
|
1908
2171
|
|
|
1909
|
-
didAddChild(
|
|
1910
|
-
|
|
1911
|
-
this.navigatorView.appendChild(this.treeNode(), (node.treeNode()));
|
|
1912
|
-
}
|
|
2172
|
+
didAddChild(_node: NavigatorTreeNode): void {
|
|
2173
|
+
this.navigatorView.requestUpdate();
|
|
1913
2174
|
}
|
|
1914
2175
|
|
|
1915
|
-
willRemoveChild(
|
|
1916
|
-
if (this.isPopulated()) {
|
|
1917
|
-
this.navigatorView.removeChild(this.treeNode(), (node.treeNode()));
|
|
1918
|
-
}
|
|
2176
|
+
willRemoveChild(_node: NavigatorTreeNode): void {
|
|
1919
2177
|
}
|
|
1920
2178
|
|
|
1921
2179
|
isPopulated(): boolean {
|
|
1922
|
-
return this
|
|
2180
|
+
return this.#populated;
|
|
1923
2181
|
}
|
|
1924
2182
|
|
|
1925
2183
|
isEmpty(): boolean {
|
|
@@ -1952,15 +2210,24 @@ export class NavigatorTreeNode {
|
|
|
1952
2210
|
}
|
|
1953
2211
|
|
|
1954
2212
|
removeChild(node: NavigatorTreeNode): void {
|
|
1955
|
-
this.navigatorView.
|
|
1956
|
-
this.willRemoveChild(node);
|
|
2213
|
+
const isSelected = this.navigatorView.isNodeSelectedOrDescendant(node);
|
|
1957
2214
|
const idx = this.#children.findIndex(n => n.id === node.id);
|
|
2215
|
+
const nextNode = isSelected && idx >= 0 ?
|
|
2216
|
+
(this.#children[idx + 1] ?? this.#children[idx - 1] ?? (this !== this.navigatorView.rootNode ? this : null)) :
|
|
2217
|
+
null;
|
|
2218
|
+
if (nextNode) {
|
|
2219
|
+
this.navigatorView.selectNode(nextNode);
|
|
2220
|
+
} else {
|
|
2221
|
+
this.navigatorView.deselectIfDescendant(node);
|
|
2222
|
+
}
|
|
2223
|
+
this.willRemoveChild(node);
|
|
1958
2224
|
if (idx >= 0) {
|
|
1959
2225
|
this.#children.splice(idx, 1);
|
|
1960
2226
|
}
|
|
1961
2227
|
this.#childById.delete(node.id);
|
|
1962
2228
|
node.parent = null;
|
|
1963
2229
|
node.dispose();
|
|
2230
|
+
this.navigatorView.requestUpdate();
|
|
1964
2231
|
}
|
|
1965
2232
|
|
|
1966
2233
|
reset(): void {
|
|
@@ -1985,26 +2252,20 @@ export class NavigatorRootTreeNode extends NavigatorTreeNode {
|
|
|
1985
2252
|
override isRoot(): boolean {
|
|
1986
2253
|
return true;
|
|
1987
2254
|
}
|
|
1988
|
-
|
|
1989
|
-
override treeNode(): UI.TreeOutline.TreeElement {
|
|
1990
|
-
return this.navigatorView.scriptsTree.rootElement();
|
|
1991
|
-
}
|
|
1992
2255
|
}
|
|
1993
2256
|
|
|
1994
2257
|
export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
1995
2258
|
#uiSourceCode: Workspace.UISourceCode.UISourceCode;
|
|
1996
|
-
treeElement: UI.TreeOutline.TreeElement|null;
|
|
1997
2259
|
isEditing = false;
|
|
1998
|
-
#
|
|
1999
|
-
private eventListeners: Common.EventTarget.EventDescriptor[];
|
|
2260
|
+
#eventListeners: Common.EventTarget.EventDescriptor[];
|
|
2000
2261
|
readonly #frame: SDK.ResourceTreeModel.ResourceTreeFrame|null;
|
|
2262
|
+
#renameCallback?: (committed: boolean) => void;
|
|
2263
|
+
|
|
2001
2264
|
constructor(
|
|
2002
2265
|
navigatorView: NavigatorView, uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
2003
2266
|
frame: SDK.ResourceTreeModel.ResourceTreeFrame|null) {
|
|
2004
2267
|
super(navigatorView, 'UISourceCode:' + uiSourceCode.canonicalScriptId(), Types.File);
|
|
2005
2268
|
this.#uiSourceCode = uiSourceCode;
|
|
2006
|
-
this.treeElement = null;
|
|
2007
|
-
this.eventListeners = [];
|
|
2008
2269
|
this.#frame = frame;
|
|
2009
2270
|
this.recursiveProperties.exclusivelySourceMapped = uiSourceCode.contentType().isFromSourceMap();
|
|
2010
2271
|
if (uiSourceCode.contentType().isScript()) {
|
|
@@ -2013,143 +2274,30 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
2013
2274
|
this.recursiveProperties.exclusivelyContentScripts =
|
|
2014
2275
|
uiSourceCode.project().type() === Workspace.Workspace.projectTypes.ContentScripts;
|
|
2015
2276
|
}
|
|
2016
|
-
this.updateTitle();
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
frame(): SDK.ResourceTreeModel.ResourceTreeFrame|null {
|
|
2020
|
-
return this.#frame;
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
uiSourceCode(): Workspace.UISourceCode.UISourceCode {
|
|
2024
|
-
return this.#uiSourceCode;
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
updateIcon(): void {
|
|
2028
|
-
if (!this.treeElement) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
2031
|
-
const icon = PanelUtils.getIconForSourceFile(this.#uiSourceCode);
|
|
2032
|
-
this.treeElement.setLeadingIcons([icon]);
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
updateAccessibleName(): void {
|
|
2036
|
-
if (!this.treeElement) {
|
|
2037
|
-
return;
|
|
2038
|
-
}
|
|
2039
|
-
UI.ARIAUtils.setLabel(this.treeElement.listItemElement, `${this.#uiSourceCode.name()}, ${this.type}`);
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
updateTrailingIcons(): void {
|
|
2043
|
-
if (!this.treeElement) {
|
|
2044
|
-
return;
|
|
2045
|
-
}
|
|
2046
|
-
const trailingIcons = renderSourceTrailingIcons(
|
|
2047
|
-
this.#uiSourceCode,
|
|
2048
|
-
(uiSourceCode, focusSource) => this.navigatorView.sourceSelected(uiSourceCode, focusSource));
|
|
2049
|
-
this.treeElement.setTrailingIcons(trailingIcons);
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
override onattach(): void {
|
|
2053
|
-
this.updateTrailingIcons();
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
override treeNode(): UI.TreeOutline.TreeElement {
|
|
2057
|
-
if (this.treeElement) {
|
|
2058
|
-
return this.treeElement;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
this.treeElement = new UI.TreeOutline.TreeElement('', false, this.#uiSourceCode.contentType().name());
|
|
2062
|
-
this.treeElement.title = this.treeElement.titleElement;
|
|
2063
|
-
this.treeElement.listItemElement.classList.add(
|
|
2064
|
-
'navigator-' + this.#uiSourceCode.contentType().name() + '-tree-item', 'navigator-file-tree-item');
|
|
2065
|
-
this.treeElement.listItemElement.draggable = true;
|
|
2066
|
-
(this.treeElement.titleElement as HTMLElement).setAttribute('jslog', `${VisualLogging.value('title').track({
|
|
2067
|
-
change: true,
|
|
2068
|
-
})}`);
|
|
2069
|
-
this.navigatorView.setNodeForTreeElement(this.treeElement, this);
|
|
2070
|
-
|
|
2071
|
-
const treeElement = this.treeElement;
|
|
2072
|
-
treeElement.selectOnMouseDown = (event: MouseEvent) => {
|
|
2073
|
-
if (event.which !== 1 || !this.navigatorView.shouldRenameOnMouseDown(this)) {
|
|
2074
|
-
UI.TreeOutline.TreeElement.prototype.selectOnMouseDown.call(treeElement, event);
|
|
2075
|
-
return;
|
|
2076
|
-
}
|
|
2077
|
-
window.setTimeout(() => {
|
|
2078
|
-
if (this.navigatorView.shouldRenameOnMouseDown(this)) {
|
|
2079
|
-
this.navigatorView.rename(this, false);
|
|
2080
|
-
}
|
|
2081
|
-
}, 300);
|
|
2082
|
-
};
|
|
2083
|
-
treeElement.onspace = () => {
|
|
2084
|
-
this.navigatorView.sourceSelected(this.#uiSourceCode, true);
|
|
2085
|
-
return true;
|
|
2086
|
-
};
|
|
2087
|
-
treeElement.ondblclick = (event: Event) => {
|
|
2088
|
-
const middleClick = (event as MouseEvent).button === 1;
|
|
2089
|
-
this.navigatorView.sourceSelected(this.#uiSourceCode, !middleClick);
|
|
2090
|
-
return false;
|
|
2091
|
-
};
|
|
2092
|
-
treeElement.onenter = () => {
|
|
2093
|
-
this.navigatorView.sourceSelected(this.#uiSourceCode, true);
|
|
2094
|
-
return true;
|
|
2095
|
-
};
|
|
2096
|
-
treeElement.ondelete = () => true;
|
|
2097
|
-
|
|
2098
|
-
treeElement.onattach = () => {
|
|
2099
|
-
this.onattach();
|
|
2100
|
-
};
|
|
2101
|
-
|
|
2102
|
-
treeElement.listItemElement.addEventListener('click', () => {
|
|
2103
|
-
this.navigatorView.sourceSelected(this.#uiSourceCode, false);
|
|
2104
|
-
}, false);
|
|
2105
|
-
treeElement.listItemElement.addEventListener('contextmenu', (event: Event) => {
|
|
2106
|
-
this.navigatorView.selectNode(this);
|
|
2107
|
-
this.navigatorView.handleFileContextMenu(new UI.ContextMenu.ContextMenu(event), this);
|
|
2108
|
-
}, false);
|
|
2109
|
-
treeElement.listItemElement.addEventListener('dragstart', (event: DragEvent) => {
|
|
2110
|
-
this.navigatorView.fileDragStarted(this, event);
|
|
2111
|
-
}, false);
|
|
2112
|
-
|
|
2113
2277
|
window.dispatchEvent(new CustomEvent(
|
|
2114
2278
|
'source-tree-file-added', {bubbles: true, cancelable: true, detail: this.#uiSourceCode.fullDisplayName()}));
|
|
2115
2279
|
|
|
2116
2280
|
this.updateTitle();
|
|
2117
2281
|
|
|
2118
2282
|
const updateTitleBound = this.updateTitle.bind(this, undefined);
|
|
2119
|
-
this
|
|
2283
|
+
this.#eventListeners = [
|
|
2120
2284
|
this.#uiSourceCode.addEventListener(Workspace.UISourceCode.Events.TitleChanged, updateTitleBound),
|
|
2121
2285
|
this.#uiSourceCode.addEventListener(Workspace.UISourceCode.Events.WorkingCopyChanged, updateTitleBound),
|
|
2122
2286
|
this.#uiSourceCode.addEventListener(Workspace.UISourceCode.Events.WorkingCopyCommitted, updateTitleBound),
|
|
2123
2287
|
];
|
|
2124
|
-
return this.treeElement;
|
|
2125
2288
|
}
|
|
2126
2289
|
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
renderSourceTitleWidget({
|
|
2133
|
-
title: this.title,
|
|
2134
|
-
editing: this.isEditing,
|
|
2135
|
-
onCommit: this.#handlePromptCommit.bind(this),
|
|
2136
|
-
onCancel: this.#handlePromptCancel.bind(this),
|
|
2137
|
-
},
|
|
2138
|
-
undefined, this.treeElement.titleElement as HTMLElement);
|
|
2139
|
-
this.updateIcon();
|
|
2140
|
-
this.updateTrailingIcons();
|
|
2141
|
-
|
|
2142
|
-
this.treeElement.listItemElement.classList.toggle('is-ignore-listed',
|
|
2143
|
-
Boolean(this.recursiveProperties.exclusivelyIgnored));
|
|
2290
|
+
frame(): SDK.ResourceTreeModel.ResourceTreeFrame|null {
|
|
2291
|
+
return this.#frame;
|
|
2292
|
+
}
|
|
2144
2293
|
|
|
2145
|
-
|
|
2146
|
-
this
|
|
2294
|
+
uiSourceCode(): Workspace.UISourceCode.UISourceCode {
|
|
2295
|
+
return this.#uiSourceCode;
|
|
2147
2296
|
}
|
|
2148
2297
|
|
|
2149
2298
|
override updateTitle(ignoreIsDirty?: boolean): void {
|
|
2150
2299
|
const isIgnoreListed =
|
|
2151
|
-
|
|
2152
|
-
this.#uiSourceCode);
|
|
2300
|
+
this.navigatorView.ignoreListManager.isUserOrSourceMapIgnoreListedUISourceCode(this.#uiSourceCode);
|
|
2153
2301
|
this.recursiveProperties.exclusivelyIgnored =
|
|
2154
2302
|
(this.#uiSourceCode.contentType().isScript() || isIgnoreListed) ? isIgnoreListed : null;
|
|
2155
2303
|
|
|
@@ -2169,7 +2317,7 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
2169
2317
|
this.tooltip = tooltip;
|
|
2170
2318
|
|
|
2171
2319
|
this.updateId('UISourceCode:' + this.#uiSourceCode.canonicalScriptId());
|
|
2172
|
-
this.
|
|
2320
|
+
this.navigatorView.requestUpdate();
|
|
2173
2321
|
}
|
|
2174
2322
|
|
|
2175
2323
|
override hasChildren(): boolean {
|
|
@@ -2177,7 +2325,8 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
2177
2325
|
}
|
|
2178
2326
|
|
|
2179
2327
|
override dispose(): void {
|
|
2180
|
-
|
|
2328
|
+
super.dispose();
|
|
2329
|
+
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
2181
2330
|
if (this.isEditing) {
|
|
2182
2331
|
this.isEditing = false;
|
|
2183
2332
|
this.navigatorView.stopRenamingNode(this);
|
|
@@ -2187,41 +2336,32 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
2187
2336
|
if (callback) {
|
|
2188
2337
|
callback(false);
|
|
2189
2338
|
}
|
|
2190
|
-
super.dispose();
|
|
2191
2339
|
}
|
|
2192
2340
|
|
|
2193
2341
|
reveal(select?: boolean): void {
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2342
|
+
let parent = this.parent;
|
|
2343
|
+
while (parent && parent !== this.navigatorView.rootNode) {
|
|
2344
|
+
parent.populate();
|
|
2345
|
+
this.navigatorView.expandNode(parent);
|
|
2346
|
+
parent = parent.parent;
|
|
2197
2347
|
}
|
|
2198
|
-
if (
|
|
2199
|
-
this.
|
|
2200
|
-
if (select) {
|
|
2201
|
-
this.navigatorView.selectNode(this, true);
|
|
2202
|
-
}
|
|
2348
|
+
if (select) {
|
|
2349
|
+
this.navigatorView.selectNode(this);
|
|
2203
2350
|
}
|
|
2204
2351
|
}
|
|
2205
2352
|
|
|
2206
2353
|
rename(callback?: ((committed: boolean) => void)): void {
|
|
2207
|
-
if (this.isDisposed()
|
|
2208
|
-
return;
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
this.treeElement.listItemElement.focus();
|
|
2212
|
-
|
|
2213
|
-
if (!this.treeElement.treeOutline) {
|
|
2354
|
+
if (this.isDisposed()) {
|
|
2214
2355
|
return;
|
|
2215
2356
|
}
|
|
2216
|
-
|
|
2217
2357
|
this.#renameCallback = callback;
|
|
2218
2358
|
this.navigatorView.startRenamingNode(this);
|
|
2219
2359
|
this.isEditing = true;
|
|
2220
2360
|
this.updateTitle(true);
|
|
2221
2361
|
}
|
|
2222
2362
|
|
|
2223
|
-
|
|
2224
|
-
if (this.isDisposed()
|
|
2363
|
+
async commitRename(newTitle: string): Promise<void> {
|
|
2364
|
+
if (this.isDisposed()) {
|
|
2225
2365
|
return;
|
|
2226
2366
|
}
|
|
2227
2367
|
const oldTitle = this.title;
|
|
@@ -2229,39 +2369,22 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
2229
2369
|
this.isEditing = false;
|
|
2230
2370
|
this.title = newTitle;
|
|
2231
2371
|
this.navigatorView.stopRenamingNode(this);
|
|
2232
|
-
this.
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
#handleRenameCallback(success: boolean): void {
|
|
2242
|
-
if (this.isDisposed()) {
|
|
2243
|
-
return;
|
|
2244
|
-
}
|
|
2245
|
-
if (!success) {
|
|
2246
|
-
this.isEditing = false;
|
|
2247
|
-
this.navigatorView.stopRenamingNode(this);
|
|
2248
|
-
this.updateTitle();
|
|
2249
|
-
this.rename(this.#renameCallback);
|
|
2250
|
-
return;
|
|
2251
|
-
}
|
|
2252
|
-
if (this.treeElement) {
|
|
2253
|
-
const {parent} = this.treeElement;
|
|
2254
|
-
if (parent) {
|
|
2255
|
-
parent.removeChild(this.treeElement);
|
|
2256
|
-
parent.appendChild(this.treeElement);
|
|
2257
|
-
this.navigatorView.selectNode(this);
|
|
2372
|
+
this.navigatorView.requestUpdate();
|
|
2373
|
+
const success = await this.#uiSourceCode.rename(newTitle as Platform.DevToolsPath.RawPathString);
|
|
2374
|
+
if (this.isDisposed()) {
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
if (!success) {
|
|
2378
|
+
this.updateTitle();
|
|
2379
|
+
this.rename(this.#renameCallback);
|
|
2380
|
+
return;
|
|
2258
2381
|
}
|
|
2382
|
+
this.parent?.resortChild(this);
|
|
2259
2383
|
}
|
|
2260
|
-
this.parent?.resortChild(this);
|
|
2261
2384
|
this.#afterEditing(true);
|
|
2262
2385
|
}
|
|
2263
2386
|
|
|
2264
|
-
|
|
2387
|
+
cancelRename(): void {
|
|
2265
2388
|
if (this.isDisposed()) {
|
|
2266
2389
|
return;
|
|
2267
2390
|
}
|
|
@@ -2272,10 +2395,15 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
|
|
|
2272
2395
|
this.isEditing = false;
|
|
2273
2396
|
this.navigatorView.stopRenamingNode(this);
|
|
2274
2397
|
this.updateTitle();
|
|
2275
|
-
|
|
2276
|
-
this
|
|
2277
|
-
|
|
2278
|
-
|
|
2398
|
+
this.navigatorView.selectNode(this);
|
|
2399
|
+
this.navigatorView.requestUpdate();
|
|
2400
|
+
void this.navigatorView.updateComplete.then(() => {
|
|
2401
|
+
this.navigatorView.focus();
|
|
2402
|
+
});
|
|
2403
|
+
if (this.#renameCallback) {
|
|
2404
|
+
const cb = this.#renameCallback;
|
|
2405
|
+
this.#renameCallback = undefined;
|
|
2406
|
+
cb(committed);
|
|
2279
2407
|
}
|
|
2280
2408
|
}
|
|
2281
2409
|
}
|
|
@@ -2285,7 +2413,7 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2285
2413
|
readonly folderPath: Platform.DevToolsPath.EncodedPathString;
|
|
2286
2414
|
readonly origin: Platform.DevToolsPath.UrlString;
|
|
2287
2415
|
override title: string;
|
|
2288
|
-
|
|
2416
|
+
|
|
2289
2417
|
constructor(
|
|
2290
2418
|
navigatorView: NavigatorView, project: Workspace.Workspace.Project|null, id: string, type: string,
|
|
2291
2419
|
folderPath: Platform.DevToolsPath.EncodedPathString, title: string, origin: Platform.DevToolsPath.UrlString) {
|
|
@@ -2296,34 +2424,6 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2296
2424
|
this.origin = origin;
|
|
2297
2425
|
}
|
|
2298
2426
|
|
|
2299
|
-
override mergedTitle(): string {
|
|
2300
|
-
const titles: string[] = [this.title];
|
|
2301
|
-
let child: NavigatorTreeNode|undefined = this.children()[0];
|
|
2302
|
-
while (child instanceof NavigatorFolderTreeNode && child.isMerged) {
|
|
2303
|
-
titles.push(child.title);
|
|
2304
|
-
child = child.children()[0];
|
|
2305
|
-
}
|
|
2306
|
-
return titles.join('/');
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
mergedLeafNode(): NavigatorFolderTreeNode {
|
|
2310
|
-
let current: NavigatorFolderTreeNode = this;
|
|
2311
|
-
let child = current.children()[0];
|
|
2312
|
-
while (child instanceof NavigatorFolderTreeNode && child.isMerged) {
|
|
2313
|
-
current = child;
|
|
2314
|
-
child = current.children()[0];
|
|
2315
|
-
}
|
|
2316
|
-
return current;
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
override effectiveChildren(): NavigatorTreeNode[] {
|
|
2320
|
-
const leaf = this.mergedLeafNode();
|
|
2321
|
-
if (!leaf.isPopulated()) {
|
|
2322
|
-
return [];
|
|
2323
|
-
}
|
|
2324
|
-
return leaf.children().filter(node => !node.isMerged);
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
2427
|
override computedTooltip(): string {
|
|
2328
2428
|
if (this.isMerged) {
|
|
2329
2429
|
return super.computedTooltip();
|
|
@@ -2335,16 +2435,7 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2335
2435
|
return super.computedTooltip();
|
|
2336
2436
|
}
|
|
2337
2437
|
|
|
2338
|
-
|
|
2339
|
-
if (this.treeElement) {
|
|
2340
|
-
return this.treeElement;
|
|
2341
|
-
}
|
|
2342
|
-
this.treeElement = this.createTreeElement(this.title, this);
|
|
2343
|
-
this.updateTitle();
|
|
2344
|
-
return this.treeElement;
|
|
2345
|
-
}
|
|
2346
|
-
|
|
2347
|
-
private computeHasMappedFiles(): boolean {
|
|
2438
|
+
#computeHasMappedFiles(): boolean {
|
|
2348
2439
|
if (!this.project || this.project.type() !== Workspace.Workspace.projectTypes.FileSystem) {
|
|
2349
2440
|
return false;
|
|
2350
2441
|
}
|
|
@@ -2356,25 +2447,10 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2356
2447
|
const isOverrides =
|
|
2357
2448
|
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemType(this.project) === 'overrides';
|
|
2358
2449
|
return isOverrides ?
|
|
2359
|
-
|
|
2450
|
+
this.navigatorView.settings
|
|
2360
2451
|
.resolve(Persistence.NetworkPersistenceManager.persistenceNetworkOverridesEnabledSettingDescriptor)
|
|
2361
2452
|
.get() :
|
|
2362
|
-
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
private updateTreeElement(): void {
|
|
2366
|
-
if (!this.treeElement) {
|
|
2367
|
-
return;
|
|
2368
|
-
}
|
|
2369
|
-
|
|
2370
|
-
this.treeElement.listItemElement.classList.toggle('is-from-source-map',
|
|
2371
|
-
Boolean(this.recursiveProperties.exclusivelySourceMapped));
|
|
2372
|
-
this.treeElement.listItemElement.classList.toggle('is-ignore-listed',
|
|
2373
|
-
Boolean(this.recursiveProperties.exclusivelyIgnored));
|
|
2374
|
-
this.treeElement.listItemElement.classList.toggle('has-mapped-files', this.hasMappedFiles);
|
|
2375
|
-
|
|
2376
|
-
const activeNode = this.navigatorView.nodeForTreeElement(this.treeElement) ?? this;
|
|
2377
|
-
activeNode.updateTooltip(this.treeElement);
|
|
2453
|
+
this.navigatorView.persistence.filePathHasBindings(absoluteFileSystemPath);
|
|
2378
2454
|
}
|
|
2379
2455
|
|
|
2380
2456
|
override updateTitle(): void {
|
|
@@ -2392,123 +2468,59 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
|
|
|
2392
2468
|
this.recursiveProperties[propName] = propValue;
|
|
2393
2469
|
}
|
|
2394
2470
|
|
|
2395
|
-
this.hasMappedFiles = this
|
|
2396
|
-
|
|
2397
|
-
this.updateTreeElement();
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
private createTreeElement(title: string, node: NavigatorTreeNode): UI.TreeOutline.TreeElement {
|
|
2401
|
-
return this.createFolderTreeElement(title, node);
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
override wasPopulated(): void {
|
|
2405
|
-
if (!this.treeElement || this.navigatorView.nodeForTreeElement(this.treeElement) !== this) {
|
|
2406
|
-
return;
|
|
2407
|
-
}
|
|
2408
|
-
this.addChildrenRecursive();
|
|
2471
|
+
this.hasMappedFiles = this.#computeHasMappedFiles();
|
|
2472
|
+
this.navigatorView.requestUpdate();
|
|
2409
2473
|
}
|
|
2410
2474
|
|
|
2411
|
-
|
|
2475
|
+
override didAddChild(node: NavigatorTreeNode): void {
|
|
2412
2476
|
const children = this.children();
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
this.
|
|
2416
|
-
|
|
2417
|
-
|
|
2477
|
+
if (children.length === 1 && this.shouldMerge(node)) {
|
|
2478
|
+
node.isMerged = true;
|
|
2479
|
+
if (this.navigatorView.isNodeExpanded(this)) {
|
|
2480
|
+
node.populate();
|
|
2481
|
+
this.navigatorView.setNodeExpanded(node);
|
|
2482
|
+
}
|
|
2483
|
+
} else if (children.length === 2) {
|
|
2484
|
+
const oldNode = children[0] !== node ? children[0] : children[1];
|
|
2485
|
+
if (oldNode) {
|
|
2486
|
+
oldNode.isMerged = false;
|
|
2487
|
+
if (this.navigatorView.isNodeExpanded(this) || this.navigatorView.isNodeExpanded(oldNode)) {
|
|
2488
|
+
this.populate();
|
|
2489
|
+
oldNode.populate();
|
|
2490
|
+
this.navigatorView.setNodeExpanded(this);
|
|
2491
|
+
this.navigatorView.setNodeExpanded(oldNode);
|
|
2492
|
+
}
|
|
2418
2493
|
}
|
|
2419
2494
|
}
|
|
2495
|
+
super.didAddChild(node);
|
|
2420
2496
|
}
|
|
2421
2497
|
|
|
2422
|
-
|
|
2498
|
+
shouldMerge(node: NavigatorTreeNode): boolean {
|
|
2423
2499
|
return this.type !== Types.Domain && node instanceof NavigatorFolderTreeNode;
|
|
2424
2500
|
}
|
|
2425
2501
|
|
|
2426
|
-
override
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
let children = this.children();
|
|
2432
|
-
|
|
2433
|
-
if (children.length === 1 && this.shouldMerge(node)) {
|
|
2434
|
-
node.isMerged = true;
|
|
2435
|
-
this.treeElement.title = this.treeElement.title + '/' + node.title;
|
|
2436
|
-
(node as NavigatorFolderTreeNode).treeElement = this.treeElement;
|
|
2437
|
-
node.updateTitle();
|
|
2438
|
-
this.navigatorView.setNodeForTreeElement(this.treeElement, node);
|
|
2439
|
-
return;
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
let oldNode;
|
|
2443
|
-
if (children.length === 2) {
|
|
2444
|
-
oldNode = children[0] !== node ? children[0] : children[1];
|
|
2502
|
+
override mergedTitle(): string {
|
|
2503
|
+
const children = this.children();
|
|
2504
|
+
if (children.length === 1 && children[0].isMerged) {
|
|
2505
|
+
return this.title + '/' + (children[0] as NavigatorFolderTreeNode).mergedTitle();
|
|
2445
2506
|
}
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
const mergedToNodes = [];
|
|
2449
|
-
mergedToNodes.push(this);
|
|
2450
|
-
let treeNode: (NavigatorTreeNode|null)|NavigatorTreeNode|this = this;
|
|
2451
|
-
while (treeNode && treeNode.isMerged) {
|
|
2452
|
-
treeNode = treeNode.parent;
|
|
2453
|
-
if (treeNode) {
|
|
2454
|
-
mergedToNodes.push(treeNode);
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
mergedToNodes.reverse();
|
|
2458
|
-
const titleText = mergedToNodes.map(node => node.title).join('/');
|
|
2459
|
-
|
|
2460
|
-
const nodes = [];
|
|
2461
|
-
treeNode = oldNode;
|
|
2462
|
-
do {
|
|
2463
|
-
nodes.push(treeNode);
|
|
2464
|
-
children = treeNode.children();
|
|
2465
|
-
treeNode = children.length === 1 ? children[0] : null;
|
|
2466
|
-
} while (treeNode?.isMerged);
|
|
2467
|
-
|
|
2468
|
-
if (!this.isPopulated()) {
|
|
2469
|
-
this.treeElement.title = titleText;
|
|
2470
|
-
this.navigatorView.setNodeForTreeElement(this.treeElement, this);
|
|
2471
|
-
for (let i = 0; i < nodes.length; ++i) {
|
|
2472
|
-
(nodes[i] as NavigatorFolderTreeNode).treeElement = null;
|
|
2473
|
-
nodes[i].isMerged = false;
|
|
2474
|
-
}
|
|
2475
|
-
this.updateTitle();
|
|
2476
|
-
return;
|
|
2477
|
-
}
|
|
2478
|
-
const oldTreeElement = this.treeElement;
|
|
2479
|
-
const treeElement = this.createTreeElement(titleText, this);
|
|
2480
|
-
for (let i = 0; i < mergedToNodes.length; ++i) {
|
|
2481
|
-
(mergedToNodes[i] as NavigatorFolderTreeNode).treeElement = treeElement;
|
|
2482
|
-
mergedToNodes[i].updateTitle();
|
|
2483
|
-
}
|
|
2484
|
-
if (oldTreeElement.parent) {
|
|
2485
|
-
this.navigatorView.appendChild(oldTreeElement.parent, treeElement);
|
|
2486
|
-
}
|
|
2507
|
+
return this.title;
|
|
2508
|
+
}
|
|
2487
2509
|
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
if (oldTreeElement.parent) {
|
|
2493
|
-
this.navigatorView.removeChild(oldTreeElement.parent, oldTreeElement);
|
|
2494
|
-
}
|
|
2495
|
-
this.navigatorView.appendChild(this.treeElement, oldTreeElement);
|
|
2496
|
-
if (wasExpanded) {
|
|
2497
|
-
this.navigatorView.expandNode(this);
|
|
2498
|
-
}
|
|
2499
|
-
this.updateTitle();
|
|
2500
|
-
}
|
|
2501
|
-
if (this.isPopulated()) {
|
|
2502
|
-
this.navigatorView.appendChild(this.treeElement, node.treeNode());
|
|
2510
|
+
mergedLeafNode(): NavigatorFolderTreeNode {
|
|
2511
|
+
const children = this.children();
|
|
2512
|
+
if (children.length === 1 && children[0].isMerged) {
|
|
2513
|
+
return (children[0] as NavigatorFolderTreeNode).mergedLeafNode();
|
|
2503
2514
|
}
|
|
2515
|
+
return this;
|
|
2504
2516
|
}
|
|
2505
2517
|
|
|
2506
|
-
override
|
|
2507
|
-
const
|
|
2508
|
-
if (
|
|
2509
|
-
return;
|
|
2518
|
+
override effectiveChildren(): NavigatorTreeNode[] {
|
|
2519
|
+
const leaf = this.mergedLeafNode();
|
|
2520
|
+
if (!leaf.isPopulated()) {
|
|
2521
|
+
return [];
|
|
2510
2522
|
}
|
|
2511
|
-
|
|
2523
|
+
return leaf.children().filter(node => !node.isMerged);
|
|
2512
2524
|
}
|
|
2513
2525
|
}
|
|
2514
2526
|
|
|
@@ -2516,7 +2528,7 @@ export class NavigatorGroupTreeNode extends NavigatorTreeNode {
|
|
|
2516
2528
|
readonly project: Workspace.Workspace.Project|null;
|
|
2517
2529
|
override title: string;
|
|
2518
2530
|
readonly frame?: SDK.ResourceTreeModel.ResourceTreeFrame;
|
|
2519
|
-
|
|
2531
|
+
|
|
2520
2532
|
constructor(navigatorView: NavigatorView, project: Workspace.Workspace.Project|null, id: string, type: string,
|
|
2521
2533
|
title: string, tooltip?: string, frame?: SDK.ResourceTreeModel.ResourceTreeFrame) {
|
|
2522
2534
|
super(navigatorView, id, type, tooltip);
|
|
@@ -2526,29 +2538,7 @@ export class NavigatorGroupTreeNode extends NavigatorTreeNode {
|
|
|
2526
2538
|
this.populate();
|
|
2527
2539
|
}
|
|
2528
2540
|
|
|
2529
|
-
|
|
2530
|
-
if (this.treeElement) {
|
|
2531
|
-
return this.treeElement;
|
|
2532
|
-
}
|
|
2533
|
-
const expandable = !(this.project instanceof Persistence.AutomaticFileSystemWorkspaceBinding.FileSystem);
|
|
2534
|
-
this.treeElement = this.createFolderTreeElement(this.title, this, expandable);
|
|
2535
|
-
this.updateTrailingIcons();
|
|
2536
|
-
return this.treeElement;
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
updateTrailingIcons(): void {
|
|
2540
|
-
if (!this.treeElement) {
|
|
2541
|
-
return;
|
|
2542
|
-
}
|
|
2543
|
-
const trailingIcons = renderGroupTrailingIcons(this.project);
|
|
2544
|
-
this.treeElement.setTrailingIcons(trailingIcons);
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
override onattach(): void {
|
|
2548
|
-
this.updateTitle();
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2551
|
-
private computeHasMappedFiles(): boolean {
|
|
2541
|
+
#computeHasMappedFiles(): boolean {
|
|
2552
2542
|
if (!this.project || this.project.type() !== Workspace.Workspace.projectTypes.FileSystem) {
|
|
2553
2543
|
return false;
|
|
2554
2544
|
}
|
|
@@ -2557,39 +2547,29 @@ export class NavigatorGroupTreeNode extends NavigatorTreeNode {
|
|
|
2557
2547
|
const isOverrides =
|
|
2558
2548
|
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.fileSystemType(this.project) === 'overrides';
|
|
2559
2549
|
return isOverrides ?
|
|
2560
|
-
|
|
2550
|
+
this.navigatorView.settings
|
|
2561
2551
|
.resolve(Persistence.NetworkPersistenceManager.persistenceNetworkOverridesEnabledSettingDescriptor)
|
|
2562
2552
|
.get() :
|
|
2563
|
-
|
|
2553
|
+
this.navigatorView.persistence.filePathHasBindings(fileSystemPath);
|
|
2564
2554
|
}
|
|
2565
2555
|
|
|
2566
2556
|
override updateTitle(): void {
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
this.updateTrailingIcons();
|
|
2570
|
-
if (!this.treeElement || !this.project || this.project.type() !== Workspace.Workspace.projectTypes.FileSystem) {
|
|
2571
|
-
return;
|
|
2572
|
-
}
|
|
2573
|
-
const wasActive = this.treeElement.listItemElement.classList.contains('has-mapped-files');
|
|
2557
|
+
const wasActive = this.hasMappedFiles;
|
|
2558
|
+
this.hasMappedFiles = this.#computeHasMappedFiles();
|
|
2574
2559
|
const isActive = this.hasMappedFiles;
|
|
2575
|
-
|
|
2576
|
-
if (
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
if (isActive) {
|
|
2583
|
-
this.navigatorView.expandNode(this);
|
|
2584
|
-
} else {
|
|
2585
|
-
this.navigatorView.collapseNode(this);
|
|
2560
|
+
|
|
2561
|
+
if (this.project?.type() === Workspace.Workspace.projectTypes.FileSystem && wasActive !== isActive) {
|
|
2562
|
+
if (isActive) {
|
|
2563
|
+
this.navigatorView.expandNode(this);
|
|
2564
|
+
} else {
|
|
2565
|
+
this.navigatorView.collapseNode(this);
|
|
2566
|
+
}
|
|
2586
2567
|
}
|
|
2568
|
+
this.navigatorView.requestUpdate();
|
|
2587
2569
|
}
|
|
2588
2570
|
|
|
2589
2571
|
override setTitle(title: string): void {
|
|
2590
2572
|
this.title = title;
|
|
2591
|
-
|
|
2592
|
-
this.treeElement.title = this.title;
|
|
2593
|
-
}
|
|
2573
|
+
this.navigatorView.requestUpdate();
|
|
2594
2574
|
}
|
|
2595
2575
|
}
|