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.
Files changed (203) 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 +24 -1
  6. package/dist/cjs/api/dockviewPanelApi.d.ts +4 -3
  7. package/dist/cjs/api/dockviewPanelApi.js +8 -0
  8. package/dist/cjs/dnd/dropTargetAnchorContainer.js +1 -2
  9. package/dist/cjs/dnd/droptarget.d.ts +8 -0
  10. package/dist/cjs/dnd/droptarget.js +28 -0
  11. package/dist/cjs/dnd/pointer/longPress.js +1 -1
  12. package/dist/cjs/dnd/pointer/pointerDragController.js +9 -7
  13. package/dist/cjs/dnd/pointer/pointerDragSource.js +4 -2
  14. package/dist/cjs/dockview/accessibilityMessages.d.ts +32 -0
  15. package/dist/cjs/dockview/accessibilityMessages.js +51 -0
  16. package/dist/cjs/dockview/allModules.d.ts +8 -0
  17. package/dist/cjs/dockview/allModules.js +25 -0
  18. package/dist/cjs/dockview/components/panel/content.d.ts +2 -0
  19. package/dist/cjs/dockview/components/panel/content.js +41 -10
  20. package/dist/cjs/dockview/components/popupService.js +1 -1
  21. package/dist/cjs/dockview/components/tab/tab.js +35 -7
  22. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +34 -0
  23. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.js +95 -0
  24. package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +51 -0
  25. package/dist/cjs/dockview/components/titlebar/groupDragSource.js +218 -0
  26. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +2 -1
  27. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +36 -30
  28. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +27 -5
  29. package/dist/cjs/dockview/components/titlebar/tabGroups.js +104 -53
  30. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +12 -0
  31. package/dist/cjs/dockview/components/titlebar/tabs.js +121 -25
  32. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +4 -0
  33. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +13 -3
  34. package/dist/cjs/dockview/components/titlebar/voidContainer.d.ts +1 -4
  35. package/dist/cjs/dockview/components/titlebar/voidContainer.js +32 -156
  36. package/dist/cjs/dockview/dndCapabilities.js +3 -3
  37. package/dist/cjs/dockview/dockviewComponent.d.ts +304 -49
  38. package/dist/cjs/dockview/dockviewComponent.js +1839 -1075
  39. package/dist/cjs/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
  40. package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +39 -3
  41. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -2
  42. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +36 -14
  43. package/dist/cjs/dockview/dockviewGroupPanelModel.js +151 -125
  44. package/dist/cjs/dockview/dockviewPanel.d.ts +2 -2
  45. package/dist/cjs/dockview/dockviewPanel.js +4 -5
  46. package/dist/cjs/dockview/dockviewShell.d.ts +29 -7
  47. package/dist/cjs/dockview/dockviewShell.js +94 -36
  48. package/dist/cjs/dockview/edgeGroupService.d.ts +38 -0
  49. package/dist/cjs/dockview/edgeGroupService.js +128 -0
  50. package/dist/cjs/dockview/floatingGroupService.d.ts +37 -0
  51. package/dist/cjs/dockview/floatingGroupService.js +231 -0
  52. package/dist/cjs/dockview/headerActionsService.d.ts +32 -0
  53. package/dist/cjs/dockview/headerActionsService.js +149 -0
  54. package/dist/cjs/dockview/liveRegionService.d.ts +53 -0
  55. package/dist/cjs/dockview/liveRegionService.js +185 -0
  56. package/dist/cjs/dockview/moduleContracts.d.ts +119 -0
  57. package/dist/cjs/dockview/moduleContracts.js +2 -0
  58. package/dist/cjs/dockview/modules.d.ts +110 -0
  59. package/dist/cjs/dockview/modules.js +304 -0
  60. package/dist/cjs/dockview/options.d.ts +159 -6
  61. package/dist/cjs/dockview/options.js +8 -1
  62. package/dist/cjs/dockview/popoutWindowService.d.ts +95 -0
  63. package/dist/cjs/dockview/popoutWindowService.js +261 -0
  64. package/dist/cjs/dockview/rootDropTargetService.d.ts +35 -0
  65. package/dist/cjs/dockview/rootDropTargetService.js +87 -0
  66. package/dist/cjs/dockview/strictEventsSequencing.js +6 -6
  67. package/dist/cjs/dockview/tabGroup.js +3 -3
  68. package/dist/cjs/dockview/tabGroupAccent.js +1 -3
  69. package/dist/cjs/dockview/watermarkService.d.ts +30 -0
  70. package/dist/cjs/dockview/watermarkService.js +61 -0
  71. package/dist/cjs/dom.js +1 -1
  72. package/dist/cjs/events.js +1 -1
  73. package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -1
  74. package/dist/cjs/gridview/baseComponentGridview.js +6 -10
  75. package/dist/cjs/gridview/branchNode.js +13 -17
  76. package/dist/cjs/gridview/gridview.js +8 -8
  77. package/dist/cjs/gridview/gridviewComponent.d.ts +3 -3
  78. package/dist/cjs/gridview/gridviewComponent.js +1 -6
  79. package/dist/cjs/gridview/gridviewPanel.d.ts +1 -1
  80. package/dist/cjs/index.d.ts +11 -4
  81. package/dist/cjs/index.js +14 -1
  82. package/dist/cjs/overlay/overlay.d.ts +43 -1
  83. package/dist/cjs/overlay/overlay.js +82 -36
  84. package/dist/cjs/overlay/overlayRenderContainer.js +3 -4
  85. package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +2 -2
  86. package/dist/cjs/paneview/draggablePaneviewPanel.js +5 -5
  87. package/dist/cjs/paneview/paneviewComponent.d.ts +3 -3
  88. package/dist/cjs/paneview/paneviewComponent.js +7 -11
  89. package/dist/cjs/popoutWindow.js +4 -4
  90. package/dist/cjs/scrollbar.d.ts +1 -1
  91. package/dist/cjs/scrollbar.js +7 -6
  92. package/dist/cjs/splitview/splitview.d.ts +1 -1
  93. package/dist/cjs/splitview/splitview.js +21 -20
  94. package/dist/cjs/splitview/viewItem.js +1 -1
  95. package/dist/dockview-core.js +3548 -1544
  96. package/dist/dockview-core.min.js +2 -2
  97. package/dist/dockview-core.min.js.map +1 -1
  98. package/dist/dockview-core.min.noStyle.js +2 -2
  99. package/dist/dockview-core.min.noStyle.js.map +1 -1
  100. package/dist/dockview-core.noStyle.js +3547 -1543
  101. package/dist/esm/api/component.api.d.ts +42 -21
  102. package/dist/esm/api/component.api.js +63 -18
  103. package/dist/esm/api/dockviewGroupPanelApi.d.ts +23 -8
  104. package/dist/esm/api/dockviewGroupPanelApi.js +20 -1
  105. package/dist/esm/api/dockviewPanelApi.d.ts +4 -3
  106. package/dist/esm/api/dockviewPanelApi.js +7 -0
  107. package/dist/esm/dnd/dropTargetAnchorContainer.js +1 -2
  108. package/dist/esm/dnd/droptarget.d.ts +8 -0
  109. package/dist/esm/dnd/droptarget.js +28 -0
  110. package/dist/esm/dnd/pointer/longPress.js +1 -1
  111. package/dist/esm/dnd/pointer/pointerDragController.js +9 -7
  112. package/dist/esm/dnd/pointer/pointerDragSource.js +4 -2
  113. package/dist/esm/dockview/accessibilityMessages.d.ts +32 -0
  114. package/dist/esm/dockview/accessibilityMessages.js +30 -0
  115. package/dist/esm/dockview/allModules.d.ts +8 -0
  116. package/dist/esm/dockview/allModules.js +22 -0
  117. package/dist/esm/dockview/components/panel/content.d.ts +2 -0
  118. package/dist/esm/dockview/components/panel/content.js +42 -11
  119. package/dist/esm/dockview/components/popupService.js +1 -1
  120. package/dist/esm/dockview/components/tab/tab.js +35 -7
  121. package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +34 -0
  122. package/dist/esm/dockview/components/titlebar/floatingTitleBar.js +65 -0
  123. package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +51 -0
  124. package/dist/esm/dockview/components/titlebar/groupDragSource.js +178 -0
  125. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +2 -1
  126. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +36 -30
  127. package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +27 -5
  128. package/dist/esm/dockview/components/titlebar/tabGroups.js +91 -41
  129. package/dist/esm/dockview/components/titlebar/tabs.d.ts +12 -0
  130. package/dist/esm/dockview/components/titlebar/tabs.js +119 -26
  131. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +4 -0
  132. package/dist/esm/dockview/components/titlebar/tabsContainer.js +8 -2
  133. package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +1 -4
  134. package/dist/esm/dockview/components/titlebar/voidContainer.js +34 -146
  135. package/dist/esm/dockview/dndCapabilities.js +3 -3
  136. package/dist/esm/dockview/dockviewComponent.d.ts +304 -49
  137. package/dist/esm/dockview/dockviewComponent.js +1459 -772
  138. package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +33 -2
  139. package/dist/esm/dockview/dockviewFloatingGroupPanel.js +35 -3
  140. package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -2
  141. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +36 -14
  142. package/dist/esm/dockview/dockviewGroupPanelModel.js +127 -117
  143. package/dist/esm/dockview/dockviewPanel.d.ts +2 -2
  144. package/dist/esm/dockview/dockviewPanel.js +1 -2
  145. package/dist/esm/dockview/dockviewShell.d.ts +29 -7
  146. package/dist/esm/dockview/dockviewShell.js +89 -37
  147. package/dist/esm/dockview/edgeGroupService.d.ts +38 -0
  148. package/dist/esm/dockview/edgeGroupService.js +63 -0
  149. package/dist/esm/dockview/floatingGroupService.d.ts +37 -0
  150. package/dist/esm/dockview/floatingGroupService.js +150 -0
  151. package/dist/esm/dockview/headerActionsService.d.ts +32 -0
  152. package/dist/esm/dockview/headerActionsService.js +86 -0
  153. package/dist/esm/dockview/liveRegionService.d.ts +53 -0
  154. package/dist/esm/dockview/liveRegionService.js +159 -0
  155. package/dist/esm/dockview/moduleContracts.d.ts +119 -0
  156. package/dist/esm/dockview/moduleContracts.js +1 -0
  157. package/dist/esm/dockview/modules.d.ts +110 -0
  158. package/dist/esm/dockview/modules.js +170 -0
  159. package/dist/esm/dockview/options.d.ts +159 -6
  160. package/dist/esm/dockview/options.js +8 -1
  161. package/dist/esm/dockview/popoutWindowService.d.ts +95 -0
  162. package/dist/esm/dockview/popoutWindowService.js +175 -0
  163. package/dist/esm/dockview/rootDropTargetService.d.ts +35 -0
  164. package/dist/esm/dockview/rootDropTargetService.js +82 -0
  165. package/dist/esm/dockview/strictEventsSequencing.js +6 -6
  166. package/dist/esm/dockview/tabGroup.js +3 -3
  167. package/dist/esm/dockview/tabGroupAccent.js +1 -3
  168. package/dist/esm/dockview/watermarkService.d.ts +30 -0
  169. package/dist/esm/dockview/watermarkService.js +56 -0
  170. package/dist/esm/dom.js +1 -1
  171. package/dist/esm/events.js +1 -1
  172. package/dist/esm/gridview/baseComponentGridview.d.ts +1 -1
  173. package/dist/esm/gridview/baseComponentGridview.js +5 -10
  174. package/dist/esm/gridview/branchNode.js +13 -15
  175. package/dist/esm/gridview/gridview.js +8 -8
  176. package/dist/esm/gridview/gridviewComponent.d.ts +3 -3
  177. package/dist/esm/gridview/gridviewComponent.js +1 -6
  178. package/dist/esm/gridview/gridviewPanel.d.ts +1 -1
  179. package/dist/esm/index.d.ts +11 -4
  180. package/dist/esm/index.js +4 -0
  181. package/dist/esm/overlay/overlay.d.ts +43 -1
  182. package/dist/esm/overlay/overlay.js +78 -36
  183. package/dist/esm/overlay/overlayRenderContainer.js +3 -4
  184. package/dist/esm/paneview/draggablePaneviewPanel.d.ts +2 -2
  185. package/dist/esm/paneview/draggablePaneviewPanel.js +5 -5
  186. package/dist/esm/paneview/paneviewComponent.d.ts +3 -3
  187. package/dist/esm/paneview/paneviewComponent.js +7 -11
  188. package/dist/esm/popoutWindow.js +4 -4
  189. package/dist/esm/scrollbar.d.ts +1 -1
  190. package/dist/esm/scrollbar.js +7 -6
  191. package/dist/esm/splitview/splitview.d.ts +1 -1
  192. package/dist/esm/splitview/splitview.js +21 -20
  193. package/dist/esm/splitview/viewItem.js +1 -1
  194. package/dist/package/main.cjs.js +3550 -1546
  195. package/dist/package/main.cjs.min.js +2 -2
  196. package/dist/package/main.esm.min.mjs +2 -2
  197. package/dist/package/main.esm.mjs +3538 -1545
  198. package/dist/styles/dockview.css +283 -21
  199. package/package.json +10 -1
  200. package/dist/cjs/dockview/contextMenu.d.ts +0 -10
  201. package/dist/cjs/dockview/contextMenu.js +0 -313
  202. package/dist/esm/dockview/contextMenu.d.ts +0 -10
  203. package/dist/esm/dockview/contextMenu.js +0 -228
@@ -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 {
@@ -142,8 +142,7 @@ class BaseTabGroupIndicator {
142
142
  const isAnimating = tg.collapsed ||
143
143
  tg.panelIds.some((pid) => {
144
144
  const te = tabMap.get(pid);
145
- return (te &&
146
- te.value.element.classList.contains('dv-tab--group-expanding'));
145
+ return te === null || te === void 0 ? void 0 : te.value.element.classList.contains('dv-tab--group-expanding');
147
146
  });
148
147
  if (isAnimating && chipEl) {
149
148
  const chipRect = chipEl.getBoundingClientRect();
@@ -240,7 +239,10 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
240
239
  // Ensure SVG + path child exists (created once, reused)
241
240
  let svg = underline.firstElementChild;
242
241
  let path;
243
- if (!svg || svg.tagName !== 'svg') {
242
+ if ((svg === null || svg === void 0 ? void 0 : svg.tagName) === 'svg') {
243
+ path = svg.firstElementChild;
244
+ }
245
+ else {
244
246
  underline.replaceChildren();
245
247
  svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
246
248
  svg.style.display = 'block';
@@ -249,9 +251,6 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
249
251
  svg.appendChild(path);
250
252
  underline.appendChild(svg);
251
253
  }
252
- else {
253
- path = svg.firstElementChild;
254
- }
255
254
  path.setAttribute('stroke', color);
256
255
  path.setAttribute('stroke-width', String(t));
257
256
  if (!activeTabEntry) {
@@ -276,6 +275,7 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
276
275
  }
277
276
  const r = 6; // corner radius
278
277
  const half = t / 2;
278
+ const headerPosition = this._ctx.getHeaderPosition();
279
279
  if (isVertical) {
280
280
  const svgW = crossSize;
281
281
  const svgH = mainSize;
@@ -283,19 +283,22 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
283
283
  svg.setAttribute('height', String(svgH));
284
284
  underline.style.width = `${svgW}px`;
285
285
  underline.style.height = `${svgH}px`;
286
- const xLeft = half;
287
- const xRight = svgW - half;
286
+ // right header: indicator on the left edge (invert x sides)
287
+ const isRightHeader = headerPosition === 'right';
288
+ const xNear = isRightHeader ? svgW - half : half;
289
+ const xFar = isRightHeader ? half : svgW - half;
290
+ const cd = isRightHeader ? -1 : 1; // curve direction
288
291
  const d = [
289
- `M ${xLeft},0`,
290
- `L ${xLeft},${aStart - r}`,
291
- `Q ${xLeft},${aStart} ${xLeft + r},${aStart}`,
292
- `L ${xRight - r},${aStart}`,
293
- `Q ${xRight},${aStart} ${xRight},${aStart + r}`,
294
- `L ${xRight},${aEnd - r}`,
295
- `Q ${xRight},${aEnd} ${xRight - r},${aEnd}`,
296
- `L ${xLeft + r},${aEnd}`,
297
- `Q ${xLeft},${aEnd} ${xLeft},${aEnd + r}`,
298
- `L ${xLeft},${svgH}`,
292
+ `M ${xNear},0`,
293
+ `L ${xNear},${aStart - r}`,
294
+ `Q ${xNear},${aStart} ${xNear + cd * r},${aStart}`,
295
+ `L ${xFar - cd * r},${aStart}`,
296
+ `Q ${xFar},${aStart} ${xFar},${aStart + r}`,
297
+ `L ${xFar},${aEnd - r}`,
298
+ `Q ${xFar},${aEnd} ${xFar - cd * r},${aEnd}`,
299
+ `L ${xNear + cd * r},${aEnd}`,
300
+ `Q ${xNear},${aEnd} ${xNear},${aEnd + r}`,
301
+ `L ${xNear},${svgH}`,
299
302
  ].join(' ');
300
303
  path.setAttribute('d', d);
301
304
  }
@@ -306,19 +309,22 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
306
309
  svg.setAttribute('height', String(svgH));
307
310
  underline.style.width = `${svgW}px`;
308
311
  underline.style.height = `${svgH}px`;
309
- const yBot = svgH - half;
310
- const yTop = half;
312
+ // bottom header: indicator on the top edge (invert y sides)
313
+ const isBottomHeader = headerPosition === 'bottom';
314
+ const yNear = isBottomHeader ? half : svgH - half;
315
+ const yFar = isBottomHeader ? svgH - half : half;
316
+ const cd = isBottomHeader ? 1 : -1; // curve direction
311
317
  const d = [
312
- `M 0,${yBot}`,
313
- `L ${aStart - r},${yBot}`,
314
- `Q ${aStart},${yBot} ${aStart},${yBot - r}`,
315
- `L ${aStart},${yTop + r}`,
316
- `Q ${aStart},${yTop} ${aStart + r},${yTop}`,
317
- `L ${aEnd - r},${yTop}`,
318
- `Q ${aEnd},${yTop} ${aEnd},${yTop + r}`,
319
- `L ${aEnd},${yBot - r}`,
320
- `Q ${aEnd},${yBot} ${aEnd + r},${yBot}`,
321
- `L ${svgW},${yBot}`,
318
+ `M 0,${yNear}`,
319
+ `L ${aStart - r},${yNear}`,
320
+ `Q ${aStart},${yNear} ${aStart},${yNear + cd * r}`,
321
+ `L ${aStart},${yFar - cd * r}`,
322
+ `Q ${aStart},${yFar} ${aStart + r},${yFar}`,
323
+ `L ${aEnd - r},${yFar}`,
324
+ `Q ${aEnd},${yFar} ${aEnd},${yFar - cd * r}`,
325
+ `L ${aEnd},${yNear + cd * r}`,
326
+ `Q ${aEnd},${yNear} ${aEnd + r},${yNear}`,
327
+ `L ${svgW},${yNear}`,
322
328
  ].join(' ');
323
329
  path.setAttribute('d', d);
324
330
  }
@@ -27,9 +27,17 @@ export interface TabGroupManagerCallbacks {
27
27
  }
28
28
  interface ChipRendererEntry {
29
29
  chip: ITabGroupChipRenderer;
30
- /** Created by the manager so it can be toggled live on strategy changes. */
31
- html5DragSource: IDragSource;
32
- pointerDragSource: IDragSource;
30
+ /**
31
+ * Created by the manager so it can be toggled live on strategy changes.
32
+ * Undefined between an in-flight drag being torn down by
33
+ * `disposeChipDrag` and the following `update()` re-arming it — the chip
34
+ * element outlives a within-group move even though its drag sources do
35
+ * not. (#1410)
36
+ */
37
+ html5DragSource: IDragSource | undefined;
38
+ pointerDragSource: IDragSource | undefined;
39
+ /** Disposes the two drag sources + their shared dragend listener. */
40
+ dragSourcesDisposable: IDisposable | undefined;
33
41
  disposable: IDisposable;
34
42
  dropTarget: Droptarget;
35
43
  }
@@ -70,14 +78,28 @@ export declare class TabGroupManager {
70
78
  * iframe shield are released BEFORE the cross-group move detaches
71
79
  * the chip (chip dispose is scheduled on a microtask via
72
80
  * `_scheduleTabGroupUpdate`, which is too late for callers that read
73
- * `getPanelData()` synchronously after the move). Idempotent — the
74
- * subsequent `update()` will also dispose the sources.
81
+ * `getPanelData()` synchronously after the move).
82
+ *
83
+ * A cross-group move dissolves the source chip entirely, but a
84
+ * within-group reorder keeps the same chip element — so the sources are
85
+ * cleared to `undefined` here and the subsequent `update()` re-arms them
86
+ * via `_ensureChipForGroup`. Without that re-arm the chip would fire a
87
+ * native `dragstart` (the element keeps `draggable=true`) but never set
88
+ * a transfer payload, leaving the group permanently undraggable after
89
+ * its first move. (#1410)
75
90
  */
76
91
  disposeChipDrag(tabGroupId: string): void;
77
92
  /** Cloned chip rect used as the pointer follow-finger ghost. */
78
93
  private _buildChipGhostElement;
79
94
  disposeAll(): void;
80
95
  private _ensureIndicator;
96
+ /**
97
+ * Create the HTML5 + pointer drag sources for a chip (and the direct
98
+ * dragend listener that clears the transfer synchronously). Extracted so
99
+ * both the initial chip build and the post-move re-arm in
100
+ * `_ensureChipForGroup` share one wiring path. (#1410)
101
+ */
102
+ private _createChipDragSources;
81
103
  private _ensureChipForGroup;
82
104
  private _positionChipForGroup;
83
105
  private _updateTabGroupClasses;
@@ -1,6 +1,6 @@
1
1
  import { toggleClass } from '../../../dom';
2
2
  import { addDisposableListener } from '../../../events';
3
- import { LocalSelectionTransfer, PanelTransfer, } from '../../../dnd/dataTransfer';
3
+ import { getPanelData, LocalSelectionTransfer, PanelTransfer, } from '../../../dnd/dataTransfer';
4
4
  import { html5Backend, pointerBackend, } from '../../../dnd/backend';
5
5
  import { LongPressDetector } from '../../../dnd/pointer/longPress';
6
6
  import { CompositeDisposable, } from '../../../lifecycle';
@@ -8,7 +8,6 @@ import { resolveDndCapabilities } from '../../dndCapabilities';
8
8
  import { applyTabGroupAccent } from '../../tabGroupAccent';
9
9
  import { TabGroupChip } from './tabGroupChip';
10
10
  import { Droptarget } from '../../../dnd/droptarget';
11
- import { getPanelData } from '../../../dnd/dataTransfer';
12
11
  import { NoneTabGroupIndicator, WrapTabGroupIndicator, } from './tabGroupIndicator';
13
12
  const EMPTY_MAP = new Map();
14
13
  export class TabGroupManager {
@@ -38,6 +37,7 @@ export class TabGroupManager {
38
37
  * in the parent group model. Call after any tab group mutation.
39
38
  */
40
39
  update() {
40
+ var _a;
41
41
  const model = this._ctx.group.model;
42
42
  const tabGroups = model.getTabGroups();
43
43
  // Track which group IDs are still active
@@ -52,6 +52,7 @@ export class TabGroupManager {
52
52
  if (!activeGroupIds.has(groupId)) {
53
53
  entry.chip.element.remove();
54
54
  entry.chip.dispose();
55
+ (_a = entry.dragSourcesDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
55
56
  entry.disposable.dispose();
56
57
  this._chipRenderers.delete(groupId);
57
58
  }
@@ -180,12 +181,13 @@ export class TabGroupManager {
180
181
  this._pendingTransitionCleanups.delete(panelId);
181
182
  }
182
183
  updateDragAndDropState() {
184
+ var _a, _b, _c;
183
185
  const caps = resolveDndCapabilities(this._ctx.accessor.options);
184
186
  for (const entry of this._chipRenderers.values()) {
185
187
  entry.chip.element.draggable = caps.html5;
186
- entry.html5DragSource.setDisabled(!caps.html5);
187
- entry.pointerDragSource.setDisabled(!caps.pointer);
188
- entry.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);
188
+ (_a = entry.html5DragSource) === null || _a === void 0 ? void 0 : _a.setDisabled(!caps.html5);
189
+ (_b = entry.pointerDragSource) === null || _b === void 0 ? void 0 : _b.setDisabled(!caps.pointer);
190
+ (_c = entry.pointerDragSource) === null || _c === void 0 ? void 0 : _c.setTouchOnly(!caps.pointerHandlesMouse);
189
191
  }
190
192
  }
191
193
  /**
@@ -194,19 +196,28 @@ export class TabGroupManager {
194
196
  * iframe shield are released BEFORE the cross-group move detaches
195
197
  * the chip (chip dispose is scheduled on a microtask via
196
198
  * `_scheduleTabGroupUpdate`, which is too late for callers that read
197
- * `getPanelData()` synchronously after the move). Idempotent — the
198
- * subsequent `update()` will also dispose the sources.
199
+ * `getPanelData()` synchronously after the move).
200
+ *
201
+ * A cross-group move dissolves the source chip entirely, but a
202
+ * within-group reorder keeps the same chip element — so the sources are
203
+ * cleared to `undefined` here and the subsequent `update()` re-arms them
204
+ * via `_ensureChipForGroup`. Without that re-arm the chip would fire a
205
+ * native `dragstart` (the element keeps `draggable=true`) but never set
206
+ * a transfer payload, leaving the group permanently undraggable after
207
+ * its first move. (#1410)
199
208
  */
200
209
  disposeChipDrag(tabGroupId) {
201
- var _a, _b;
210
+ var _a;
202
211
  const entry = this._chipRenderers.get(tabGroupId);
203
212
  if (!entry) {
204
213
  return;
205
214
  }
206
215
  // Optional-chained because tests may inject minimal entries
207
216
  // that skip the manager's normal `_ensureChipForGroup` flow.
208
- (_a = entry.html5DragSource) === null || _a === void 0 ? void 0 : _a.dispose();
209
- (_b = entry.pointerDragSource) === null || _b === void 0 ? void 0 : _b.dispose();
217
+ (_a = entry.dragSourcesDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
218
+ entry.html5DragSource = undefined;
219
+ entry.pointerDragSource = undefined;
220
+ entry.dragSourcesDisposable = undefined;
210
221
  }
211
222
  /** Cloned chip rect used as the pointer follow-finger ghost. */
212
223
  _buildChipGhostElement(chipEl) {
@@ -219,7 +230,7 @@ export class TabGroupManager {
219
230
  return clone;
220
231
  }
221
232
  disposeAll() {
222
- var _a;
233
+ var _a, _b;
223
234
  (_a = this._indicator) === null || _a === void 0 ? void 0 : _a.dispose();
224
235
  this._indicator = null;
225
236
  for (const [, cleanup] of this._pendingTransitionCleanups) {
@@ -229,12 +240,13 @@ export class TabGroupManager {
229
240
  for (const [, entry] of this._chipRenderers) {
230
241
  entry.chip.element.remove();
231
242
  entry.chip.dispose();
243
+ (_b = entry.dragSourcesDisposable) === null || _b === void 0 ? void 0 : _b.dispose();
232
244
  entry.disposable.dispose();
233
245
  }
234
246
  this._chipRenderers.clear();
235
247
  }
236
248
  _ensureIndicator() {
237
- var _a, _b;
249
+ var _a, _b, _c;
238
250
  const mode = (_b = (_a = this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabGroupIndicator) !== null && _b !== void 0 ? _b : 'wrap';
239
251
  const Ctor = mode === 'none' ? NoneTabGroupIndicator : WrapTabGroupIndicator;
240
252
  // Re-create if the indicator type changed (e.g. theme switch)
@@ -242,27 +254,24 @@ export class TabGroupManager {
242
254
  this._indicator.dispose();
243
255
  this._indicator = null;
244
256
  }
245
- if (!this._indicator) {
246
- this._indicator = new Ctor({
247
- tabsList: this._ctx.tabsList,
248
- getTabGroups: () => this._ctx.group.model.getTabGroups(),
249
- getActivePanelId: () => { var _a; return (_a = this._ctx.group.activePanel) === null || _a === void 0 ? void 0 : _a.id; },
250
- getTabMap: () => this._ctx.getTabMap(),
251
- getChipElement: (id) => { var _a; return (_a = this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
252
- getDirection: () => this._ctx.getDirection(),
253
- getColorPalette: () => this._ctx.accessor.tabGroupColorPalette,
254
- });
255
- }
257
+ (_c = this._indicator) !== null && _c !== void 0 ? _c : (this._indicator = new Ctor({
258
+ tabsList: this._ctx.tabsList,
259
+ getTabGroups: () => this._ctx.group.model.getTabGroups(),
260
+ getActivePanelId: () => { var _a; return (_a = this._ctx.group.activePanel) === null || _a === void 0 ? void 0 : _a.id; },
261
+ getTabMap: () => this._ctx.getTabMap(),
262
+ getChipElement: (id) => { var _a; return (_a = this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
263
+ getDirection: () => this._ctx.getDirection(),
264
+ getHeaderPosition: () => this._ctx.group.model.headerPosition,
265
+ getColorPalette: () => this._ctx.accessor.tabGroupColorPalette,
266
+ }));
256
267
  }
257
- _ensureChipForGroup(tabGroup) {
258
- if (this._chipRenderers.has(tabGroup.id)) {
259
- return;
260
- }
261
- const createChip = this._ctx.accessor.options.createTabGroupChipComponent;
262
- const chip = createChip
263
- ? createChip(tabGroup)
264
- : new TabGroupChip(this._ctx.accessor.tabGroupColorPalette);
265
- chip.init({ tabGroup, api: this._ctx.accessor.api });
268
+ /**
269
+ * Create the HTML5 + pointer drag sources for a chip (and the direct
270
+ * dragend listener that clears the transfer synchronously). Extracted so
271
+ * both the initial chip build and the post-move re-arm in
272
+ * `_ensureChipForGroup` share one wiring path. (#1410)
273
+ */
274
+ _createChipDragSources(chip, tabGroup) {
266
275
  const caps = resolveDndCapabilities(this._ctx.accessor.options);
267
276
  chip.element.draggable = caps.html5;
268
277
  const panelTransfer = LocalSelectionTransfer.getInstance();
@@ -314,9 +323,12 @@ export class TabGroupManager {
314
323
  // the listener survives chip disposal in the detach-then-dragend
315
324
  // cross-group path; `once: true` auto-removes after the single
316
325
  // dragend that we care about. (#1254)
317
- chip.element.addEventListener('dragend', () => {
326
+ const onDragEndClear = () => {
318
327
  panelTransfer.clearData(PanelTransfer.prototype);
319
- }, { once: true });
328
+ };
329
+ chip.element.addEventListener('dragend', onDragEndClear, {
330
+ once: true,
331
+ });
320
332
  const pointerDragSource = pointerBackend.createDragSource(chip.element, {
321
333
  getData,
322
334
  disabled: !caps.pointer,
@@ -331,6 +343,41 @@ export class TabGroupManager {
331
343
  this._callbacks.onChipDragStart(tabGroup, chip, event);
332
344
  },
333
345
  });
346
+ return {
347
+ html5DragSource,
348
+ pointerDragSource,
349
+ disposable: {
350
+ dispose: () => {
351
+ html5DragSource.dispose();
352
+ pointerDragSource.dispose();
353
+ chip.element.removeEventListener('dragend', onDragEndClear);
354
+ },
355
+ },
356
+ };
357
+ }
358
+ _ensureChipForGroup(tabGroup) {
359
+ const existing = this._chipRenderers.get(tabGroup.id);
360
+ if (existing) {
361
+ // A committed group move tears down the chip's drag sources via
362
+ // `disposeChipDrag`, but a within-group reorder keeps the same
363
+ // chip element alive. Re-arm the sources so the group stays
364
+ // draggable; without this the chip is stuck after its first
365
+ // move — `dragstart` still fires (the element keeps
366
+ // `draggable=true`) but no transfer payload is set. (#1410)
367
+ if (!existing.html5DragSource) {
368
+ const sources = this._createChipDragSources(existing.chip, tabGroup);
369
+ existing.html5DragSource = sources.html5DragSource;
370
+ existing.pointerDragSource = sources.pointerDragSource;
371
+ existing.dragSourcesDisposable = sources.disposable;
372
+ }
373
+ return;
374
+ }
375
+ const createChip = this._ctx.accessor.options.createTabGroupChipComponent;
376
+ const chip = createChip
377
+ ? createChip(tabGroup)
378
+ : new TabGroupChip(this._ctx.accessor.tabGroupColorPalette);
379
+ chip.init({ tabGroup, api: this._ctx.accessor.api });
380
+ const dragSources = this._createChipDragSources(chip, tabGroup);
334
381
  const disposables = [
335
382
  tabGroup.onDidChange(() => {
336
383
  var _a;
@@ -344,17 +391,19 @@ export class TabGroupManager {
344
391
  tabGroup.onDidCollapseChange(() => {
345
392
  this._updateTabGroupClasses();
346
393
  }),
347
- html5DragSource,
348
- pointerDragSource,
349
394
  ];
350
395
  // Context menu: built-in TabGroupChip already aggregates right-click
351
396
  // + touch long-press into `onContextMenu`. Custom chip renderers
352
397
  // don't, so attach a long-press detector and contextmenu listener
353
398
  // directly on their element.
354
399
  const onContextMenu = (event) => {
400
+ var _a, _b;
355
401
  // A long-press on a chip should preempt the in-flight pointer
356
- // drag and open the menu instead.
357
- pointerDragSource.cancelPending();
402
+ // drag and open the menu instead. Resolve the source from the
403
+ // entry so a post-move re-armed source is cancelled, not the
404
+ // stale one captured at build time. (#1410)
405
+ (_b = (_a = this._chipRenderers
406
+ .get(tabGroup.id)) === null || _a === void 0 ? void 0 : _a.pointerDragSource) === null || _b === void 0 ? void 0 : _b.cancelPending();
358
407
  this._callbacks.onChipContextMenu(tabGroup, event);
359
408
  };
360
409
  if (chip instanceof TabGroupChip) {
@@ -387,7 +436,7 @@ export class TabGroupManager {
387
436
  return false;
388
437
  }
389
438
  const data = getPanelData();
390
- if (data && this._ctx.accessor.id === data.viewId) {
439
+ if (this._ctx.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
391
440
  if (((_a = this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) ===
392
441
  'smooth') {
393
442
  return false;
@@ -403,8 +452,9 @@ export class TabGroupManager {
403
452
  const disposable = new CompositeDisposable(...disposables);
404
453
  this._chipRenderers.set(tabGroup.id, {
405
454
  chip,
406
- html5DragSource,
407
- pointerDragSource,
455
+ html5DragSource: dragSources.html5DragSource,
456
+ pointerDragSource: dragSources.pointerDragSource,
457
+ dragSourcesDisposable: dragSources.disposable,
408
458
  disposable,
409
459
  dropTarget,
410
460
  });
@@ -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;