dockview-core 7.0.4 → 8.1.0
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/LICENCE.md +21 -0
- package/README.md +17 -86
- package/dist/cjs/api/component.api.d.ts +100 -9
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +45 -1
- package/dist/cjs/api/dockviewPanelApi.d.ts +21 -0
- package/dist/cjs/dismissableLayer.d.ts +57 -0
- package/dist/cjs/dnd/backend.d.ts +2 -2
- package/dist/cjs/dnd/dataTransfer.d.ts +1 -0
- package/dist/cjs/dnd/dropTargetAnchorContainer.d.ts +12 -0
- package/dist/cjs/dnd/droptarget.d.ts +94 -0
- package/dist/cjs/dnd/ghost.d.ts +1 -0
- package/dist/cjs/dnd/pointer/longPress.d.ts +2 -2
- package/dist/cjs/dnd/pointer/pointerDragController.d.ts +5 -2
- package/dist/cjs/dnd/pointer/pointerDragSource.d.ts +1 -1
- package/dist/cjs/dnd/pointer/pointerDropTarget.d.ts +30 -1
- package/dist/cjs/dnd/pointer/pointerGhost.d.ts +1 -1
- package/dist/cjs/dockview/accessibilityMessages.d.ts +6 -0
- package/dist/cjs/dockview/advancedDnDService.d.ts +31 -0
- package/dist/cjs/dockview/components/panel/content.d.ts +1 -1
- package/dist/cjs/dockview/components/tab/defaultTab.d.ts +2 -0
- package/dist/cjs/dockview/components/tab/tab.d.ts +2 -0
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +2 -2
- package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +1 -1
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.d.ts +1 -1
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +73 -2
- package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +1 -1
- package/dist/cjs/dockview/components/titlebar/tabReorderController.d.ts +295 -0
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +120 -50
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +48 -0
- package/dist/cjs/dockview/dndCapabilities.d.ts +1 -1
- package/dist/cjs/dockview/dockviewComponent.d.ts +307 -19
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +5 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +76 -2
- package/dist/cjs/dockview/dockviewPanel.d.ts +12 -0
- package/dist/cjs/dockview/dockviewShell.d.ts +48 -24
- package/dist/cjs/dockview/edgeGroupService.d.ts +20 -0
- package/dist/cjs/dockview/events.d.ts +6 -0
- package/dist/cjs/dockview/liveRegionService.d.ts +18 -5
- package/dist/cjs/dockview/moduleContracts.d.ts +485 -14
- package/dist/cjs/dockview/modules.d.ts +101 -22
- package/dist/cjs/dockview/options.d.ts +336 -30
- package/dist/cjs/dockview/optionsModules.d.ts +73 -0
- package/dist/cjs/dockview/popoutWindowService.d.ts +15 -10
- package/dist/cjs/dockview/rootDropTargetService.d.ts +11 -0
- package/dist/cjs/dockview/tabGroup.d.ts +3 -0
- package/dist/cjs/dockview/tabGroupAccent.d.ts +1 -1
- package/dist/cjs/dockview/tabGroupChipsService.d.ts +10 -0
- package/dist/cjs/dockview/theme.d.ts +2 -2
- package/dist/cjs/dockview/types.d.ts +3 -0
- package/dist/cjs/dom.d.ts +9 -1
- package/dist/cjs/events.d.ts +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +2 -2
- package/dist/cjs/gridview/branchNode.d.ts +16 -0
- package/dist/cjs/gridview/gridview.d.ts +2 -0
- package/dist/cjs/index.d.ts +35 -29
- package/dist/cjs/lifecycle.d.ts +1 -0
- package/dist/cjs/overlay/overlay.d.ts +4 -2
- package/dist/cjs/overlay/overlayRenderContainer.d.ts +8 -0
- package/dist/cjs/paneview/paneview.d.ts +2 -1
- package/dist/cjs/paneview/paneviewComponent.d.ts +3 -0
- package/dist/cjs/paneview/paneviewPanel.d.ts +5 -0
- package/dist/cjs/scrollbar.d.ts +10 -0
- package/dist/cjs/splitview/viewItem.d.ts +10 -0
- package/dist/cjs/svg.d.ts +1 -0
- package/dist/cjs/types.d.ts +8 -0
- package/dist/dockview-core.js +18513 -19679
- package/dist/dockview-core.min.js +4138 -6
- package/dist/dockview-core.min.noStyle.js +6 -7
- package/dist/dockview-core.noStyle.js +18512 -19656
- package/dist/package/main.cjs.js +18123 -19267
- package/dist/package/main.cjs.min.js +6 -6
- package/dist/package/main.esm.min.mjs +6 -6
- package/dist/package/main.esm.mjs +18081 -19260
- package/package.json +81 -77
- package/dist/cjs/api/component.api.js +0 -1242
- package/dist/cjs/api/dockviewGroupPanelApi.js +0 -200
- package/dist/cjs/api/dockviewPanelApi.js +0 -172
- package/dist/cjs/api/entryPoints.js +0 -27
- package/dist/cjs/api/gridviewPanelApi.js +0 -45
- package/dist/cjs/api/panelApi.js +0 -133
- package/dist/cjs/api/paneviewPanelApi.js +0 -57
- package/dist/cjs/api/splitviewPanelApi.js +0 -47
- package/dist/cjs/array.js +0 -66
- package/dist/cjs/constants.js +0 -11
- package/dist/cjs/dnd/backend.js +0 -171
- package/dist/cjs/dnd/dataTransfer.js +0 -100
- package/dist/cjs/dnd/dnd.js +0 -74
- package/dist/cjs/dnd/dropOverlay.js +0 -197
- package/dist/cjs/dnd/dropTargetAnchorContainer.js +0 -104
- package/dist/cjs/dnd/droptarget.js +0 -362
- package/dist/cjs/dnd/ghost.js +0 -17
- package/dist/cjs/dnd/pointer/index.js +0 -13
- package/dist/cjs/dnd/pointer/longPress.js +0 -151
- package/dist/cjs/dnd/pointer/pointerDragController.js +0 -243
- package/dist/cjs/dnd/pointer/pointerDragSource.js +0 -197
- package/dist/cjs/dnd/pointer/pointerDropTarget.js +0 -198
- package/dist/cjs/dnd/pointer/pointerGhost.js +0 -44
- package/dist/cjs/dnd/pointer/types.js +0 -2
- package/dist/cjs/dockview/accessibilityMessages.js +0 -51
- package/dist/cjs/dockview/allModules.js +0 -25
- package/dist/cjs/dockview/components/panel/content.js +0 -213
- package/dist/cjs/dockview/components/popupService.js +0 -132
- package/dist/cjs/dockview/components/tab/defaultTab.js +0 -70
- package/dist/cjs/dockview/components/tab/tab.js +0 -281
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.js +0 -95
- package/dist/cjs/dockview/components/titlebar/groupDragSource.js +0 -218
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.js +0 -104
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +0 -477
- package/dist/cjs/dockview/components/titlebar/tabGroups.js +0 -854
- package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +0 -19
- package/dist/cjs/dockview/components/titlebar/tabs.js +0 -2016
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +0 -458
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +0 -120
- package/dist/cjs/dockview/components/watermark/watermark.js +0 -40
- package/dist/cjs/dockview/deserializer.js +0 -39
- package/dist/cjs/dockview/dndCapabilities.js +0 -39
- package/dist/cjs/dockview/dockviewComponent.js +0 -3896
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +0 -70
- package/dist/cjs/dockview/dockviewGroupPanel.js +0 -204
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +0 -1514
- package/dist/cjs/dockview/dockviewPanel.js +0 -265
- package/dist/cjs/dockview/dockviewPanelModel.js +0 -105
- package/dist/cjs/dockview/dockviewShell.js +0 -744
- package/dist/cjs/dockview/edgeGroupService.js +0 -128
- package/dist/cjs/dockview/events.js +0 -67
- package/dist/cjs/dockview/floatingGroupService.js +0 -231
- package/dist/cjs/dockview/framework.js +0 -2
- package/dist/cjs/dockview/headerActionsService.js +0 -149
- package/dist/cjs/dockview/liveRegionService.js +0 -185
- package/dist/cjs/dockview/moduleContracts.js +0 -2
- package/dist/cjs/dockview/modules.js +0 -304
- package/dist/cjs/dockview/options.js +0 -103
- package/dist/cjs/dockview/popoutWindowService.js +0 -261
- package/dist/cjs/dockview/rootDropTargetService.js +0 -87
- package/dist/cjs/dockview/strictEventsSequencing.js +0 -63
- package/dist/cjs/dockview/tabGroup.js +0 -219
- package/dist/cjs/dockview/tabGroupAccent.js +0 -126
- package/dist/cjs/dockview/theme.js +0 -139
- package/dist/cjs/dockview/types.js +0 -2
- package/dist/cjs/dockview/validate.js +0 -76
- package/dist/cjs/dockview/watermarkService.js +0 -61
- package/dist/cjs/dom.js +0 -543
- package/dist/cjs/events.js +0 -296
- package/dist/cjs/framwork.js +0 -2
- package/dist/cjs/gridview/baseComponentGridview.js +0 -330
- package/dist/cjs/gridview/basePanelView.js +0 -162
- package/dist/cjs/gridview/branchNode.js +0 -372
- package/dist/cjs/gridview/gridview.js +0 -776
- package/dist/cjs/gridview/gridviewComponent.js +0 -363
- package/dist/cjs/gridview/gridviewPanel.js +0 -249
- package/dist/cjs/gridview/leafNode.js +0 -169
- package/dist/cjs/gridview/options.js +0 -17
- package/dist/cjs/gridview/types.js +0 -2
- package/dist/cjs/index.js +0 -105
- package/dist/cjs/lifecycle.js +0 -80
- package/dist/cjs/math.js +0 -38
- package/dist/cjs/overlay/overlay.js +0 -602
- package/dist/cjs/overlay/overlayRenderContainer.js +0 -309
- package/dist/cjs/panel/types.js +0 -2
- package/dist/cjs/paneview/defaultPaneviewHeader.js +0 -92
- package/dist/cjs/paneview/draggablePaneviewPanel.js +0 -141
- package/dist/cjs/paneview/options.js +0 -44
- package/dist/cjs/paneview/paneview.js +0 -203
- package/dist/cjs/paneview/paneviewComponent.js +0 -430
- package/dist/cjs/paneview/paneviewPanel.js +0 -275
- package/dist/cjs/popoutWindow.js +0 -244
- package/dist/cjs/resizable.js +0 -97
- package/dist/cjs/scrollbar.js +0 -169
- package/dist/cjs/splitview/options.js +0 -19
- package/dist/cjs/splitview/splitview.js +0 -999
- package/dist/cjs/splitview/splitviewComponent.js +0 -401
- package/dist/cjs/splitview/splitviewPanel.js +0 -179
- package/dist/cjs/splitview/viewItem.js +0 -119
- package/dist/cjs/svg.js +0 -43
- package/dist/cjs/types.js +0 -2
- package/dist/dockview-core.min.js.map +0 -1
- package/dist/dockview-core.min.noStyle.js.map +0 -1
- package/dist/esm/api/component.api.d.ts +0 -640
- package/dist/esm/api/component.api.js +0 -887
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +0 -109
- package/dist/esm/api/dockviewGroupPanelApi.js +0 -155
- package/dist/esm/api/dockviewPanelApi.d.ts +0 -84
- package/dist/esm/api/dockviewPanelApi.js +0 -124
- package/dist/esm/api/entryPoints.d.ts +0 -9
- package/dist/esm/api/entryPoints.js +0 -21
- package/dist/esm/api/gridviewPanelApi.d.ts +0 -37
- package/dist/esm/api/gridviewPanelApi.js +0 -23
- package/dist/esm/api/panelApi.d.ts +0 -100
- package/dist/esm/api/panelApi.js +0 -87
- package/dist/esm/api/paneviewPanelApi.d.ts +0 -26
- package/dist/esm/api/paneviewPanelApi.js +0 -27
- package/dist/esm/api/splitviewPanelApi.d.ts +0 -32
- package/dist/esm/api/splitviewPanelApi.js +0 -25
- package/dist/esm/array.d.ts +0 -13
- package/dist/esm/array.js +0 -57
- package/dist/esm/constants.d.ts +0 -8
- package/dist/esm/constants.js +0 -8
- package/dist/esm/dnd/backend.d.ts +0 -70
- package/dist/esm/dnd/backend.js +0 -148
- package/dist/esm/dnd/dataTransfer.d.ts +0 -31
- package/dist/esm/dnd/dataTransfer.js +0 -67
- package/dist/esm/dnd/dnd.d.ts +0 -32
- package/dist/esm/dnd/dnd.js +0 -51
- package/dist/esm/dnd/dropOverlay.d.ts +0 -20
- package/dist/esm/dnd/dropOverlay.js +0 -192
- package/dist/esm/dnd/dropTargetAnchorContainer.d.ts +0 -16
- package/dist/esm/dnd/dropTargetAnchorContainer.js +0 -73
- package/dist/esm/dnd/droptarget.d.ts +0 -116
- package/dist/esm/dnd/droptarget.js +0 -316
- package/dist/esm/dnd/ghost.d.ts +0 -4
- package/dist/esm/dnd/ghost.js +0 -14
- package/dist/esm/dnd/pointer/index.d.ts +0 -11
- package/dist/esm/dnd/pointer/index.js +0 -5
- package/dist/esm/dnd/pointer/longPress.d.ts +0 -32
- package/dist/esm/dnd/pointer/longPress.js +0 -127
- package/dist/esm/dnd/pointer/pointerDragController.d.ts +0 -60
- package/dist/esm/dnd/pointer/pointerDragController.js +0 -193
- package/dist/esm/dnd/pointer/pointerDragSource.d.ts +0 -61
- package/dist/esm/dnd/pointer/pointerDragSource.js +0 -173
- package/dist/esm/dnd/pointer/pointerDropTarget.d.ts +0 -39
- package/dist/esm/dnd/pointer/pointerDropTarget.js +0 -168
- package/dist/esm/dnd/pointer/pointerGhost.d.ts +0 -30
- package/dist/esm/dnd/pointer/pointerGhost.js +0 -39
- package/dist/esm/dnd/pointer/types.d.ts +0 -16
- package/dist/esm/dnd/pointer/types.js +0 -1
- package/dist/esm/dockview/accessibilityMessages.d.ts +0 -32
- package/dist/esm/dockview/accessibilityMessages.js +0 -30
- package/dist/esm/dockview/allModules.d.ts +0 -8
- package/dist/esm/dockview/allModules.js +0 -22
- package/dist/esm/dockview/components/panel/content.d.ts +0 -54
- package/dist/esm/dockview/components/panel/content.js +0 -185
- package/dist/esm/dockview/components/popupService.d.ts +0 -21
- package/dist/esm/dockview/components/popupService.js +0 -108
- package/dist/esm/dockview/components/tab/defaultTab.d.ts +0 -12
- package/dist/esm/dockview/components/tab/defaultTab.js +0 -43
- package/dist/esm/dockview/components/tab/tab.d.ts +0 -44
- package/dist/esm/dockview/components/tab/tab.js +0 -242
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +0 -34
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.js +0 -65
- package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +0 -51
- package/dist/esm/dockview/components/titlebar/groupDragSource.js +0 -178
- package/dist/esm/dockview/components/titlebar/tabGroupChip.d.ts +0 -37
- package/dist/esm/dockview/components/titlebar/tabGroupChip.js +0 -77
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +0 -72
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +0 -360
- package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +0 -107
- package/dist/esm/dockview/components/titlebar/tabGroups.js +0 -621
- package/dist/esm/dockview/components/titlebar/tabOverflowControl.d.ts +0 -8
- package/dist/esm/dockview/components/titlebar/tabOverflowControl.js +0 -16
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +0 -167
- package/dist/esm/dockview/components/titlebar/tabs.js +0 -1653
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +0 -104
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +0 -359
- package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +0 -21
- package/dist/esm/dockview/components/titlebar/voidContainer.js +0 -92
- package/dist/esm/dockview/components/watermark/watermark.d.ts +0 -8
- package/dist/esm/dockview/components/watermark/watermark.js +0 -14
- package/dist/esm/dockview/deserializer.d.ts +0 -12
- package/dist/esm/dockview/deserializer.js +0 -34
- package/dist/esm/dockview/dndCapabilities.d.ts +0 -19
- package/dist/esm/dockview/dndCapabilities.js +0 -36
- package/dist/esm/dockview/dockviewComponent.d.ts +0 -626
- package/dist/esm/dockview/dockviewComponent.js +0 -3214
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +0 -45
- package/dist/esm/dockview/dockviewFloatingGroupPanel.js +0 -44
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +0 -35
- package/dist/esm/dockview/dockviewGroupPanel.js +0 -142
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +0 -358
- package/dist/esm/dockview/dockviewGroupPanelModel.js +0 -1180
- package/dist/esm/dockview/dockviewPanel.d.ts +0 -69
- package/dist/esm/dockview/dockviewPanel.js +0 -178
- package/dist/esm/dockview/dockviewPanelModel.d.ts +0 -37
- package/dist/esm/dockview/dockviewPanelModel.js +0 -81
- package/dist/esm/dockview/dockviewShell.d.ts +0 -150
- package/dist/esm/dockview/dockviewShell.js +0 -678
- package/dist/esm/dockview/edgeGroupService.d.ts +0 -38
- package/dist/esm/dockview/edgeGroupService.js +0 -63
- package/dist/esm/dockview/events.d.ts +0 -38
- package/dist/esm/dockview/events.js +0 -34
- package/dist/esm/dockview/floatingGroupService.d.ts +0 -37
- package/dist/esm/dockview/floatingGroupService.js +0 -150
- package/dist/esm/dockview/framework.d.ts +0 -65
- package/dist/esm/dockview/framework.js +0 -1
- package/dist/esm/dockview/headerActionsService.d.ts +0 -32
- package/dist/esm/dockview/headerActionsService.js +0 -86
- package/dist/esm/dockview/liveRegionService.d.ts +0 -53
- package/dist/esm/dockview/liveRegionService.js +0 -159
- package/dist/esm/dockview/moduleContracts.d.ts +0 -119
- package/dist/esm/dockview/moduleContracts.js +0 -1
- package/dist/esm/dockview/modules.d.ts +0 -110
- package/dist/esm/dockview/modules.js +0 -170
- package/dist/esm/dockview/options.d.ts +0 -474
- package/dist/esm/dockview/options.js +0 -77
- package/dist/esm/dockview/popoutWindowService.d.ts +0 -95
- package/dist/esm/dockview/popoutWindowService.js +0 -175
- package/dist/esm/dockview/rootDropTargetService.d.ts +0 -35
- package/dist/esm/dockview/rootDropTargetService.js +0 -82
- package/dist/esm/dockview/strictEventsSequencing.d.ts +0 -7
- package/dist/esm/dockview/strictEventsSequencing.js +0 -41
- package/dist/esm/dockview/tabGroup.d.ts +0 -99
- package/dist/esm/dockview/tabGroup.js +0 -144
- package/dist/esm/dockview/tabGroupAccent.d.ts +0 -65
- package/dist/esm/dockview/tabGroupAccent.js +0 -114
- package/dist/esm/dockview/theme.d.ts +0 -86
- package/dist/esm/dockview/theme.js +0 -136
- package/dist/esm/dockview/types.d.ts +0 -53
- package/dist/esm/dockview/types.js +0 -1
- package/dist/esm/dockview/validate.d.ts +0 -0
- package/dist/esm/dockview/validate.js +0 -76
- package/dist/esm/dockview/watermarkService.d.ts +0 -30
- package/dist/esm/dockview/watermarkService.js +0 -56
- package/dist/esm/dom.d.ts +0 -60
- package/dist/esm/dom.js +0 -375
- package/dist/esm/events.d.ts +0 -79
- package/dist/esm/events.js +0 -219
- package/dist/esm/framwork.d.ts +0 -4
- package/dist/esm/framwork.js +0 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts +0 -111
- package/dist/esm/gridview/baseComponentGridview.js +0 -237
- package/dist/esm/gridview/basePanelView.d.ts +0 -40
- package/dist/esm/gridview/basePanelView.js +0 -91
- package/dist/esm/gridview/branchNode.d.ts +0 -57
- package/dist/esm/gridview/branchNode.js +0 -257
- package/dist/esm/gridview/gridview.d.ts +0 -158
- package/dist/esm/gridview/gridview.js +0 -681
- package/dist/esm/gridview/gridviewComponent.d.ts +0 -88
- package/dist/esm/gridview/gridviewComponent.js +0 -265
- package/dist/esm/gridview/gridviewPanel.d.ts +0 -77
- package/dist/esm/gridview/gridviewPanel.js +0 -182
- package/dist/esm/gridview/leafNode.d.ts +0 -34
- package/dist/esm/gridview/leafNode.js +0 -102
- package/dist/esm/gridview/options.d.ts +0 -15
- package/dist/esm/gridview/options.js +0 -14
- package/dist/esm/gridview/types.d.ts +0 -3
- package/dist/esm/gridview/types.js +0 -1
- package/dist/esm/index.d.ts +0 -58
- package/dist/esm/index.js +0 -44
- package/dist/esm/lifecycle.d.ts +0 -25
- package/dist/esm/lifecycle.js +0 -56
- package/dist/esm/math.d.ts +0 -5
- package/dist/esm/math.js +0 -32
- package/dist/esm/overlay/overlay.d.ts +0 -91
- package/dist/esm/overlay/overlay.js +0 -520
- package/dist/esm/overlay/overlayRenderContainer.d.ts +0 -24
- package/dist/esm/overlay/overlayRenderContainer.js +0 -249
- package/dist/esm/panel/types.d.ts +0 -33
- package/dist/esm/panel/types.js +0 -1
- package/dist/esm/paneview/defaultPaneviewHeader.d.ts +0 -21
- package/dist/esm/paneview/defaultPaneviewHeader.js +0 -65
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +0 -38
- package/dist/esm/paneview/draggablePaneviewPanel.js +0 -107
- package/dist/esm/paneview/options.d.ts +0 -30
- package/dist/esm/paneview/options.js +0 -22
- package/dist/esm/paneview/paneview.d.ts +0 -41
- package/dist/esm/paneview/paneview.js +0 -148
- package/dist/esm/paneview/paneviewComponent.d.ts +0 -133
- package/dist/esm/paneview/paneviewComponent.js +0 -306
- package/dist/esm/paneview/paneviewPanel.d.ts +0 -98
- package/dist/esm/paneview/paneviewPanel.js +0 -192
- package/dist/esm/popoutWindow.d.ts +0 -38
- package/dist/esm/popoutWindow.js +0 -170
- package/dist/esm/resizable.d.ts +0 -12
- package/dist/esm/resizable.js +0 -66
- package/dist/esm/scrollbar.d.ts +0 -15
- package/dist/esm/scrollbar.js +0 -139
- package/dist/esm/splitview/options.d.ts +0 -21
- package/dist/esm/splitview/options.js +0 -16
- package/dist/esm/splitview/splitview.d.ts +0 -145
- package/dist/esm/splitview/splitview.js +0 -770
- package/dist/esm/splitview/splitviewComponent.d.ts +0 -101
- package/dist/esm/splitview/splitviewComponent.js +0 -267
- package/dist/esm/splitview/splitviewPanel.d.ts +0 -45
- package/dist/esm/splitview/splitviewPanel.js +0 -108
- package/dist/esm/splitview/viewItem.d.ts +0 -25
- package/dist/esm/splitview/viewItem.js +0 -74
- package/dist/esm/svg.d.ts +0 -3
- package/dist/esm/svg.js +0 -31
- package/dist/esm/types.d.ts +0 -31
- package/dist/esm/types.js +0 -1
- package/dist/styles/dockview.css +0 -3436
|
@@ -1,1180 +0,0 @@
|
|
|
1
|
-
import { DockviewApi } from '../api/component.api';
|
|
2
|
-
import { getPanelData } from '../dnd/dataTransfer';
|
|
3
|
-
import { addClasses, isAncestor, removeClasses, toggleClass } from '../dom';
|
|
4
|
-
import { addDisposableListener, DockviewEvent, Emitter, } from '../events';
|
|
5
|
-
import { DockviewWillShowOverlayLocationEvent, } from './events';
|
|
6
|
-
import { CompositeDisposable } from '../lifecycle';
|
|
7
|
-
import { ContentContainer, } from './components/panel/content';
|
|
8
|
-
import { TabsContainer, } from './components/titlebar/tabsContainer';
|
|
9
|
-
import { DockviewUnhandledDragOverEvent, } from './options';
|
|
10
|
-
import { TabGroup, } from './tabGroup';
|
|
11
|
-
export class DockviewDidDropEvent extends DockviewEvent {
|
|
12
|
-
/**
|
|
13
|
-
* `PointerEvent` for touch drags has no `dataTransfer`; use
|
|
14
|
-
* `getData()` for the dockview payload regardless of input method.
|
|
15
|
-
*/
|
|
16
|
-
get nativeEvent() {
|
|
17
|
-
return this.options.nativeEvent;
|
|
18
|
-
}
|
|
19
|
-
get position() {
|
|
20
|
-
return this.options.position;
|
|
21
|
-
}
|
|
22
|
-
get panel() {
|
|
23
|
-
return this.options.panel;
|
|
24
|
-
}
|
|
25
|
-
get group() {
|
|
26
|
-
return this.options.group;
|
|
27
|
-
}
|
|
28
|
-
get api() {
|
|
29
|
-
return this.options.api;
|
|
30
|
-
}
|
|
31
|
-
constructor(options) {
|
|
32
|
-
super();
|
|
33
|
-
this.options = options;
|
|
34
|
-
}
|
|
35
|
-
getData() {
|
|
36
|
-
return this.options.getData();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
40
|
-
get kind() {
|
|
41
|
-
return this._kind;
|
|
42
|
-
}
|
|
43
|
-
constructor(options) {
|
|
44
|
-
super(options);
|
|
45
|
-
this._kind = options.kind;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export class DockviewGroupPanelModel extends CompositeDisposable {
|
|
49
|
-
get tabGroups() {
|
|
50
|
-
return this._tabGroups;
|
|
51
|
-
}
|
|
52
|
-
get element() {
|
|
53
|
-
throw new Error('dockview: not supported');
|
|
54
|
-
}
|
|
55
|
-
get activePanel() {
|
|
56
|
-
return this._activePanel;
|
|
57
|
-
}
|
|
58
|
-
/** DOM id of the content container (the group's tabpanel), referenced by each tab's `aria-controls`. */
|
|
59
|
-
get contentContainerId() {
|
|
60
|
-
return this.contentContainer.element.id;
|
|
61
|
-
}
|
|
62
|
-
/** The group's content drop target — lets keyboard docking preview a drop here. */
|
|
63
|
-
get contentDropTarget() {
|
|
64
|
-
return this.contentContainer.dropTarget;
|
|
65
|
-
}
|
|
66
|
-
get locked() {
|
|
67
|
-
return this._locked;
|
|
68
|
-
}
|
|
69
|
-
set locked(value) {
|
|
70
|
-
this._locked = value;
|
|
71
|
-
toggleClass(this.container, 'dv-locked-groupview', value === 'no-drop-target' || value);
|
|
72
|
-
}
|
|
73
|
-
get isActive() {
|
|
74
|
-
return this._isGroupActive;
|
|
75
|
-
}
|
|
76
|
-
get panels() {
|
|
77
|
-
return this._panels;
|
|
78
|
-
}
|
|
79
|
-
get size() {
|
|
80
|
-
return this._panels.length;
|
|
81
|
-
}
|
|
82
|
-
get isEmpty() {
|
|
83
|
-
return this._panels.length === 0;
|
|
84
|
-
}
|
|
85
|
-
get hasWatermark() {
|
|
86
|
-
return !!(this.watermark && this.container.contains(this.watermark.element));
|
|
87
|
-
}
|
|
88
|
-
get header() {
|
|
89
|
-
return this.tabsContainer;
|
|
90
|
-
}
|
|
91
|
-
get isContentFocused() {
|
|
92
|
-
if (!document.activeElement) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
96
|
-
}
|
|
97
|
-
get headerPosition() {
|
|
98
|
-
var _a;
|
|
99
|
-
return (_a = this._headerPosition) !== null && _a !== void 0 ? _a : 'top';
|
|
100
|
-
}
|
|
101
|
-
set headerPosition(value) {
|
|
102
|
-
var _a;
|
|
103
|
-
this._headerPosition = value;
|
|
104
|
-
removeClasses(this.container, 'dv-groupview-header-top', 'dv-groupview-header-bottom', 'dv-groupview-header-left', 'dv-groupview-header-right');
|
|
105
|
-
addClasses(this.container, `dv-groupview-header-${value}`);
|
|
106
|
-
const direction = value === 'top' || value === 'bottom' ? 'horizontal' : 'vertical';
|
|
107
|
-
this.tabsContainer.direction = direction;
|
|
108
|
-
this.header.direction = direction;
|
|
109
|
-
// resize the active panel to fit the new header direction
|
|
110
|
-
// if not, the panel will overflow the tabs container
|
|
111
|
-
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
112
|
-
this._activePanel.layout(this._width, this._height);
|
|
113
|
-
}
|
|
114
|
-
this.updateHeaderActions();
|
|
115
|
-
}
|
|
116
|
-
get location() {
|
|
117
|
-
return this._location;
|
|
118
|
-
}
|
|
119
|
-
set location(value) {
|
|
120
|
-
this._location = value;
|
|
121
|
-
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
122
|
-
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
123
|
-
toggleClass(this.container, 'dv-groupview-edge', false);
|
|
124
|
-
// Mouse and touch drop targets must agree on accepted zones.
|
|
125
|
-
const applyZones = (zones) => {
|
|
126
|
-
this.contentContainer.dropTarget.setTargetZones(zones);
|
|
127
|
-
this.contentContainer.pointerDropTarget.setTargetZones(zones);
|
|
128
|
-
};
|
|
129
|
-
switch (value.type) {
|
|
130
|
-
case 'grid':
|
|
131
|
-
applyZones(['top', 'bottom', 'left', 'right', 'center']);
|
|
132
|
-
break;
|
|
133
|
-
case 'floating':
|
|
134
|
-
// Floating windows host their own nested gridview, so an edge
|
|
135
|
-
// drop splits the window's layout just like the main grid.
|
|
136
|
-
applyZones(['top', 'bottom', 'left', 'right', 'center']);
|
|
137
|
-
toggleClass(this.container, 'dv-groupview-floating', true);
|
|
138
|
-
break;
|
|
139
|
-
case 'popout':
|
|
140
|
-
// Popout windows host their own nested gridview, so an edge
|
|
141
|
-
// drop splits the window's layout just like the main grid.
|
|
142
|
-
applyZones(['top', 'bottom', 'left', 'right', 'center']);
|
|
143
|
-
toggleClass(this.container, 'dv-groupview-popout', true);
|
|
144
|
-
break;
|
|
145
|
-
case 'edge':
|
|
146
|
-
applyZones(['center']);
|
|
147
|
-
toggleClass(this.container, 'dv-groupview-edge', true);
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
this.groupPanel.api._onDidLocationChange.fire({
|
|
151
|
-
location: this.location,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
constructor(container, accessor, id, options, groupPanel) {
|
|
155
|
-
var _a, _b;
|
|
156
|
-
super();
|
|
157
|
-
this.container = container;
|
|
158
|
-
this.accessor = accessor;
|
|
159
|
-
this.id = id;
|
|
160
|
-
this.options = options;
|
|
161
|
-
this.groupPanel = groupPanel;
|
|
162
|
-
this._isGroupActive = false;
|
|
163
|
-
this._locked = false;
|
|
164
|
-
this._location = { type: 'grid' };
|
|
165
|
-
this.mostRecentlyUsed = [];
|
|
166
|
-
this._overwriteRenderContainer = null;
|
|
167
|
-
this._overwriteDropTargetContainer = null;
|
|
168
|
-
this._onDidChange = new Emitter();
|
|
169
|
-
this.onDidChange = this._onDidChange.event;
|
|
170
|
-
this._width = 0;
|
|
171
|
-
this._height = 0;
|
|
172
|
-
this._panels = [];
|
|
173
|
-
this._panelDisposables = new Map();
|
|
174
|
-
this._tabGroupDisposables = new Map();
|
|
175
|
-
this._pendingMicrotaskDisposables = new Set();
|
|
176
|
-
this._onMove = new Emitter();
|
|
177
|
-
this.onMove = this._onMove.event;
|
|
178
|
-
this._onDidDrop = new Emitter();
|
|
179
|
-
this.onDidDrop = this._onDidDrop.event;
|
|
180
|
-
this._onWillDrop = new Emitter();
|
|
181
|
-
this.onWillDrop = this._onWillDrop.event;
|
|
182
|
-
this._onWillShowOverlay = new Emitter();
|
|
183
|
-
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
184
|
-
this._onTabDragStart = new Emitter();
|
|
185
|
-
this.onTabDragStart = this._onTabDragStart.event;
|
|
186
|
-
this._onGroupDragStart = new Emitter();
|
|
187
|
-
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
188
|
-
this._onDidAddPanel = new Emitter();
|
|
189
|
-
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
190
|
-
this._onDidPanelTitleChange = new Emitter();
|
|
191
|
-
this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
|
|
192
|
-
this._onDidPanelParametersChange = new Emitter();
|
|
193
|
-
this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
|
|
194
|
-
this._onDidRemovePanel = new Emitter();
|
|
195
|
-
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
196
|
-
this._onDidActivePanelChange = new Emitter();
|
|
197
|
-
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
198
|
-
this._onUnhandledDragOver = new Emitter();
|
|
199
|
-
this.onUnhandledDragOver = this._onUnhandledDragOver.event;
|
|
200
|
-
this._tabGroups = [];
|
|
201
|
-
this._tabGroupMap = new Map();
|
|
202
|
-
this._panelToTabGroup = new Map();
|
|
203
|
-
this._tabGroupIdCounter = 0;
|
|
204
|
-
this._pendingTabGroupUpdate = false;
|
|
205
|
-
this._onDidCreateTabGroup = new Emitter();
|
|
206
|
-
this.onDidCreateTabGroup = this._onDidCreateTabGroup.event;
|
|
207
|
-
this._onDidDestroyTabGroup = new Emitter();
|
|
208
|
-
this.onDidDestroyTabGroup = this._onDidDestroyTabGroup.event;
|
|
209
|
-
this._onDidAddPanelToTabGroup = new Emitter();
|
|
210
|
-
this.onDidAddPanelToTabGroup = this._onDidAddPanelToTabGroup.event;
|
|
211
|
-
this._onDidRemovePanelFromTabGroup = new Emitter();
|
|
212
|
-
this.onDidRemovePanelFromTabGroup = this._onDidRemovePanelFromTabGroup.event;
|
|
213
|
-
this._onDidTabGroupChange = new Emitter();
|
|
214
|
-
this.onDidTabGroupChange = this._onDidTabGroupChange.event;
|
|
215
|
-
this._onDidTabGroupCollapsedChange = new Emitter();
|
|
216
|
-
this.onDidTabGroupCollapsedChange = this._onDidTabGroupCollapsedChange.event;
|
|
217
|
-
toggleClass(this.container, 'dv-groupview', true);
|
|
218
|
-
// Each group is a navigable region, labelled by its active panel
|
|
219
|
-
// (see `updateAccessibleLabel`, driven on activation / title change).
|
|
220
|
-
this.container.setAttribute('role', 'region');
|
|
221
|
-
this._api = new DockviewApi(this.accessor);
|
|
222
|
-
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
223
|
-
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
224
|
-
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
225
|
-
this.header.hidden = !!options.hideHeader;
|
|
226
|
-
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
227
|
-
this.headerPosition =
|
|
228
|
-
(_b = options.headerPosition) !== null && _b !== void 0 ? _b : accessor.defaultHeaderPosition;
|
|
229
|
-
this.addDisposables(
|
|
230
|
-
// Keep the region's accessible name in sync when the active
|
|
231
|
-
// panel's title changes (no-op when a non-active title changes).
|
|
232
|
-
this._onDidPanelTitleChange.event(() => this.updateAccessibleLabel()), this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
233
|
-
this._onTabDragStart.fire(event);
|
|
234
|
-
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
235
|
-
this._onGroupDragStart.fire(event);
|
|
236
|
-
}), this.tabsContainer.onDrop((event) => {
|
|
237
|
-
var _a;
|
|
238
|
-
// Capture panel data before handleDropEvent (which may trigger moves)
|
|
239
|
-
const dragData = getPanelData();
|
|
240
|
-
const draggedPanelId = (_a = dragData === null || dragData === void 0 ? void 0 : dragData.panelId) !== null && _a !== void 0 ? _a : null;
|
|
241
|
-
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
242
|
-
// Update tab group membership after the move completes
|
|
243
|
-
if (draggedPanelId && event.targetTabGroupId) {
|
|
244
|
-
// Compute the local index within the target tab group
|
|
245
|
-
// from the global panel index so the panel is inserted
|
|
246
|
-
// at the correct position, not just appended.
|
|
247
|
-
const tabGroup = this._tabGroupMap.get(event.targetTabGroupId);
|
|
248
|
-
let localIndex;
|
|
249
|
-
if (tabGroup) {
|
|
250
|
-
const globalIdx = this._panels.findIndex((p) => p.id === draggedPanelId);
|
|
251
|
-
if (globalIdx !== -1) {
|
|
252
|
-
// Count how many of this group's panels
|
|
253
|
-
// appear before the dragged panel
|
|
254
|
-
localIndex = 0;
|
|
255
|
-
for (const pid of tabGroup.panelIds) {
|
|
256
|
-
const pidIdx = this._panels.findIndex((p) => p.id === pid);
|
|
257
|
-
if (pidIdx < globalIdx) {
|
|
258
|
-
localIndex++;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
this.addPanelToTabGroup(event.targetTabGroupId, draggedPanelId, localIndex);
|
|
264
|
-
}
|
|
265
|
-
else if (draggedPanelId && event.targetTabGroupId === null) {
|
|
266
|
-
// Dropped outside any group — remove from current group
|
|
267
|
-
this.removePanelFromTabGroup(draggedPanelId);
|
|
268
|
-
}
|
|
269
|
-
}), this.contentContainer.onDidFocus(() => {
|
|
270
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
271
|
-
}), this.contentContainer.onDidBlur(() => {
|
|
272
|
-
// noop
|
|
273
|
-
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
274
|
-
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
275
|
-
}), this.contentContainer.pointerDropTarget.onDrop((event) => {
|
|
276
|
-
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
277
|
-
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
278
|
-
this._onWillShowOverlay.fire(event);
|
|
279
|
-
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
280
|
-
this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
|
|
281
|
-
kind: 'content',
|
|
282
|
-
panel: this.activePanel,
|
|
283
|
-
api: this._api,
|
|
284
|
-
group: this.groupPanel,
|
|
285
|
-
getData: getPanelData,
|
|
286
|
-
}));
|
|
287
|
-
}), this.contentContainer.pointerDropTarget.onWillShowOverlay((event) => {
|
|
288
|
-
this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {
|
|
289
|
-
kind: 'content',
|
|
290
|
-
panel: this.activePanel,
|
|
291
|
-
api: this._api,
|
|
292
|
-
group: this.groupPanel,
|
|
293
|
-
getData: getPanelData,
|
|
294
|
-
}));
|
|
295
|
-
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOver, this._onDidPanelTitleChange, this._onDidPanelParametersChange, this._onDidCreateTabGroup, this._onDidDestroyTabGroup, this._onDidAddPanelToTabGroup, this._onDidRemovePanelFromTabGroup, this._onDidTabGroupChange, this._onDidTabGroupCollapsedChange, this._onDidCreateTabGroup.event(() => {
|
|
296
|
-
this._scheduleTabGroupUpdate();
|
|
297
|
-
}), this._onDidDestroyTabGroup.event(() => {
|
|
298
|
-
this._scheduleTabGroupUpdate();
|
|
299
|
-
}), this._onDidAddPanelToTabGroup.event(() => {
|
|
300
|
-
this._scheduleTabGroupUpdate();
|
|
301
|
-
}), this._onDidRemovePanelFromTabGroup.event(() => {
|
|
302
|
-
this._scheduleTabGroupUpdate();
|
|
303
|
-
}), this._onDidTabGroupChange.event(() => {
|
|
304
|
-
this._scheduleTabGroupUpdate();
|
|
305
|
-
}), this._onDidTabGroupCollapsedChange.event(() => {
|
|
306
|
-
this._scheduleTabGroupUpdate();
|
|
307
|
-
}));
|
|
308
|
-
}
|
|
309
|
-
_scheduleTabGroupUpdate() {
|
|
310
|
-
if (this._pendingTabGroupUpdate) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
this._pendingTabGroupUpdate = true;
|
|
314
|
-
queueMicrotask(() => {
|
|
315
|
-
this._pendingTabGroupUpdate = false;
|
|
316
|
-
if (!this.isDisposed) {
|
|
317
|
-
this.tabsContainer.updateTabGroups();
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Bracket a tab-group mutation as a layout transaction. `accessor` is
|
|
323
|
-
* always a full {@link DockviewComponent} in production; the optional-call
|
|
324
|
-
* fallback keeps partial test doubles (which omit `mutation`) working.
|
|
325
|
-
* When nested inside a larger operation (a drag-driven move, fromJSON
|
|
326
|
-
* restore) the component's depth counter folds it into the outer one.
|
|
327
|
-
*/
|
|
328
|
-
_bracketTabGroupMutation(func) {
|
|
329
|
-
return this.accessor.mutation
|
|
330
|
-
? this.accessor.mutation('tab-group', func)
|
|
331
|
-
: func();
|
|
332
|
-
}
|
|
333
|
-
createTabGroup(options) {
|
|
334
|
-
return this._bracketTabGroupMutation(() => this._doCreateTabGroup(options));
|
|
335
|
-
}
|
|
336
|
-
_doCreateTabGroup(options) {
|
|
337
|
-
var _a;
|
|
338
|
-
const id = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : `tg-${this.id}-${this._tabGroupIdCounter++}`;
|
|
339
|
-
const tabGroup = new TabGroup(id, {
|
|
340
|
-
label: options === null || options === void 0 ? void 0 : options.label,
|
|
341
|
-
color: options === null || options === void 0 ? void 0 : options.color,
|
|
342
|
-
collapsed: options === null || options === void 0 ? void 0 : options.collapsed,
|
|
343
|
-
componentParams: options === null || options === void 0 ? void 0 : options.componentParams,
|
|
344
|
-
});
|
|
345
|
-
this._tabGroups.push(tabGroup);
|
|
346
|
-
this._tabGroupMap.set(id, tabGroup);
|
|
347
|
-
this._tabGroupDisposables.set(id, new CompositeDisposable(tabGroup.onDidChange(() => {
|
|
348
|
-
this._onDidTabGroupChange.fire({ tabGroup });
|
|
349
|
-
}), tabGroup.onDidCollapseChange((isCollapsed) => {
|
|
350
|
-
if (isCollapsed) {
|
|
351
|
-
this._handleGroupCollapse(tabGroup);
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
this._handleGroupExpand(tabGroup);
|
|
355
|
-
}
|
|
356
|
-
this._onDidTabGroupCollapsedChange.fire({
|
|
357
|
-
tabGroup,
|
|
358
|
-
});
|
|
359
|
-
}), tabGroup.onDidDestroy(() => {
|
|
360
|
-
this._removeTabGroupInternal(tabGroup);
|
|
361
|
-
})));
|
|
362
|
-
this._onDidCreateTabGroup.fire({ tabGroup });
|
|
363
|
-
return tabGroup;
|
|
364
|
-
}
|
|
365
|
-
dissolveTabGroup(tabGroupId) {
|
|
366
|
-
const tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
367
|
-
if (!tabGroup) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
this._bracketTabGroupMutation(() => {
|
|
371
|
-
// Remove all panels from the group (they stay in the flat panel list)
|
|
372
|
-
const panelIds = [...tabGroup.panelIds];
|
|
373
|
-
for (const panelId of panelIds) {
|
|
374
|
-
tabGroup.removePanel(panelId);
|
|
375
|
-
this._panelToTabGroup.delete(panelId);
|
|
376
|
-
this._onDidRemovePanelFromTabGroup.fire({ tabGroup, panelId });
|
|
377
|
-
}
|
|
378
|
-
tabGroup.dispose();
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
addPanelToTabGroup(tabGroupId, panelId, index) {
|
|
382
|
-
const tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
383
|
-
if (!tabGroup) {
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
// Ensure the panel actually exists in this group model
|
|
387
|
-
if (!this._panels.some((p) => p.id === panelId)) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
// Remove from any existing group first
|
|
391
|
-
const existingGroup = this.getTabGroupForPanel(panelId);
|
|
392
|
-
if ((existingGroup === null || existingGroup === void 0 ? void 0 : existingGroup.id) === tabGroupId) {
|
|
393
|
-
return; // already in this group — no mutation
|
|
394
|
-
}
|
|
395
|
-
this._bracketTabGroupMutation(() => {
|
|
396
|
-
if (existingGroup) {
|
|
397
|
-
this.removePanelFromTabGroup(panelId);
|
|
398
|
-
}
|
|
399
|
-
tabGroup.addPanel(panelId, index);
|
|
400
|
-
this._panelToTabGroup.set(panelId, tabGroup);
|
|
401
|
-
// Enforce contiguity: move the panel in the flat _panels array
|
|
402
|
-
// to the correct global position matching its group-local index
|
|
403
|
-
this._enforceContiguity(tabGroup, panelId);
|
|
404
|
-
this._onDidAddPanelToTabGroup.fire({ tabGroup, panelId });
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Move a panel to a new index within its tab group.
|
|
409
|
-
* Updates both the group's panelIds order and the flat _panels array.
|
|
410
|
-
*/
|
|
411
|
-
movePanelWithinGroup(tabGroupId, panelId, newIndex) {
|
|
412
|
-
const tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
413
|
-
if (!(tabGroup === null || tabGroup === void 0 ? void 0 : tabGroup.containsPanel(panelId))) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
// Remove and re-add at new index within the group
|
|
417
|
-
tabGroup.removePanel(panelId);
|
|
418
|
-
tabGroup.addPanel(panelId, newIndex);
|
|
419
|
-
// Re-enforce contiguity in the flat array
|
|
420
|
-
this._enforceContiguity(tabGroup, panelId);
|
|
421
|
-
this.tabsContainer.updateTabGroups();
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Move a panel from one tab group to another.
|
|
425
|
-
*/
|
|
426
|
-
movePanelBetweenGroups(sourcePanelId, targetTabGroupId, targetIndex) {
|
|
427
|
-
const sourceGroup = this._findTabGroupForPanel(sourcePanelId);
|
|
428
|
-
const targetGroup = this._tabGroupMap.get(targetTabGroupId);
|
|
429
|
-
if (!targetGroup) {
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
if (sourceGroup) {
|
|
433
|
-
sourceGroup.removePanel(sourcePanelId);
|
|
434
|
-
this._panelToTabGroup.delete(sourcePanelId);
|
|
435
|
-
this._onDidRemovePanelFromTabGroup.fire({
|
|
436
|
-
tabGroup: sourceGroup,
|
|
437
|
-
panelId: sourcePanelId,
|
|
438
|
-
});
|
|
439
|
-
// Auto-destroy empty source group
|
|
440
|
-
if (sourceGroup.isEmpty) {
|
|
441
|
-
sourceGroup.dispose();
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
targetGroup.addPanel(sourcePanelId, targetIndex);
|
|
445
|
-
this._panelToTabGroup.set(sourcePanelId, targetGroup);
|
|
446
|
-
this._enforceContiguity(targetGroup, sourcePanelId);
|
|
447
|
-
this._onDidAddPanelToTabGroup.fire({
|
|
448
|
-
tabGroup: targetGroup,
|
|
449
|
-
panelId: sourcePanelId,
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Move an entire tab group to a new position in the tab bar.
|
|
454
|
-
* The group's internal panel order is preserved.
|
|
455
|
-
*/
|
|
456
|
-
moveTabGroup(tabGroupId, targetIndex) {
|
|
457
|
-
const tabGroup = this._tabGroupMap.get(tabGroupId);
|
|
458
|
-
if (!tabGroup || tabGroup.panelIds.length === 0) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
// Collect group panels in their current order
|
|
462
|
-
const groupPanelIds = new Set(tabGroup.panelIds);
|
|
463
|
-
const groupPanels = tabGroup.panelIds
|
|
464
|
-
.map((pid) => this._panels.find((p) => p.id === pid))
|
|
465
|
-
.filter((p) => p !== undefined);
|
|
466
|
-
if (groupPanels.length === 0) {
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
// Count how many group panels sit before the target index so
|
|
470
|
-
// we can compensate after removing them from the array.
|
|
471
|
-
let groupPanelsBefore = 0;
|
|
472
|
-
for (let i = 0; i < Math.min(targetIndex, this._panels.length); i++) {
|
|
473
|
-
if (groupPanelIds.has(this._panels[i].id)) {
|
|
474
|
-
groupPanelsBefore++;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
// Remove group panels from the flat array
|
|
478
|
-
for (const panel of groupPanels) {
|
|
479
|
-
const idx = this._panels.indexOf(panel);
|
|
480
|
-
if (idx !== -1) {
|
|
481
|
-
this._panels.splice(idx, 1);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
// Adjust target index to account for removed panels
|
|
485
|
-
const adjustedIndex = targetIndex - groupPanelsBefore;
|
|
486
|
-
// Clamp target index to valid range after removal
|
|
487
|
-
const insertAt = Math.max(0, Math.min(adjustedIndex, this._panels.length));
|
|
488
|
-
// Insert group panels at the target position
|
|
489
|
-
this._panels.splice(insertAt, 0, ...groupPanels);
|
|
490
|
-
// Rebuild the tabs container to match new order
|
|
491
|
-
for (const panel of this._panels) {
|
|
492
|
-
this.tabsContainer.delete(panel.id);
|
|
493
|
-
}
|
|
494
|
-
for (let i = 0; i < this._panels.length; i++) {
|
|
495
|
-
this.tabsContainer.openPanel(this._panels[i], i);
|
|
496
|
-
}
|
|
497
|
-
this.tabsContainer.updateTabGroups();
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Ensure a panel is at the correct global index in _panels
|
|
501
|
-
* to maintain contiguity of its tab group members.
|
|
502
|
-
*/
|
|
503
|
-
_enforceContiguity(tabGroup, panelId) {
|
|
504
|
-
const panel = this._panels.find((p) => p.id === panelId);
|
|
505
|
-
if (!panel) {
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
const localIndex = tabGroup.indexOfPanel(panelId);
|
|
509
|
-
const globalIndex = this._computeGlobalIndex(tabGroup, localIndex);
|
|
510
|
-
const currentIndex = this._panels.indexOf(panel);
|
|
511
|
-
if (currentIndex === globalIndex) {
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
// Move panel in the flat array
|
|
515
|
-
this._panels.splice(currentIndex, 1);
|
|
516
|
-
const adjustedIndex = globalIndex > currentIndex ? globalIndex - 1 : globalIndex;
|
|
517
|
-
this._panels.splice(adjustedIndex, 0, panel);
|
|
518
|
-
// Reorder in the tabs container to match
|
|
519
|
-
this.tabsContainer.delete(panelId);
|
|
520
|
-
this.tabsContainer.openPanel(panel, adjustedIndex);
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Compute the global index in _panels for a group-local index.
|
|
524
|
-
* Finds where the group's panels start in the flat array and offsets.
|
|
525
|
-
*/
|
|
526
|
-
_computeGlobalIndex(tabGroup, localIndex) {
|
|
527
|
-
const groupPanelIds = tabGroup.panelIds;
|
|
528
|
-
if (groupPanelIds.length <= 1) {
|
|
529
|
-
// Only one panel (the one being added), keep current position
|
|
530
|
-
const panel = this._panels.find((p) => p.id === groupPanelIds[0]);
|
|
531
|
-
return panel ? this._panels.indexOf(panel) : this._panels.length;
|
|
532
|
-
}
|
|
533
|
-
// Find the first existing group member (other than the one at localIndex)
|
|
534
|
-
// to anchor the group position
|
|
535
|
-
for (let i = 0; i < groupPanelIds.length; i++) {
|
|
536
|
-
if (i === localIndex) {
|
|
537
|
-
continue;
|
|
538
|
-
}
|
|
539
|
-
const existingPanel = this._panels.find((p) => p.id === groupPanelIds[i]);
|
|
540
|
-
if (existingPanel) {
|
|
541
|
-
const existingGlobalIndex = this._panels.indexOf(existingPanel);
|
|
542
|
-
// Offset based on relative position within group
|
|
543
|
-
return Math.max(0, existingGlobalIndex + (localIndex - i));
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
return this._panels.length;
|
|
547
|
-
}
|
|
548
|
-
removePanelFromTabGroup(panelId) {
|
|
549
|
-
const tabGroup = this._findTabGroupForPanel(panelId);
|
|
550
|
-
if (!tabGroup) {
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
this._bracketTabGroupMutation(() => {
|
|
554
|
-
tabGroup.removePanel(panelId);
|
|
555
|
-
this._panelToTabGroup.delete(panelId);
|
|
556
|
-
this._onDidRemovePanelFromTabGroup.fire({ tabGroup, panelId });
|
|
557
|
-
// Auto-destroy empty groups
|
|
558
|
-
if (tabGroup.isEmpty) {
|
|
559
|
-
tabGroup.dispose();
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
getTabGroups() {
|
|
564
|
-
return this._tabGroups;
|
|
565
|
-
}
|
|
566
|
-
updateTabGroups() {
|
|
567
|
-
this.tabsContainer.updateTabGroups();
|
|
568
|
-
}
|
|
569
|
-
refreshTabGroupAccent() {
|
|
570
|
-
this.tabsContainer.refreshTabGroupAccent();
|
|
571
|
-
}
|
|
572
|
-
refreshWatermark() {
|
|
573
|
-
var _a, _b;
|
|
574
|
-
if (this.watermark) {
|
|
575
|
-
this.watermark.element.remove();
|
|
576
|
-
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
577
|
-
this.watermark = undefined;
|
|
578
|
-
}
|
|
579
|
-
this.updateContainer();
|
|
580
|
-
}
|
|
581
|
-
getTabGroupForPanel(panelId) {
|
|
582
|
-
return this._findTabGroupForPanel(panelId);
|
|
583
|
-
}
|
|
584
|
-
_findTabGroupForPanel(panelId) {
|
|
585
|
-
return this._panelToTabGroup.get(panelId);
|
|
586
|
-
}
|
|
587
|
-
_removeTabGroupInternal(tabGroup) {
|
|
588
|
-
const index = this._tabGroups.indexOf(tabGroup);
|
|
589
|
-
if (index !== -1) {
|
|
590
|
-
this._tabGroups.splice(index, 1);
|
|
591
|
-
this._tabGroupMap.delete(tabGroup.id);
|
|
592
|
-
for (const panelId of tabGroup.panelIds) {
|
|
593
|
-
this._panelToTabGroup.delete(panelId);
|
|
594
|
-
}
|
|
595
|
-
this._onDidDestroyTabGroup.fire({ tabGroup });
|
|
596
|
-
// Dispose the external listeners (onDidChange, onDidCollapseChange)
|
|
597
|
-
// we registered on this group. We cannot dispose synchronously
|
|
598
|
-
// here because this method runs inside the onDidDestroy fire
|
|
599
|
-
// loop — disposing the CompositeDisposable that holds the
|
|
600
|
-
// onDidDestroy subscription would splice listeners mid-iteration.
|
|
601
|
-
// Schedule cleanup on the next microtask instead.
|
|
602
|
-
const tabGroupDisposable = this._tabGroupDisposables.get(tabGroup.id);
|
|
603
|
-
this._tabGroupDisposables.delete(tabGroup.id);
|
|
604
|
-
if (tabGroupDisposable) {
|
|
605
|
-
this._pendingMicrotaskDisposables.add(tabGroupDisposable);
|
|
606
|
-
queueMicrotask(() => {
|
|
607
|
-
this._pendingMicrotaskDisposables.delete(tabGroupDisposable);
|
|
608
|
-
tabGroupDisposable.dispose();
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
_handleGroupCollapse(tabGroup) {
|
|
614
|
-
if (!this._activePanel) {
|
|
615
|
-
return;
|
|
616
|
-
}
|
|
617
|
-
// Only act if the active panel belongs to the collapsed group
|
|
618
|
-
if (!tabGroup.containsPanel(this._activePanel.id)) {
|
|
619
|
-
return;
|
|
620
|
-
}
|
|
621
|
-
const activePanelIndex = this._panels.indexOf(this._activePanel);
|
|
622
|
-
// Search right first, then left, for a visible (non-collapsed-group) panel
|
|
623
|
-
for (let i = activePanelIndex + 1; i < this._panels.length; i++) {
|
|
624
|
-
const candidate = this._panels[i];
|
|
625
|
-
const candidateGroup = this._findTabGroupForPanel(candidate.id);
|
|
626
|
-
if (!(candidateGroup === null || candidateGroup === void 0 ? void 0 : candidateGroup.collapsed)) {
|
|
627
|
-
this.doSetActivePanel(candidate);
|
|
628
|
-
this.updateContainer();
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
for (let i = activePanelIndex - 1; i >= 0; i--) {
|
|
633
|
-
const candidate = this._panels[i];
|
|
634
|
-
const candidateGroup = this._findTabGroupForPanel(candidate.id);
|
|
635
|
-
if (!(candidateGroup === null || candidateGroup === void 0 ? void 0 : candidateGroup.collapsed)) {
|
|
636
|
-
this.doSetActivePanel(candidate);
|
|
637
|
-
this.updateContainer();
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
// All tabs are in collapsed groups — show watermark
|
|
642
|
-
this.contentContainer.closePanel();
|
|
643
|
-
this.doSetActivePanel(undefined);
|
|
644
|
-
this.updateContainer();
|
|
645
|
-
}
|
|
646
|
-
_handleGroupExpand(tabGroup) {
|
|
647
|
-
if (this._activePanel) {
|
|
648
|
-
return;
|
|
649
|
-
}
|
|
650
|
-
// Watermark is showing because all groups were collapsed.
|
|
651
|
-
// Activate the first panel in the newly expanded group.
|
|
652
|
-
const firstPanelId = tabGroup.panelIds[0];
|
|
653
|
-
if (firstPanelId) {
|
|
654
|
-
const panel = this._panels.find((p) => p.id === firstPanelId);
|
|
655
|
-
if (panel) {
|
|
656
|
-
this.doSetActivePanel(panel);
|
|
657
|
-
this.updateContainer();
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
/** Restore tab groups from serialized data (used by fromJSON) */
|
|
662
|
-
restoreTabGroups(serializedGroups) {
|
|
663
|
-
// Bump counter past any restored numeric suffixes to avoid ID collisions
|
|
664
|
-
for (const data of serializedGroups) {
|
|
665
|
-
const match = /-(\d+)$/.exec(data.id);
|
|
666
|
-
if (match) {
|
|
667
|
-
const num = Number.parseInt(match[1], 10) + 1;
|
|
668
|
-
if (num > this._tabGroupIdCounter) {
|
|
669
|
-
this._tabGroupIdCounter = num;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
for (const data of serializedGroups) {
|
|
674
|
-
const tabGroup = this.createTabGroup({
|
|
675
|
-
id: data.id,
|
|
676
|
-
label: data.label,
|
|
677
|
-
color: data.color,
|
|
678
|
-
componentParams: data.componentParams,
|
|
679
|
-
});
|
|
680
|
-
const concreteGroup = this._tabGroupMap.get(tabGroup.id);
|
|
681
|
-
for (const panelId of data.panelIds) {
|
|
682
|
-
// Only add panels that actually exist in this group model
|
|
683
|
-
if (this._panels.some((p) => p.id === panelId)) {
|
|
684
|
-
tabGroup.addPanel(panelId);
|
|
685
|
-
this._panelToTabGroup.set(panelId, concreteGroup);
|
|
686
|
-
this._enforceContiguity(concreteGroup, panelId);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
if (data.collapsed) {
|
|
690
|
-
tabGroup.collapse();
|
|
691
|
-
}
|
|
692
|
-
// Auto-destroy if no valid panels were added
|
|
693
|
-
if (tabGroup.isEmpty) {
|
|
694
|
-
tabGroup.dispose();
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
focusContent() {
|
|
699
|
-
this.contentContainer.element.focus();
|
|
700
|
-
}
|
|
701
|
-
focusActiveTab() {
|
|
702
|
-
this.tabsContainer.focusActiveTab();
|
|
703
|
-
}
|
|
704
|
-
set renderContainer(value) {
|
|
705
|
-
this.panels.forEach((panel) => {
|
|
706
|
-
this.renderContainer.detatch(panel);
|
|
707
|
-
});
|
|
708
|
-
this._overwriteRenderContainer = value;
|
|
709
|
-
this.panels.forEach((panel) => {
|
|
710
|
-
this.rerender(panel);
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
get renderContainer() {
|
|
714
|
-
var _a;
|
|
715
|
-
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
716
|
-
}
|
|
717
|
-
set dropTargetContainer(value) {
|
|
718
|
-
this._overwriteDropTargetContainer = value;
|
|
719
|
-
}
|
|
720
|
-
get dropTargetContainer() {
|
|
721
|
-
var _a;
|
|
722
|
-
return ((_a = this._overwriteDropTargetContainer) !== null && _a !== void 0 ? _a : this.accessor.rootDropTargetContainer);
|
|
723
|
-
}
|
|
724
|
-
initialize() {
|
|
725
|
-
if (this.options.panels) {
|
|
726
|
-
this.options.panels.forEach((panel) => {
|
|
727
|
-
this.doAddPanel(panel);
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
if (this.options.activePanel) {
|
|
731
|
-
this.openPanel(this.options.activePanel);
|
|
732
|
-
}
|
|
733
|
-
// must be run after the constructor otherwise this.parent may not be
|
|
734
|
-
// correctly initialized
|
|
735
|
-
this.setActive(this.isActive, true);
|
|
736
|
-
this.updateContainer();
|
|
737
|
-
this.updateHeaderActions();
|
|
738
|
-
}
|
|
739
|
-
updateHeaderActions() {
|
|
740
|
-
var _a;
|
|
741
|
-
(_a = this.accessor.headerActionsService) === null || _a === void 0 ? void 0 : _a.refresh(this.groupPanel);
|
|
742
|
-
}
|
|
743
|
-
attachHeaderAction(slot, element) {
|
|
744
|
-
switch (slot) {
|
|
745
|
-
case 'left':
|
|
746
|
-
this.tabsContainer.setLeftActionsElement(element);
|
|
747
|
-
break;
|
|
748
|
-
case 'right':
|
|
749
|
-
this.tabsContainer.setRightActionsElement(element);
|
|
750
|
-
break;
|
|
751
|
-
case 'prefix':
|
|
752
|
-
this.tabsContainer.setPrefixActionsElement(element);
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
rerender(panel) {
|
|
757
|
-
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
758
|
-
}
|
|
759
|
-
indexOf(panel) {
|
|
760
|
-
return this.tabsContainer.indexOf(panel.id);
|
|
761
|
-
}
|
|
762
|
-
toJSON() {
|
|
763
|
-
var _a;
|
|
764
|
-
const result = {
|
|
765
|
-
views: this.tabsContainer.panels,
|
|
766
|
-
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
767
|
-
id: this.id,
|
|
768
|
-
};
|
|
769
|
-
if (this.locked !== false) {
|
|
770
|
-
result.locked = this.locked;
|
|
771
|
-
}
|
|
772
|
-
if (this.header.hidden) {
|
|
773
|
-
result.hideHeader = true;
|
|
774
|
-
}
|
|
775
|
-
if (this.headerPosition !== 'top') {
|
|
776
|
-
result.headerPosition = this.headerPosition;
|
|
777
|
-
}
|
|
778
|
-
if (this._tabGroups.length > 0) {
|
|
779
|
-
result.tabGroups = this._tabGroups.map((tg) => tg.toJSON());
|
|
780
|
-
}
|
|
781
|
-
return result;
|
|
782
|
-
}
|
|
783
|
-
moveToNext(options) {
|
|
784
|
-
var _a;
|
|
785
|
-
options !== null && options !== void 0 ? options : (options = {});
|
|
786
|
-
(_a = options.panel) !== null && _a !== void 0 ? _a : (options.panel = this.activePanel);
|
|
787
|
-
const index = options.panel ? this.panels.indexOf(options.panel) : -1;
|
|
788
|
-
let normalizedIndex;
|
|
789
|
-
if (index < this.panels.length - 1) {
|
|
790
|
-
normalizedIndex = index + 1;
|
|
791
|
-
}
|
|
792
|
-
else if (options.suppressRoll) {
|
|
793
|
-
return;
|
|
794
|
-
}
|
|
795
|
-
else {
|
|
796
|
-
normalizedIndex = 0;
|
|
797
|
-
}
|
|
798
|
-
this.openPanel(this.panels[normalizedIndex]);
|
|
799
|
-
}
|
|
800
|
-
moveToPrevious(options) {
|
|
801
|
-
var _a;
|
|
802
|
-
options !== null && options !== void 0 ? options : (options = {});
|
|
803
|
-
(_a = options.panel) !== null && _a !== void 0 ? _a : (options.panel = this.activePanel);
|
|
804
|
-
if (!options.panel) {
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
const index = this.panels.indexOf(options.panel);
|
|
808
|
-
let normalizedIndex;
|
|
809
|
-
if (index > 0) {
|
|
810
|
-
normalizedIndex = index - 1;
|
|
811
|
-
}
|
|
812
|
-
else if (options.suppressRoll) {
|
|
813
|
-
return;
|
|
814
|
-
}
|
|
815
|
-
else {
|
|
816
|
-
normalizedIndex = this.panels.length - 1;
|
|
817
|
-
}
|
|
818
|
-
this.openPanel(this.panels[normalizedIndex]);
|
|
819
|
-
}
|
|
820
|
-
containsPanel(panel) {
|
|
821
|
-
return this.panels.includes(panel);
|
|
822
|
-
}
|
|
823
|
-
init(_params) {
|
|
824
|
-
//noop
|
|
825
|
-
}
|
|
826
|
-
update(_params) {
|
|
827
|
-
//noop
|
|
828
|
-
}
|
|
829
|
-
focus() {
|
|
830
|
-
var _a;
|
|
831
|
-
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
832
|
-
}
|
|
833
|
-
openPanel(panel, options = {}) {
|
|
834
|
-
/**
|
|
835
|
-
* set the panel group
|
|
836
|
-
* add the panel
|
|
837
|
-
* check if group active
|
|
838
|
-
* check if panel active
|
|
839
|
-
*/
|
|
840
|
-
if (typeof options.index !== 'number' ||
|
|
841
|
-
options.index > this.panels.length) {
|
|
842
|
-
options.index = this.panels.length;
|
|
843
|
-
}
|
|
844
|
-
const skipSetActive = !!options.skipSetActive;
|
|
845
|
-
// ensure the group is updated before we fire any events
|
|
846
|
-
panel.updateParentGroup(this.groupPanel, {
|
|
847
|
-
skipSetActive: options.skipSetActive,
|
|
848
|
-
});
|
|
849
|
-
this.doAddPanel(panel, options.index, {
|
|
850
|
-
skipSetActive: skipSetActive,
|
|
851
|
-
});
|
|
852
|
-
if (this._activePanel === panel) {
|
|
853
|
-
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
if (!skipSetActive) {
|
|
857
|
-
this.doSetActivePanel(panel);
|
|
858
|
-
}
|
|
859
|
-
if (!options.skipSetGroupActive) {
|
|
860
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
861
|
-
}
|
|
862
|
-
if (!options.skipSetActive) {
|
|
863
|
-
this.updateContainer();
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
removePanel(groupItemOrId, options = {
|
|
867
|
-
skipSetActive: false,
|
|
868
|
-
}) {
|
|
869
|
-
const id = typeof groupItemOrId === 'string'
|
|
870
|
-
? groupItemOrId
|
|
871
|
-
: groupItemOrId.id;
|
|
872
|
-
const panelToRemove = this._panels.find((panel) => panel.id === id);
|
|
873
|
-
if (!panelToRemove) {
|
|
874
|
-
throw new Error('invalid operation');
|
|
875
|
-
}
|
|
876
|
-
return this._removePanel(panelToRemove, options);
|
|
877
|
-
}
|
|
878
|
-
closeAllPanels() {
|
|
879
|
-
if (this.panels.length > 0) {
|
|
880
|
-
// take a copy since we will be edting the array as we iterate through
|
|
881
|
-
const arrPanelCpy = [...this.panels];
|
|
882
|
-
for (const panel of arrPanelCpy) {
|
|
883
|
-
this.doClose(panel);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
else {
|
|
887
|
-
this.accessor.removeGroup(this.groupPanel);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
closePanel(panel) {
|
|
891
|
-
this.doClose(panel);
|
|
892
|
-
}
|
|
893
|
-
doClose(panel) {
|
|
894
|
-
const isLast = this.panels.length === 1 && this.accessor.groups.length === 1;
|
|
895
|
-
this.accessor.removePanel(panel, isLast && this.accessor.options.noPanelsOverlay === 'emptyGroup'
|
|
896
|
-
? { removeEmptyGroup: false }
|
|
897
|
-
: undefined);
|
|
898
|
-
}
|
|
899
|
-
isPanelActive(panel) {
|
|
900
|
-
return this._activePanel === panel;
|
|
901
|
-
}
|
|
902
|
-
updateActions(element) {
|
|
903
|
-
this.tabsContainer.setRightActionsElement(element);
|
|
904
|
-
}
|
|
905
|
-
setActive(isGroupActive, force = false) {
|
|
906
|
-
if (!force && this.isActive === isGroupActive) {
|
|
907
|
-
return;
|
|
908
|
-
}
|
|
909
|
-
this._isGroupActive = isGroupActive;
|
|
910
|
-
toggleClass(this.container, 'dv-active-group', isGroupActive);
|
|
911
|
-
toggleClass(this.container, 'dv-inactive-group', !isGroupActive);
|
|
912
|
-
this.tabsContainer.setActive(this.isActive);
|
|
913
|
-
if (!this._activePanel && this.panels.length > 0) {
|
|
914
|
-
const candidate = this._panels.find((p) => {
|
|
915
|
-
const tg = this._findTabGroupForPanel(p.id);
|
|
916
|
-
return !(tg === null || tg === void 0 ? void 0 : tg.collapsed);
|
|
917
|
-
});
|
|
918
|
-
if (candidate) {
|
|
919
|
-
this.doSetActivePanel(candidate);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
this.updateContainer();
|
|
923
|
-
}
|
|
924
|
-
layout(width, height) {
|
|
925
|
-
var _a;
|
|
926
|
-
this._width = width;
|
|
927
|
-
this._height = height;
|
|
928
|
-
this.contentContainer.layout(this._width, this._height);
|
|
929
|
-
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
930
|
-
this._activePanel.layout(this._width, this._height);
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
_removePanel(panel, options) {
|
|
934
|
-
const isActivePanel = this._activePanel === panel;
|
|
935
|
-
this.doRemovePanel(panel);
|
|
936
|
-
if (isActivePanel && this.panels.length > 0) {
|
|
937
|
-
const nextPanel = this.mostRecentlyUsed[0];
|
|
938
|
-
this.openPanel(nextPanel, {
|
|
939
|
-
skipSetActive: options.skipSetActive,
|
|
940
|
-
skipSetGroupActive: options.skipSetActiveGroup,
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
if (this._activePanel && this.panels.length === 0) {
|
|
944
|
-
this.doSetActivePanel(undefined);
|
|
945
|
-
}
|
|
946
|
-
if (!options.skipSetActive) {
|
|
947
|
-
this.updateContainer();
|
|
948
|
-
}
|
|
949
|
-
return panel;
|
|
950
|
-
}
|
|
951
|
-
doRemovePanel(panel) {
|
|
952
|
-
const index = this.panels.indexOf(panel);
|
|
953
|
-
if (this._activePanel === panel) {
|
|
954
|
-
this.contentContainer.closePanel();
|
|
955
|
-
}
|
|
956
|
-
this.tabsContainer.delete(panel.id);
|
|
957
|
-
this._panels.splice(index, 1);
|
|
958
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
959
|
-
const index = this.mostRecentlyUsed.indexOf(panel);
|
|
960
|
-
this.mostRecentlyUsed.splice(index, 1);
|
|
961
|
-
}
|
|
962
|
-
const disposable = this._panelDisposables.get(panel.id);
|
|
963
|
-
if (disposable) {
|
|
964
|
-
disposable.dispose();
|
|
965
|
-
this._panelDisposables.delete(panel.id);
|
|
966
|
-
}
|
|
967
|
-
// Remove panel from its tab group (auto-destroys empty groups)
|
|
968
|
-
this.removePanelFromTabGroup(panel.id);
|
|
969
|
-
this._onDidRemovePanel.fire({ panel });
|
|
970
|
-
}
|
|
971
|
-
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
972
|
-
const existingPanel = this._panels.indexOf(panel);
|
|
973
|
-
const hasExistingPanel = existingPanel > -1;
|
|
974
|
-
this.tabsContainer.show();
|
|
975
|
-
this.contentContainer.show();
|
|
976
|
-
this.tabsContainer.openPanel(panel, index);
|
|
977
|
-
if (!options.skipSetActive) {
|
|
978
|
-
this.contentContainer.openPanel(panel);
|
|
979
|
-
}
|
|
980
|
-
else if (panel.api.renderer === 'always') {
|
|
981
|
-
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
982
|
-
}
|
|
983
|
-
if (hasExistingPanel) {
|
|
984
|
-
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
this.updateMru(panel);
|
|
988
|
-
this.panels.splice(index, 0, panel);
|
|
989
|
-
this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
|
|
990
|
-
this._onDidAddPanel.fire({ panel });
|
|
991
|
-
}
|
|
992
|
-
doSetActivePanel(panel) {
|
|
993
|
-
var _a, _b, _c;
|
|
994
|
-
if (this._activePanel === panel) {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
this._activePanel = panel;
|
|
998
|
-
if (panel) {
|
|
999
|
-
this.tabsContainer.setActivePanel(panel);
|
|
1000
|
-
// Point the tabpanel's `aria-labelledby` at the now-active tab.
|
|
1001
|
-
this.contentContainer.setLabelledBy(this.tabsContainer.getTabId(panel.id));
|
|
1002
|
-
this.contentContainer.openPanel(panel);
|
|
1003
|
-
panel.layout(this._width, this._height);
|
|
1004
|
-
this.updateMru(panel);
|
|
1005
|
-
// Refresh focus state to handle programmatic activation without DOM focus change
|
|
1006
|
-
this.contentContainer.refreshFocusState();
|
|
1007
|
-
this._onDidActivePanelChange.fire({
|
|
1008
|
-
panel,
|
|
1009
|
-
// `currentOrigin` is always present on the real component;
|
|
1010
|
-
// default to 'user' for minimal test accessors.
|
|
1011
|
-
origin: (_c = (_b = (_a = this.accessor).currentOrigin) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : 'user',
|
|
1012
|
-
});
|
|
1013
|
-
}
|
|
1014
|
-
this.updateAccessibleLabel();
|
|
1015
|
-
}
|
|
1016
|
-
/** Label the group region with its active panel's title (the WAI-ARIA region name). */
|
|
1017
|
-
updateAccessibleLabel() {
|
|
1018
|
-
var _a;
|
|
1019
|
-
const title = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.title;
|
|
1020
|
-
if (title) {
|
|
1021
|
-
this.container.setAttribute('aria-label', title);
|
|
1022
|
-
}
|
|
1023
|
-
else {
|
|
1024
|
-
this.container.removeAttribute('aria-label');
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
updateMru(panel) {
|
|
1028
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
1029
|
-
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
1030
|
-
}
|
|
1031
|
-
this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
|
|
1032
|
-
}
|
|
1033
|
-
updateContainer() {
|
|
1034
|
-
var _a, _b;
|
|
1035
|
-
this.panels.forEach((panel) => panel.runEvents());
|
|
1036
|
-
const shouldShowWatermark = this.isEmpty || !this._activePanel;
|
|
1037
|
-
if (shouldShowWatermark && !this.watermark) {
|
|
1038
|
-
const watermark = this.accessor.createWatermarkComponent();
|
|
1039
|
-
watermark.init({
|
|
1040
|
-
containerApi: this._api,
|
|
1041
|
-
group: this.groupPanel,
|
|
1042
|
-
});
|
|
1043
|
-
this.watermark = watermark;
|
|
1044
|
-
addDisposableListener(this.watermark.element, 'pointerdown', () => {
|
|
1045
|
-
if (!this.isActive) {
|
|
1046
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
this.contentContainer.element.appendChild(this.watermark.element);
|
|
1050
|
-
}
|
|
1051
|
-
if (!shouldShowWatermark && this.watermark) {
|
|
1052
|
-
this.watermark.element.remove();
|
|
1053
|
-
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1054
|
-
this.watermark = undefined;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
canDisplayOverlay(event, position, target) {
|
|
1058
|
-
const firedEvent = new DockviewUnhandledDragOverEvent(event, target, position, getPanelData, this.accessor.getPanel(this.id));
|
|
1059
|
-
this._onUnhandledDragOver.fire(firedEvent);
|
|
1060
|
-
return firedEvent.isAccepted;
|
|
1061
|
-
}
|
|
1062
|
-
handleDropEvent(type, event, position, index) {
|
|
1063
|
-
if (this.locked === 'no-drop-target') {
|
|
1064
|
-
return;
|
|
1065
|
-
}
|
|
1066
|
-
function getKind() {
|
|
1067
|
-
switch (type) {
|
|
1068
|
-
case 'header':
|
|
1069
|
-
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
1070
|
-
case 'content':
|
|
1071
|
-
return 'content';
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
1075
|
-
const willDropEvent = new DockviewWillDropEvent({
|
|
1076
|
-
nativeEvent: event,
|
|
1077
|
-
position,
|
|
1078
|
-
panel,
|
|
1079
|
-
getData: () => getPanelData(),
|
|
1080
|
-
kind: getKind(),
|
|
1081
|
-
group: this.groupPanel,
|
|
1082
|
-
api: this._api,
|
|
1083
|
-
});
|
|
1084
|
-
this._onWillDrop.fire(willDropEvent);
|
|
1085
|
-
if (willDropEvent.defaultPrevented) {
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
const data = getPanelData();
|
|
1089
|
-
if (data && data.viewId === this.accessor.id) {
|
|
1090
|
-
if (type === 'content') {
|
|
1091
|
-
if (data.groupId === this.id) {
|
|
1092
|
-
// don't allow to drop on self for center position
|
|
1093
|
-
if (position === 'center') {
|
|
1094
|
-
return;
|
|
1095
|
-
}
|
|
1096
|
-
if (data.panelId === null && !data.tabGroupId) {
|
|
1097
|
-
// Full-group drops on self are a no-op.
|
|
1098
|
-
// Tab-group drags are partial moves: an edge drop
|
|
1099
|
-
// splits the layout and creates a new group.
|
|
1100
|
-
return;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
if (type === 'header') {
|
|
1105
|
-
if (data.groupId === this.id) {
|
|
1106
|
-
if (data.panelId === null && !data.tabGroupId) {
|
|
1107
|
-
return;
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
if (data.panelId === null) {
|
|
1112
|
-
// this is a group move dnd event
|
|
1113
|
-
const { groupId } = data;
|
|
1114
|
-
this._onMove.fire({
|
|
1115
|
-
target: position,
|
|
1116
|
-
groupId: groupId,
|
|
1117
|
-
index,
|
|
1118
|
-
tabGroupId: data.tabGroupId,
|
|
1119
|
-
});
|
|
1120
|
-
return;
|
|
1121
|
-
}
|
|
1122
|
-
const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
|
|
1123
|
-
if (fromSameGroup && this.tabsContainer.size === 1) {
|
|
1124
|
-
return;
|
|
1125
|
-
}
|
|
1126
|
-
const { groupId, panelId } = data;
|
|
1127
|
-
const isSameGroup = this.id === groupId;
|
|
1128
|
-
if (isSameGroup && !position) {
|
|
1129
|
-
const oldIndex = this.tabsContainer.indexOf(panelId);
|
|
1130
|
-
if (oldIndex === index) {
|
|
1131
|
-
return;
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
this._onMove.fire({
|
|
1135
|
-
target: position,
|
|
1136
|
-
groupId: data.groupId,
|
|
1137
|
-
itemId: data.panelId,
|
|
1138
|
-
index,
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
else {
|
|
1142
|
-
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
1143
|
-
nativeEvent: event,
|
|
1144
|
-
position,
|
|
1145
|
-
panel,
|
|
1146
|
-
getData: () => getPanelData(),
|
|
1147
|
-
group: this.groupPanel,
|
|
1148
|
-
api: this._api,
|
|
1149
|
-
}));
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
updateDragAndDropState() {
|
|
1153
|
-
this.tabsContainer.updateDragAndDropState();
|
|
1154
|
-
}
|
|
1155
|
-
dispose() {
|
|
1156
|
-
var _a, _b, _c;
|
|
1157
|
-
super.dispose();
|
|
1158
|
-
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
1159
|
-
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
1160
|
-
this.watermark = undefined;
|
|
1161
|
-
// Dispose all tab groups
|
|
1162
|
-
for (const tabGroup of [...this._tabGroups]) {
|
|
1163
|
-
tabGroup.dispose();
|
|
1164
|
-
}
|
|
1165
|
-
for (const disposable of this._tabGroupDisposables.values()) {
|
|
1166
|
-
disposable.dispose();
|
|
1167
|
-
}
|
|
1168
|
-
this._tabGroupDisposables.clear();
|
|
1169
|
-
// Dispose any microtask-deferred disposables that haven't run yet
|
|
1170
|
-
for (const disposable of this._pendingMicrotaskDisposables) {
|
|
1171
|
-
disposable.dispose();
|
|
1172
|
-
}
|
|
1173
|
-
this._pendingMicrotaskDisposables.clear();
|
|
1174
|
-
for (const panel of this.panels) {
|
|
1175
|
-
panel.dispose();
|
|
1176
|
-
}
|
|
1177
|
-
this.tabsContainer.dispose();
|
|
1178
|
-
this.contentContainer.dispose();
|
|
1179
|
-
}
|
|
1180
|
-
}
|