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,185 @@
|
|
|
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.LiveRegionModule = exports.LiveRegionService = void 0;
|
|
19
|
+
var lifecycle_1 = require("../lifecycle");
|
|
20
|
+
var accessibilityMessages_1 = require("./accessibilityMessages");
|
|
21
|
+
var modules_1 = require("./modules");
|
|
22
|
+
/** Bulk transactions whose per-panel events should not each be announced. */
|
|
23
|
+
var isBulk = function (kind) {
|
|
24
|
+
return kind === 'load' || kind === 'clear';
|
|
25
|
+
};
|
|
26
|
+
function createLiveRegion(politeness) {
|
|
27
|
+
var el = document.createElement('div');
|
|
28
|
+
el.className =
|
|
29
|
+
politeness === 'assertive'
|
|
30
|
+
? 'dv-live-region-assertive'
|
|
31
|
+
: 'dv-live-region';
|
|
32
|
+
// assertive interrupts the SR (errors / cancellations); polite waits for a
|
|
33
|
+
// pause (routine status). `alert` implies assertive, `status` implies polite.
|
|
34
|
+
el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');
|
|
35
|
+
el.setAttribute('aria-live', politeness);
|
|
36
|
+
el.setAttribute('aria-atomic', 'true');
|
|
37
|
+
// Visually hidden but kept in the accessibility tree (never display:none /
|
|
38
|
+
// visibility:hidden, which would drop it from AT). Standard clip pattern.
|
|
39
|
+
Object.assign(el.style, {
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
width: '1px',
|
|
42
|
+
height: '1px',
|
|
43
|
+
margin: '-1px',
|
|
44
|
+
padding: '0',
|
|
45
|
+
overflow: 'hidden',
|
|
46
|
+
clip: 'rect(0 0 0 0)',
|
|
47
|
+
clipPath: 'inset(50%)',
|
|
48
|
+
whiteSpace: 'nowrap',
|
|
49
|
+
border: '0',
|
|
50
|
+
});
|
|
51
|
+
return el;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Narrates layout state changes to screen readers via visually-hidden
|
|
55
|
+
* `aria-live` regions. Free / core (WCAG 4.1.3). Announces panel open/close +
|
|
56
|
+
* the shared `announce()` sink (the accessibility module narrates docking here too).
|
|
57
|
+
* Two regions: a **polite** one for routine status and an **assertive** one
|
|
58
|
+
* for errors/cancellations. The bulk load/clear burst is suppressed via the
|
|
59
|
+
* mutation-transaction events, and an app can take over delivery entirely with
|
|
60
|
+
* the `announcer` option.
|
|
61
|
+
*/
|
|
62
|
+
var LiveRegionService = /** @class */ (function (_super) {
|
|
63
|
+
__extends(LiveRegionService, _super);
|
|
64
|
+
function LiveRegionService(host) {
|
|
65
|
+
var _this = _super.call(this) || this;
|
|
66
|
+
_this._suppressDepth = 0;
|
|
67
|
+
_this._locationSubs = new Map();
|
|
68
|
+
_this._host = host;
|
|
69
|
+
_this._polite = createLiveRegion('polite');
|
|
70
|
+
_this._assertive = createLiveRegion('assertive');
|
|
71
|
+
host.element.appendChild(_this._polite);
|
|
72
|
+
host.element.appendChild(_this._assertive);
|
|
73
|
+
_this.addDisposables({ dispose: function () { return _this._polite.remove(); } }, { dispose: function () { return _this._assertive.remove(); } }, host.onDidAddPanel(function (panel) { return _this._announce(panel, 'open'); }), host.onDidRemovePanel(function (panel) { return _this._announce(panel, 'close'); }),
|
|
74
|
+
// Bracket bulk transactions so a fromJSON / clear doesn't announce
|
|
75
|
+
// every nested add/remove.
|
|
76
|
+
host.onWillMutateLayout(function (e) {
|
|
77
|
+
if (isBulk(e.kind)) {
|
|
78
|
+
_this._suppressDepth++;
|
|
79
|
+
}
|
|
80
|
+
}), host.onDidMutateLayout(function (e) {
|
|
81
|
+
if (isBulk(e.kind)) {
|
|
82
|
+
_this._suppressDepth = Math.max(0, _this._suppressDepth - 1);
|
|
83
|
+
}
|
|
84
|
+
}), host.onDidMaximizedGroupChange(function (e) {
|
|
85
|
+
var panel = e.group.activePanel;
|
|
86
|
+
if (panel) {
|
|
87
|
+
_this._announce(panel, e.isMaximized ? 'maximize' : 'restore');
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
// Narrate a group floating / docking back / popping out. A group is
|
|
91
|
+
// born in the grid then transitions, so track each group's previous
|
|
92
|
+
// location and ignore the no-op initial `-> grid`.
|
|
93
|
+
host.onDidAddGroup(function (group) { return _this._trackLocation(group); }), host.onDidRemoveGroup(function (group) {
|
|
94
|
+
var _a;
|
|
95
|
+
(_a = _this._locationSubs.get(group.id)) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
96
|
+
_this._locationSubs.delete(group.id);
|
|
97
|
+
}), {
|
|
98
|
+
dispose: function () {
|
|
99
|
+
_this._locationSubs.forEach(function (sub) { return sub.dispose(); });
|
|
100
|
+
_this._locationSubs.clear();
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
return _this;
|
|
104
|
+
}
|
|
105
|
+
LiveRegionService.prototype._trackLocation = function (group) {
|
|
106
|
+
var _this = this;
|
|
107
|
+
var prev = group.api.location.type;
|
|
108
|
+
var sub = group.api.onDidLocationChange(function (e) {
|
|
109
|
+
var next = e.location.type;
|
|
110
|
+
if (next === prev) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
prev = next;
|
|
114
|
+
var panel = group.activePanel;
|
|
115
|
+
if (!panel) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
var kind = next === 'floating'
|
|
119
|
+
? 'float'
|
|
120
|
+
: next === 'popout'
|
|
121
|
+
? 'popout'
|
|
122
|
+
: 'dock';
|
|
123
|
+
_this._announce(panel, kind);
|
|
124
|
+
});
|
|
125
|
+
this._locationSubs.set(group.id, sub);
|
|
126
|
+
};
|
|
127
|
+
LiveRegionService.prototype.announce = function (message, politeness) {
|
|
128
|
+
if (politeness === void 0) { politeness = 'polite'; }
|
|
129
|
+
// Opt-out (read live so `updateOptions({ announcements })` applies).
|
|
130
|
+
if (this._host.options.announcements === false ||
|
|
131
|
+
this._suppressDepth > 0 ||
|
|
132
|
+
!message) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// Apps can route announcements into their own SR system instead of the
|
|
136
|
+
// built-in regions (e.g. a shared app-wide live region).
|
|
137
|
+
var announcer = this._host.options.announcer;
|
|
138
|
+
if (announcer) {
|
|
139
|
+
announcer({ message: message, politeness: politeness });
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// Clearing first forces SRs to re-announce an identical message.
|
|
143
|
+
var region = politeness === 'assertive' ? this._assertive : this._polite;
|
|
144
|
+
region.textContent = '';
|
|
145
|
+
region.textContent = message;
|
|
146
|
+
};
|
|
147
|
+
LiveRegionService.prototype._announce = function (panel, kind) {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
// The app may localise/override the message, suppress it (null / ''),
|
|
150
|
+
// or fall through to the default (undefined).
|
|
151
|
+
var custom = (_b = (_a = this._host.options).getAnnouncement) === null || _b === void 0 ? void 0 : _b.call(_a, { kind: kind, panel: panel });
|
|
152
|
+
if (custom === null || custom === '') {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.announce(custom !== null && custom !== void 0 ? custom : this._defaultMessage(panel, kind));
|
|
156
|
+
};
|
|
157
|
+
LiveRegionService.prototype._defaultMessage = function (panel, kind) {
|
|
158
|
+
var _a;
|
|
159
|
+
var m = (0, accessibilityMessages_1.resolveMessages)(this._host.options.messages);
|
|
160
|
+
var name = (_a = panel.title) !== null && _a !== void 0 ? _a : panel.id;
|
|
161
|
+
switch (kind) {
|
|
162
|
+
case 'open':
|
|
163
|
+
return m.panelOpened(name);
|
|
164
|
+
case 'close':
|
|
165
|
+
return m.panelClosed(name);
|
|
166
|
+
case 'maximize':
|
|
167
|
+
return m.groupMaximized(name);
|
|
168
|
+
case 'restore':
|
|
169
|
+
return m.groupRestored(name);
|
|
170
|
+
case 'float':
|
|
171
|
+
return m.groupFloated(name);
|
|
172
|
+
case 'dock':
|
|
173
|
+
return m.groupDocked(name);
|
|
174
|
+
case 'popout':
|
|
175
|
+
return m.groupPoppedOut(name);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
return LiveRegionService;
|
|
179
|
+
}(lifecycle_1.CompositeDisposable));
|
|
180
|
+
exports.LiveRegionService = LiveRegionService;
|
|
181
|
+
exports.LiveRegionModule = (0, modules_1.defineModule)({
|
|
182
|
+
name: 'LiveRegion',
|
|
183
|
+
serviceKey: 'liveRegionService',
|
|
184
|
+
create: function (host) { return new LiveRegionService(host); },
|
|
185
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service + host interfaces for the pluggable feature modules. Core references
|
|
3
|
+
* only these interfaces — never a module's implementation — so each module is
|
|
4
|
+
* decoupled from core and independently testable / removable. Keep this file
|
|
5
|
+
* implementation-free.
|
|
6
|
+
*/
|
|
7
|
+
import { IDisposable } from '../lifecycle';
|
|
8
|
+
import { Event } from '../events';
|
|
9
|
+
import { DroptargetOverlayModel, Position } from '../dnd/droptarget';
|
|
10
|
+
import { IDragGhostSpec } from '../dnd/backend';
|
|
11
|
+
import { DockviewApi } from '../api/component.api';
|
|
12
|
+
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
13
|
+
import { IDockviewPanel } from './dockviewPanel';
|
|
14
|
+
import { ITabGroup } from './tabGroup';
|
|
15
|
+
import { TabGroupColorPalette } from './tabGroupAccent';
|
|
16
|
+
import { PopupService } from './components/popupService';
|
|
17
|
+
import { DockviewComponentOptions } from './options';
|
|
18
|
+
import { DockviewLayoutMutationEvent, GroupNavigationDirection } from './dockviewComponent';
|
|
19
|
+
import { DockviewWillDropEvent } from './dockviewGroupPanelModel';
|
|
20
|
+
import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
|
|
21
|
+
import { DockviewGroupDropLocation, DockviewTabGroupChangeEvent, DockviewTabGroupPanelChangeEvent, DockviewTabGroupCollapsedChangeEvent, DockviewWillShowOverlayLocationEvent } from './events';
|
|
22
|
+
export interface IContextMenuHost {
|
|
23
|
+
readonly options: DockviewComponentOptions;
|
|
24
|
+
readonly api: DockviewApi;
|
|
25
|
+
readonly tabGroupColorPalette: TabGroupColorPalette;
|
|
26
|
+
getPopupServiceForGroup(group: DockviewGroupPanel): PopupService;
|
|
27
|
+
}
|
|
28
|
+
export interface IContextMenuService {
|
|
29
|
+
show(panel: IDockviewPanel, group: DockviewGroupPanel, event: MouseEvent): void;
|
|
30
|
+
showForChip(tabGroup: ITabGroup, group: DockviewGroupPanel, event: MouseEvent): void;
|
|
31
|
+
}
|
|
32
|
+
export interface ITabGroupChipsHost {
|
|
33
|
+
readonly onDidAddGroup: Event<DockviewGroupPanel>;
|
|
34
|
+
readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
|
|
35
|
+
fireDidCreateTabGroup(event: DockviewTabGroupChangeEvent): void;
|
|
36
|
+
fireDidDestroyTabGroup(event: DockviewTabGroupChangeEvent): void;
|
|
37
|
+
fireDidAddPanelToTabGroup(event: DockviewTabGroupPanelChangeEvent): void;
|
|
38
|
+
fireDidRemovePanelFromTabGroup(event: DockviewTabGroupPanelChangeEvent): void;
|
|
39
|
+
fireDidTabGroupChange(event: DockviewTabGroupChangeEvent): void;
|
|
40
|
+
fireDidTabGroupCollapsedChange(event: DockviewTabGroupCollapsedChangeEvent): void;
|
|
41
|
+
}
|
|
42
|
+
export interface ITabGroupChipsService extends IDisposable {
|
|
43
|
+
/**
|
|
44
|
+
* Subscribe to the per-group tab-group events on the given group and
|
|
45
|
+
* re-fire them on the host's component-level emitters. Returns a
|
|
46
|
+
* disposable that detaches the subscriptions; intended to be bundled
|
|
47
|
+
* into the per-group CompositeDisposable so cleanup happens when the
|
|
48
|
+
* group is removed.
|
|
49
|
+
*/
|
|
50
|
+
attachToGroup(group: DockviewGroupPanel): IDisposable;
|
|
51
|
+
}
|
|
52
|
+
export interface IAccessibilityHost {
|
|
53
|
+
/**
|
|
54
|
+
* The outermost dockview element (the shell, which also contains edge
|
|
55
|
+
* groups). A getter — it must resolve to the shell once that exists, not
|
|
56
|
+
* the inner gridview, or keydowns from edge groups are missed.
|
|
57
|
+
*/
|
|
58
|
+
readonly rootElement: HTMLElement;
|
|
59
|
+
readonly options: DockviewComponentOptions;
|
|
60
|
+
readonly groups: DockviewGroupPanel[];
|
|
61
|
+
readonly activeGroup: DockviewGroupPanel | undefined;
|
|
62
|
+
readonly activePanel: IDockviewPanel | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* The next / previous group in gridview (spatial) order, wrapping round —
|
|
65
|
+
* the one piece of navigation that needs the grid internals. All other
|
|
66
|
+
* focus logic lives in the service, using the public group API.
|
|
67
|
+
*/
|
|
68
|
+
adjacentGroup(group: DockviewGroupPanel, reverse: boolean): DockviewGroupPanel | undefined;
|
|
69
|
+
/** The nearest grid group in a spatial direction — drives Alt+Arrow nav. */
|
|
70
|
+
adjacentGroupInDirection(group: DockviewGroupPanel, direction: GroupNavigationDirection): DockviewGroupPanel | undefined;
|
|
71
|
+
/** Fires before / after a structural layout change — used to restore focus on close. */
|
|
72
|
+
readonly onWillMutateLayout: Event<DockviewLayoutMutationEvent>;
|
|
73
|
+
readonly onDidMutateLayout: Event<DockviewLayoutMutationEvent>;
|
|
74
|
+
showDropPreview(group: DockviewGroupPanel, position: Position): IDisposable;
|
|
75
|
+
announce(message: string): void;
|
|
76
|
+
dockPanel(panel: IDockviewPanel, group: DockviewGroupPanel, position: Position): void;
|
|
77
|
+
}
|
|
78
|
+
export interface IAccessibilityService extends IDisposable {
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Marker for the advanced keyboard docking service (spatial group focus +
|
|
82
|
+
* keyboard move mode). Self-driven; the component never calls into it.
|
|
83
|
+
*/
|
|
84
|
+
export interface IKeyboardDockingService extends IDisposable {
|
|
85
|
+
}
|
|
86
|
+
export interface IAdvancedDnDHost {
|
|
87
|
+
readonly options: DockviewComponentOptions;
|
|
88
|
+
readonly api: DockviewApi;
|
|
89
|
+
fireWillDragPanel(event: TabDragEvent): void;
|
|
90
|
+
fireWillDragGroup(event: GroupDragEvent): void;
|
|
91
|
+
fireWillDrop(event: DockviewWillDropEvent): void;
|
|
92
|
+
fireWillShowOverlay(event: DockviewWillShowOverlayLocationEvent): void;
|
|
93
|
+
}
|
|
94
|
+
export interface IAdvancedDnDService extends IDisposable {
|
|
95
|
+
dispatchWillDragPanel(event: TabDragEvent): void;
|
|
96
|
+
dispatchWillDragGroup(event: GroupDragEvent): void;
|
|
97
|
+
dispatchWillDrop(event: DockviewWillDropEvent): void;
|
|
98
|
+
dispatchWillShowOverlay(event: DockviewWillShowOverlayLocationEvent): void;
|
|
99
|
+
/**
|
|
100
|
+
* Resolve the custom group drag ghost from
|
|
101
|
+
* `createGroupDragGhostComponent`, or `undefined` when no factory is
|
|
102
|
+
* configured (the caller then renders the default chip). Returning
|
|
103
|
+
* `undefined` is also what happens when this module is absent.
|
|
104
|
+
*/
|
|
105
|
+
buildGroupDragGhost(group: DockviewGroupPanel): IDragGhostSpec | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Resolve the app-supplied overlay model for a group drop target via the
|
|
108
|
+
* `dropOverlayModel` option, or `undefined` to keep the target's default.
|
|
109
|
+
*/
|
|
110
|
+
resolveOverlayModel(location: DockviewGroupDropLocation, group?: DockviewGroupPanel): DroptargetOverlayModel | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Render the drop-preview overlay on a group at `position` — the same
|
|
113
|
+
* overlay a mouse drag shows — without a live drag. Returns a disposable
|
|
114
|
+
* that clears it. Used by keyboard docking so keyboard and mouse previews
|
|
115
|
+
* are identical (single source of truth). Commit the move via the public
|
|
116
|
+
* `api.moveGroupOrPanel({ to: { group, position } })`.
|
|
117
|
+
*/
|
|
118
|
+
showPreviewOverlay(group: DockviewGroupPanel, position: Position): IDisposable;
|
|
119
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal module system for dockview.
|
|
3
|
+
*
|
|
4
|
+
* Modules are feature bundles that register services into the dockview
|
|
5
|
+
* component. `registerModules(...)` is the one public entry point — it lets a
|
|
6
|
+
* sibling package contribute modules that `DockviewComponent` picks up at
|
|
7
|
+
* construction. The richer opt-in surface (a per-component `modules` option,
|
|
8
|
+
* framework wrappers) is still reserved for a future version; the module
|
|
9
|
+
* authoring API (`defineModule`, the service contracts) remains internal.
|
|
10
|
+
*/
|
|
11
|
+
import { IDisposable } from '../lifecycle';
|
|
12
|
+
import { IFloatingGroupService } from './floatingGroupService';
|
|
13
|
+
import { IPopoutWindowService } from './popoutWindowService';
|
|
14
|
+
import { IWatermarkService } from './watermarkService';
|
|
15
|
+
import { IEdgeGroupService } from './edgeGroupService';
|
|
16
|
+
import { IRootDropTargetService } from './rootDropTargetService';
|
|
17
|
+
import { IHeaderActionsService } from './headerActionsService';
|
|
18
|
+
import { ILiveRegionService } from './liveRegionService';
|
|
19
|
+
import { IAccessibilityService, IAdvancedDnDService, IContextMenuService, IKeyboardDockingService, ITabGroupChipsService } from './moduleContracts';
|
|
20
|
+
export interface ServiceCollection {
|
|
21
|
+
floatingGroupService?: IFloatingGroupService;
|
|
22
|
+
popoutWindowService?: IPopoutWindowService;
|
|
23
|
+
watermarkService?: IWatermarkService;
|
|
24
|
+
edgeGroupService?: IEdgeGroupService;
|
|
25
|
+
tabGroupChipsService?: ITabGroupChipsService;
|
|
26
|
+
contextMenuService?: IContextMenuService;
|
|
27
|
+
rootDropTargetService?: IRootDropTargetService;
|
|
28
|
+
headerActionsService?: IHeaderActionsService;
|
|
29
|
+
advancedDnDService?: IAdvancedDnDService;
|
|
30
|
+
liveRegionService?: ILiveRegionService;
|
|
31
|
+
accessibilityService?: IAccessibilityService;
|
|
32
|
+
keyboardDockingService?: IKeyboardDockingService;
|
|
33
|
+
}
|
|
34
|
+
export interface DockviewModule<THost = unknown> {
|
|
35
|
+
moduleName: string;
|
|
36
|
+
services?: Record<string, (host: THost) => unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Optional post-construct hook called once after the host is fully
|
|
39
|
+
* constructed and all module services are instantiated. Use this to
|
|
40
|
+
* subscribe to host events — the returned disposable runs at host
|
|
41
|
+
* teardown. Components don't need to call into the service from event
|
|
42
|
+
* handlers; the module owns its own reactivity.
|
|
43
|
+
*/
|
|
44
|
+
init?: (host: THost, services: ServiceCollection) => IDisposable;
|
|
45
|
+
dependsOn?: DockviewModule<any>[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Typed helper for defining a module. Enforces that the factory's return
|
|
49
|
+
* type matches the slot in ServiceCollection at compile time, replacing
|
|
50
|
+
* the manual cast each module file would otherwise need.
|
|
51
|
+
*/
|
|
52
|
+
export declare function defineModule<K extends keyof ServiceCollection, THost>(config: {
|
|
53
|
+
name: string;
|
|
54
|
+
serviceKey: K;
|
|
55
|
+
create: (host: THost) => NonNullable<ServiceCollection[K]>;
|
|
56
|
+
init?: (host: THost, service: NonNullable<ServiceCollection[K]>) => IDisposable;
|
|
57
|
+
dependsOn?: DockviewModule<any>[];
|
|
58
|
+
}): DockviewModule<THost>;
|
|
59
|
+
/**
|
|
60
|
+
* For tests — clears the once-per-key dedup cache used by `assertModule`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function _resetMissingModuleWarnings(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the service if its module is registered, otherwise logs a
|
|
65
|
+
* deduplicated console error and returns `undefined`. Modelled on AG Grid's
|
|
66
|
+
* `assertModuleRegistered`: missing modules never throw — they degrade the
|
|
67
|
+
* affected feature to a no-op so consuming applications don't crash in
|
|
68
|
+
* production.
|
|
69
|
+
*
|
|
70
|
+
* Use at public-API entry points where the caller wants to surface which
|
|
71
|
+
* module is missing. For internal/lifecycle paths, plain `?.` chaining on
|
|
72
|
+
* the service slot is preferred — no log, just a silent no-op.
|
|
73
|
+
*/
|
|
74
|
+
export declare function assertModule<T>(service: T | undefined, moduleName: string, context?: string): T | undefined;
|
|
75
|
+
export declare class ModuleRegistry<THost> implements IDisposable {
|
|
76
|
+
private readonly _modules;
|
|
77
|
+
private readonly _services;
|
|
78
|
+
private readonly _initDisposables;
|
|
79
|
+
get services(): ServiceCollection;
|
|
80
|
+
register<H>(module: DockviewModule<H>): void;
|
|
81
|
+
initialize(host: THost): void;
|
|
82
|
+
postConstruct(host: THost): void;
|
|
83
|
+
has(moduleName: string): boolean;
|
|
84
|
+
dispose(): void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Register modules globally. Idempotent per `moduleName` — registering the
|
|
88
|
+
* same module twice is a no-op. Intended to be called once at import time by
|
|
89
|
+
* the package that bundles a given set of modules.
|
|
90
|
+
*/
|
|
91
|
+
export declare function registerModules(modules: DockviewModule<any>[]): void;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the globally-registered modules (a copy). `DockviewComponent` reads
|
|
94
|
+
* this to extend its built-in module set.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getRegisteredModules(): DockviewModule<any>[];
|
|
97
|
+
/**
|
|
98
|
+
* For tests — clears the global module registry.
|
|
99
|
+
*/
|
|
100
|
+
export declare function clearRegisteredModules(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Called once by the `dockview` package on import, solely so `dockview-core`
|
|
103
|
+
* can warn when it is used directly (see above). Not used for anything else.
|
|
104
|
+
*/
|
|
105
|
+
export declare function markDockviewPackageLoaded(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the `dockview` package has been loaded in this process. Used only to
|
|
108
|
+
* gate the "don't use dockview-core directly" developer warning.
|
|
109
|
+
*/
|
|
110
|
+
export declare function isDockviewPackageLoaded(): boolean;
|