dockview-core 6.6.1 → 7.0.2
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 +23 -0
- package/dist/cjs/api/dockviewPanelApi.d.ts +4 -3
- package/dist/cjs/api/dockviewPanelApi.js +8 -0
- package/dist/cjs/dnd/droptarget.d.ts +8 -0
- package/dist/cjs/dnd/droptarget.js +28 -0
- 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 +35 -4
- package/dist/cjs/dockview/components/tab/tab.js +33 -5
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +35 -0
- package/dist/cjs/dockview/components/titlebar/floatingTitleBar.js +95 -0
- package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +52 -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 +31 -24
- package/dist/cjs/dockview/components/titlebar/tabGroups.js +1 -0
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +12 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +105 -2
- 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 +31 -155
- package/dist/cjs/dockview/dockviewComponent.d.ts +299 -44
- package/dist/cjs/dockview/dockviewComponent.js +1787 -1041
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
- package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +39 -3
- package/dist/cjs/dockview/dockviewGroupPanel.d.ts +0 -1
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +36 -14
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +133 -101
- package/dist/cjs/dockview/dockviewPanel.d.ts +2 -2
- 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/watermarkService.d.ts +30 -0
- package/dist/cjs/dockview/watermarkService.js +61 -0
- package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -1
- package/dist/cjs/gridview/baseComponentGridview.js +3 -2
- package/dist/cjs/gridview/gridviewComponent.d.ts +3 -3
- 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 +57 -8
- package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/cjs/paneview/draggablePaneviewPanel.js +4 -4
- package/dist/cjs/paneview/paneviewComponent.d.ts +3 -3
- package/dist/cjs/paneview/paneviewComponent.js +5 -5
- package/dist/dockview-core.js +3201 -1280
- 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 +3200 -1279
- 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 +19 -0
- package/dist/esm/api/dockviewPanelApi.d.ts +4 -3
- package/dist/esm/api/dockviewPanelApi.js +7 -0
- package/dist/esm/dnd/droptarget.d.ts +8 -0
- package/dist/esm/dnd/droptarget.js +28 -0
- 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 +36 -5
- package/dist/esm/dockview/components/tab/tab.js +33 -5
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +35 -0
- package/dist/esm/dockview/components/titlebar/floatingTitleBar.js +65 -0
- package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +52 -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 +31 -24
- package/dist/esm/dockview/components/titlebar/tabGroups.js +1 -0
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +12 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +102 -2
- 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 +33 -145
- package/dist/esm/dockview/dockviewComponent.d.ts +299 -44
- package/dist/esm/dockview/dockviewComponent.js +1420 -743
- package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
- package/dist/esm/dockview/dockviewFloatingGroupPanel.js +35 -3
- package/dist/esm/dockview/dockviewGroupPanel.d.ts +0 -1
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +36 -14
- package/dist/esm/dockview/dockviewGroupPanelModel.js +109 -93
- package/dist/esm/dockview/dockviewPanel.d.ts +2 -2
- 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/watermarkService.d.ts +30 -0
- package/dist/esm/dockview/watermarkService.js +56 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +1 -1
- package/dist/esm/gridview/baseComponentGridview.js +2 -2
- package/dist/esm/gridview/gridviewComponent.d.ts +3 -3
- 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 +53 -8
- package/dist/esm/paneview/draggablePaneviewPanel.d.ts +2 -2
- package/dist/esm/paneview/draggablePaneviewPanel.js +4 -4
- package/dist/esm/paneview/paneviewComponent.d.ts +3 -3
- package/dist/esm/paneview/paneviewComponent.js +5 -5
- package/dist/package/main.cjs.js +3236 -1315
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +3191 -1281
- package/dist/styles/dockview.css +275 -13
- 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,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.DEFAULT_MESSAGES = void 0;
|
|
15
|
+
exports.resolveMessages = resolveMessages;
|
|
16
|
+
/** Where a drop position lands, phrased for the *edge prompt*. */
|
|
17
|
+
function edgeWhere(position, target) {
|
|
18
|
+
return position === 'center'
|
|
19
|
+
? "Tab into ".concat(target)
|
|
20
|
+
: "Split ".concat(position, " of ").concat(target);
|
|
21
|
+
}
|
|
22
|
+
/** Where a drop position landed, phrased for the *commit* sentence. */
|
|
23
|
+
function committedWhere(position, target) {
|
|
24
|
+
return position === 'center'
|
|
25
|
+
? "docked into ".concat(target)
|
|
26
|
+
: "split ".concat(position, " of ").concat(target);
|
|
27
|
+
}
|
|
28
|
+
exports.DEFAULT_MESSAGES = {
|
|
29
|
+
panelOpened: function (title) { return "".concat(title, " opened"); },
|
|
30
|
+
panelClosed: function (title) { return "".concat(title, " closed"); },
|
|
31
|
+
groupMaximized: function (title) { return "".concat(title, " maximized"); },
|
|
32
|
+
groupRestored: function (title) { return "".concat(title, " restored"); },
|
|
33
|
+
groupFloated: function (title) { return "".concat(title, " floated"); },
|
|
34
|
+
groupDocked: function (title) { return "".concat(title, " docked"); },
|
|
35
|
+
groupPoppedOut: function (title) { return "".concat(title, " opened in a new window"); },
|
|
36
|
+
movePickTarget: function (source, target, current, total) {
|
|
37
|
+
return "Moving ".concat(source, ". Target ").concat(target, ", ").concat(current, " of ").concat(total, ". Enter to choose where, Escape to cancel.");
|
|
38
|
+
},
|
|
39
|
+
movePickEdge: function (position, target) {
|
|
40
|
+
return "".concat(edgeWhere(position, target), ". Arrows to change, Enter to confirm, Escape to go back.");
|
|
41
|
+
},
|
|
42
|
+
moveCommitted: function (source, target, position) {
|
|
43
|
+
return "".concat(source, " ").concat(committedWhere(position, target), ".");
|
|
44
|
+
},
|
|
45
|
+
moveCancelled: function () { return "Move cancelled."; },
|
|
46
|
+
moveNotAllowed: function () { return "That move is not allowed."; },
|
|
47
|
+
};
|
|
48
|
+
/** Merge an app's partial overrides over the English defaults. */
|
|
49
|
+
function resolveMessages(overrides) {
|
|
50
|
+
return overrides ? __assign(__assign({}, exports.DEFAULT_MESSAGES), overrides) : exports.DEFAULT_MESSAGES;
|
|
51
|
+
}
|
|
@@ -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,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllModules = void 0;
|
|
4
|
+
var floatingGroupService_1 = require("./floatingGroupService");
|
|
5
|
+
var popoutWindowService_1 = require("./popoutWindowService");
|
|
6
|
+
var watermarkService_1 = require("./watermarkService");
|
|
7
|
+
var edgeGroupService_1 = require("./edgeGroupService");
|
|
8
|
+
var rootDropTargetService_1 = require("./rootDropTargetService");
|
|
9
|
+
var headerActionsService_1 = require("./headerActionsService");
|
|
10
|
+
var liveRegionService_1 = require("./liveRegionService");
|
|
11
|
+
/**
|
|
12
|
+
* Internal list of the built-in modules that ship with the core. Registered
|
|
13
|
+
* automatically by DockviewComponent at construction time; not exported from
|
|
14
|
+
* the package. Additional modules contributed by sibling packages (via
|
|
15
|
+
* `registerModules(...)`) are appended at construction.
|
|
16
|
+
*/
|
|
17
|
+
exports.AllModules = [
|
|
18
|
+
floatingGroupService_1.FloatingGroupModule,
|
|
19
|
+
popoutWindowService_1.PopoutWindowModule,
|
|
20
|
+
watermarkService_1.WatermarkModule,
|
|
21
|
+
edgeGroupService_1.EdgeGroupModule,
|
|
22
|
+
rootDropTargetService_1.RootDropTargetModule,
|
|
23
|
+
headerActionsService_1.HeaderActionsModule,
|
|
24
|
+
liveRegionService_1.LiveRegionModule,
|
|
25
|
+
];
|
|
@@ -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;
|
|
@@ -22,9 +22,13 @@ var dom_1 = require("../../../dom");
|
|
|
22
22
|
var droptarget_1 = require("../../../dnd/droptarget");
|
|
23
23
|
var backend_1 = require("../../../dnd/backend");
|
|
24
24
|
var dataTransfer_1 = require("../../../dnd/dataTransfer");
|
|
25
|
+
var _contentId = 0;
|
|
26
|
+
/** Stable DOM id so each tab's `aria-controls` can reference its tabpanel. */
|
|
27
|
+
var nextContentId = function () { return "dv-tabpanel-".concat(_contentId++); };
|
|
25
28
|
var ContentContainer = /** @class */ (function (_super) {
|
|
26
29
|
__extends(ContentContainer, _super);
|
|
27
30
|
function ContentContainer(accessor, group) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
28
32
|
var _this = _super.call(this) || this;
|
|
29
33
|
_this.accessor = accessor;
|
|
30
34
|
_this.group = group;
|
|
@@ -36,8 +40,17 @@ var ContentContainer = /** @class */ (function (_super) {
|
|
|
36
40
|
_this._element = document.createElement('div');
|
|
37
41
|
_this._element.className = 'dv-content-container';
|
|
38
42
|
_this._element.tabIndex = -1;
|
|
43
|
+
// WAI-ARIA Tabs pattern: the single content area per group is the
|
|
44
|
+
// tabpanel; `aria-labelledby` is pointed at the active tab in
|
|
45
|
+
// `setLabelledBy` (driven from the group model on activation).
|
|
46
|
+
_this._element.id = nextContentId();
|
|
47
|
+
_this._element.setAttribute('role', 'tabpanel');
|
|
39
48
|
_this.addDisposables(_this._onDidFocus, _this._onDidBlur);
|
|
40
|
-
|
|
49
|
+
// Resolve the override anchor dynamically: a group can be relocated
|
|
50
|
+
// between roots (grid / floating / popout) after construction, and the
|
|
51
|
+
// popout anchor in particular lives in another window — a value
|
|
52
|
+
// captured here would mount overlays in the wrong window.
|
|
53
|
+
var getOverrideTarget = function () { var _a; return (_a = group.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; };
|
|
41
54
|
var canDisplayOverlay = function (event, position) {
|
|
42
55
|
if (_this.group.locked === 'no-drop-target' ||
|
|
43
56
|
(_this.group.locked && position === 'center')) {
|
|
@@ -67,7 +80,8 @@ var ContentContainer = /** @class */ (function (_super) {
|
|
|
67
80
|
className: 'dv-drop-target-content',
|
|
68
81
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
69
82
|
canDisplayOverlay: canDisplayOverlay,
|
|
70
|
-
getOverrideTarget:
|
|
83
|
+
getOverrideTarget: getOverrideTarget,
|
|
84
|
+
overlayModel: (_b = (_a = _this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content'),
|
|
71
85
|
});
|
|
72
86
|
_this.pointerDropTarget = backend_1.pointerBackend.createDropTarget(_this.element, {
|
|
73
87
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
@@ -79,9 +93,18 @@ var ContentContainer = /** @class */ (function (_super) {
|
|
|
79
93
|
: null;
|
|
80
94
|
},
|
|
81
95
|
className: 'dv-drop-target-content',
|
|
82
|
-
getOverrideTarget:
|
|
96
|
+
getOverrideTarget: getOverrideTarget,
|
|
97
|
+
overlayModel: (_d = (_c = _this.accessor).resolveDropOverlayModel) === null || _d === void 0 ? void 0 : _d.call(_c, 'content'),
|
|
83
98
|
});
|
|
84
|
-
_this.addDisposables(_this.dropTarget, _this.pointerDropTarget
|
|
99
|
+
_this.addDisposables(_this.dropTarget, _this.pointerDropTarget,
|
|
100
|
+
// Re-apply the app-supplied overlay model when options change.
|
|
101
|
+
// `{}` resets to the built-in default (all fields optional).
|
|
102
|
+
(_g = (_f = (_e = _this.accessor).onDidOptionsChange) === null || _f === void 0 ? void 0 : _f.call(_e, function () {
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
var model = (_c = (_b = (_a = _this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content')) !== null && _c !== void 0 ? _c : {};
|
|
105
|
+
_this.dropTarget.setOverlayModel(model);
|
|
106
|
+
_this.pointerDropTarget.setOverlayModel(model);
|
|
107
|
+
})) !== null && _g !== void 0 ? _g : lifecycle_1.Disposable.NONE);
|
|
85
108
|
return _this;
|
|
86
109
|
}
|
|
87
110
|
Object.defineProperty(ContentContainer.prototype, "element", {
|
|
@@ -97,6 +120,14 @@ var ContentContainer = /** @class */ (function (_super) {
|
|
|
97
120
|
ContentContainer.prototype.hide = function () {
|
|
98
121
|
this.element.style.display = 'none';
|
|
99
122
|
};
|
|
123
|
+
ContentContainer.prototype.setLabelledBy = function (tabElementId) {
|
|
124
|
+
if (tabElementId) {
|
|
125
|
+
this._element.setAttribute('aria-labelledby', tabElementId);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this._element.removeAttribute('aria-labelledby');
|
|
129
|
+
}
|
|
130
|
+
};
|
|
100
131
|
ContentContainer.prototype.renderPanel = function (panel, options) {
|
|
101
132
|
var _this = this;
|
|
102
133
|
var _a, _b, _c, _d;
|
|
@@ -34,9 +34,13 @@ var dom_1 = require("../../../dom");
|
|
|
34
34
|
var backend_1 = require("../../../dnd/backend");
|
|
35
35
|
var longPress_1 = require("../../../dnd/pointer/longPress");
|
|
36
36
|
var dndCapabilities_1 = require("../../dndCapabilities");
|
|
37
|
+
var _tabId = 0;
|
|
38
|
+
/** Stable DOM id referenced by the tabpanel's `aria-labelledby`. */
|
|
39
|
+
var nextTabId = function () { return "dv-tab-".concat(_tabId++); };
|
|
37
40
|
var Tab = /** @class */ (function (_super) {
|
|
38
41
|
__extends(Tab, _super);
|
|
39
42
|
function Tab(panel, accessor, group) {
|
|
43
|
+
var _a, _b;
|
|
40
44
|
var _this = _super.call(this) || this;
|
|
41
45
|
_this.panel = panel;
|
|
42
46
|
_this.accessor = accessor;
|
|
@@ -57,8 +61,20 @@ var Tab = /** @class */ (function (_super) {
|
|
|
57
61
|
var caps = (0, dndCapabilities_1.resolveDndCapabilities)(_this.accessor.options);
|
|
58
62
|
_this._element = document.createElement('div');
|
|
59
63
|
_this._element.className = 'dv-tab';
|
|
60
|
-
|
|
64
|
+
// Roving tabindex (WAI-ARIA Tabs pattern): only the active tab is in
|
|
65
|
+
// the tab order; `setActive` flips this. Inactive tabs are reachable
|
|
66
|
+
// via arrow keys, handled by the tab strip.
|
|
67
|
+
_this._element.tabIndex = -1;
|
|
61
68
|
_this._element.draggable = caps.html5;
|
|
69
|
+
// WAI-ARIA Tabs pattern. `aria-controls` points at the group's single
|
|
70
|
+
// tabpanel (the content container); `aria-selected` tracks activation.
|
|
71
|
+
_this._element.id = nextTabId();
|
|
72
|
+
_this._element.setAttribute('role', 'tab');
|
|
73
|
+
_this._element.setAttribute('aria-selected', 'false');
|
|
74
|
+
var contentContainerId = (_b = (_a = _this.group) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.contentContainerId;
|
|
75
|
+
if (contentContainerId) {
|
|
76
|
+
_this._element.setAttribute('aria-controls', contentContainerId);
|
|
77
|
+
}
|
|
62
78
|
(0, dom_1.toggleClass)(_this.element, 'dv-inactive-tab', true);
|
|
63
79
|
var canDisplayOverlay = function (event, position) {
|
|
64
80
|
var _a;
|
|
@@ -143,13 +159,15 @@ var Tab = /** @class */ (function (_super) {
|
|
|
143
159
|
}), (0, events_1.addDisposableListener)(_this._element, 'click', function (event) {
|
|
144
160
|
_this._onTabClick.fire(event);
|
|
145
161
|
}), (0, events_1.addDisposableListener)(_this._element, 'contextmenu', function (event) {
|
|
146
|
-
|
|
162
|
+
var _a;
|
|
163
|
+
(_a = _this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(_this.panel, _this.group, event);
|
|
147
164
|
}), new longPress_1.LongPressDetector(_this._element, {
|
|
148
165
|
onLongPress: function (event) {
|
|
166
|
+
var _a;
|
|
149
167
|
// Don't let a subsequent finger move arm a drag on top
|
|
150
168
|
// of the just-opened menu.
|
|
151
169
|
_this.pointerDragSource.cancelPending();
|
|
152
|
-
_this.accessor.
|
|
170
|
+
(_a = _this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(_this.panel, _this.group, event);
|
|
153
171
|
},
|
|
154
172
|
}), _this.dropTarget.onDrop(function (event) {
|
|
155
173
|
_this._onDropped.fire(event);
|
|
@@ -168,6 +186,10 @@ var Tab = /** @class */ (function (_super) {
|
|
|
168
186
|
Tab.prototype.setActive = function (isActive) {
|
|
169
187
|
(0, dom_1.toggleClass)(this.element, 'dv-active-tab', isActive);
|
|
170
188
|
(0, dom_1.toggleClass)(this.element, 'dv-inactive-tab', !isActive);
|
|
189
|
+
this._element.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
190
|
+
// Roving tabindex anchors to the active tab; arrow-key navigation in
|
|
191
|
+
// the tab strip moves the rover from there.
|
|
192
|
+
this._element.tabIndex = isActive ? 0 : -1;
|
|
171
193
|
};
|
|
172
194
|
Tab.prototype.setContent = function (part) {
|
|
173
195
|
if (this.content) {
|
|
@@ -177,12 +199,18 @@ var Tab = /** @class */ (function (_super) {
|
|
|
177
199
|
this._element.appendChild(this.content.element);
|
|
178
200
|
};
|
|
179
201
|
Tab.prototype._buildOverlayModel = function () {
|
|
180
|
-
var _a;
|
|
202
|
+
var _a, _b, _c;
|
|
203
|
+
// An app-supplied model (the dropOverlayModel option) takes precedence
|
|
204
|
+
// over the theme-derived default for this tab.
|
|
205
|
+
var custom = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'tab', this.group);
|
|
206
|
+
if (custom) {
|
|
207
|
+
return custom;
|
|
208
|
+
}
|
|
181
209
|
// 'line' themes render a 4px insertion strip at the tab edge via the
|
|
182
210
|
// anchor container's small-boundary path. 'fill' themes render a
|
|
183
211
|
// half-width highlighted area, so we disable the small-boundary path
|
|
184
212
|
// entirely (boundary = 0 ⟹ isSmall always false).
|
|
185
|
-
var smallBoundary = ((
|
|
213
|
+
var smallBoundary = ((_c = this.accessor.options.theme) === null || _c === void 0 ? void 0 : _c.dndTabIndicator) === 'line'
|
|
186
214
|
? Number.POSITIVE_INFINITY
|
|
187
215
|
: 0;
|
|
188
216
|
return {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DockviewComponent } from '../../dockviewComponent';
|
|
2
|
+
import { Event } from '../../../events';
|
|
3
|
+
import { CompositeDisposable } from '../../../lifecycle';
|
|
4
|
+
import { DockviewGroupPanel } from '../../dockviewGroupPanel';
|
|
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 declare class FloatingTitleBar extends CompositeDisposable {
|
|
18
|
+
private readonly accessor;
|
|
19
|
+
private readonly _element;
|
|
20
|
+
private readonly dragSource;
|
|
21
|
+
private _group;
|
|
22
|
+
private readonly _onDragStart;
|
|
23
|
+
readonly onDragStart: Event<PointerEvent | DragEvent>;
|
|
24
|
+
get element(): HTMLElement;
|
|
25
|
+
/** The window's current anchor group — the one this bar drags/activates. */
|
|
26
|
+
get group(): DockviewGroupPanel;
|
|
27
|
+
/**
|
|
28
|
+
* Retarget the bar at a new anchor group. Called when the original anchor
|
|
29
|
+
* leaves a multi-group floating window and another member is promoted, so
|
|
30
|
+
* the bar keeps activating/redocking a group that actually lives here.
|
|
31
|
+
*/
|
|
32
|
+
setGroup(group: DockviewGroupPanel): void;
|
|
33
|
+
constructor(accessor: DockviewComponent, group: DockviewGroupPanel);
|
|
34
|
+
updateDragAndDropState(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.FloatingTitleBar = void 0;
|
|
19
|
+
var events_1 = require("../../../events");
|
|
20
|
+
var lifecycle_1 = require("../../../lifecycle");
|
|
21
|
+
var dom_1 = require("../../../dom");
|
|
22
|
+
var groupDragSource_1 = require("./groupDragSource");
|
|
23
|
+
/**
|
|
24
|
+
* A dedicated, blank drag handle rendered above a floating group's tab bar.
|
|
25
|
+
*
|
|
26
|
+
* It plays the same dual role the tab-bar void container plays today: a plain
|
|
27
|
+
* pointer-drag moves the floating window (wired by the overlay via
|
|
28
|
+
* `setupDrag`), while a shift+drag (mouse) or long-press (touch) detaches the
|
|
29
|
+
* group to redock it into the grid. The redock half is provided by the shared
|
|
30
|
+
* {@link GroupDragSource}; the move half is owned by the overlay.
|
|
31
|
+
*
|
|
32
|
+
* The bar is intentionally contentless — styling is driven entirely through
|
|
33
|
+
* the `--dv-floating-titlebar-*` theme variables.
|
|
34
|
+
*/
|
|
35
|
+
var FloatingTitleBar = /** @class */ (function (_super) {
|
|
36
|
+
__extends(FloatingTitleBar, _super);
|
|
37
|
+
function FloatingTitleBar(accessor, group) {
|
|
38
|
+
var _this = _super.call(this) || this;
|
|
39
|
+
_this.accessor = accessor;
|
|
40
|
+
_this._onDragStart = new events_1.Emitter();
|
|
41
|
+
_this.onDragStart = _this._onDragStart.event;
|
|
42
|
+
_this._group = group;
|
|
43
|
+
_this._element = document.createElement('div');
|
|
44
|
+
_this._element.className = 'dv-floating-titlebar';
|
|
45
|
+
_this.addDisposables(_this._onDragStart, (0, events_1.addDisposableListener)(_this._element, 'pointerdown', function () {
|
|
46
|
+
_this.accessor.doSetGroupActive(_this._group);
|
|
47
|
+
}),
|
|
48
|
+
// Shift+pointerdown marks the event so the overlay's
|
|
49
|
+
// move-the-float drag doesn't fire alongside the HTML5 redock
|
|
50
|
+
// drag. See VoidContainer for the same disambiguation.
|
|
51
|
+
(0, events_1.addDisposableListener)(_this._element, 'pointerdown', function (e) {
|
|
52
|
+
if (e.shiftKey) {
|
|
53
|
+
(0, dom_1.quasiPreventDefault)(e);
|
|
54
|
+
}
|
|
55
|
+
}, true));
|
|
56
|
+
_this.dragSource = new groupDragSource_1.GroupDragSource({
|
|
57
|
+
element: _this._element,
|
|
58
|
+
accessor: _this.accessor,
|
|
59
|
+
// resolve lazily so the drag source follows anchor reassignment
|
|
60
|
+
group: function () { return _this._group; },
|
|
61
|
+
});
|
|
62
|
+
_this.addDisposables(_this.dragSource, _this.dragSource.onDragStart(function (event) {
|
|
63
|
+
_this._onDragStart.fire(event);
|
|
64
|
+
}));
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
Object.defineProperty(FloatingTitleBar.prototype, "element", {
|
|
68
|
+
get: function () {
|
|
69
|
+
return this._element;
|
|
70
|
+
},
|
|
71
|
+
enumerable: false,
|
|
72
|
+
configurable: true
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(FloatingTitleBar.prototype, "group", {
|
|
75
|
+
/** The window's current anchor group — the one this bar drags/activates. */
|
|
76
|
+
get: function () {
|
|
77
|
+
return this._group;
|
|
78
|
+
},
|
|
79
|
+
enumerable: false,
|
|
80
|
+
configurable: true
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Retarget the bar at a new anchor group. Called when the original anchor
|
|
84
|
+
* leaves a multi-group floating window and another member is promoted, so
|
|
85
|
+
* the bar keeps activating/redocking a group that actually lives here.
|
|
86
|
+
*/
|
|
87
|
+
FloatingTitleBar.prototype.setGroup = function (group) {
|
|
88
|
+
this._group = group;
|
|
89
|
+
};
|
|
90
|
+
FloatingTitleBar.prototype.updateDragAndDropState = function () {
|
|
91
|
+
this.dragSource.updateDragAndDropState();
|
|
92
|
+
};
|
|
93
|
+
return FloatingTitleBar;
|
|
94
|
+
}(lifecycle_1.CompositeDisposable));
|
|
95
|
+
exports.FloatingTitleBar = FloatingTitleBar;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DockviewComponent } from '../../dockviewComponent';
|
|
2
|
+
import { Event } from '../../../events';
|
|
3
|
+
import { CompositeDisposable } from '../../../lifecycle';
|
|
4
|
+
import { DockviewGroupPanel } from '../../dockviewGroupPanel';
|
|
5
|
+
declare const FLOATING_REDOCK_INITIATION_DELAY_MS = 500;
|
|
6
|
+
export interface GroupDragSourceOptions {
|
|
7
|
+
readonly element: HTMLElement;
|
|
8
|
+
readonly accessor: DockviewComponent;
|
|
9
|
+
/**
|
|
10
|
+
* The group this handle drags. Pass a function when the handle outlives the
|
|
11
|
+
* group it represents and can be retargeted — e.g. a floating window's
|
|
12
|
+
* dedicated title bar, whose anchor group is reassigned when the original
|
|
13
|
+
* anchor leaves a multi-group window. A fixed reference (the tab-bar void
|
|
14
|
+
* container, which lives inside its own group's DOM) is also accepted.
|
|
15
|
+
*/
|
|
16
|
+
readonly group: DockviewGroupPanel | (() => DockviewGroupPanel);
|
|
17
|
+
/**
|
|
18
|
+
* Whether this element is the floating window's move handle. Only the move
|
|
19
|
+
* handle needs the floating disambiguation (shift for mouse / long-press
|
|
20
|
+
* for touch) that keeps the redock gesture from firing alongside the
|
|
21
|
+
* move-the-float gesture. Other handles on a floating group (e.g. the tab
|
|
22
|
+
* bar's void container when a dedicated title bar is the move handle) drag
|
|
23
|
+
* to redock with a plain drag, exactly like a group in the main grid.
|
|
24
|
+
* Defaults to `() => true`.
|
|
25
|
+
*/
|
|
26
|
+
readonly isFloatingMoveHandle?: () => boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The drag-source half of a group drag handle: html5 + pointer drag sources
|
|
30
|
+
* that publish a group-level `PanelTransfer`, the "Multiple Panels (N)" ghost,
|
|
31
|
+
* and the floating-group disambiguation that keeps the redock gesture from
|
|
32
|
+
* firing alongside the overlay's move-the-float gesture.
|
|
33
|
+
*
|
|
34
|
+
* Shared by the tab-bar void container and the dedicated floating title bar so
|
|
35
|
+
* both grab handles redock identically.
|
|
36
|
+
*/
|
|
37
|
+
export declare class GroupDragSource extends CompositeDisposable {
|
|
38
|
+
private readonly _element;
|
|
39
|
+
private readonly accessor;
|
|
40
|
+
private readonly groupAccessor;
|
|
41
|
+
private readonly html5DragSource;
|
|
42
|
+
private readonly pointerDragSource;
|
|
43
|
+
private readonly panelTransfer;
|
|
44
|
+
private readonly _onDragStart;
|
|
45
|
+
readonly onDragStart: Event<PointerEvent | DragEvent>;
|
|
46
|
+
private readonly isFloatingMoveHandle;
|
|
47
|
+
private get group();
|
|
48
|
+
constructor(options: GroupDragSourceOptions);
|
|
49
|
+
updateDragAndDropState(): void;
|
|
50
|
+
private getFloatingOverlay;
|
|
51
|
+
}
|
|
52
|
+
export { FLOATING_REDOCK_INITIATION_DELAY_MS };
|