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.
Files changed (153) hide show
  1. package/README.md +8 -1
  2. package/dist/cjs/api/component.api.d.ts +42 -21
  3. package/dist/cjs/api/component.api.js +111 -20
  4. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +23 -8
  5. package/dist/cjs/api/dockviewGroupPanelApi.js +23 -0
  6. package/dist/cjs/api/dockviewPanelApi.d.ts +4 -3
  7. package/dist/cjs/api/dockviewPanelApi.js +8 -0
  8. package/dist/cjs/dnd/droptarget.d.ts +8 -0
  9. package/dist/cjs/dnd/droptarget.js +28 -0
  10. package/dist/cjs/dockview/accessibilityMessages.d.ts +32 -0
  11. package/dist/cjs/dockview/accessibilityMessages.js +51 -0
  12. package/dist/cjs/dockview/allModules.d.ts +8 -0
  13. package/dist/cjs/dockview/allModules.js +25 -0
  14. package/dist/cjs/dockview/components/panel/content.d.ts +2 -0
  15. package/dist/cjs/dockview/components/panel/content.js +35 -4
  16. package/dist/cjs/dockview/components/tab/tab.js +33 -5
  17. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +35 -0
  18. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.js +95 -0
  19. package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +52 -0
  20. package/dist/cjs/dockview/components/titlebar/groupDragSource.js +218 -0
  21. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +2 -1
  22. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +31 -24
  23. package/dist/cjs/dockview/components/titlebar/tabGroups.js +1 -0
  24. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +12 -0
  25. package/dist/cjs/dockview/components/titlebar/tabs.js +105 -2
  26. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +4 -0
  27. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +13 -3
  28. package/dist/cjs/dockview/components/titlebar/voidContainer.d.ts +1 -4
  29. package/dist/cjs/dockview/components/titlebar/voidContainer.js +31 -155
  30. package/dist/cjs/dockview/dockviewComponent.d.ts +299 -44
  31. package/dist/cjs/dockview/dockviewComponent.js +1787 -1041
  32. package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
  33. package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +39 -3
  34. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +0 -1
  35. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +36 -14
  36. package/dist/cjs/dockview/dockviewGroupPanelModel.js +133 -101
  37. package/dist/cjs/dockview/dockviewPanel.d.ts +2 -2
  38. package/dist/cjs/dockview/edgeGroupService.d.ts +38 -0
  39. package/dist/cjs/dockview/edgeGroupService.js +128 -0
  40. package/dist/cjs/dockview/floatingGroupService.d.ts +37 -0
  41. package/dist/cjs/dockview/floatingGroupService.js +231 -0
  42. package/dist/cjs/dockview/headerActionsService.d.ts +32 -0
  43. package/dist/cjs/dockview/headerActionsService.js +149 -0
  44. package/dist/cjs/dockview/liveRegionService.d.ts +53 -0
  45. package/dist/cjs/dockview/liveRegionService.js +185 -0
  46. package/dist/cjs/dockview/moduleContracts.d.ts +119 -0
  47. package/dist/cjs/dockview/moduleContracts.js +2 -0
  48. package/dist/cjs/dockview/modules.d.ts +110 -0
  49. package/dist/cjs/dockview/modules.js +304 -0
  50. package/dist/cjs/dockview/options.d.ts +159 -6
  51. package/dist/cjs/dockview/options.js +8 -1
  52. package/dist/cjs/dockview/popoutWindowService.d.ts +95 -0
  53. package/dist/cjs/dockview/popoutWindowService.js +261 -0
  54. package/dist/cjs/dockview/rootDropTargetService.d.ts +35 -0
  55. package/dist/cjs/dockview/rootDropTargetService.js +87 -0
  56. package/dist/cjs/dockview/watermarkService.d.ts +30 -0
  57. package/dist/cjs/dockview/watermarkService.js +61 -0
  58. package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -1
  59. package/dist/cjs/gridview/baseComponentGridview.js +3 -2
  60. package/dist/cjs/gridview/gridviewComponent.d.ts +3 -3
  61. package/dist/cjs/gridview/gridviewPanel.d.ts +1 -1
  62. package/dist/cjs/index.d.ts +11 -4
  63. package/dist/cjs/index.js +14 -1
  64. package/dist/cjs/overlay/overlay.d.ts +43 -1
  65. package/dist/cjs/overlay/overlay.js +57 -8
  66. package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +2 -2
  67. package/dist/cjs/paneview/draggablePaneviewPanel.js +4 -4
  68. package/dist/cjs/paneview/paneviewComponent.d.ts +3 -3
  69. package/dist/cjs/paneview/paneviewComponent.js +5 -5
  70. package/dist/dockview-core.js +3201 -1280
  71. package/dist/dockview-core.min.js +2 -2
  72. package/dist/dockview-core.min.js.map +1 -1
  73. package/dist/dockview-core.min.noStyle.js +2 -2
  74. package/dist/dockview-core.min.noStyle.js.map +1 -1
  75. package/dist/dockview-core.noStyle.js +3200 -1279
  76. package/dist/esm/api/component.api.d.ts +42 -21
  77. package/dist/esm/api/component.api.js +63 -18
  78. package/dist/esm/api/dockviewGroupPanelApi.d.ts +23 -8
  79. package/dist/esm/api/dockviewGroupPanelApi.js +19 -0
  80. package/dist/esm/api/dockviewPanelApi.d.ts +4 -3
  81. package/dist/esm/api/dockviewPanelApi.js +7 -0
  82. package/dist/esm/dnd/droptarget.d.ts +8 -0
  83. package/dist/esm/dnd/droptarget.js +28 -0
  84. package/dist/esm/dockview/accessibilityMessages.d.ts +32 -0
  85. package/dist/esm/dockview/accessibilityMessages.js +30 -0
  86. package/dist/esm/dockview/allModules.d.ts +8 -0
  87. package/dist/esm/dockview/allModules.js +22 -0
  88. package/dist/esm/dockview/components/panel/content.d.ts +2 -0
  89. package/dist/esm/dockview/components/panel/content.js +36 -5
  90. package/dist/esm/dockview/components/tab/tab.js +33 -5
  91. package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +35 -0
  92. package/dist/esm/dockview/components/titlebar/floatingTitleBar.js +65 -0
  93. package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +52 -0
  94. package/dist/esm/dockview/components/titlebar/groupDragSource.js +178 -0
  95. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +2 -1
  96. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +31 -24
  97. package/dist/esm/dockview/components/titlebar/tabGroups.js +1 -0
  98. package/dist/esm/dockview/components/titlebar/tabs.d.ts +12 -0
  99. package/dist/esm/dockview/components/titlebar/tabs.js +102 -2
  100. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +4 -0
  101. package/dist/esm/dockview/components/titlebar/tabsContainer.js +8 -2
  102. package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +1 -4
  103. package/dist/esm/dockview/components/titlebar/voidContainer.js +33 -145
  104. package/dist/esm/dockview/dockviewComponent.d.ts +299 -44
  105. package/dist/esm/dockview/dockviewComponent.js +1420 -743
  106. package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
  107. package/dist/esm/dockview/dockviewFloatingGroupPanel.js +35 -3
  108. package/dist/esm/dockview/dockviewGroupPanel.d.ts +0 -1
  109. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +36 -14
  110. package/dist/esm/dockview/dockviewGroupPanelModel.js +109 -93
  111. package/dist/esm/dockview/dockviewPanel.d.ts +2 -2
  112. package/dist/esm/dockview/edgeGroupService.d.ts +38 -0
  113. package/dist/esm/dockview/edgeGroupService.js +63 -0
  114. package/dist/esm/dockview/floatingGroupService.d.ts +37 -0
  115. package/dist/esm/dockview/floatingGroupService.js +150 -0
  116. package/dist/esm/dockview/headerActionsService.d.ts +32 -0
  117. package/dist/esm/dockview/headerActionsService.js +86 -0
  118. package/dist/esm/dockview/liveRegionService.d.ts +53 -0
  119. package/dist/esm/dockview/liveRegionService.js +159 -0
  120. package/dist/esm/dockview/moduleContracts.d.ts +119 -0
  121. package/dist/esm/dockview/moduleContracts.js +1 -0
  122. package/dist/esm/dockview/modules.d.ts +110 -0
  123. package/dist/esm/dockview/modules.js +170 -0
  124. package/dist/esm/dockview/options.d.ts +159 -6
  125. package/dist/esm/dockview/options.js +8 -1
  126. package/dist/esm/dockview/popoutWindowService.d.ts +95 -0
  127. package/dist/esm/dockview/popoutWindowService.js +175 -0
  128. package/dist/esm/dockview/rootDropTargetService.d.ts +35 -0
  129. package/dist/esm/dockview/rootDropTargetService.js +82 -0
  130. package/dist/esm/dockview/watermarkService.d.ts +30 -0
  131. package/dist/esm/dockview/watermarkService.js +56 -0
  132. package/dist/esm/gridview/baseComponentGridview.d.ts +1 -1
  133. package/dist/esm/gridview/baseComponentGridview.js +2 -2
  134. package/dist/esm/gridview/gridviewComponent.d.ts +3 -3
  135. package/dist/esm/gridview/gridviewPanel.d.ts +1 -1
  136. package/dist/esm/index.d.ts +11 -4
  137. package/dist/esm/index.js +4 -0
  138. package/dist/esm/overlay/overlay.d.ts +43 -1
  139. package/dist/esm/overlay/overlay.js +53 -8
  140. package/dist/esm/paneview/draggablePaneviewPanel.d.ts +2 -2
  141. package/dist/esm/paneview/draggablePaneviewPanel.js +4 -4
  142. package/dist/esm/paneview/paneviewComponent.d.ts +3 -3
  143. package/dist/esm/paneview/paneviewComponent.js +5 -5
  144. package/dist/package/main.cjs.js +3236 -1315
  145. package/dist/package/main.cjs.min.js +2 -2
  146. package/dist/package/main.esm.min.mjs +2 -2
  147. package/dist/package/main.esm.mjs +3191 -1281
  148. package/dist/styles/dockview.css +275 -13
  149. package/package.json +10 -1
  150. package/dist/cjs/dockview/contextMenu.d.ts +0 -10
  151. package/dist/cjs/dockview/contextMenu.js +0 -313
  152. package/dist/esm/dockview/contextMenu.d.ts +0 -10
  153. package/dist/esm/dockview/contextMenu.js +0 -228
@@ -0,0 +1,218 @@
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
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.FLOATING_REDOCK_INITIATION_DELAY_MS = exports.GroupDragSource = void 0;
30
+ var dataTransfer_1 = require("../../../dnd/dataTransfer");
31
+ var backend_1 = require("../../../dnd/backend");
32
+ var events_1 = require("../../../events");
33
+ var lifecycle_1 = require("../../../lifecycle");
34
+ var dom_1 = require("../../../dom");
35
+ var dndCapabilities_1 = require("../../dndCapabilities");
36
+ // Floating-group redock via touch: require a deliberate long press so the
37
+ // "move the float around" gesture doesn't double-trigger the redock ghost.
38
+ // Infinity pressTolerance disables the pre-arm flick override; any motion
39
+ // during the wait is treated as drag-the-float, not redock intent.
40
+ var FLOATING_REDOCK_INITIATION_DELAY_MS = 500;
41
+ exports.FLOATING_REDOCK_INITIATION_DELAY_MS = FLOATING_REDOCK_INITIATION_DELAY_MS;
42
+ /**
43
+ * The drag-source half of a group drag handle: html5 + pointer drag sources
44
+ * that publish a group-level `PanelTransfer`, the "Multiple Panels (N)" ghost,
45
+ * and the floating-group disambiguation that keeps the redock gesture from
46
+ * firing alongside the overlay's move-the-float gesture.
47
+ *
48
+ * Shared by the tab-bar void container and the dedicated floating title bar so
49
+ * both grab handles redock identically.
50
+ */
51
+ var GroupDragSource = /** @class */ (function (_super) {
52
+ __extends(GroupDragSource, _super);
53
+ function GroupDragSource(options) {
54
+ var _a, _b, _c;
55
+ var _this = _super.call(this) || this;
56
+ _this.panelTransfer = dataTransfer_1.LocalSelectionTransfer.getInstance();
57
+ _this._onDragStart = new events_1.Emitter();
58
+ _this.onDragStart = _this._onDragStart.event;
59
+ _this._element = options.element;
60
+ _this.accessor = options.accessor;
61
+ var group = options.group;
62
+ _this.groupAccessor = typeof group === 'function' ? group : function () { return group; };
63
+ _this.isFloatingMoveHandle =
64
+ (_a = options.isFloatingMoveHandle) !== null && _a !== void 0 ? _a : (function () { return true; });
65
+ var caps = (0, dndCapabilities_1.resolveDndCapabilities)(_this.accessor.options);
66
+ _this._element.draggable = caps.html5;
67
+ (0, dom_1.toggleClass)(_this._element, 'dv-draggable', caps.html5 || caps.pointer);
68
+ _this.addDisposables(_this._onDragStart);
69
+ var buildMultiPanelsGhost = function () {
70
+ var ghostEl = document.createElement('div');
71
+ var style = window.getComputedStyle(_this._element);
72
+ var bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
73
+ var color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
74
+ ghostEl.style.backgroundColor = bgColor;
75
+ ghostEl.style.color = color;
76
+ ghostEl.style.padding = '2px 8px';
77
+ ghostEl.style.height = '24px';
78
+ ghostEl.style.fontSize = '11px';
79
+ ghostEl.style.lineHeight = '20px';
80
+ ghostEl.style.borderRadius = '12px';
81
+ ghostEl.style.whiteSpace = 'nowrap';
82
+ ghostEl.style.boxSizing = 'border-box';
83
+ // HTML5 setDragImage snapshots the element as appended to the
84
+ // document; a default block-level div would stretch to the
85
+ // body's width and render as a viewport-wide bar.
86
+ ghostEl.style.display = 'inline-block';
87
+ ghostEl.textContent = "Multiple Panels (".concat(_this.group.size, ")");
88
+ return ghostEl;
89
+ };
90
+ var buildGhostSpec = function () {
91
+ var _a, _b;
92
+ // The custom-ghost resolution (createGroupDragGhostComponent) is
93
+ // owned by the AdvancedDnD module; core keeps the default chip and
94
+ // falls back to it when no custom ghost is produced (incl. when
95
+ // the module is absent).
96
+ var customGhost = (_b = (_a = _this.accessor).buildGroupDragGhost) === null || _b === void 0 ? void 0 : _b.call(_a, _this.group);
97
+ if (customGhost) {
98
+ return customGhost;
99
+ }
100
+ return {
101
+ element: buildMultiPanelsGhost(),
102
+ offsetX: 30,
103
+ offsetY: -10,
104
+ };
105
+ };
106
+ var sharedDragOptions = {
107
+ getData: function () {
108
+ _this.panelTransfer.setData([new dataTransfer_1.PanelTransfer(_this.accessor.id, _this.group.id, null)], dataTransfer_1.PanelTransfer.prototype);
109
+ return {
110
+ dispose: function () {
111
+ _this.panelTransfer.clearData(dataTransfer_1.PanelTransfer.prototype);
112
+ },
113
+ };
114
+ },
115
+ createGhost: buildGhostSpec,
116
+ onDragStart: function (event) {
117
+ _this._onDragStart.fire(event);
118
+ },
119
+ };
120
+ _this.html5DragSource = backend_1.html5Backend.createDragSource(_this._element, __assign(__assign({}, sharedDragOptions), { disabled: !caps.html5, isCancelled: function (event) {
121
+ // HTML5: when this element is the floating window's move
122
+ // handle, redock needs shift+drag (otherwise click-and-drag
123
+ // conflicts with moving the float). A non-move-handle (e.g. the
124
+ // void container when a title bar moves the float) redocks with
125
+ // a plain drag, like a group in the main grid.
126
+ if (_this.group.api.location.type === 'floating' &&
127
+ _this.isFloatingMoveHandle() &&
128
+ !event.shiftKey) {
129
+ return true;
130
+ }
131
+ if (_this.group.api.location.type === 'edge' &&
132
+ _this.group.size === 0) {
133
+ return true;
134
+ }
135
+ return false;
136
+ } }));
137
+ // Only the move handle needs the touch disambiguation; other handles
138
+ // redock with the normal grid press behaviour.
139
+ var isFloating = function () {
140
+ var _a, _b, _c;
141
+ return ((_c = (_b = (_a = _this.group) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.location) === null || _c === void 0 ? void 0 : _c.type) === 'floating' &&
142
+ _this.isFloatingMoveHandle();
143
+ };
144
+ _this.pointerDragSource = backend_1.pointerBackend.createDragSource(_this._element, __assign(__assign({}, sharedDragOptions), { disabled: !caps.pointer, touchOnly: !caps.pointerHandlesMouse,
145
+ // Floating groups share this element with the overlay's
146
+ // move-the-float drag. Without a longer hold + tolerance
147
+ // override, both gestures commit simultaneously and the
148
+ // user sees the float follow their finger *and* a ghost.
149
+ touchInitiationDelay: function () {
150
+ return isFloating() ? FLOATING_REDOCK_INITIATION_DELAY_MS : 250;
151
+ }, pressTolerance: function () { return (isFloating() ? Infinity : 8); }, isCancelled: function () {
152
+ if (!(0, dndCapabilities_1.resolveDndCapabilities)(_this.accessor.options).pointer) {
153
+ return true;
154
+ }
155
+ // Pointer: long-press IS the deliberate gesture, so
156
+ // floating groups don't need the shift gate.
157
+ if (_this.group.api.location.type === 'edge' &&
158
+ _this.group.size === 0) {
159
+ return true;
160
+ }
161
+ return false;
162
+ }, onDragStart: function (event) {
163
+ var _a;
164
+ // Redock just committed — abort any in-flight overlay
165
+ // move so the float stops following the finger while
166
+ // the ghost takes over.
167
+ (_a = _this.getFloatingOverlay()) === null || _a === void 0 ? void 0 : _a.cancelPendingDrag();
168
+ _this._onDragStart.fire(event);
169
+ } }));
170
+ // Mirror direction: once the overlay's move-the-float gesture has
171
+ // actually moved something, cancel the pending redock arm so the
172
+ // ghost doesn't appear mid-drag if the user holds past 500ms.
173
+ var overlayMoveSub = new lifecycle_1.MutableDisposable();
174
+ var refreshOverlayMoveSub = function () {
175
+ var overlay = _this.getFloatingOverlay();
176
+ overlayMoveSub.value = overlay
177
+ ? overlay.onDidStartMoving(function () {
178
+ _this.pointerDragSource.cancelPending();
179
+ })
180
+ : lifecycle_1.Disposable.NONE;
181
+ };
182
+ refreshOverlayMoveSub();
183
+ _this.addDisposables(overlayMoveSub);
184
+ var locationChange = (_c = (_b = _this.group) === null || _b === void 0 ? void 0 : _b.api) === null || _c === void 0 ? void 0 : _c.onDidLocationChange;
185
+ if (locationChange) {
186
+ _this.addDisposables(locationChange(refreshOverlayMoveSub));
187
+ }
188
+ _this.addDisposables(_this.html5DragSource, _this.pointerDragSource);
189
+ return _this;
190
+ }
191
+ Object.defineProperty(GroupDragSource.prototype, "group", {
192
+ // Resolved lazily so a retargetable handle (the floating title bar) always
193
+ // drags the window's *current* anchor group, not the one captured here.
194
+ get: function () {
195
+ return this.groupAccessor();
196
+ },
197
+ enumerable: false,
198
+ configurable: true
199
+ });
200
+ GroupDragSource.prototype.updateDragAndDropState = function () {
201
+ var caps = (0, dndCapabilities_1.resolveDndCapabilities)(this.accessor.options);
202
+ this._element.draggable = caps.html5;
203
+ (0, dom_1.toggleClass)(this._element, 'dv-draggable', caps.html5 || caps.pointer);
204
+ this.html5DragSource.setDisabled(!caps.html5);
205
+ this.pointerDragSource.setDisabled(!caps.pointer);
206
+ this.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);
207
+ };
208
+ GroupDragSource.prototype.getFloatingOverlay = function () {
209
+ var _this = this;
210
+ var _a, _b;
211
+ if (!this.group) {
212
+ return undefined;
213
+ }
214
+ return (_b = (_a = this.accessor.floatingGroups) === null || _a === void 0 ? void 0 : _a.find(function (fg) { return fg.group === _this.group; })) === null || _b === void 0 ? void 0 : _b.overlay;
215
+ };
216
+ return GroupDragSource;
217
+ }(lifecycle_1.CompositeDisposable));
218
+ exports.GroupDragSource = GroupDragSource;
@@ -1,5 +1,5 @@
1
1
  import { IValueDisposable } from '../../../lifecycle';
2
- import { DockviewHeaderDirection } from '../../options';
2
+ import { DockviewHeaderDirection, DockviewHeaderPosition } from '../../options';
3
3
  import { Tab } from '../tab/tab';
4
4
  import { ITabGroup } from '../../tabGroup';
5
5
  import { TabGroupColorPalette } from '../../tabGroupAccent';
@@ -10,6 +10,7 @@ export interface TabGroupIndicatorContext {
10
10
  getTabMap(): Map<string, IValueDisposable<Tab>>;
11
11
  getChipElement(groupId: string): HTMLElement | undefined;
12
12
  getDirection(): DockviewHeaderDirection;
13
+ getHeaderPosition(): DockviewHeaderPosition;
13
14
  getColorPalette(): TabGroupColorPalette | undefined;
14
15
  }
15
16
  export interface ITabGroupIndicator {
@@ -385,6 +385,7 @@ var WrapTabGroupIndicator = /** @class */ (function (_super) {
385
385
  }
386
386
  var r = 6; // corner radius
387
387
  var half = t / 2;
388
+ var headerPosition = this._ctx.getHeaderPosition();
388
389
  if (isVertical) {
389
390
  var svgW = crossSize;
390
391
  var svgH = mainSize;
@@ -392,19 +393,22 @@ var WrapTabGroupIndicator = /** @class */ (function (_super) {
392
393
  svg.setAttribute('height', String(svgH));
393
394
  underline.style.width = "".concat(svgW, "px");
394
395
  underline.style.height = "".concat(svgH, "px");
395
- var xLeft = half;
396
- var xRight = svgW - half;
396
+ // right header: indicator on the left edge (invert x sides)
397
+ var isRightHeader = headerPosition === 'right';
398
+ var xNear = isRightHeader ? svgW - half : half;
399
+ var xFar = isRightHeader ? half : svgW - half;
400
+ var cd = isRightHeader ? -1 : 1; // curve direction
397
401
  var d = [
398
- "M ".concat(xLeft, ",0"),
399
- "L ".concat(xLeft, ",").concat(aStart - r),
400
- "Q ".concat(xLeft, ",").concat(aStart, " ").concat(xLeft + r, ",").concat(aStart),
401
- "L ".concat(xRight - r, ",").concat(aStart),
402
- "Q ".concat(xRight, ",").concat(aStart, " ").concat(xRight, ",").concat(aStart + r),
403
- "L ".concat(xRight, ",").concat(aEnd - r),
404
- "Q ".concat(xRight, ",").concat(aEnd, " ").concat(xRight - r, ",").concat(aEnd),
405
- "L ".concat(xLeft + r, ",").concat(aEnd),
406
- "Q ".concat(xLeft, ",").concat(aEnd, " ").concat(xLeft, ",").concat(aEnd + r),
407
- "L ".concat(xLeft, ",").concat(svgH),
402
+ "M ".concat(xNear, ",0"),
403
+ "L ".concat(xNear, ",").concat(aStart - r),
404
+ "Q ".concat(xNear, ",").concat(aStart, " ").concat(xNear + cd * r, ",").concat(aStart),
405
+ "L ".concat(xFar - cd * r, ",").concat(aStart),
406
+ "Q ".concat(xFar, ",").concat(aStart, " ").concat(xFar, ",").concat(aStart + r),
407
+ "L ".concat(xFar, ",").concat(aEnd - r),
408
+ "Q ".concat(xFar, ",").concat(aEnd, " ").concat(xFar - cd * r, ",").concat(aEnd),
409
+ "L ".concat(xNear + cd * r, ",").concat(aEnd),
410
+ "Q ".concat(xNear, ",").concat(aEnd, " ").concat(xNear, ",").concat(aEnd + r),
411
+ "L ".concat(xNear, ",").concat(svgH),
408
412
  ].join(' ');
409
413
  path.setAttribute('d', d);
410
414
  }
@@ -415,19 +419,22 @@ var WrapTabGroupIndicator = /** @class */ (function (_super) {
415
419
  svg.setAttribute('height', String(svgH));
416
420
  underline.style.width = "".concat(svgW, "px");
417
421
  underline.style.height = "".concat(svgH, "px");
418
- var yBot = svgH - half;
419
- var yTop = half;
422
+ // bottom header: indicator on the top edge (invert y sides)
423
+ var isBottomHeader = headerPosition === 'bottom';
424
+ var yNear = isBottomHeader ? half : svgH - half;
425
+ var yFar = isBottomHeader ? svgH - half : half;
426
+ var cd = isBottomHeader ? 1 : -1; // curve direction
420
427
  var d = [
421
- "M 0,".concat(yBot),
422
- "L ".concat(aStart - r, ",").concat(yBot),
423
- "Q ".concat(aStart, ",").concat(yBot, " ").concat(aStart, ",").concat(yBot - r),
424
- "L ".concat(aStart, ",").concat(yTop + r),
425
- "Q ".concat(aStart, ",").concat(yTop, " ").concat(aStart + r, ",").concat(yTop),
426
- "L ".concat(aEnd - r, ",").concat(yTop),
427
- "Q ".concat(aEnd, ",").concat(yTop, " ").concat(aEnd, ",").concat(yTop + r),
428
- "L ".concat(aEnd, ",").concat(yBot - r),
429
- "Q ".concat(aEnd, ",").concat(yBot, " ").concat(aEnd + r, ",").concat(yBot),
430
- "L ".concat(svgW, ",").concat(yBot),
428
+ "M 0,".concat(yNear),
429
+ "L ".concat(aStart - r, ",").concat(yNear),
430
+ "Q ".concat(aStart, ",").concat(yNear, " ").concat(aStart, ",").concat(yNear + cd * r),
431
+ "L ".concat(aStart, ",").concat(yFar - cd * r),
432
+ "Q ".concat(aStart, ",").concat(yFar, " ").concat(aStart + r, ",").concat(yFar),
433
+ "L ".concat(aEnd - r, ",").concat(yFar),
434
+ "Q ".concat(aEnd, ",").concat(yFar, " ").concat(aEnd, ",").concat(yFar - cd * r),
435
+ "L ".concat(aEnd, ",").concat(yNear + cd * r),
436
+ "Q ".concat(aEnd, ",").concat(yNear, " ").concat(aEnd + r, ",").concat(yNear),
437
+ "L ".concat(svgW, ",").concat(yNear),
431
438
  ].join(' ');
432
439
  path.setAttribute('d', d);
433
440
  }
@@ -399,6 +399,7 @@ var TabGroupManager = /** @class */ (function () {
399
399
  getTabMap: function () { return _this._ctx.getTabMap(); },
400
400
  getChipElement: function (id) { var _a; return (_a = _this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
401
401
  getDirection: function () { return _this._ctx.getDirection(); },
402
+ getHeaderPosition: function () { return _this._ctx.group.model.headerPosition; },
402
403
  getColorPalette: function () { return _this._ctx.accessor.tabGroupColorPalette; },
403
404
  });
404
405
  }
@@ -59,7 +59,19 @@ export declare class Tabs extends CompositeDisposable {
59
59
  showTabsOverflowControl: boolean;
60
60
  });
61
61
  indexOf(id: string): number;
62
+ /** DOM id of the tab element for a panel — for the tabpanel's `aria-labelledby`. */
63
+ getTabId(panelId: string): string | undefined;
62
64
  isActive(tab: Tab): boolean;
65
+ private _onKeyDown;
66
+ /**
67
+ * Close the tab at `index` and move roving focus to a neighbouring tab so
68
+ * keyboard focus stays in the tablist.
69
+ */
70
+ private _closeTab;
71
+ /** Move the roving focus to the tab at `index` (updates tabindex + DOM focus). */
72
+ private _focusTab;
73
+ /** Move DOM focus to the active tab — the entry point into the tablist. */
74
+ focusActiveTab(): void;
63
75
  setActivePanel(panel: IDockviewPanel): void;
64
76
  openPanel(panel: IDockviewPanel, index?: number): void;
65
77
  delete(id: string): void;
@@ -92,6 +92,9 @@ var Tabs = /** @class */ (function (_super) {
92
92
  _this.onOverflowTabsChange = _this._onOverflowTabsChange.event;
93
93
  _this._tabsList = document.createElement('div');
94
94
  _this._tabsList.className = 'dv-tabs-container';
95
+ // WAI-ARIA Tabs pattern: the strip of tabs is the tablist.
96
+ _this._tabsList.setAttribute('role', 'tablist');
97
+ _this._tabsList.setAttribute('aria-orientation', _this._direction === 'vertical' ? 'vertical' : 'horizontal');
95
98
  _this.showTabsOverflowControl = options.showTabsOverflowControl;
96
99
  if (accessor.options.scrollbars === 'native') {
97
100
  _this._element = _this._tabsList;
@@ -111,7 +114,8 @@ var Tabs = /** @class */ (function (_super) {
111
114
  getDirection: function () { return _this._direction; },
112
115
  }, {
113
116
  onChipContextMenu: function (tabGroup, event) {
114
- _this.accessor.contextMenuController.showForChip(tabGroup, _this.group, event);
117
+ var _a;
118
+ (_a = _this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.showForChip(tabGroup, _this.group, event);
115
119
  },
116
120
  onChipDragStart: function (tabGroup, chip, event) {
117
121
  _this._handleChipDragStart(tabGroup, chip, event);
@@ -204,7 +208,14 @@ var Tabs = /** @class */ (function (_super) {
204
208
  else {
205
209
  _this._tabsList.scrollLeft = current + primary;
206
210
  }
207
- }, { passive: false }), (0, events_1.addDisposableListener)(_this._tabsList, 'dragover', function (event) {
211
+ }, { passive: false }),
212
+ // WAI-ARIA Tabs keyboard pattern: arrow keys move the roving
213
+ // focus along the strip, Home/End jump to the ends, and
214
+ // Enter/Space activate the focused tab (manual activation, so
215
+ // arrowing through tabs doesn't switch panels until committed).
216
+ (0, events_1.addDisposableListener)(_this._tabsList, 'keydown', function (event) {
217
+ _this._onKeyDown(event);
218
+ }), (0, events_1.addDisposableListener)(_this._tabsList, 'dragover', function (event) {
208
219
  if (_this._processDragOver(event.clientX)) {
209
220
  // Allow `drop` to fire on the tabs list container.
210
221
  event.preventDefault();
@@ -401,6 +412,7 @@ var Tabs = /** @class */ (function (_super) {
401
412
  return;
402
413
  }
403
414
  this._direction = value;
415
+ this._tabsList.setAttribute('aria-orientation', value === 'vertical' ? 'vertical' : 'horizontal');
404
416
  if (this._scrollbar) {
405
417
  this._scrollbar.orientation = value;
406
418
  }
@@ -433,10 +445,101 @@ var Tabs = /** @class */ (function (_super) {
433
445
  Tabs.prototype.indexOf = function (id) {
434
446
  return this._tabs.findIndex(function (tab) { return tab.value.panel.id === id; });
435
447
  };
448
+ /** DOM id of the tab element for a panel — for the tabpanel's `aria-labelledby`. */
449
+ Tabs.prototype.getTabId = function (panelId) {
450
+ var _a;
451
+ return (_a = this._tabMap.get(panelId)) === null || _a === void 0 ? void 0 : _a.value.element.id;
452
+ };
436
453
  Tabs.prototype.isActive = function (tab) {
437
454
  return (this.selectedIndex > -1 &&
438
455
  this._tabs[this.selectedIndex].value === tab);
439
456
  };
457
+ Tabs.prototype._onKeyDown = function (event) {
458
+ var _this = this;
459
+ // Only handle when a tab element itself is focused — never hijack keys
460
+ // typed inside a custom tab renderer's own controls (inputs etc.).
461
+ var index = this._tabs.findIndex(function (tab) { return tab.value.element === event.target; });
462
+ if (index === -1) {
463
+ return;
464
+ }
465
+ var isVertical = this._direction === 'vertical';
466
+ var nextKey = isVertical ? 'ArrowDown' : 'ArrowRight';
467
+ var prevKey = isVertical ? 'ArrowUp' : 'ArrowLeft';
468
+ var last = this._tabs.length - 1;
469
+ switch (event.key) {
470
+ case nextKey:
471
+ event.preventDefault();
472
+ this._focusTab(Math.min(index + 1, last));
473
+ break;
474
+ case prevKey:
475
+ event.preventDefault();
476
+ this._focusTab(Math.max(index - 1, 0));
477
+ break;
478
+ case 'Home':
479
+ event.preventDefault();
480
+ this._focusTab(0);
481
+ break;
482
+ case 'End':
483
+ event.preventDefault();
484
+ this._focusTab(last);
485
+ break;
486
+ case 'Enter':
487
+ case ' ':
488
+ // Manual activation of the focused tab.
489
+ event.preventDefault();
490
+ this.accessor.withOrigin('user', function () {
491
+ return _this._tabs[index].value.panel.api.setActive();
492
+ });
493
+ break;
494
+ case 'Delete':
495
+ case 'Backspace':
496
+ // Close the focused tab (Backspace covers macOS, where the
497
+ // primary delete key reports as Backspace).
498
+ event.preventDefault();
499
+ this._closeTab(index);
500
+ break;
501
+ }
502
+ };
503
+ /**
504
+ * Close the tab at `index` and move roving focus to a neighbouring tab so
505
+ * keyboard focus stays in the tablist.
506
+ */
507
+ Tabs.prototype._closeTab = function (index) {
508
+ var _a, _b, _c, _d, _e;
509
+ var tab = (_a = this._tabs[index]) === null || _a === void 0 ? void 0 : _a.value;
510
+ if (!tab) {
511
+ return;
512
+ }
513
+ // Resolve the post-close focus target before closing mutates the list:
514
+ // prefer the next tab, otherwise the previous.
515
+ var neighbourId = (_e = ((_c = (_b = this._tabs[index + 1]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : (_d = this._tabs[index - 1]) === null || _d === void 0 ? void 0 : _d.value)) === null || _e === void 0 ? void 0 : _e.panel.id;
516
+ tab.panel.api.close();
517
+ if (neighbourId !== undefined) {
518
+ var nextIndex = this._tabs.findIndex(function (t) { return t.value.panel.id === neighbourId; });
519
+ if (nextIndex > -1) {
520
+ this._focusTab(nextIndex);
521
+ }
522
+ }
523
+ };
524
+ /** Move the roving focus to the tab at `index` (updates tabindex + DOM focus). */
525
+ Tabs.prototype._focusTab = function (index) {
526
+ for (var i = 0; i < this._tabs.length; i++) {
527
+ this._tabs[i].value.element.tabIndex = i === index ? 0 : -1;
528
+ }
529
+ this._tabs[index].value.element.focus();
530
+ };
531
+ /** Move DOM focus to the active tab — the entry point into the tablist. */
532
+ Tabs.prototype.focusActiveTab = function () {
533
+ var _a;
534
+ if (this._tabs.length === 0) {
535
+ return;
536
+ }
537
+ var activeId = (_a = this.group.activePanel) === null || _a === void 0 ? void 0 : _a.id;
538
+ var activeIndex = activeId
539
+ ? this._tabs.findIndex(function (t) { return t.value.panel.id === activeId; })
540
+ : -1;
541
+ this._focusTab(activeIndex > -1 ? activeIndex : 0);
542
+ };
440
543
  Tabs.prototype.setActivePanel = function (panel) {
441
544
  var e_3, _a;
442
545
  var isVertical = this._direction === 'vertical';
@@ -33,8 +33,10 @@ export interface ITabsContainer extends IDisposable {
33
33
  direction: DockviewHeaderDirection;
34
34
  delete(id: string): void;
35
35
  indexOf(id: string): number;
36
+ getTabId(panelId: string): string | undefined;
36
37
  setActive(isGroupActive: boolean): void;
37
38
  setActivePanel(panel: IDockviewPanel): void;
39
+ focusActiveTab(): void;
38
40
  isActive(tab: Tab): boolean;
39
41
  closePanel(panel: IDockviewPanel): void;
40
42
  openPanel(panel: IDockviewPanel, index?: number): void;
@@ -87,9 +89,11 @@ export declare class TabsContainer extends CompositeDisposable implements ITabsC
87
89
  setPrefixActionsElement(element: HTMLElement | undefined): void;
88
90
  isActive(tab: Tab): boolean;
89
91
  indexOf(id: string): number;
92
+ getTabId(panelId: string): string | undefined;
90
93
  setActive(_isGroupActive: boolean): void;
91
94
  delete(id: string): void;
92
95
  setActivePanel(panel: IDockviewPanel): void;
96
+ focusActiveTab(): void;
93
97
  openPanel(panel: IDockviewPanel, index?: number): void;
94
98
  closePanel(panel: IDockviewPanel): void;
95
99
  private updateClassnames;
@@ -253,6 +253,9 @@ var TabsContainer = /** @class */ (function (_super) {
253
253
  TabsContainer.prototype.indexOf = function (id) {
254
254
  return this.tabs.indexOf(id);
255
255
  };
256
+ TabsContainer.prototype.getTabId = function (panelId) {
257
+ return this.tabs.getTabId(panelId);
258
+ };
256
259
  TabsContainer.prototype.setActive = function (_isGroupActive) {
257
260
  // noop
258
261
  };
@@ -263,6 +266,9 @@ var TabsContainer = /** @class */ (function (_super) {
263
266
  TabsContainer.prototype.setActivePanel = function (panel) {
264
267
  this.tabs.setActivePanel(panel);
265
268
  };
269
+ TabsContainer.prototype.focusActiveTab = function () {
270
+ this.tabs.focusActiveTab();
271
+ };
266
272
  TabsContainer.prototype.openPanel = function (panel, index) {
267
273
  if (index === void 0) { index = this.tabs.size; }
268
274
  this.tabs.openPanel(panel, index);
@@ -374,8 +380,10 @@ var TabsContainer = /** @class */ (function (_super) {
374
380
  // Activate the first panel in the group
375
381
  var firstPanelId = tg.panelIds[0];
376
382
  if (firstPanelId) {
377
- var panel = _this.group.panels.find(function (p) { return p.id === firstPanelId; });
378
- panel === null || panel === void 0 ? void 0 : panel.api.setActive();
383
+ var panel_1 = _this.group.panels.find(function (p) { return p.id === firstPanelId; });
384
+ _this.accessor.withOrigin('user', function () {
385
+ return panel_1 === null || panel_1 === void 0 ? void 0 : panel_1.api.setActive();
386
+ });
379
387
  }
380
388
  });
381
389
  el.appendChild(groupHeader);
@@ -401,7 +409,9 @@ var TabsContainer = /** @class */ (function (_super) {
401
409
  tg.expand();
402
410
  }
403
411
  tab.element.scrollIntoView();
404
- tab.panel.api.setActive();
412
+ _this.accessor.withOrigin('user', function () {
413
+ return tab.panel.api.setActive();
414
+ });
405
415
  });
406
416
  wrapper.appendChild(child);
407
417
  el.appendChild(wrapper);
@@ -9,9 +9,7 @@ export declare class VoidContainer extends CompositeDisposable {
9
9
  private readonly _element;
10
10
  private readonly dropTarget;
11
11
  private readonly pointerDropTarget;
12
- private readonly html5DragSource;
13
- private readonly pointerDragSource;
14
- private readonly panelTransfer;
12
+ private readonly dragSource;
15
13
  private readonly _onDrop;
16
14
  readonly onDrop: Event<DroptargetEvent>;
17
15
  private readonly _onDragStart;
@@ -20,5 +18,4 @@ export declare class VoidContainer extends CompositeDisposable {
20
18
  get element(): HTMLElement;
21
19
  constructor(accessor: DockviewComponent, group: DockviewGroupPanel);
22
20
  updateDragAndDropState(): void;
23
- private getFloatingOverlay;
24
21
  }