dockview-core 6.6.1 → 7.0.3
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/README.md +8 -1
- package/dist/cjs/api/component.api.d.ts +42 -21
- package/dist/cjs/api/component.api.js +111 -20
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +23 -8
- package/dist/cjs/api/dockviewGroupPanelApi.js +24 -1
- package/dist/cjs/api/dockviewPanelApi.d.ts +4 -3
- package/dist/cjs/api/dockviewPanelApi.js +8 -0
- package/dist/cjs/dnd/dropTargetAnchorContainer.js +1 -2
- package/dist/cjs/dnd/droptarget.d.ts +8 -0
- package/dist/cjs/dnd/droptarget.js +28 -0
- package/dist/cjs/dnd/pointer/longPress.js +1 -1
- package/dist/cjs/dnd/pointer/pointerDragController.js +9 -7
- package/dist/cjs/dnd/pointer/pointerDragSource.js +4 -2
- package/dist/cjs/dockview/accessibilityMessages.d.ts +32 -0
- package/dist/cjs/dockview/accessibilityMessages.js +51 -0
- package/dist/cjs/dockview/allModules.d.ts +8 -0
- package/dist/cjs/dockview/allModules.js +25 -0
- package/dist/cjs/dockview/components/panel/content.d.ts +2 -0
- package/dist/cjs/dockview/components/panel/content.js +41 -10
- package/dist/cjs/dockview/components/popupService.js +1 -1
- package/dist/cjs/dockview/components/tab/tab.js +35 -7
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +34 -0
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.js +95 -0
- package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +51 -0
- package/dist/cjs/dockview/components/titlebar/groupDragSource.js +218 -0
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +2 -1
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +36 -30
- package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +27 -5
- package/dist/cjs/dockview/components/titlebar/tabGroups.js +104 -53
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +12 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +121 -25
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +4 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +13 -3
- package/dist/cjs/dockview/components/titlebar/voidContainer.d.ts +1 -4
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +32 -156
- package/dist/cjs/dockview/dndCapabilities.js +3 -3
- package/dist/cjs/dockview/dockviewComponent.d.ts +304 -49
- package/dist/cjs/dockview/dockviewComponent.js +1839 -1075
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +39 -3
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -2
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +36 -14
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +151 -125
- package/dist/cjs/dockview/dockviewPanel.d.ts +2 -2
- package/dist/cjs/dockview/dockviewPanel.js +4 -5
- package/dist/cjs/dockview/dockviewShell.d.ts +29 -7
- package/dist/cjs/dockview/dockviewShell.js +94 -36
- package/dist/cjs/dockview/edgeGroupService.d.ts +38 -0
- package/dist/cjs/dockview/edgeGroupService.js +128 -0
- package/dist/cjs/dockview/floatingGroupService.d.ts +37 -0
- package/dist/cjs/dockview/floatingGroupService.js +231 -0
- package/dist/cjs/dockview/headerActionsService.d.ts +32 -0
- package/dist/cjs/dockview/headerActionsService.js +149 -0
- package/dist/cjs/dockview/liveRegionService.d.ts +53 -0
- package/dist/cjs/dockview/liveRegionService.js +185 -0
- package/dist/cjs/dockview/moduleContracts.d.ts +119 -0
- package/dist/cjs/dockview/moduleContracts.js +2 -0
- package/dist/cjs/dockview/modules.d.ts +110 -0
- package/dist/cjs/dockview/modules.js +304 -0
- package/dist/cjs/dockview/options.d.ts +159 -6
- package/dist/cjs/dockview/options.js +8 -1
- package/dist/cjs/dockview/popoutWindowService.d.ts +95 -0
- package/dist/cjs/dockview/popoutWindowService.js +261 -0
- package/dist/cjs/dockview/rootDropTargetService.d.ts +35 -0
- package/dist/cjs/dockview/rootDropTargetService.js +87 -0
- package/dist/cjs/dockview/strictEventsSequencing.js +6 -6
- package/dist/cjs/dockview/tabGroup.js +3 -3
- package/dist/cjs/dockview/tabGroupAccent.js +1 -3
- package/dist/cjs/dockview/watermarkService.d.ts +30 -0
- package/dist/cjs/dockview/watermarkService.js +61 -0
- package/dist/cjs/dom.js +1 -1
- package/dist/cjs/events.js +1 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -1
- package/dist/cjs/gridview/baseComponentGridview.js +6 -10
- package/dist/cjs/gridview/branchNode.js +13 -17
- package/dist/cjs/gridview/gridview.js +8 -8
- package/dist/cjs/gridview/gridviewComponent.d.ts +3 -3
- package/dist/cjs/gridview/gridviewComponent.js +1 -6
- package/dist/cjs/gridview/gridviewPanel.d.ts +1 -1
- package/dist/cjs/index.d.ts +11 -4
- package/dist/cjs/index.js +14 -1
- package/dist/cjs/overlay/overlay.d.ts +43 -1
- package/dist/cjs/overlay/overlay.js +82 -36
- package/dist/cjs/overlay/overlayRenderContainer.js +3 -4
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/cjs/paneview/draggablePaneviewPanel.js +5 -5
- package/dist/cjs/paneview/paneviewComponent.d.ts +3 -3
- package/dist/cjs/paneview/paneviewComponent.js +7 -11
- package/dist/cjs/popoutWindow.js +4 -4
- package/dist/cjs/scrollbar.d.ts +1 -1
- package/dist/cjs/scrollbar.js +7 -6
- package/dist/cjs/splitview/splitview.d.ts +1 -1
- package/dist/cjs/splitview/splitview.js +21 -20
- package/dist/cjs/splitview/viewItem.js +1 -1
- package/dist/dockview-core.js +3548 -1544
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +3547 -1543
- package/dist/esm/api/component.api.d.ts +42 -21
- package/dist/esm/api/component.api.js +63 -18
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +23 -8
- package/dist/esm/api/dockviewGroupPanelApi.js +20 -1
- package/dist/esm/api/dockviewPanelApi.d.ts +4 -3
- package/dist/esm/api/dockviewPanelApi.js +7 -0
- package/dist/esm/dnd/dropTargetAnchorContainer.js +1 -2
- package/dist/esm/dnd/droptarget.d.ts +8 -0
- package/dist/esm/dnd/droptarget.js +28 -0
- package/dist/esm/dnd/pointer/longPress.js +1 -1
- package/dist/esm/dnd/pointer/pointerDragController.js +9 -7
- package/dist/esm/dnd/pointer/pointerDragSource.js +4 -2
- package/dist/esm/dockview/accessibilityMessages.d.ts +32 -0
- package/dist/esm/dockview/accessibilityMessages.js +30 -0
- package/dist/esm/dockview/allModules.d.ts +8 -0
- package/dist/esm/dockview/allModules.js +22 -0
- package/dist/esm/dockview/components/panel/content.d.ts +2 -0
- package/dist/esm/dockview/components/panel/content.js +42 -11
- package/dist/esm/dockview/components/popupService.js +1 -1
- package/dist/esm/dockview/components/tab/tab.js +35 -7
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +34 -0
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.js +65 -0
- package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +51 -0
- package/dist/esm/dockview/components/titlebar/groupDragSource.js +178 -0
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +2 -1
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +36 -30
- package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +27 -5
- package/dist/esm/dockview/components/titlebar/tabGroups.js +91 -41
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +12 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +119 -26
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +4 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +8 -2
- package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +1 -4
- package/dist/esm/dockview/components/titlebar/voidContainer.js +34 -146
- package/dist/esm/dockview/dndCapabilities.js +3 -3
- package/dist/esm/dockview/dockviewComponent.d.ts +304 -49
- package/dist/esm/dockview/dockviewComponent.js +1459 -772
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
- package/dist/esm/dockview/dockviewFloatingGroupPanel.js +35 -3
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -2
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +36 -14
- package/dist/esm/dockview/dockviewGroupPanelModel.js +127 -117
- package/dist/esm/dockview/dockviewPanel.d.ts +2 -2
- package/dist/esm/dockview/dockviewPanel.js +1 -2
- package/dist/esm/dockview/dockviewShell.d.ts +29 -7
- package/dist/esm/dockview/dockviewShell.js +89 -37
- package/dist/esm/dockview/edgeGroupService.d.ts +38 -0
- package/dist/esm/dockview/edgeGroupService.js +63 -0
- package/dist/esm/dockview/floatingGroupService.d.ts +37 -0
- package/dist/esm/dockview/floatingGroupService.js +150 -0
- package/dist/esm/dockview/headerActionsService.d.ts +32 -0
- package/dist/esm/dockview/headerActionsService.js +86 -0
- package/dist/esm/dockview/liveRegionService.d.ts +53 -0
- package/dist/esm/dockview/liveRegionService.js +159 -0
- package/dist/esm/dockview/moduleContracts.d.ts +119 -0
- package/dist/esm/dockview/moduleContracts.js +1 -0
- package/dist/esm/dockview/modules.d.ts +110 -0
- package/dist/esm/dockview/modules.js +170 -0
- package/dist/esm/dockview/options.d.ts +159 -6
- package/dist/esm/dockview/options.js +8 -1
- package/dist/esm/dockview/popoutWindowService.d.ts +95 -0
- package/dist/esm/dockview/popoutWindowService.js +175 -0
- package/dist/esm/dockview/rootDropTargetService.d.ts +35 -0
- package/dist/esm/dockview/rootDropTargetService.js +82 -0
- package/dist/esm/dockview/strictEventsSequencing.js +6 -6
- package/dist/esm/dockview/tabGroup.js +3 -3
- package/dist/esm/dockview/tabGroupAccent.js +1 -3
- package/dist/esm/dockview/watermarkService.d.ts +30 -0
- package/dist/esm/dockview/watermarkService.js +56 -0
- package/dist/esm/dom.js +1 -1
- package/dist/esm/events.js +1 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts +1 -1
- package/dist/esm/gridview/baseComponentGridview.js +5 -10
- package/dist/esm/gridview/branchNode.js +13 -15
- package/dist/esm/gridview/gridview.js +8 -8
- package/dist/esm/gridview/gridviewComponent.d.ts +3 -3
- package/dist/esm/gridview/gridviewComponent.js +1 -6
- package/dist/esm/gridview/gridviewPanel.d.ts +1 -1
- package/dist/esm/index.d.ts +11 -4
- package/dist/esm/index.js +4 -0
- package/dist/esm/overlay/overlay.d.ts +43 -1
- package/dist/esm/overlay/overlay.js +78 -36
- package/dist/esm/overlay/overlayRenderContainer.js +3 -4
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/esm/paneview/draggablePaneviewPanel.js +5 -5
- package/dist/esm/paneview/paneviewComponent.d.ts +3 -3
- package/dist/esm/paneview/paneviewComponent.js +7 -11
- package/dist/esm/popoutWindow.js +4 -4
- package/dist/esm/scrollbar.d.ts +1 -1
- package/dist/esm/scrollbar.js +7 -6
- package/dist/esm/splitview/splitview.d.ts +1 -1
- package/dist/esm/splitview/splitview.js +21 -20
- package/dist/esm/splitview/viewItem.js +1 -1
- package/dist/package/main.cjs.js +3550 -1546
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +3538 -1545
- package/dist/styles/dockview.css +283 -21
- package/package.json +10 -1
- package/dist/cjs/dockview/contextMenu.d.ts +0 -10
- package/dist/cjs/dockview/contextMenu.js +0 -313
- package/dist/esm/dockview/contextMenu.d.ts +0 -10
- package/dist/esm/dockview/contextMenu.js +0 -228
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Where a drop position lands, phrased for the *edge prompt*. */
|
|
2
|
+
function edgeWhere(position, target) {
|
|
3
|
+
return position === 'center'
|
|
4
|
+
? `Tab into ${target}`
|
|
5
|
+
: `Split ${position} of ${target}`;
|
|
6
|
+
}
|
|
7
|
+
/** Where a drop position landed, phrased for the *commit* sentence. */
|
|
8
|
+
function committedWhere(position, target) {
|
|
9
|
+
return position === 'center'
|
|
10
|
+
? `docked into ${target}`
|
|
11
|
+
: `split ${position} of ${target}`;
|
|
12
|
+
}
|
|
13
|
+
export const DEFAULT_MESSAGES = {
|
|
14
|
+
panelOpened: (title) => `${title} opened`,
|
|
15
|
+
panelClosed: (title) => `${title} closed`,
|
|
16
|
+
groupMaximized: (title) => `${title} maximized`,
|
|
17
|
+
groupRestored: (title) => `${title} restored`,
|
|
18
|
+
groupFloated: (title) => `${title} floated`,
|
|
19
|
+
groupDocked: (title) => `${title} docked`,
|
|
20
|
+
groupPoppedOut: (title) => `${title} opened in a new window`,
|
|
21
|
+
movePickTarget: (source, target, current, total) => `Moving ${source}. Target ${target}, ${current} of ${total}. Enter to choose where, Escape to cancel.`,
|
|
22
|
+
movePickEdge: (position, target) => `${edgeWhere(position, target)}. Arrows to change, Enter to confirm, Escape to go back.`,
|
|
23
|
+
moveCommitted: (source, target, position) => `${source} ${committedWhere(position, target)}.`,
|
|
24
|
+
moveCancelled: () => `Move cancelled.`,
|
|
25
|
+
moveNotAllowed: () => `That move is not allowed.`,
|
|
26
|
+
};
|
|
27
|
+
/** Merge an app's partial overrides over the English defaults. */
|
|
28
|
+
export function resolveMessages(overrides) {
|
|
29
|
+
return overrides ? Object.assign(Object.assign({}, DEFAULT_MESSAGES), overrides) : DEFAULT_MESSAGES;
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DockviewModule } from './modules';
|
|
2
|
+
/**
|
|
3
|
+
* Internal list of the built-in modules that ship with the core. Registered
|
|
4
|
+
* automatically by DockviewComponent at construction time; not exported from
|
|
5
|
+
* the package. Additional modules contributed by sibling packages (via
|
|
6
|
+
* `registerModules(...)`) are appended at construction.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AllModules: DockviewModule<any>[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FloatingGroupModule } from './floatingGroupService';
|
|
2
|
+
import { PopoutWindowModule } from './popoutWindowService';
|
|
3
|
+
import { WatermarkModule } from './watermarkService';
|
|
4
|
+
import { EdgeGroupModule } from './edgeGroupService';
|
|
5
|
+
import { RootDropTargetModule } from './rootDropTargetService';
|
|
6
|
+
import { HeaderActionsModule } from './headerActionsService';
|
|
7
|
+
import { LiveRegionModule } from './liveRegionService';
|
|
8
|
+
/**
|
|
9
|
+
* Internal list of the built-in modules that ship with the core. Registered
|
|
10
|
+
* automatically by DockviewComponent at construction time; not exported from
|
|
11
|
+
* the package. Additional modules contributed by sibling packages (via
|
|
12
|
+
* `registerModules(...)`) are appended at construction.
|
|
13
|
+
*/
|
|
14
|
+
export const AllModules = [
|
|
15
|
+
FloatingGroupModule,
|
|
16
|
+
PopoutWindowModule,
|
|
17
|
+
WatermarkModule,
|
|
18
|
+
EdgeGroupModule,
|
|
19
|
+
RootDropTargetModule,
|
|
20
|
+
HeaderActionsModule,
|
|
21
|
+
LiveRegionModule,
|
|
22
|
+
];
|
|
@@ -19,6 +19,7 @@ export interface IContentContainer extends IDisposable {
|
|
|
19
19
|
asActive: boolean;
|
|
20
20
|
}): void;
|
|
21
21
|
refreshFocusState(): void;
|
|
22
|
+
setLabelledBy(tabElementId: string | undefined): void;
|
|
22
23
|
}
|
|
23
24
|
export declare class ContentContainer extends CompositeDisposable implements IContentContainer {
|
|
24
25
|
private readonly accessor;
|
|
@@ -37,6 +38,7 @@ export declare class ContentContainer extends CompositeDisposable implements ICo
|
|
|
37
38
|
constructor(accessor: DockviewComponent, group: DockviewGroupPanelModel);
|
|
38
39
|
show(): void;
|
|
39
40
|
hide(): void;
|
|
41
|
+
setLabelledBy(tabElementId: string | undefined): void;
|
|
40
42
|
renderPanel(panel: IDockviewPanel, options?: {
|
|
41
43
|
asActive: boolean;
|
|
42
44
|
}): void;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { CompositeDisposable, MutableDisposable, } from '../../../lifecycle';
|
|
1
|
+
import { CompositeDisposable, Disposable, MutableDisposable, } from '../../../lifecycle';
|
|
2
2
|
import { Emitter } from '../../../events';
|
|
3
3
|
import { trackFocus } from '../../../dom';
|
|
4
4
|
import { Droptarget } from '../../../dnd/droptarget';
|
|
5
5
|
import { pointerBackend } from '../../../dnd/backend';
|
|
6
6
|
import { getPanelData } from '../../../dnd/dataTransfer';
|
|
7
|
+
let _contentId = 0;
|
|
8
|
+
/** Stable DOM id so each tab's `aria-controls` can reference its tabpanel. */
|
|
9
|
+
const nextContentId = () => `dv-tabpanel-${_contentId++}`;
|
|
7
10
|
export class ContentContainer extends CompositeDisposable {
|
|
8
11
|
get element() {
|
|
9
12
|
return this._element;
|
|
10
13
|
}
|
|
11
14
|
constructor(accessor, group) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
12
16
|
super();
|
|
13
17
|
this.accessor = accessor;
|
|
14
18
|
this.group = group;
|
|
@@ -20,8 +24,17 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
20
24
|
this._element = document.createElement('div');
|
|
21
25
|
this._element.className = 'dv-content-container';
|
|
22
26
|
this._element.tabIndex = -1;
|
|
27
|
+
// WAI-ARIA Tabs pattern: the single content area per group is the
|
|
28
|
+
// tabpanel; `aria-labelledby` is pointed at the active tab in
|
|
29
|
+
// `setLabelledBy` (driven from the group model on activation).
|
|
30
|
+
this._element.id = nextContentId();
|
|
31
|
+
this._element.setAttribute('role', 'tabpanel');
|
|
23
32
|
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
24
|
-
|
|
33
|
+
// Resolve the override anchor dynamically: a group can be relocated
|
|
34
|
+
// between roots (grid / floating / popout) after construction, and the
|
|
35
|
+
// popout anchor in particular lives in another window — a value
|
|
36
|
+
// captured here would mount overlays in the wrong window.
|
|
37
|
+
const getOverrideTarget = () => { var _a; return (_a = group.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; };
|
|
25
38
|
const canDisplayOverlay = (event, position) => {
|
|
26
39
|
if (this.group.locked === 'no-drop-target' ||
|
|
27
40
|
(this.group.locked && position === 'center')) {
|
|
@@ -33,7 +46,7 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
33
46
|
this.group.location.type !== 'floating') {
|
|
34
47
|
return false;
|
|
35
48
|
}
|
|
36
|
-
if (data
|
|
49
|
+
if ((data === null || data === void 0 ? void 0 : data.viewId) === this.accessor.id) {
|
|
37
50
|
return true;
|
|
38
51
|
}
|
|
39
52
|
return this.group.canDisplayOverlay(event, position, 'content');
|
|
@@ -51,7 +64,8 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
51
64
|
className: 'dv-drop-target-content',
|
|
52
65
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
53
66
|
canDisplayOverlay,
|
|
54
|
-
getOverrideTarget
|
|
67
|
+
getOverrideTarget,
|
|
68
|
+
overlayModel: (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content'),
|
|
55
69
|
});
|
|
56
70
|
this.pointerDropTarget = pointerBackend.createDropTarget(this.element, {
|
|
57
71
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
@@ -63,9 +77,18 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
63
77
|
: null;
|
|
64
78
|
},
|
|
65
79
|
className: 'dv-drop-target-content',
|
|
66
|
-
getOverrideTarget
|
|
80
|
+
getOverrideTarget,
|
|
81
|
+
overlayModel: (_d = (_c = this.accessor).resolveDropOverlayModel) === null || _d === void 0 ? void 0 : _d.call(_c, 'content'),
|
|
67
82
|
});
|
|
68
|
-
this.addDisposables(this.dropTarget, this.pointerDropTarget
|
|
83
|
+
this.addDisposables(this.dropTarget, this.pointerDropTarget,
|
|
84
|
+
// Re-apply the app-supplied overlay model when options change.
|
|
85
|
+
// `{}` resets to the built-in default (all fields optional).
|
|
86
|
+
(_g = (_f = (_e = this.accessor).onDidOptionsChange) === null || _f === void 0 ? void 0 : _f.call(_e, () => {
|
|
87
|
+
var _a, _b, _c;
|
|
88
|
+
const model = (_c = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content')) !== null && _c !== void 0 ? _c : {};
|
|
89
|
+
this.dropTarget.setOverlayModel(model);
|
|
90
|
+
this.pointerDropTarget.setOverlayModel(model);
|
|
91
|
+
})) !== null && _g !== void 0 ? _g : Disposable.NONE);
|
|
69
92
|
}
|
|
70
93
|
show() {
|
|
71
94
|
this.element.style.display = '';
|
|
@@ -73,6 +96,14 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
73
96
|
hide() {
|
|
74
97
|
this.element.style.display = 'none';
|
|
75
98
|
}
|
|
99
|
+
setLabelledBy(tabElementId) {
|
|
100
|
+
if (tabElementId) {
|
|
101
|
+
this._element.setAttribute('aria-labelledby', tabElementId);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this._element.removeAttribute('aria-labelledby');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
76
107
|
renderPanel(panel, options = { asActive: true }) {
|
|
77
108
|
var _a, _b, _c, _d;
|
|
78
109
|
const doRender = options.asActive ||
|
|
@@ -82,7 +113,7 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
82
113
|
/**
|
|
83
114
|
* If the currently attached panel is mounted directly to the content then remove it
|
|
84
115
|
*/
|
|
85
|
-
this.
|
|
116
|
+
this.panel.view.content.element.remove();
|
|
86
117
|
(_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
87
118
|
}
|
|
88
119
|
this.panel = panel;
|
|
@@ -100,7 +131,7 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
100
131
|
break;
|
|
101
132
|
case 'always':
|
|
102
133
|
if (panel.view.content.element.parentElement === this._element) {
|
|
103
|
-
|
|
134
|
+
panel.view.content.element.remove();
|
|
104
135
|
}
|
|
105
136
|
container = this.group.renderContainer.attach({
|
|
106
137
|
panel,
|
|
@@ -128,11 +159,11 @@ export class ContentContainer extends CompositeDisposable {
|
|
|
128
159
|
// noop
|
|
129
160
|
}
|
|
130
161
|
closePanel() {
|
|
131
|
-
var _a, _b
|
|
162
|
+
var _a, _b;
|
|
132
163
|
if (this.panel) {
|
|
133
164
|
if (this.panel.api.renderer === 'onlyWhenVisible') {
|
|
134
|
-
|
|
135
|
-
(
|
|
165
|
+
this.panel.view.content.element.remove();
|
|
166
|
+
(_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
136
167
|
}
|
|
137
168
|
}
|
|
138
169
|
this.panel = undefined;
|
|
@@ -10,7 +10,7 @@ function isCoarsePrimaryInput(win) {
|
|
|
10
10
|
return coarse && !fine;
|
|
11
11
|
}
|
|
12
12
|
export class PopupService extends CompositeDisposable {
|
|
13
|
-
constructor(root, win = window) {
|
|
13
|
+
constructor(root, win = globalThis.window) {
|
|
14
14
|
super();
|
|
15
15
|
this._active = null;
|
|
16
16
|
this._activeDisposable = new MutableDisposable();
|
|
@@ -5,11 +5,15 @@ import { toggleClass } from '../../../dom';
|
|
|
5
5
|
import { html5Backend, pointerBackend, } from '../../../dnd/backend';
|
|
6
6
|
import { LongPressDetector } from '../../../dnd/pointer/longPress';
|
|
7
7
|
import { resolveDndCapabilities } from '../../dndCapabilities';
|
|
8
|
+
let _tabId = 0;
|
|
9
|
+
/** Stable DOM id referenced by the tabpanel's `aria-labelledby`. */
|
|
10
|
+
const nextTabId = () => `dv-tab-${_tabId++}`;
|
|
8
11
|
export class Tab extends CompositeDisposable {
|
|
9
12
|
get element() {
|
|
10
13
|
return this._element;
|
|
11
14
|
}
|
|
12
15
|
constructor(panel, accessor, group) {
|
|
16
|
+
var _a, _b;
|
|
13
17
|
super();
|
|
14
18
|
this.panel = panel;
|
|
15
19
|
this.accessor = accessor;
|
|
@@ -30,8 +34,20 @@ export class Tab extends CompositeDisposable {
|
|
|
30
34
|
const caps = resolveDndCapabilities(this.accessor.options);
|
|
31
35
|
this._element = document.createElement('div');
|
|
32
36
|
this._element.className = 'dv-tab';
|
|
33
|
-
|
|
37
|
+
// Roving tabindex (WAI-ARIA Tabs pattern): only the active tab is in
|
|
38
|
+
// the tab order; `setActive` flips this. Inactive tabs are reachable
|
|
39
|
+
// via arrow keys, handled by the tab strip.
|
|
40
|
+
this._element.tabIndex = -1;
|
|
34
41
|
this._element.draggable = caps.html5;
|
|
42
|
+
// WAI-ARIA Tabs pattern. `aria-controls` points at the group's single
|
|
43
|
+
// tabpanel (the content container); `aria-selected` tracks activation.
|
|
44
|
+
this._element.id = nextTabId();
|
|
45
|
+
this._element.setAttribute('role', 'tab');
|
|
46
|
+
this._element.setAttribute('aria-selected', 'false');
|
|
47
|
+
const contentContainerId = (_b = (_a = this.group) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.contentContainerId;
|
|
48
|
+
if (contentContainerId) {
|
|
49
|
+
this._element.setAttribute('aria-controls', contentContainerId);
|
|
50
|
+
}
|
|
35
51
|
toggleClass(this.element, 'dv-inactive-tab', true);
|
|
36
52
|
const canDisplayOverlay = (event, position) => {
|
|
37
53
|
var _a;
|
|
@@ -39,7 +55,7 @@ export class Tab extends CompositeDisposable {
|
|
|
39
55
|
return false;
|
|
40
56
|
}
|
|
41
57
|
const data = getPanelData();
|
|
42
|
-
if (
|
|
58
|
+
if (this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
|
|
43
59
|
// Smooth-reorder takes over the in-flight visual when active,
|
|
44
60
|
// so individual tab overlays are suppressed for internal drags.
|
|
45
61
|
if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {
|
|
@@ -114,13 +130,15 @@ export class Tab extends CompositeDisposable {
|
|
|
114
130
|
}), addDisposableListener(this._element, 'click', (event) => {
|
|
115
131
|
this._onTabClick.fire(event);
|
|
116
132
|
}), addDisposableListener(this._element, 'contextmenu', (event) => {
|
|
117
|
-
|
|
133
|
+
var _a;
|
|
134
|
+
(_a = this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(this.panel, this.group, event);
|
|
118
135
|
}), new LongPressDetector(this._element, {
|
|
119
136
|
onLongPress: (event) => {
|
|
137
|
+
var _a;
|
|
120
138
|
// Don't let a subsequent finger move arm a drag on top
|
|
121
139
|
// of the just-opened menu.
|
|
122
140
|
this.pointerDragSource.cancelPending();
|
|
123
|
-
this.accessor.
|
|
141
|
+
(_a = this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(this.panel, this.group, event);
|
|
124
142
|
},
|
|
125
143
|
}), this.dropTarget.onDrop((event) => {
|
|
126
144
|
this._onDropped.fire(event);
|
|
@@ -131,21 +149,31 @@ export class Tab extends CompositeDisposable {
|
|
|
131
149
|
setActive(isActive) {
|
|
132
150
|
toggleClass(this.element, 'dv-active-tab', isActive);
|
|
133
151
|
toggleClass(this.element, 'dv-inactive-tab', !isActive);
|
|
152
|
+
this._element.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
153
|
+
// Roving tabindex anchors to the active tab; arrow-key navigation in
|
|
154
|
+
// the tab strip moves the rover from there.
|
|
155
|
+
this._element.tabIndex = isActive ? 0 : -1;
|
|
134
156
|
}
|
|
135
157
|
setContent(part) {
|
|
136
158
|
if (this.content) {
|
|
137
|
-
this.
|
|
159
|
+
this.content.element.remove();
|
|
138
160
|
}
|
|
139
161
|
this.content = part;
|
|
140
162
|
this._element.appendChild(this.content.element);
|
|
141
163
|
}
|
|
142
164
|
_buildOverlayModel() {
|
|
143
|
-
var _a;
|
|
165
|
+
var _a, _b, _c;
|
|
166
|
+
// An app-supplied model (the dropOverlayModel option) takes precedence
|
|
167
|
+
// over the theme-derived default for this tab.
|
|
168
|
+
const custom = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'tab', this.group);
|
|
169
|
+
if (custom) {
|
|
170
|
+
return custom;
|
|
171
|
+
}
|
|
144
172
|
// 'line' themes render a 4px insertion strip at the tab edge via the
|
|
145
173
|
// anchor container's small-boundary path. 'fill' themes render a
|
|
146
174
|
// half-width highlighted area, so we disable the small-boundary path
|
|
147
175
|
// entirely (boundary = 0 ⟹ isSmall always false).
|
|
148
|
-
const smallBoundary = ((
|
|
176
|
+
const smallBoundary = ((_c = this.accessor.options.theme) === null || _c === void 0 ? void 0 : _c.dndTabIndicator) === 'line'
|
|
149
177
|
? Number.POSITIVE_INFINITY
|
|
150
178
|
: 0;
|
|
151
179
|
return {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DockviewComponent } from '../../dockviewComponent';
|
|
2
|
+
import { CompositeDisposable } from '../../../lifecycle';
|
|
3
|
+
import { DockviewGroupPanel } from '../../dockviewGroupPanel';
|
|
4
|
+
/**
|
|
5
|
+
* A dedicated, blank drag handle rendered above a floating group's tab bar.
|
|
6
|
+
*
|
|
7
|
+
* It plays the same dual role the tab-bar void container plays today: a plain
|
|
8
|
+
* pointer-drag moves the floating window (wired by the overlay via
|
|
9
|
+
* `setupDrag`), while a shift+drag (mouse) or long-press (touch) detaches the
|
|
10
|
+
* group to redock it into the grid. The redock half is provided by the shared
|
|
11
|
+
* {@link GroupDragSource}; the move half is owned by the overlay.
|
|
12
|
+
*
|
|
13
|
+
* The bar is intentionally contentless — styling is driven entirely through
|
|
14
|
+
* the `--dv-floating-titlebar-*` theme variables.
|
|
15
|
+
*/
|
|
16
|
+
export declare class FloatingTitleBar extends CompositeDisposable {
|
|
17
|
+
private readonly accessor;
|
|
18
|
+
private readonly _element;
|
|
19
|
+
private readonly dragSource;
|
|
20
|
+
private _group;
|
|
21
|
+
private readonly _onDragStart;
|
|
22
|
+
readonly onDragStart: import("../../../events").Event<PointerEvent | DragEvent>;
|
|
23
|
+
get element(): HTMLElement;
|
|
24
|
+
/** The window's current anchor group — the one this bar drags/activates. */
|
|
25
|
+
get group(): DockviewGroupPanel;
|
|
26
|
+
/**
|
|
27
|
+
* Retarget the bar at a new anchor group. Called when the original anchor
|
|
28
|
+
* leaves a multi-group floating window and another member is promoted, so
|
|
29
|
+
* the bar keeps activating/redocking a group that actually lives here.
|
|
30
|
+
*/
|
|
31
|
+
setGroup(group: DockviewGroupPanel): void;
|
|
32
|
+
constructor(accessor: DockviewComponent, group: DockviewGroupPanel);
|
|
33
|
+
updateDragAndDropState(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { addDisposableListener, Emitter } from '../../../events';
|
|
2
|
+
import { CompositeDisposable } from '../../../lifecycle';
|
|
3
|
+
import { quasiPreventDefault } from '../../../dom';
|
|
4
|
+
import { GroupDragSource } from './groupDragSource';
|
|
5
|
+
/**
|
|
6
|
+
* A dedicated, blank drag handle rendered above a floating group's tab bar.
|
|
7
|
+
*
|
|
8
|
+
* It plays the same dual role the tab-bar void container plays today: a plain
|
|
9
|
+
* pointer-drag moves the floating window (wired by the overlay via
|
|
10
|
+
* `setupDrag`), while a shift+drag (mouse) or long-press (touch) detaches the
|
|
11
|
+
* group to redock it into the grid. The redock half is provided by the shared
|
|
12
|
+
* {@link GroupDragSource}; the move half is owned by the overlay.
|
|
13
|
+
*
|
|
14
|
+
* The bar is intentionally contentless — styling is driven entirely through
|
|
15
|
+
* the `--dv-floating-titlebar-*` theme variables.
|
|
16
|
+
*/
|
|
17
|
+
export class FloatingTitleBar extends CompositeDisposable {
|
|
18
|
+
get element() {
|
|
19
|
+
return this._element;
|
|
20
|
+
}
|
|
21
|
+
/** The window's current anchor group — the one this bar drags/activates. */
|
|
22
|
+
get group() {
|
|
23
|
+
return this._group;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Retarget the bar at a new anchor group. Called when the original anchor
|
|
27
|
+
* leaves a multi-group floating window and another member is promoted, so
|
|
28
|
+
* the bar keeps activating/redocking a group that actually lives here.
|
|
29
|
+
*/
|
|
30
|
+
setGroup(group) {
|
|
31
|
+
this._group = group;
|
|
32
|
+
}
|
|
33
|
+
constructor(accessor, group) {
|
|
34
|
+
super();
|
|
35
|
+
this.accessor = accessor;
|
|
36
|
+
this._onDragStart = new Emitter();
|
|
37
|
+
this.onDragStart = this._onDragStart.event;
|
|
38
|
+
this._group = group;
|
|
39
|
+
this._element = document.createElement('div');
|
|
40
|
+
this._element.className = 'dv-floating-titlebar';
|
|
41
|
+
this.addDisposables(this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
|
|
42
|
+
this.accessor.doSetGroupActive(this._group);
|
|
43
|
+
}),
|
|
44
|
+
// Shift+pointerdown marks the event so the overlay's
|
|
45
|
+
// move-the-float drag doesn't fire alongside the HTML5 redock
|
|
46
|
+
// drag. See VoidContainer for the same disambiguation.
|
|
47
|
+
addDisposableListener(this._element, 'pointerdown', (e) => {
|
|
48
|
+
if (e.shiftKey) {
|
|
49
|
+
quasiPreventDefault(e);
|
|
50
|
+
}
|
|
51
|
+
}, true));
|
|
52
|
+
this.dragSource = new GroupDragSource({
|
|
53
|
+
element: this._element,
|
|
54
|
+
accessor: this.accessor,
|
|
55
|
+
// resolve lazily so the drag source follows anchor reassignment
|
|
56
|
+
group: () => this._group,
|
|
57
|
+
});
|
|
58
|
+
this.addDisposables(this.dragSource, this.dragSource.onDragStart((event) => {
|
|
59
|
+
this._onDragStart.fire(event);
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
updateDragAndDropState() {
|
|
63
|
+
this.dragSource.updateDragAndDropState();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DockviewComponent } from '../../dockviewComponent';
|
|
2
|
+
import { CompositeDisposable } from '../../../lifecycle';
|
|
3
|
+
import { DockviewGroupPanel } from '../../dockviewGroupPanel';
|
|
4
|
+
declare const FLOATING_REDOCK_INITIATION_DELAY_MS = 500;
|
|
5
|
+
export interface GroupDragSourceOptions {
|
|
6
|
+
readonly element: HTMLElement;
|
|
7
|
+
readonly accessor: DockviewComponent;
|
|
8
|
+
/**
|
|
9
|
+
* The group this handle drags. Pass a function when the handle outlives the
|
|
10
|
+
* group it represents and can be retargeted — e.g. a floating window's
|
|
11
|
+
* dedicated title bar, whose anchor group is reassigned when the original
|
|
12
|
+
* anchor leaves a multi-group window. A fixed reference (the tab-bar void
|
|
13
|
+
* container, which lives inside its own group's DOM) is also accepted.
|
|
14
|
+
*/
|
|
15
|
+
readonly group: DockviewGroupPanel | (() => DockviewGroupPanel);
|
|
16
|
+
/**
|
|
17
|
+
* Whether this element is the floating window's move handle. Only the move
|
|
18
|
+
* handle needs the floating disambiguation (shift for mouse / long-press
|
|
19
|
+
* for touch) that keeps the redock gesture from firing alongside the
|
|
20
|
+
* move-the-float gesture. Other handles on a floating group (e.g. the tab
|
|
21
|
+
* bar's void container when a dedicated title bar is the move handle) drag
|
|
22
|
+
* to redock with a plain drag, exactly like a group in the main grid.
|
|
23
|
+
* Defaults to `() => true`.
|
|
24
|
+
*/
|
|
25
|
+
readonly isFloatingMoveHandle?: () => boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The drag-source half of a group drag handle: html5 + pointer drag sources
|
|
29
|
+
* that publish a group-level `PanelTransfer`, the "Multiple Panels (N)" ghost,
|
|
30
|
+
* and the floating-group disambiguation that keeps the redock gesture from
|
|
31
|
+
* firing alongside the overlay's move-the-float gesture.
|
|
32
|
+
*
|
|
33
|
+
* Shared by the tab-bar void container and the dedicated floating title bar so
|
|
34
|
+
* both grab handles redock identically.
|
|
35
|
+
*/
|
|
36
|
+
export declare class GroupDragSource extends CompositeDisposable {
|
|
37
|
+
private readonly _element;
|
|
38
|
+
private readonly accessor;
|
|
39
|
+
private readonly groupAccessor;
|
|
40
|
+
private readonly html5DragSource;
|
|
41
|
+
private readonly pointerDragSource;
|
|
42
|
+
private readonly panelTransfer;
|
|
43
|
+
private readonly _onDragStart;
|
|
44
|
+
readonly onDragStart: import("../../../events").Event<PointerEvent | DragEvent>;
|
|
45
|
+
private readonly isFloatingMoveHandle;
|
|
46
|
+
private get group();
|
|
47
|
+
constructor(options: GroupDragSourceOptions);
|
|
48
|
+
updateDragAndDropState(): void;
|
|
49
|
+
private getFloatingOverlay;
|
|
50
|
+
}
|
|
51
|
+
export { FLOATING_REDOCK_INITIATION_DELAY_MS };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { LocalSelectionTransfer, PanelTransfer, } from '../../../dnd/dataTransfer';
|
|
2
|
+
import { html5Backend, pointerBackend, } from '../../../dnd/backend';
|
|
3
|
+
import { Emitter } from '../../../events';
|
|
4
|
+
import { CompositeDisposable, Disposable, MutableDisposable, } from '../../../lifecycle';
|
|
5
|
+
import { toggleClass } from '../../../dom';
|
|
6
|
+
import { resolveDndCapabilities } from '../../dndCapabilities';
|
|
7
|
+
// Floating-group redock via touch: require a deliberate long press so the
|
|
8
|
+
// "move the float around" gesture doesn't double-trigger the redock ghost.
|
|
9
|
+
// Infinity pressTolerance disables the pre-arm flick override; any motion
|
|
10
|
+
// during the wait is treated as drag-the-float, not redock intent.
|
|
11
|
+
const FLOATING_REDOCK_INITIATION_DELAY_MS = 500;
|
|
12
|
+
/**
|
|
13
|
+
* The drag-source half of a group drag handle: html5 + pointer drag sources
|
|
14
|
+
* that publish a group-level `PanelTransfer`, the "Multiple Panels (N)" ghost,
|
|
15
|
+
* and the floating-group disambiguation that keeps the redock gesture from
|
|
16
|
+
* firing alongside the overlay's move-the-float gesture.
|
|
17
|
+
*
|
|
18
|
+
* Shared by the tab-bar void container and the dedicated floating title bar so
|
|
19
|
+
* both grab handles redock identically.
|
|
20
|
+
*/
|
|
21
|
+
export class GroupDragSource extends CompositeDisposable {
|
|
22
|
+
// Resolved lazily so a retargetable handle (the floating title bar) always
|
|
23
|
+
// drags the window's *current* anchor group, not the one captured here.
|
|
24
|
+
get group() {
|
|
25
|
+
return this.groupAccessor();
|
|
26
|
+
}
|
|
27
|
+
constructor(options) {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
super();
|
|
30
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
31
|
+
this._onDragStart = new Emitter();
|
|
32
|
+
this.onDragStart = this._onDragStart.event;
|
|
33
|
+
this._element = options.element;
|
|
34
|
+
this.accessor = options.accessor;
|
|
35
|
+
const group = options.group;
|
|
36
|
+
this.groupAccessor = typeof group === 'function' ? group : () => group;
|
|
37
|
+
this.isFloatingMoveHandle =
|
|
38
|
+
(_a = options.isFloatingMoveHandle) !== null && _a !== void 0 ? _a : (() => true);
|
|
39
|
+
const caps = resolveDndCapabilities(this.accessor.options);
|
|
40
|
+
this._element.draggable = caps.html5;
|
|
41
|
+
toggleClass(this._element, 'dv-draggable', caps.html5 || caps.pointer);
|
|
42
|
+
this.addDisposables(this._onDragStart);
|
|
43
|
+
const buildMultiPanelsGhost = () => {
|
|
44
|
+
const ghostEl = document.createElement('div');
|
|
45
|
+
const style = globalThis.getComputedStyle(this._element);
|
|
46
|
+
const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
|
|
47
|
+
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
48
|
+
ghostEl.style.backgroundColor = bgColor;
|
|
49
|
+
ghostEl.style.color = color;
|
|
50
|
+
ghostEl.style.padding = '2px 8px';
|
|
51
|
+
ghostEl.style.height = '24px';
|
|
52
|
+
ghostEl.style.fontSize = '11px';
|
|
53
|
+
ghostEl.style.lineHeight = '20px';
|
|
54
|
+
ghostEl.style.borderRadius = '12px';
|
|
55
|
+
ghostEl.style.whiteSpace = 'nowrap';
|
|
56
|
+
ghostEl.style.boxSizing = 'border-box';
|
|
57
|
+
// HTML5 setDragImage snapshots the element as appended to the
|
|
58
|
+
// document; a default block-level div would stretch to the
|
|
59
|
+
// body's width and render as a viewport-wide bar.
|
|
60
|
+
ghostEl.style.display = 'inline-block';
|
|
61
|
+
ghostEl.textContent = `Multiple Panels (${this.group.size})`;
|
|
62
|
+
return ghostEl;
|
|
63
|
+
};
|
|
64
|
+
const buildGhostSpec = () => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
// The custom-ghost resolution (createGroupDragGhostComponent) is
|
|
67
|
+
// owned by the AdvancedDnD module; core keeps the default chip and
|
|
68
|
+
// falls back to it when no custom ghost is produced (incl. when
|
|
69
|
+
// the module is absent).
|
|
70
|
+
const customGhost = (_b = (_a = this.accessor).buildGroupDragGhost) === null || _b === void 0 ? void 0 : _b.call(_a, this.group);
|
|
71
|
+
if (customGhost) {
|
|
72
|
+
return customGhost;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
element: buildMultiPanelsGhost(),
|
|
76
|
+
offsetX: 30,
|
|
77
|
+
offsetY: -10,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const sharedDragOptions = {
|
|
81
|
+
getData: () => {
|
|
82
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, null)], PanelTransfer.prototype);
|
|
83
|
+
return {
|
|
84
|
+
dispose: () => {
|
|
85
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
createGhost: buildGhostSpec,
|
|
90
|
+
onDragStart: (event) => {
|
|
91
|
+
this._onDragStart.fire(event);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
this.html5DragSource = html5Backend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.html5, isCancelled: (event) => {
|
|
95
|
+
// HTML5: when this element is the floating window's move
|
|
96
|
+
// handle, redock needs shift+drag (otherwise click-and-drag
|
|
97
|
+
// conflicts with moving the float). A non-move-handle (e.g. the
|
|
98
|
+
// void container when a title bar moves the float) redocks with
|
|
99
|
+
// a plain drag, like a group in the main grid.
|
|
100
|
+
if (this.group.api.location.type === 'floating' &&
|
|
101
|
+
this.isFloatingMoveHandle() &&
|
|
102
|
+
!event.shiftKey) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (this.group.api.location.type === 'edge' &&
|
|
106
|
+
this.group.size === 0) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
} }));
|
|
111
|
+
// Only the move handle needs the touch disambiguation; other handles
|
|
112
|
+
// redock with the normal grid press behaviour.
|
|
113
|
+
const isFloating = () => {
|
|
114
|
+
var _a, _b, _c;
|
|
115
|
+
return ((_c = (_b = (_a = this.group) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.location) === null || _c === void 0 ? void 0 : _c.type) === 'floating' &&
|
|
116
|
+
this.isFloatingMoveHandle();
|
|
117
|
+
};
|
|
118
|
+
this.pointerDragSource = pointerBackend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.pointer, touchOnly: !caps.pointerHandlesMouse,
|
|
119
|
+
// Floating groups share this element with the overlay's
|
|
120
|
+
// move-the-float drag. Without a longer hold + tolerance
|
|
121
|
+
// override, both gestures commit simultaneously and the
|
|
122
|
+
// user sees the float follow their finger *and* a ghost.
|
|
123
|
+
touchInitiationDelay: () => isFloating() ? FLOATING_REDOCK_INITIATION_DELAY_MS : 250, pressTolerance: () => (isFloating() ? Infinity : 8), isCancelled: () => {
|
|
124
|
+
if (!resolveDndCapabilities(this.accessor.options).pointer) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
// Pointer: long-press IS the deliberate gesture, so
|
|
128
|
+
// floating groups don't need the shift gate.
|
|
129
|
+
if (this.group.api.location.type === 'edge' &&
|
|
130
|
+
this.group.size === 0) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}, onDragStart: (event) => {
|
|
135
|
+
var _a;
|
|
136
|
+
// Redock just committed — abort any in-flight overlay
|
|
137
|
+
// move so the float stops following the finger while
|
|
138
|
+
// the ghost takes over.
|
|
139
|
+
(_a = this.getFloatingOverlay()) === null || _a === void 0 ? void 0 : _a.cancelPendingDrag();
|
|
140
|
+
this._onDragStart.fire(event);
|
|
141
|
+
} }));
|
|
142
|
+
// Mirror direction: once the overlay's move-the-float gesture has
|
|
143
|
+
// actually moved something, cancel the pending redock arm so the
|
|
144
|
+
// ghost doesn't appear mid-drag if the user holds past 500ms.
|
|
145
|
+
const overlayMoveSub = new MutableDisposable();
|
|
146
|
+
const refreshOverlayMoveSub = () => {
|
|
147
|
+
const overlay = this.getFloatingOverlay();
|
|
148
|
+
overlayMoveSub.value = overlay
|
|
149
|
+
? overlay.onDidStartMoving(() => {
|
|
150
|
+
this.pointerDragSource.cancelPending();
|
|
151
|
+
})
|
|
152
|
+
: Disposable.NONE;
|
|
153
|
+
};
|
|
154
|
+
refreshOverlayMoveSub();
|
|
155
|
+
this.addDisposables(overlayMoveSub);
|
|
156
|
+
const locationChange = (_c = (_b = this.group) === null || _b === void 0 ? void 0 : _b.api) === null || _c === void 0 ? void 0 : _c.onDidLocationChange;
|
|
157
|
+
if (locationChange) {
|
|
158
|
+
this.addDisposables(locationChange(refreshOverlayMoveSub));
|
|
159
|
+
}
|
|
160
|
+
this.addDisposables(this.html5DragSource, this.pointerDragSource);
|
|
161
|
+
}
|
|
162
|
+
updateDragAndDropState() {
|
|
163
|
+
const caps = resolveDndCapabilities(this.accessor.options);
|
|
164
|
+
this._element.draggable = caps.html5;
|
|
165
|
+
toggleClass(this._element, 'dv-draggable', caps.html5 || caps.pointer);
|
|
166
|
+
this.html5DragSource.setDisabled(!caps.html5);
|
|
167
|
+
this.pointerDragSource.setDisabled(!caps.pointer);
|
|
168
|
+
this.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);
|
|
169
|
+
}
|
|
170
|
+
getFloatingOverlay() {
|
|
171
|
+
var _a, _b;
|
|
172
|
+
if (!this.group) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
return (_b = (_a = this.accessor.floatingGroups) === null || _a === void 0 ? void 0 : _a.find((fg) => fg.group === this.group)) === null || _b === void 0 ? void 0 : _b.overlay;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export { FLOATING_REDOCK_INITIATION_DELAY_MS };
|