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
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import { Emitter } from '../events';
|
|
2
2
|
import { CompositeDisposable } from '../lifecycle';
|
|
3
3
|
import { LayoutPriority, Orientation, Splitview, } from '../splitview/splitview';
|
|
4
|
-
import { watchElementResize } from '../dom';
|
|
4
|
+
import { isInDocument, watchElementResize } from '../dom';
|
|
5
5
|
export class EdgeGroupView {
|
|
6
|
+
/**
|
|
7
|
+
* The effective (pre-gap) collapsed size: the measured tab-strip size when
|
|
8
|
+
* available, otherwise the configured/theme base.
|
|
9
|
+
*/
|
|
10
|
+
get _effectiveBaseCollapsed() {
|
|
11
|
+
var _a;
|
|
12
|
+
return (_a = this._measuredTabSize) !== null && _a !== void 0 ? _a : this._baseCollapsedSize;
|
|
13
|
+
}
|
|
6
14
|
get minimumSize() {
|
|
7
15
|
// When collapsed, lock size to collapsedSize so sash can't drag it open
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
if (this._isCollapsed) {
|
|
17
|
+
return this.collapsedSize;
|
|
18
|
+
}
|
|
19
|
+
// If the caller explicitly provides a minimumSize, respect it.
|
|
20
|
+
// Otherwise fall back to collapsedSize + 50 so the expanded state is
|
|
21
|
+
// visually distinguishable from the collapsed state.
|
|
22
|
+
return this._baseMinimumSize !== undefined
|
|
23
|
+
? this._baseMinimumSize + this._gapAdd
|
|
24
|
+
: this._effectiveBaseCollapsed + 50 + this._gapAdd;
|
|
11
25
|
}
|
|
12
26
|
get maximumSize() {
|
|
13
27
|
// When collapsed, lock size to collapsedSize so sash can't drag it open
|
|
14
28
|
return this._isCollapsed
|
|
15
|
-
? this.
|
|
29
|
+
? this.collapsedSize
|
|
16
30
|
: this._expandedMaximumSize;
|
|
17
31
|
}
|
|
18
32
|
get element() {
|
|
@@ -25,34 +39,62 @@ export class EdgeGroupView {
|
|
|
25
39
|
return this._lastExpandedSize;
|
|
26
40
|
}
|
|
27
41
|
get collapsedSize() {
|
|
28
|
-
return this.
|
|
42
|
+
return this._effectiveBaseCollapsed + this._gapAdd;
|
|
29
43
|
}
|
|
30
|
-
constructor(options, group, orientation) {
|
|
44
|
+
constructor(options, group, orientation, gapAdd = 0) {
|
|
31
45
|
var _a, _b, _c;
|
|
32
46
|
this._onDidChange = new Emitter();
|
|
33
47
|
this.onDidChange = this._onDidChange.event;
|
|
34
48
|
this.snap = false;
|
|
35
49
|
this.priority = LayoutPriority.Low;
|
|
36
50
|
this._isCollapsed = false;
|
|
51
|
+
this._tabSizeDisposables = new CompositeDisposable();
|
|
37
52
|
this._group = group;
|
|
38
53
|
this._orientation = orientation;
|
|
39
54
|
group.element.classList.add('dv-edge-group');
|
|
40
55
|
group.element.dataset.testid = `dv-edge-group-${options.id}`;
|
|
41
|
-
this.
|
|
56
|
+
this._baseCollapsedSize = (_a = options.collapsedSize) !== null && _a !== void 0 ? _a : 35;
|
|
57
|
+
this._baseMinimumSize = options.minimumSize;
|
|
58
|
+
this._gapAdd = gapAdd;
|
|
42
59
|
this._expandedMaximumSize =
|
|
43
60
|
(_b = options.maximumSize) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY;
|
|
44
|
-
// If the caller explicitly provides a minimumSize, respect it.
|
|
45
|
-
// Otherwise fall back to collapsedSize + 50 so the expanded state is
|
|
46
|
-
// visually distinguishable from the collapsed state.
|
|
47
|
-
this._expandedMinimumSize =
|
|
48
|
-
options.minimumSize !== undefined
|
|
49
|
-
? options.minimumSize
|
|
50
|
-
: this._collapsedSize + 50;
|
|
51
61
|
this._lastExpandedSize = (_c = options.initialSize) !== null && _c !== void 0 ? _c : 200;
|
|
52
62
|
if (options.collapsed) {
|
|
53
63
|
this._isCollapsed = true;
|
|
54
64
|
group.element.classList.add('dv-edge-collapsed');
|
|
55
65
|
}
|
|
66
|
+
this._observeTabStrip();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Watch the group's tab strip so the collapsed size follows the live tab
|
|
70
|
+
* height. The strip's cross-axis size (height for top/bottom, width for
|
|
71
|
+
* left/right) is exactly what a collapsed edge group should occupy; a
|
|
72
|
+
* ResizeObserver keeps them in sync when the tab height changes at runtime.
|
|
73
|
+
*/
|
|
74
|
+
_observeTabStrip() {
|
|
75
|
+
const strip = this._group.element.querySelector('.dv-tabs-and-actions-container');
|
|
76
|
+
if (!strip) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this._tabSizeDisposables.addDisposables(watchElementResize(strip, () => {
|
|
80
|
+
this._applyMeasuredTabSize(this._orientation === 'vertical'
|
|
81
|
+
? strip.offsetHeight
|
|
82
|
+
: strip.offsetWidth);
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Apply a freshly-measured tab-strip cross size. When the group is
|
|
87
|
+
* collapsed this resizes it in the parent splitview so the collapsed strip
|
|
88
|
+
* always shows the full tab height.
|
|
89
|
+
*/
|
|
90
|
+
_applyMeasuredTabSize(size) {
|
|
91
|
+
if (size <= 0 || size === this._measuredTabSize) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this._measuredTabSize = size;
|
|
95
|
+
if (this._isCollapsed) {
|
|
96
|
+
this._onDidChange.fire({ size: this.collapsedSize });
|
|
97
|
+
}
|
|
56
98
|
}
|
|
57
99
|
layout(size, orthogonalSize) {
|
|
58
100
|
// Track the last expanded size so we can restore it after collapsing
|
|
@@ -88,15 +130,18 @@ export class EdgeGroupView {
|
|
|
88
130
|
this._lastExpandedSize = size;
|
|
89
131
|
}
|
|
90
132
|
/**
|
|
91
|
-
* Apply new
|
|
92
|
-
* or gap change.
|
|
93
|
-
*
|
|
133
|
+
* Apply a new base (pre-gap) collapsed size, base minimum size and gap
|
|
134
|
+
* contribution after a theme or gap change. Base values come from the
|
|
135
|
+
* original config; the ShellManager owns the gap arithmetic. A live
|
|
136
|
+
* measured tab size (if any) continues to win over the base collapsed size.
|
|
94
137
|
*/
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
138
|
+
updateSizing(baseCollapsedSize, baseMinimumSize, gapAdd) {
|
|
139
|
+
this._baseCollapsedSize = baseCollapsedSize;
|
|
140
|
+
this._baseMinimumSize = baseMinimumSize;
|
|
141
|
+
this._gapAdd = gapAdd;
|
|
98
142
|
}
|
|
99
143
|
dispose() {
|
|
144
|
+
this._tabSizeDisposables.dispose();
|
|
100
145
|
this._onDidChange.dispose();
|
|
101
146
|
}
|
|
102
147
|
}
|
|
@@ -228,15 +273,6 @@ class MiddleColumnView {
|
|
|
228
273
|
this._splitview.dispose();
|
|
229
274
|
}
|
|
230
275
|
}
|
|
231
|
-
function adjustedOpts(base, defaultCollapsed, gapAdd) {
|
|
232
|
-
var _a;
|
|
233
|
-
const effectiveCollapsed = ((_a = base.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsed) + gapAdd;
|
|
234
|
-
const result = Object.assign(Object.assign({}, base), { collapsedSize: effectiveCollapsed });
|
|
235
|
-
if (base.minimumSize !== undefined) {
|
|
236
|
-
result.minimumSize = base.minimumSize + gapAdd;
|
|
237
|
-
}
|
|
238
|
-
return result;
|
|
239
|
-
}
|
|
240
276
|
export class ShellManager {
|
|
241
277
|
constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {
|
|
242
278
|
this._disposables = new CompositeDisposable();
|
|
@@ -262,6 +298,26 @@ export class ShellManager {
|
|
|
262
298
|
this._middleIndex = 0;
|
|
263
299
|
this._outerSplitview.addView(this._middleColumn, { type: 'distribute' }, 0);
|
|
264
300
|
this._disposables.addDisposables(watchElementResize(this._shellElement, (entry) => {
|
|
301
|
+
/**
|
|
302
|
+
* When the shell (or an ancestor) becomes hidden — e.g. a
|
|
303
|
+
* nested dockview whose `onlyWhenVisible` host panel is
|
|
304
|
+
* deactivated — the element collapses to (0, 0) or is detached
|
|
305
|
+
* from the DOM. Propagating that zero size would relayout the
|
|
306
|
+
* edge-group splitview at 0, clamping the low-priority edge
|
|
307
|
+
* groups down to their minimum size and destroying the user's
|
|
308
|
+
* sizing. Skip these cases so sizes are preserved while hidden;
|
|
309
|
+
* mirrors the guard in the `Resizable` base class. See #1495.
|
|
310
|
+
*
|
|
311
|
+
* offsetParent === null is equivalent to display: none on the
|
|
312
|
+
* element or one of its ancestors.
|
|
313
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
314
|
+
*/
|
|
315
|
+
if (!this._shellElement.offsetParent) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (!isInDocument(this._shellElement)) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
265
321
|
const width = Math.round(entry.contentRect.width);
|
|
266
322
|
const height = Math.round(entry.contentRect.height);
|
|
267
323
|
if (width === this._currentWidth &&
|
|
@@ -298,7 +354,7 @@ export class ShellManager {
|
|
|
298
354
|
const isHorizontal = position === 'left' || position === 'right';
|
|
299
355
|
const gapAdd = isHorizontal ? outerGapAdd : innerGapAdd;
|
|
300
356
|
const orientation = isHorizontal ? 'horizontal' : 'vertical';
|
|
301
|
-
const view = new EdgeGroupView(
|
|
357
|
+
const view = new EdgeGroupView(Object.assign({ collapsedSize: this._defaultCollapsedSize }, options), group, orientation, gapAdd);
|
|
302
358
|
const initialSize = view.isCollapsed
|
|
303
359
|
? view.collapsedSize
|
|
304
360
|
: view.lastExpandedSize;
|
|
@@ -365,10 +421,7 @@ export class ShellManager {
|
|
|
365
421
|
const updateView = (view, baseCfg, gapAdd) => {
|
|
366
422
|
var _a;
|
|
367
423
|
const baseCS = (_a = baseCfg.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsedSize;
|
|
368
|
-
|
|
369
|
-
const baseMS = baseCfg.minimumSize;
|
|
370
|
-
const newMS = baseMS !== undefined ? baseMS + gapAdd : newCS + 50;
|
|
371
|
-
view.updateCollapsedSize(newCS, newMS);
|
|
424
|
+
view.updateSizing(baseCS, baseCfg.minimumSize, gapAdd);
|
|
372
425
|
};
|
|
373
426
|
const topCfg = this._viewConfigs.get('top');
|
|
374
427
|
if (this._topView && topCfg) {
|
|
@@ -619,8 +672,7 @@ export class ShellManager {
|
|
|
619
672
|
}
|
|
620
673
|
}
|
|
621
674
|
dispose() {
|
|
622
|
-
var _a;
|
|
623
675
|
this._disposables.dispose();
|
|
624
|
-
|
|
676
|
+
this._shellElement.remove();
|
|
625
677
|
}
|
|
626
678
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IDisposable } from '../lifecycle';
|
|
2
|
+
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
3
|
+
import { EdgeGroupPosition } from './dockviewShell';
|
|
4
|
+
/**
|
|
5
|
+
* EdgeGroupService is a pure registry: it tracks which positions are
|
|
6
|
+
* occupied and owns each edge group's per-instance cleanup disposable.
|
|
7
|
+
*
|
|
8
|
+
* The ShellManager (layout infrastructure) and the addEdgeGroup
|
|
9
|
+
* orchestration remain on DockviewComponent.
|
|
10
|
+
*/
|
|
11
|
+
export interface IEdgeGroupServiceHost {
|
|
12
|
+
}
|
|
13
|
+
export interface IEdgeGroupService extends IDisposable {
|
|
14
|
+
add(position: EdgeGroupPosition, group: DockviewGroupPanel, autoCollapseDisposable: IDisposable): void;
|
|
15
|
+
remove(position: EdgeGroupPosition): void;
|
|
16
|
+
get(position: EdgeGroupPosition): DockviewGroupPanel | undefined;
|
|
17
|
+
has(position: EdgeGroupPosition): boolean;
|
|
18
|
+
hasAny(): boolean;
|
|
19
|
+
entries(): IterableIterator<[EdgeGroupPosition, DockviewGroupPanel]>;
|
|
20
|
+
includes(group: DockviewGroupPanel): boolean;
|
|
21
|
+
findPositionOf(group: DockviewGroupPanel): EdgeGroupPosition | undefined;
|
|
22
|
+
disposeAll(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare class EdgeGroupService implements IEdgeGroupService {
|
|
25
|
+
private readonly _edgeGroups;
|
|
26
|
+
private readonly _edgeGroupDisposables;
|
|
27
|
+
add(position: EdgeGroupPosition, group: DockviewGroupPanel, autoCollapseDisposable: IDisposable): void;
|
|
28
|
+
remove(position: EdgeGroupPosition): void;
|
|
29
|
+
get(position: EdgeGroupPosition): DockviewGroupPanel | undefined;
|
|
30
|
+
has(position: EdgeGroupPosition): boolean;
|
|
31
|
+
hasAny(): boolean;
|
|
32
|
+
entries(): IterableIterator<[EdgeGroupPosition, DockviewGroupPanel]>;
|
|
33
|
+
includes(group: DockviewGroupPanel): boolean;
|
|
34
|
+
findPositionOf(group: DockviewGroupPanel): EdgeGroupPosition | undefined;
|
|
35
|
+
disposeAll(): void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare const EdgeGroupModule: import("./modules").DockviewModule<IEdgeGroupServiceHost>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineModule } from './modules';
|
|
2
|
+
export class EdgeGroupService {
|
|
3
|
+
constructor() {
|
|
4
|
+
this._edgeGroups = new Map();
|
|
5
|
+
this._edgeGroupDisposables = new Map();
|
|
6
|
+
}
|
|
7
|
+
// No constructor needed — the host is currently unused. The
|
|
8
|
+
// IEdgeGroupServiceHost slot stays for symmetry with the other modules
|
|
9
|
+
// and to leave room for future host callbacks.
|
|
10
|
+
add(position, group, autoCollapseDisposable) {
|
|
11
|
+
this._edgeGroups.set(position, group);
|
|
12
|
+
this._edgeGroupDisposables.set(position, autoCollapseDisposable);
|
|
13
|
+
}
|
|
14
|
+
remove(position) {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = this._edgeGroupDisposables.get(position)) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
17
|
+
this._edgeGroupDisposables.delete(position);
|
|
18
|
+
this._edgeGroups.delete(position);
|
|
19
|
+
}
|
|
20
|
+
get(position) {
|
|
21
|
+
return this._edgeGroups.get(position);
|
|
22
|
+
}
|
|
23
|
+
has(position) {
|
|
24
|
+
return this._edgeGroups.has(position);
|
|
25
|
+
}
|
|
26
|
+
hasAny() {
|
|
27
|
+
return this._edgeGroups.size > 0;
|
|
28
|
+
}
|
|
29
|
+
entries() {
|
|
30
|
+
return this._edgeGroups.entries();
|
|
31
|
+
}
|
|
32
|
+
includes(group) {
|
|
33
|
+
for (const edgeGroup of this._edgeGroups.values()) {
|
|
34
|
+
if (edgeGroup === group) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
findPositionOf(group) {
|
|
41
|
+
for (const [position, edgeGroup] of this._edgeGroups) {
|
|
42
|
+
if (edgeGroup === group) {
|
|
43
|
+
return position;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
disposeAll() {
|
|
49
|
+
for (const disposable of this._edgeGroupDisposables.values()) {
|
|
50
|
+
disposable.dispose();
|
|
51
|
+
}
|
|
52
|
+
this._edgeGroupDisposables.clear();
|
|
53
|
+
this._edgeGroups.clear();
|
|
54
|
+
}
|
|
55
|
+
dispose() {
|
|
56
|
+
this.disposeAll();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export const EdgeGroupModule = defineModule({
|
|
60
|
+
name: 'EdgeGroup',
|
|
61
|
+
serviceKey: 'edgeGroupService',
|
|
62
|
+
create: () => new EdgeGroupService(),
|
|
63
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { IDisposable } from '../lifecycle';
|
|
2
|
+
import { Gridview } from '../gridview/gridview';
|
|
3
|
+
import { Overlay } from '../overlay/overlay';
|
|
4
|
+
import { DockviewFloatingGroupPanel } from './dockviewFloatingGroupPanel';
|
|
5
|
+
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
6
|
+
import { DockviewOptions } from './options';
|
|
7
|
+
import { SerializedFloatingGroup } from './dockviewComponent';
|
|
8
|
+
/**
|
|
9
|
+
* Narrow callback surface the FloatingGroupService needs from its host
|
|
10
|
+
* component. Keeps the service decoupled from DockviewComponent.
|
|
11
|
+
*/
|
|
12
|
+
export interface IFloatingGroupHost {
|
|
13
|
+
fireLayoutChange(): void;
|
|
14
|
+
}
|
|
15
|
+
export interface IFloatingGroupService extends IDisposable {
|
|
16
|
+
readonly floatingGroups: readonly DockviewFloatingGroupPanel[];
|
|
17
|
+
add(group: DockviewGroupPanel, overlay: Overlay, gridview: Gridview): DockviewFloatingGroupPanel;
|
|
18
|
+
findByGroup(group: DockviewGroupPanel): DockviewFloatingGroupPanel | undefined;
|
|
19
|
+
serialize(): SerializedFloatingGroup[];
|
|
20
|
+
constrainBounds(): void;
|
|
21
|
+
updateBounds(options: Partial<DockviewOptions>): void;
|
|
22
|
+
disposeAll(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare class FloatingGroupService implements IFloatingGroupService {
|
|
25
|
+
private readonly _host;
|
|
26
|
+
private readonly _floatingGroups;
|
|
27
|
+
get floatingGroups(): readonly DockviewFloatingGroupPanel[];
|
|
28
|
+
constructor(host: IFloatingGroupHost);
|
|
29
|
+
add(group: DockviewGroupPanel, overlay: Overlay, gridview: Gridview): DockviewFloatingGroupPanel;
|
|
30
|
+
findByGroup(group: DockviewGroupPanel): DockviewFloatingGroupPanel | undefined;
|
|
31
|
+
serialize(): SerializedFloatingGroup[];
|
|
32
|
+
constrainBounds(): void;
|
|
33
|
+
updateBounds(options: Partial<DockviewOptions>): void;
|
|
34
|
+
disposeAll(): void;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
}
|
|
37
|
+
export declare const FloatingGroupModule: import("./modules").DockviewModule<IFloatingGroupHost>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { CompositeDisposable } from '../lifecycle';
|
|
2
|
+
import { remove } from '../array';
|
|
3
|
+
import { watchElementResize } from '../dom';
|
|
4
|
+
import { DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE } from '../constants';
|
|
5
|
+
import { DockviewFloatingGroupPanel } from './dockviewFloatingGroupPanel';
|
|
6
|
+
import { defineModule } from './modules';
|
|
7
|
+
export class FloatingGroupService {
|
|
8
|
+
get floatingGroups() {
|
|
9
|
+
return this._floatingGroups;
|
|
10
|
+
}
|
|
11
|
+
constructor(host) {
|
|
12
|
+
this._floatingGroups = [];
|
|
13
|
+
this._host = host;
|
|
14
|
+
}
|
|
15
|
+
add(group, overlay, gridview) {
|
|
16
|
+
const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay, gridview);
|
|
17
|
+
const disposable = new CompositeDisposable(group.api.onDidActiveChange((event) => {
|
|
18
|
+
if (event.isActive) {
|
|
19
|
+
overlay.bringToFront();
|
|
20
|
+
}
|
|
21
|
+
}), (() => {
|
|
22
|
+
// The floating window's nested gridview fills the overlay
|
|
23
|
+
// beneath the (optional) title bar; size it from its own
|
|
24
|
+
// measured box so it follows the overlay as the user drags
|
|
25
|
+
// / resizes the window.
|
|
26
|
+
let lastWidth = -1;
|
|
27
|
+
let lastHeight = -1;
|
|
28
|
+
return watchElementResize(gridview.element, (entry) => {
|
|
29
|
+
const width = Math.round(entry.contentRect.width);
|
|
30
|
+
const height = Math.round(entry.contentRect.height);
|
|
31
|
+
if (width === lastWidth && height === lastHeight) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
lastWidth = width;
|
|
35
|
+
lastHeight = height;
|
|
36
|
+
gridview.layout(width, height);
|
|
37
|
+
});
|
|
38
|
+
})());
|
|
39
|
+
// Floating windows are non-modal dialogs (role set in Overlay). Give
|
|
40
|
+
// the dialog an accessible name from the representative group's active
|
|
41
|
+
// panel, refreshed as the active panel changes. An untitled panel
|
|
42
|
+
// leaves the dialog unnamed rather than hard-coding a label string.
|
|
43
|
+
const updateDialogLabel = () => {
|
|
44
|
+
var _a;
|
|
45
|
+
const title = (_a = group.activePanel) === null || _a === void 0 ? void 0 : _a.title;
|
|
46
|
+
if (title) {
|
|
47
|
+
overlay.element.setAttribute('aria-label', title);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
overlay.element.removeAttribute('aria-label');
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
updateDialogLabel();
|
|
54
|
+
floatingGroupPanel.addDisposables(group.api.onDidActivePanelChange(() => updateDialogLabel()), overlay.onDidChange(() => {
|
|
55
|
+
gridview.layout(gridview.width, gridview.height);
|
|
56
|
+
}), overlay.onDidChangeEnd(() => {
|
|
57
|
+
this._host.fireLayoutChange();
|
|
58
|
+
}), group.onDidChange((event) => {
|
|
59
|
+
// `event.height` is the group's requested *content* height.
|
|
60
|
+
// When a dedicated title bar is present the overlay's outer
|
|
61
|
+
// box is taller by the header, so add it back to preserve the
|
|
62
|
+
// requested content size.
|
|
63
|
+
overlay.setBounds({
|
|
64
|
+
height: typeof (event === null || event === void 0 ? void 0 : event.height) === 'number'
|
|
65
|
+
? event.height + overlay.headerHeight
|
|
66
|
+
: event === null || event === void 0 ? void 0 : event.height,
|
|
67
|
+
width: event === null || event === void 0 ? void 0 : event.width,
|
|
68
|
+
});
|
|
69
|
+
}), {
|
|
70
|
+
dispose: () => {
|
|
71
|
+
disposable.dispose();
|
|
72
|
+
remove(this._floatingGroups, floatingGroupPanel);
|
|
73
|
+
group.model.location = { type: 'grid' };
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
this._floatingGroups.push(floatingGroupPanel);
|
|
77
|
+
return floatingGroupPanel;
|
|
78
|
+
}
|
|
79
|
+
findByGroup(group) {
|
|
80
|
+
// A floating window may host several groups in a nested gridview, so
|
|
81
|
+
// match by membership (DOM containment) rather than only the anchor
|
|
82
|
+
// group. `floating.group === group` covers the brief window before the
|
|
83
|
+
// anchor's element is attached to the gridview.
|
|
84
|
+
return this._floatingGroups.find((floating) => floating.group === group ||
|
|
85
|
+
floating.gridview.element.contains(group.element));
|
|
86
|
+
}
|
|
87
|
+
serialize() {
|
|
88
|
+
return this._floatingGroups.map((floating) => {
|
|
89
|
+
const grid = floating.gridview.serialize();
|
|
90
|
+
const position = floating.overlay.toJSON();
|
|
91
|
+
const root = grid.root;
|
|
92
|
+
// A single-group window keeps the legacy `data` shape so layouts
|
|
93
|
+
// round-trip byte-stably and older readers keep working; only
|
|
94
|
+
// genuine multi-group windows emit the nested `grid` form.
|
|
95
|
+
if (root.type === 'branch' &&
|
|
96
|
+
root.data.length === 1 &&
|
|
97
|
+
root.data[0].type === 'leaf') {
|
|
98
|
+
return {
|
|
99
|
+
data: root.data[0].data,
|
|
100
|
+
position,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return { grid, position };
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
constrainBounds() {
|
|
107
|
+
for (const floating of this._floatingGroups) {
|
|
108
|
+
floating.overlay.setBounds();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
updateBounds(options) {
|
|
112
|
+
var _a, _b;
|
|
113
|
+
if (!('floatingGroupBounds' in options)) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
for (const group of this._floatingGroups) {
|
|
117
|
+
switch (options.floatingGroupBounds) {
|
|
118
|
+
case 'boundedWithinViewport':
|
|
119
|
+
group.overlay.minimumInViewportHeight = undefined;
|
|
120
|
+
group.overlay.minimumInViewportWidth = undefined;
|
|
121
|
+
break;
|
|
122
|
+
case undefined:
|
|
123
|
+
group.overlay.minimumInViewportHeight =
|
|
124
|
+
DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;
|
|
125
|
+
group.overlay.minimumInViewportWidth =
|
|
126
|
+
DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;
|
|
127
|
+
break;
|
|
128
|
+
default:
|
|
129
|
+
group.overlay.minimumInViewportHeight =
|
|
130
|
+
(_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
|
|
131
|
+
group.overlay.minimumInViewportWidth =
|
|
132
|
+
(_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
133
|
+
}
|
|
134
|
+
group.overlay.setBounds();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
disposeAll() {
|
|
138
|
+
for (const floating of [...this._floatingGroups]) {
|
|
139
|
+
floating.dispose();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
dispose() {
|
|
143
|
+
this.disposeAll();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export const FloatingGroupModule = defineModule({
|
|
147
|
+
name: 'FloatingGroup',
|
|
148
|
+
serviceKey: 'floatingGroupService',
|
|
149
|
+
create: (host) => new FloatingGroupService(host),
|
|
150
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IDisposable } from '../lifecycle';
|
|
2
|
+
import { Event } from '../events';
|
|
3
|
+
import { DockviewComponentOptions } from './options';
|
|
4
|
+
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
5
|
+
import { DockviewApi } from '../api/component.api';
|
|
6
|
+
export interface IHeaderActionsHost {
|
|
7
|
+
readonly api: DockviewApi;
|
|
8
|
+
readonly options: DockviewComponentOptions;
|
|
9
|
+
readonly groups: DockviewGroupPanel[];
|
|
10
|
+
readonly onDidAddGroup: Event<DockviewGroupPanel>;
|
|
11
|
+
readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
|
|
12
|
+
}
|
|
13
|
+
export interface IHeaderActionsService extends IDisposable {
|
|
14
|
+
/** Re-mount the three header action slots on a single group. */
|
|
15
|
+
refresh(group: DockviewGroupPanel): void;
|
|
16
|
+
/** Re-mount on every group; used when one of the three options changes. */
|
|
17
|
+
refreshAll(): void;
|
|
18
|
+
/** Tear down per-group renderer state. */
|
|
19
|
+
disposeGroup(group: DockviewGroupPanel): void;
|
|
20
|
+
}
|
|
21
|
+
export declare class HeaderActionsService implements IHeaderActionsService {
|
|
22
|
+
private readonly _host;
|
|
23
|
+
private readonly _perGroup;
|
|
24
|
+
constructor(host: IHeaderActionsHost);
|
|
25
|
+
refresh(group: DockviewGroupPanel): void;
|
|
26
|
+
refreshAll(): void;
|
|
27
|
+
disposeGroup(group: DockviewGroupPanel): void;
|
|
28
|
+
dispose(): void;
|
|
29
|
+
private _ensureState;
|
|
30
|
+
private _refreshSlot;
|
|
31
|
+
}
|
|
32
|
+
export declare const HeaderActionsModule: import("./modules").DockviewModule<IHeaderActionsHost>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { CompositeDisposable, MutableDisposable, } from '../lifecycle';
|
|
2
|
+
import { defineModule } from './modules';
|
|
3
|
+
const SLOT_OPTION_KEY = {
|
|
4
|
+
left: 'createLeftHeaderActionComponent',
|
|
5
|
+
right: 'createRightHeaderActionComponent',
|
|
6
|
+
prefix: 'createPrefixHeaderActionComponent',
|
|
7
|
+
};
|
|
8
|
+
export class HeaderActionsService {
|
|
9
|
+
constructor(host) {
|
|
10
|
+
this._perGroup = new Map();
|
|
11
|
+
this._host = host;
|
|
12
|
+
}
|
|
13
|
+
refresh(group) {
|
|
14
|
+
// The headerPosition setter on DockviewGroupPanelModel fires inside
|
|
15
|
+
// the model's constructor — before the parent DockviewGroupPanel has
|
|
16
|
+
// assigned its `_model` field, and in tests where the parent panel
|
|
17
|
+
// may be null. Skip; DockviewGroupPanel.initialize() will refresh
|
|
18
|
+
// once construction completes for real groups.
|
|
19
|
+
if (!(group === null || group === void 0 ? void 0 : group.model)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const state = this._ensureState(group);
|
|
23
|
+
this._refreshSlot('left', group, state.left);
|
|
24
|
+
this._refreshSlot('right', group, state.right);
|
|
25
|
+
this._refreshSlot('prefix', group, state.prefix);
|
|
26
|
+
}
|
|
27
|
+
refreshAll() {
|
|
28
|
+
for (const group of this._host.groups) {
|
|
29
|
+
this.refresh(group);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
disposeGroup(group) {
|
|
33
|
+
const state = this._perGroup.get(group);
|
|
34
|
+
if (!state) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
state.left.dispose();
|
|
38
|
+
state.right.dispose();
|
|
39
|
+
state.prefix.dispose();
|
|
40
|
+
this._perGroup.delete(group);
|
|
41
|
+
}
|
|
42
|
+
dispose() {
|
|
43
|
+
for (const group of [...this._perGroup.keys()]) {
|
|
44
|
+
this.disposeGroup(group);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
_ensureState(group) {
|
|
48
|
+
let state = this._perGroup.get(group);
|
|
49
|
+
if (!state) {
|
|
50
|
+
state = {
|
|
51
|
+
left: new MutableDisposable(),
|
|
52
|
+
right: new MutableDisposable(),
|
|
53
|
+
prefix: new MutableDisposable(),
|
|
54
|
+
};
|
|
55
|
+
this._perGroup.set(group, state);
|
|
56
|
+
}
|
|
57
|
+
return state;
|
|
58
|
+
}
|
|
59
|
+
_refreshSlot(slot, group, disposable) {
|
|
60
|
+
const factory = this._host.options[SLOT_OPTION_KEY[slot]];
|
|
61
|
+
if (factory) {
|
|
62
|
+
const renderer = factory(group);
|
|
63
|
+
disposable.value = renderer;
|
|
64
|
+
renderer.init({
|
|
65
|
+
containerApi: this._host.api,
|
|
66
|
+
api: group.api,
|
|
67
|
+
group,
|
|
68
|
+
});
|
|
69
|
+
group.model.attachHeaderAction(slot, renderer.element);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
disposable.dispose();
|
|
73
|
+
group.model.attachHeaderAction(slot, undefined);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export const HeaderActionsModule = defineModule({
|
|
78
|
+
name: 'HeaderActions',
|
|
79
|
+
serviceKey: 'headerActionsService',
|
|
80
|
+
create: (host) => new HeaderActionsService(host),
|
|
81
|
+
init: (host, service) => {
|
|
82
|
+
return new CompositeDisposable(host.onDidRemoveGroup((group) => {
|
|
83
|
+
service.disposeGroup(group);
|
|
84
|
+
}));
|
|
85
|
+
},
|
|
86
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CompositeDisposable, IDisposable } from '../lifecycle';
|
|
2
|
+
import { Event } from '../events';
|
|
3
|
+
import { IDockviewPanel } from './dockviewPanel';
|
|
4
|
+
import { DockviewGroupPanel } from './dockviewGroupPanel';
|
|
5
|
+
import { DockviewLayoutMutationEvent, DockviewMaximizedGroupChangeEvent } from './dockviewComponent';
|
|
6
|
+
import { DockviewComponentOptions } from './options';
|
|
7
|
+
/**
|
|
8
|
+
* The narrow surface the {@link LiveRegionService} needs from the host
|
|
9
|
+
* (the `DockviewComponent`) — somewhere to mount the region and the layout
|
|
10
|
+
* events to narrate. `onWill/onDidMutateLayout` are used to suppress the
|
|
11
|
+
* bulk-load / clear burst (one transaction, not N panel announcements).
|
|
12
|
+
*/
|
|
13
|
+
export interface ILiveRegionHost {
|
|
14
|
+
readonly element: HTMLElement;
|
|
15
|
+
readonly options: DockviewComponentOptions;
|
|
16
|
+
readonly onDidAddPanel: Event<IDockviewPanel>;
|
|
17
|
+
readonly onDidRemovePanel: Event<IDockviewPanel>;
|
|
18
|
+
readonly onWillMutateLayout: Event<DockviewLayoutMutationEvent>;
|
|
19
|
+
readonly onDidMutateLayout: Event<DockviewLayoutMutationEvent>;
|
|
20
|
+
readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChangeEvent>;
|
|
21
|
+
readonly onDidAddGroup: Event<DockviewGroupPanel>;
|
|
22
|
+
readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
|
|
23
|
+
}
|
|
24
|
+
export interface ILiveRegionService extends IDisposable {
|
|
25
|
+
/**
|
|
26
|
+
* Announce a message to assistive technology via the live region. The
|
|
27
|
+
* shared sink — the accessibility module writes keyboard-docking
|
|
28
|
+
* narration here too, so all announcements use one region.
|
|
29
|
+
*/
|
|
30
|
+
announce(message: string, politeness?: 'polite' | 'assertive'): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Narrates layout state changes to screen readers via visually-hidden
|
|
34
|
+
* `aria-live` regions. Free / core (WCAG 4.1.3). Announces panel open/close +
|
|
35
|
+
* the shared `announce()` sink (the accessibility module narrates docking here too).
|
|
36
|
+
* Two regions: a **polite** one for routine status and an **assertive** one
|
|
37
|
+
* for errors/cancellations. The bulk load/clear burst is suppressed via the
|
|
38
|
+
* mutation-transaction events, and an app can take over delivery entirely with
|
|
39
|
+
* the `announcer` option.
|
|
40
|
+
*/
|
|
41
|
+
export declare class LiveRegionService extends CompositeDisposable implements ILiveRegionService {
|
|
42
|
+
private readonly _host;
|
|
43
|
+
private readonly _polite;
|
|
44
|
+
private readonly _assertive;
|
|
45
|
+
private _suppressDepth;
|
|
46
|
+
private readonly _locationSubs;
|
|
47
|
+
constructor(host: ILiveRegionHost);
|
|
48
|
+
private _trackLocation;
|
|
49
|
+
announce(message: string, politeness?: 'polite' | 'assertive'): void;
|
|
50
|
+
private _announce;
|
|
51
|
+
private _defaultMessage;
|
|
52
|
+
}
|
|
53
|
+
export declare const LiveRegionModule: import("./modules").DockviewModule<ILiveRegionHost>;
|