dockview-core 7.0.2 → 7.0.4

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 (98) hide show
  1. package/dist/cjs/api/dockviewGroupPanelApi.js +1 -1
  2. package/dist/cjs/dnd/dropTargetAnchorContainer.js +1 -2
  3. package/dist/cjs/dnd/pointer/longPress.js +1 -1
  4. package/dist/cjs/dnd/pointer/pointerDragController.js +9 -7
  5. package/dist/cjs/dnd/pointer/pointerDragSource.js +4 -2
  6. package/dist/cjs/dockview/components/panel/content.js +6 -6
  7. package/dist/cjs/dockview/components/popupService.js +1 -1
  8. package/dist/cjs/dockview/components/tab/tab.js +2 -2
  9. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +1 -2
  10. package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +1 -2
  11. package/dist/cjs/dockview/components/titlebar/groupDragSource.js +1 -1
  12. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +5 -6
  13. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +27 -5
  14. package/dist/cjs/dockview/components/titlebar/tabGroups.js +104 -54
  15. package/dist/cjs/dockview/components/titlebar/tabs.js +16 -23
  16. package/dist/cjs/dockview/components/titlebar/voidContainer.js +1 -1
  17. package/dist/cjs/dockview/dndCapabilities.js +3 -3
  18. package/dist/cjs/dockview/dockviewComponent.d.ts +5 -5
  19. package/dist/cjs/dockview/dockviewComponent.js +140 -122
  20. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +1 -1
  21. package/dist/cjs/dockview/dockviewGroupPanelModel.js +19 -25
  22. package/dist/cjs/dockview/dockviewPanel.js +4 -5
  23. package/dist/cjs/dockview/dockviewShell.d.ts +29 -7
  24. package/dist/cjs/dockview/dockviewShell.js +94 -36
  25. package/dist/cjs/dockview/strictEventsSequencing.js +6 -6
  26. package/dist/cjs/dockview/tabGroup.js +3 -3
  27. package/dist/cjs/dockview/tabGroupAccent.js +1 -3
  28. package/dist/cjs/dom.js +1 -1
  29. package/dist/cjs/events.js +1 -1
  30. package/dist/cjs/gridview/baseComponentGridview.js +3 -8
  31. package/dist/cjs/gridview/branchNode.js +13 -17
  32. package/dist/cjs/gridview/gridview.js +8 -8
  33. package/dist/cjs/gridview/gridviewComponent.js +1 -6
  34. package/dist/cjs/overlay/overlay.js +25 -28
  35. package/dist/cjs/overlay/overlayRenderContainer.js +3 -4
  36. package/dist/cjs/paneview/draggablePaneviewPanel.js +1 -1
  37. package/dist/cjs/paneview/paneviewComponent.js +2 -6
  38. package/dist/cjs/popoutWindow.js +4 -4
  39. package/dist/cjs/scrollbar.d.ts +1 -1
  40. package/dist/cjs/scrollbar.js +7 -6
  41. package/dist/cjs/splitview/splitview.d.ts +1 -1
  42. package/dist/cjs/splitview/splitview.js +21 -20
  43. package/dist/cjs/splitview/viewItem.js +1 -1
  44. package/dist/dockview-core.js +413 -330
  45. package/dist/dockview-core.min.js +2 -2
  46. package/dist/dockview-core.min.js.map +1 -1
  47. package/dist/dockview-core.min.noStyle.js +2 -2
  48. package/dist/dockview-core.min.noStyle.js.map +1 -1
  49. package/dist/dockview-core.noStyle.js +412 -329
  50. package/dist/esm/api/dockviewGroupPanelApi.js +1 -1
  51. package/dist/esm/dnd/dropTargetAnchorContainer.js +1 -2
  52. package/dist/esm/dnd/pointer/longPress.js +1 -1
  53. package/dist/esm/dnd/pointer/pointerDragController.js +9 -7
  54. package/dist/esm/dnd/pointer/pointerDragSource.js +4 -2
  55. package/dist/esm/dockview/components/panel/content.js +6 -6
  56. package/dist/esm/dockview/components/popupService.js +1 -1
  57. package/dist/esm/dockview/components/tab/tab.js +2 -2
  58. package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +1 -2
  59. package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +1 -2
  60. package/dist/esm/dockview/components/titlebar/groupDragSource.js +1 -1
  61. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +5 -6
  62. package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +27 -5
  63. package/dist/esm/dockview/components/titlebar/tabGroups.js +91 -42
  64. package/dist/esm/dockview/components/titlebar/tabs.js +17 -24
  65. package/dist/esm/dockview/components/titlebar/voidContainer.js +1 -1
  66. package/dist/esm/dockview/dndCapabilities.js +3 -3
  67. package/dist/esm/dockview/dockviewComponent.d.ts +5 -5
  68. package/dist/esm/dockview/dockviewComponent.js +61 -51
  69. package/dist/esm/dockview/dockviewGroupPanel.d.ts +1 -1
  70. package/dist/esm/dockview/dockviewGroupPanelModel.js +19 -25
  71. package/dist/esm/dockview/dockviewPanel.js +1 -2
  72. package/dist/esm/dockview/dockviewShell.d.ts +29 -7
  73. package/dist/esm/dockview/dockviewShell.js +89 -37
  74. package/dist/esm/dockview/strictEventsSequencing.js +6 -6
  75. package/dist/esm/dockview/tabGroup.js +3 -3
  76. package/dist/esm/dockview/tabGroupAccent.js +1 -3
  77. package/dist/esm/dom.js +1 -1
  78. package/dist/esm/events.js +1 -1
  79. package/dist/esm/gridview/baseComponentGridview.js +3 -8
  80. package/dist/esm/gridview/branchNode.js +13 -15
  81. package/dist/esm/gridview/gridview.js +8 -8
  82. package/dist/esm/gridview/gridviewComponent.js +1 -6
  83. package/dist/esm/overlay/overlay.js +25 -28
  84. package/dist/esm/overlay/overlayRenderContainer.js +3 -4
  85. package/dist/esm/paneview/draggablePaneviewPanel.js +1 -1
  86. package/dist/esm/paneview/paneviewComponent.js +2 -6
  87. package/dist/esm/popoutWindow.js +4 -4
  88. package/dist/esm/scrollbar.d.ts +1 -1
  89. package/dist/esm/scrollbar.js +7 -6
  90. package/dist/esm/splitview/splitview.d.ts +1 -1
  91. package/dist/esm/splitview/splitview.js +21 -20
  92. package/dist/esm/splitview/viewItem.js +1 -1
  93. package/dist/package/main.cjs.js +412 -329
  94. package/dist/package/main.cjs.min.js +2 -2
  95. package/dist/package/main.esm.min.mjs +2 -2
  96. package/dist/package/main.esm.mjs +412 -329
  97. package/dist/styles/dockview.css +8 -8
  98. package/package.json +1 -1
@@ -115,7 +115,7 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
115
115
  DockviewGroupPanelApiImpl.prototype.getWindow = function () {
116
116
  return this.location.type === 'popout'
117
117
  ? this.location.getWindow()
118
- : window;
118
+ : globalThis.window;
119
119
  };
120
120
  DockviewGroupPanelApiImpl.prototype.setHeaderPosition = function (position) {
121
121
  if (!this._group) {
@@ -55,9 +55,8 @@ var DropTargetAnchorContainer = /** @class */ (function (_super) {
55
55
  }
56
56
  return {
57
57
  clear: function () {
58
- var _a;
59
58
  if (_this._model) {
60
- (_a = _this._model.root.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(_this._model.root);
59
+ _this._model.root.remove();
61
60
  }
62
61
  _this._model = undefined;
63
62
  },
@@ -54,7 +54,7 @@ var LongPressDetector = /** @class */ (function (_super) {
54
54
  var delay = (_b = this.options.delay) !== null && _b !== void 0 ? _b : DEFAULT_DELAY;
55
55
  var tolerance = (_c = this.options.tolerance) !== null && _c !== void 0 ? _c : DEFAULT_TOLERANCE;
56
56
  // Source's owning window — popout drags fire on their own window.
57
- var targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : window;
57
+ var targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : globalThis.window;
58
58
  this._timer = setTimeout(function () {
59
59
  _this._timer = undefined;
60
60
  _this._cancelPending();
@@ -58,9 +58,8 @@ var PointerDragController = /** @class */ (function (_super) {
58
58
  return _this;
59
59
  }
60
60
  PointerDragController.getInstance = function () {
61
- if (!PointerDragController._instance) {
62
- PointerDragController._instance = new PointerDragController();
63
- }
61
+ var _a;
62
+ (_a = PointerDragController._instance) !== null && _a !== void 0 ? _a : (PointerDragController._instance = new PointerDragController());
64
63
  return PointerDragController._instance;
65
64
  };
66
65
  Object.defineProperty(PointerDragController.prototype, "active", {
@@ -118,21 +117,24 @@ var PointerDragController = /** @class */ (function (_super) {
118
117
  this._onDragStart.fire(startEvent);
119
118
  // Source's owning window — popout drags fire on their own window,
120
119
  // not the main one.
121
- var targetWindow = (_c = (_b = source.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) !== null && _c !== void 0 ? _c : window;
120
+ var targetWindow = (_c = (_b = source.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) !== null && _c !== void 0 ? _c : globalThis.window;
122
121
  this._moveListener = (0, events_1.addDisposableListener)(targetWindow, 'pointermove', function (e) {
123
- if (!_this._active || e.pointerId !== _this._active.pointerId) {
122
+ var _a;
123
+ if (e.pointerId !== ((_a = _this._active) === null || _a === void 0 ? void 0 : _a.pointerId)) {
124
124
  return;
125
125
  }
126
126
  _this._handleMove(e);
127
127
  });
128
128
  this._upListener = (0, events_1.addDisposableListener)(targetWindow, 'pointerup', function (e) {
129
- if (!_this._active || e.pointerId !== _this._active.pointerId) {
129
+ var _a;
130
+ if (e.pointerId !== ((_a = _this._active) === null || _a === void 0 ? void 0 : _a.pointerId)) {
130
131
  return;
131
132
  }
132
133
  _this._handleEnd(e, true);
133
134
  });
134
135
  this._cancelListener = (0, events_1.addDisposableListener)(targetWindow, 'pointercancel', function (e) {
135
- if (!_this._active || e.pointerId !== _this._active.pointerId) {
136
+ var _a;
137
+ if (e.pointerId !== ((_a = _this._active) === null || _a === void 0 ? void 0 : _a.pointerId)) {
136
138
  return;
137
139
  }
138
140
  _this._handleEnd(e, false);
@@ -103,7 +103,9 @@ var PointerDragSource = /** @class */ (function (_super) {
103
103
  ? initiationDelayOpt()
104
104
  : initiationDelayOpt)) !== null && _a !== void 0 ? _a : DEFAULT_TOUCH_INITIATION_DELAY;
105
105
  this._armed = !isTouch || initiationDelay <= 0;
106
- if (isTouch && initiationDelay > 0 && isFinite(initiationDelay)) {
106
+ if (isTouch &&
107
+ initiationDelay > 0 &&
108
+ Number.isFinite(initiationDelay)) {
107
109
  this._armTimer = setTimeout(function () {
108
110
  _this._armTimer = undefined;
109
111
  _this._armed = true;
@@ -115,7 +117,7 @@ var PointerDragSource = /** @class */ (function (_super) {
115
117
  ? pressToleranceOpt()
116
118
  : pressToleranceOpt)) !== null && _c !== void 0 ? _c : DEFAULT_PRESS_TOLERANCE;
117
119
  // Source's owning window — popout drags fire on their own window.
118
- var targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : window;
120
+ var targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : globalThis.window;
119
121
  this._pendingMoveListener = (0, events_1.addDisposableListener)(targetWindow, 'pointermove', function (moveEvent) {
120
122
  if (moveEvent.pointerId !== _this._pendingPointerId) {
121
123
  return;
@@ -62,7 +62,7 @@ var ContentContainer = /** @class */ (function (_super) {
62
62
  _this.group.location.type !== 'floating') {
63
63
  return false;
64
64
  }
65
- if (data && data.viewId === _this.accessor.id) {
65
+ if ((data === null || data === void 0 ? void 0 : data.viewId) === _this.accessor.id) {
66
66
  return true;
67
67
  }
68
68
  return _this.group.canDisplayOverlay(event, position, 'content');
@@ -139,7 +139,7 @@ var ContentContainer = /** @class */ (function (_super) {
139
139
  /**
140
140
  * If the currently attached panel is mounted directly to the content then remove it
141
141
  */
142
- this._element.removeChild(this.panel.view.content.element);
142
+ this.panel.view.content.element.remove();
143
143
  (_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);
144
144
  }
145
145
  this.panel = panel;
@@ -157,7 +157,7 @@ var ContentContainer = /** @class */ (function (_super) {
157
157
  break;
158
158
  case 'always':
159
159
  if (panel.view.content.element.parentElement === this._element) {
160
- this._element.removeChild(panel.view.content.element);
160
+ panel.view.content.element.remove();
161
161
  }
162
162
  container = this.group.renderContainer.attach({
163
163
  panel: panel,
@@ -185,11 +185,11 @@ var ContentContainer = /** @class */ (function (_super) {
185
185
  // noop
186
186
  };
187
187
  ContentContainer.prototype.closePanel = function () {
188
- var _a, _b, _c;
188
+ var _a, _b;
189
189
  if (this.panel) {
190
190
  if (this.panel.api.renderer === 'onlyWhenVisible') {
191
- (_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
192
- (_c = (_b = this.panel.view.content).onHide) === null || _c === void 0 ? void 0 : _c.call(_b);
191
+ this.panel.view.content.element.remove();
192
+ (_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);
193
193
  }
194
194
  }
195
195
  this.panel = undefined;
@@ -30,7 +30,7 @@ function isCoarsePrimaryInput(win) {
30
30
  var PopupService = /** @class */ (function (_super) {
31
31
  __extends(PopupService, _super);
32
32
  function PopupService(root, win) {
33
- if (win === void 0) { win = window; }
33
+ if (win === void 0) { win = globalThis.window; }
34
34
  var _this = _super.call(this) || this;
35
35
  _this._active = null;
36
36
  _this._activeDisposable = new lifecycle_1.MutableDisposable();
@@ -82,7 +82,7 @@ var Tab = /** @class */ (function (_super) {
82
82
  return false;
83
83
  }
84
84
  var data = (0, dataTransfer_1.getPanelData)();
85
- if (data && _this.accessor.id === data.viewId) {
85
+ if (_this.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
86
86
  // Smooth-reorder takes over the in-flight visual when active,
87
87
  // so individual tab overlays are suppressed for internal drags.
88
88
  if (((_a = _this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {
@@ -193,7 +193,7 @@ var Tab = /** @class */ (function (_super) {
193
193
  };
194
194
  Tab.prototype.setContent = function (part) {
195
195
  if (this.content) {
196
- this._element.removeChild(this.content.element);
196
+ this.content.element.remove();
197
197
  }
198
198
  this.content = part;
199
199
  this._element.appendChild(this.content.element);
@@ -1,5 +1,4 @@
1
1
  import { DockviewComponent } from '../../dockviewComponent';
2
- import { Event } from '../../../events';
3
2
  import { CompositeDisposable } from '../../../lifecycle';
4
3
  import { DockviewGroupPanel } from '../../dockviewGroupPanel';
5
4
  /**
@@ -20,7 +19,7 @@ export declare class FloatingTitleBar extends CompositeDisposable {
20
19
  private readonly dragSource;
21
20
  private _group;
22
21
  private readonly _onDragStart;
23
- readonly onDragStart: Event<PointerEvent | DragEvent>;
22
+ readonly onDragStart: import("../../../events").Event<PointerEvent | DragEvent>;
24
23
  get element(): HTMLElement;
25
24
  /** The window's current anchor group — the one this bar drags/activates. */
26
25
  get group(): DockviewGroupPanel;
@@ -1,5 +1,4 @@
1
1
  import { DockviewComponent } from '../../dockviewComponent';
2
- import { Event } from '../../../events';
3
2
  import { CompositeDisposable } from '../../../lifecycle';
4
3
  import { DockviewGroupPanel } from '../../dockviewGroupPanel';
5
4
  declare const FLOATING_REDOCK_INITIATION_DELAY_MS = 500;
@@ -42,7 +41,7 @@ export declare class GroupDragSource extends CompositeDisposable {
42
41
  private readonly pointerDragSource;
43
42
  private readonly panelTransfer;
44
43
  private readonly _onDragStart;
45
- readonly onDragStart: Event<PointerEvent | DragEvent>;
44
+ readonly onDragStart: import("../../../events").Event<PointerEvent | DragEvent>;
46
45
  private readonly isFloatingMoveHandle;
47
46
  private get group();
48
47
  constructor(options: GroupDragSourceOptions);
@@ -68,7 +68,7 @@ var GroupDragSource = /** @class */ (function (_super) {
68
68
  _this.addDisposables(_this._onDragStart);
69
69
  var buildMultiPanelsGhost = function () {
70
70
  var ghostEl = document.createElement('div');
71
- var style = window.getComputedStyle(_this._element);
71
+ var style = globalThis.getComputedStyle(_this._element);
72
72
  var bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
73
73
  var color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
74
74
  ghostEl.style.backgroundColor = bgColor;
@@ -228,8 +228,7 @@ var BaseTabGroupIndicator = /** @class */ (function () {
228
228
  var isAnimating = tg.collapsed ||
229
229
  tg.panelIds.some(function (pid) {
230
230
  var te = tabMap.get(pid);
231
- return (te &&
232
- te.value.element.classList.contains('dv-tab--group-expanding'));
231
+ return te === null || te === void 0 ? void 0 : te.value.element.classList.contains('dv-tab--group-expanding');
233
232
  });
234
233
  if (isAnimating && chipEl) {
235
234
  var chipRect = chipEl.getBoundingClientRect();
@@ -349,7 +348,10 @@ var WrapTabGroupIndicator = /** @class */ (function (_super) {
349
348
  // Ensure SVG + path child exists (created once, reused)
350
349
  var svg = underline.firstElementChild;
351
350
  var path;
352
- if (!svg || svg.tagName !== 'svg') {
351
+ if ((svg === null || svg === void 0 ? void 0 : svg.tagName) === 'svg') {
352
+ path = svg.firstElementChild;
353
+ }
354
+ else {
353
355
  underline.replaceChildren();
354
356
  svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
355
357
  svg.style.display = 'block';
@@ -358,9 +360,6 @@ var WrapTabGroupIndicator = /** @class */ (function (_super) {
358
360
  svg.appendChild(path);
359
361
  underline.appendChild(svg);
360
362
  }
361
- else {
362
- path = svg.firstElementChild;
363
- }
364
363
  path.setAttribute('stroke', color);
365
364
  path.setAttribute('stroke-width', String(t));
366
365
  if (!activeTabEntry) {
@@ -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;
@@ -47,7 +47,6 @@ var dndCapabilities_1 = require("../../dndCapabilities");
47
47
  var tabGroupAccent_1 = require("../../tabGroupAccent");
48
48
  var tabGroupChip_1 = require("./tabGroupChip");
49
49
  var droptarget_1 = require("../../../dnd/droptarget");
50
- var dataTransfer_2 = require("../../../dnd/dataTransfer");
51
50
  var tabGroupIndicator_1 = require("./tabGroupIndicator");
52
51
  var EMPTY_MAP = new Map();
53
52
  var TabGroupManager = /** @class */ (function () {
@@ -90,6 +89,7 @@ var TabGroupManager = /** @class */ (function () {
90
89
  */
91
90
  TabGroupManager.prototype.update = function () {
92
91
  var e_1, _a, e_2, _b;
92
+ var _c;
93
93
  var model = this._ctx.group.model;
94
94
  var tabGroups = model.getTabGroups();
95
95
  // Track which group IDs are still active
@@ -111,11 +111,12 @@ var TabGroupManager = /** @class */ (function () {
111
111
  }
112
112
  try {
113
113
  // Remove chips for dissolved/destroyed groups
114
- for (var _c = __values(this._chipRenderers), _d = _c.next(); !_d.done; _d = _c.next()) {
115
- var _e = __read(_d.value, 2), groupId = _e[0], entry = _e[1];
114
+ for (var _d = __values(this._chipRenderers), _e = _d.next(); !_e.done; _e = _d.next()) {
115
+ var _f = __read(_e.value, 2), groupId = _f[0], entry = _f[1];
116
116
  if (!activeGroupIds.has(groupId)) {
117
117
  entry.chip.element.remove();
118
118
  entry.chip.dispose();
119
+ (_c = entry.dragSourcesDisposable) === null || _c === void 0 ? void 0 : _c.dispose();
119
120
  entry.disposable.dispose();
120
121
  this._chipRenderers.delete(groupId);
121
122
  }
@@ -124,7 +125,7 @@ var TabGroupManager = /** @class */ (function () {
124
125
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
125
126
  finally {
126
127
  try {
127
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
128
+ if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
128
129
  }
129
130
  finally { if (e_2) throw e_2.error; }
130
131
  }
@@ -297,20 +298,21 @@ var TabGroupManager = /** @class */ (function () {
297
298
  };
298
299
  TabGroupManager.prototype.updateDragAndDropState = function () {
299
300
  var e_7, _a;
301
+ var _b, _c, _d;
300
302
  var caps = (0, dndCapabilities_1.resolveDndCapabilities)(this._ctx.accessor.options);
301
303
  try {
302
- for (var _b = __values(this._chipRenderers.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
303
- var entry = _c.value;
304
+ for (var _e = __values(this._chipRenderers.values()), _f = _e.next(); !_f.done; _f = _e.next()) {
305
+ var entry = _f.value;
304
306
  entry.chip.element.draggable = caps.html5;
305
- entry.html5DragSource.setDisabled(!caps.html5);
306
- entry.pointerDragSource.setDisabled(!caps.pointer);
307
- entry.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);
307
+ (_b = entry.html5DragSource) === null || _b === void 0 ? void 0 : _b.setDisabled(!caps.html5);
308
+ (_c = entry.pointerDragSource) === null || _c === void 0 ? void 0 : _c.setDisabled(!caps.pointer);
309
+ (_d = entry.pointerDragSource) === null || _d === void 0 ? void 0 : _d.setTouchOnly(!caps.pointerHandlesMouse);
308
310
  }
309
311
  }
310
312
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
311
313
  finally {
312
314
  try {
313
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
315
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
314
316
  }
315
317
  finally { if (e_7) throw e_7.error; }
316
318
  }
@@ -321,19 +323,28 @@ var TabGroupManager = /** @class */ (function () {
321
323
  * iframe shield are released BEFORE the cross-group move detaches
322
324
  * the chip (chip dispose is scheduled on a microtask via
323
325
  * `_scheduleTabGroupUpdate`, which is too late for callers that read
324
- * `getPanelData()` synchronously after the move). Idempotent — the
325
- * subsequent `update()` will also dispose the sources.
326
+ * `getPanelData()` synchronously after the move).
327
+ *
328
+ * A cross-group move dissolves the source chip entirely, but a
329
+ * within-group reorder keeps the same chip element — so the sources are
330
+ * cleared to `undefined` here and the subsequent `update()` re-arms them
331
+ * via `_ensureChipForGroup`. Without that re-arm the chip would fire a
332
+ * native `dragstart` (the element keeps `draggable=true`) but never set
333
+ * a transfer payload, leaving the group permanently undraggable after
334
+ * its first move. (#1410)
326
335
  */
327
336
  TabGroupManager.prototype.disposeChipDrag = function (tabGroupId) {
328
- var _a, _b;
337
+ var _a;
329
338
  var entry = this._chipRenderers.get(tabGroupId);
330
339
  if (!entry) {
331
340
  return;
332
341
  }
333
342
  // Optional-chained because tests may inject minimal entries
334
343
  // that skip the manager's normal `_ensureChipForGroup` flow.
335
- (_a = entry.html5DragSource) === null || _a === void 0 ? void 0 : _a.dispose();
336
- (_b = entry.pointerDragSource) === null || _b === void 0 ? void 0 : _b.dispose();
344
+ (_a = entry.dragSourcesDisposable) === null || _a === void 0 ? void 0 : _a.dispose();
345
+ entry.html5DragSource = undefined;
346
+ entry.pointerDragSource = undefined;
347
+ entry.dragSourcesDisposable = undefined;
337
348
  };
338
349
  /** Cloned chip rect used as the pointer follow-finger ghost. */
339
350
  TabGroupManager.prototype._buildChipGhostElement = function (chipEl) {
@@ -347,35 +358,36 @@ var TabGroupManager = /** @class */ (function () {
347
358
  };
348
359
  TabGroupManager.prototype.disposeAll = function () {
349
360
  var e_8, _a, e_9, _b;
350
- var _c;
361
+ var _c, _d;
351
362
  (_c = this._indicator) === null || _c === void 0 ? void 0 : _c.dispose();
352
363
  this._indicator = null;
353
364
  try {
354
- for (var _d = __values(this._pendingTransitionCleanups), _e = _d.next(); !_e.done; _e = _d.next()) {
355
- var _f = __read(_e.value, 2), cleanup = _f[1];
365
+ for (var _e = __values(this._pendingTransitionCleanups), _f = _e.next(); !_f.done; _f = _e.next()) {
366
+ var _g = __read(_f.value, 2), cleanup = _g[1];
356
367
  cleanup();
357
368
  }
358
369
  }
359
370
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
360
371
  finally {
361
372
  try {
362
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
373
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
363
374
  }
364
375
  finally { if (e_8) throw e_8.error; }
365
376
  }
366
377
  this._pendingTransitionCleanups.clear();
367
378
  try {
368
- for (var _g = __values(this._chipRenderers), _h = _g.next(); !_h.done; _h = _g.next()) {
369
- var _j = __read(_h.value, 2), entry = _j[1];
379
+ for (var _h = __values(this._chipRenderers), _j = _h.next(); !_j.done; _j = _h.next()) {
380
+ var _k = __read(_j.value, 2), entry = _k[1];
370
381
  entry.chip.element.remove();
371
382
  entry.chip.dispose();
383
+ (_d = entry.dragSourcesDisposable) === null || _d === void 0 ? void 0 : _d.dispose();
372
384
  entry.disposable.dispose();
373
385
  }
374
386
  }
375
387
  catch (e_9_1) { e_9 = { error: e_9_1 }; }
376
388
  finally {
377
389
  try {
378
- if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
390
+ if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
379
391
  }
380
392
  finally { if (e_9) throw e_9.error; }
381
393
  }
@@ -383,7 +395,7 @@ var TabGroupManager = /** @class */ (function () {
383
395
  };
384
396
  TabGroupManager.prototype._ensureIndicator = function () {
385
397
  var _this = this;
386
- var _a, _b;
398
+ var _a, _b, _c;
387
399
  var mode = (_b = (_a = this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabGroupIndicator) !== null && _b !== void 0 ? _b : 'wrap';
388
400
  var Ctor = mode === 'none' ? tabGroupIndicator_1.NoneTabGroupIndicator : tabGroupIndicator_1.WrapTabGroupIndicator;
389
401
  // Re-create if the indicator type changed (e.g. theme switch)
@@ -391,29 +403,25 @@ var TabGroupManager = /** @class */ (function () {
391
403
  this._indicator.dispose();
392
404
  this._indicator = null;
393
405
  }
394
- if (!this._indicator) {
395
- this._indicator = new Ctor({
396
- tabsList: this._ctx.tabsList,
397
- getTabGroups: function () { return _this._ctx.group.model.getTabGroups(); },
398
- getActivePanelId: function () { var _a; return (_a = _this._ctx.group.activePanel) === null || _a === void 0 ? void 0 : _a.id; },
399
- getTabMap: function () { return _this._ctx.getTabMap(); },
400
- getChipElement: function (id) { var _a; return (_a = _this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
401
- getDirection: function () { return _this._ctx.getDirection(); },
402
- getHeaderPosition: function () { return _this._ctx.group.model.headerPosition; },
403
- getColorPalette: function () { return _this._ctx.accessor.tabGroupColorPalette; },
404
- });
405
- }
406
+ (_c = this._indicator) !== null && _c !== void 0 ? _c : (this._indicator = new Ctor({
407
+ tabsList: this._ctx.tabsList,
408
+ getTabGroups: function () { return _this._ctx.group.model.getTabGroups(); },
409
+ getActivePanelId: function () { var _a; return (_a = _this._ctx.group.activePanel) === null || _a === void 0 ? void 0 : _a.id; },
410
+ getTabMap: function () { return _this._ctx.getTabMap(); },
411
+ getChipElement: function (id) { var _a; return (_a = _this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
412
+ getDirection: function () { return _this._ctx.getDirection(); },
413
+ getHeaderPosition: function () { return _this._ctx.group.model.headerPosition; },
414
+ getColorPalette: function () { return _this._ctx.accessor.tabGroupColorPalette; },
415
+ }));
406
416
  };
407
- TabGroupManager.prototype._ensureChipForGroup = function (tabGroup) {
417
+ /**
418
+ * Create the HTML5 + pointer drag sources for a chip (and the direct
419
+ * dragend listener that clears the transfer synchronously). Extracted so
420
+ * both the initial chip build and the post-move re-arm in
421
+ * `_ensureChipForGroup` share one wiring path. (#1410)
422
+ */
423
+ TabGroupManager.prototype._createChipDragSources = function (chip, tabGroup) {
408
424
  var _this = this;
409
- if (this._chipRenderers.has(tabGroup.id)) {
410
- return;
411
- }
412
- var createChip = this._ctx.accessor.options.createTabGroupChipComponent;
413
- var chip = createChip
414
- ? createChip(tabGroup)
415
- : new tabGroupChip_1.TabGroupChip(this._ctx.accessor.tabGroupColorPalette);
416
- chip.init({ tabGroup: tabGroup, api: this._ctx.accessor.api });
417
425
  var caps = (0, dndCapabilities_1.resolveDndCapabilities)(this._ctx.accessor.options);
418
426
  chip.element.draggable = caps.html5;
419
427
  var panelTransfer = dataTransfer_1.LocalSelectionTransfer.getInstance();
@@ -467,9 +475,12 @@ var TabGroupManager = /** @class */ (function () {
467
475
  // the listener survives chip disposal in the detach-then-dragend
468
476
  // cross-group path; `once: true` auto-removes after the single
469
477
  // dragend that we care about. (#1254)
470
- chip.element.addEventListener('dragend', function () {
478
+ var onDragEndClear = function () {
471
479
  panelTransfer.clearData(dataTransfer_1.PanelTransfer.prototype);
472
- }, { once: true });
480
+ };
481
+ chip.element.addEventListener('dragend', onDragEndClear, {
482
+ once: true,
483
+ });
473
484
  var pointerDragSource = backend_1.pointerBackend.createDragSource(chip.element, {
474
485
  getData: getData,
475
486
  disabled: !caps.pointer,
@@ -486,6 +497,42 @@ var TabGroupManager = /** @class */ (function () {
486
497
  _this._callbacks.onChipDragStart(tabGroup, chip, event);
487
498
  },
488
499
  });
500
+ return {
501
+ html5DragSource: html5DragSource,
502
+ pointerDragSource: pointerDragSource,
503
+ disposable: {
504
+ dispose: function () {
505
+ html5DragSource.dispose();
506
+ pointerDragSource.dispose();
507
+ chip.element.removeEventListener('dragend', onDragEndClear);
508
+ },
509
+ },
510
+ };
511
+ };
512
+ TabGroupManager.prototype._ensureChipForGroup = function (tabGroup) {
513
+ var _this = this;
514
+ var existing = this._chipRenderers.get(tabGroup.id);
515
+ if (existing) {
516
+ // A committed group move tears down the chip's drag sources via
517
+ // `disposeChipDrag`, but a within-group reorder keeps the same
518
+ // chip element alive. Re-arm the sources so the group stays
519
+ // draggable; without this the chip is stuck after its first
520
+ // move — `dragstart` still fires (the element keeps
521
+ // `draggable=true`) but no transfer payload is set. (#1410)
522
+ if (!existing.html5DragSource) {
523
+ var sources = this._createChipDragSources(existing.chip, tabGroup);
524
+ existing.html5DragSource = sources.html5DragSource;
525
+ existing.pointerDragSource = sources.pointerDragSource;
526
+ existing.dragSourcesDisposable = sources.disposable;
527
+ }
528
+ return;
529
+ }
530
+ var createChip = this._ctx.accessor.options.createTabGroupChipComponent;
531
+ var chip = createChip
532
+ ? createChip(tabGroup)
533
+ : new tabGroupChip_1.TabGroupChip(this._ctx.accessor.tabGroupColorPalette);
534
+ chip.init({ tabGroup: tabGroup, api: this._ctx.accessor.api });
535
+ var dragSources = this._createChipDragSources(chip, tabGroup);
489
536
  var disposables = [
490
537
  tabGroup.onDidChange(function () {
491
538
  var _a;
@@ -499,17 +546,19 @@ var TabGroupManager = /** @class */ (function () {
499
546
  tabGroup.onDidCollapseChange(function () {
500
547
  _this._updateTabGroupClasses();
501
548
  }),
502
- html5DragSource,
503
- pointerDragSource,
504
549
  ];
505
550
  // Context menu: built-in TabGroupChip already aggregates right-click
506
551
  // + touch long-press into `onContextMenu`. Custom chip renderers
507
552
  // don't, so attach a long-press detector and contextmenu listener
508
553
  // directly on their element.
509
554
  var onContextMenu = function (event) {
555
+ var _a, _b;
510
556
  // A long-press on a chip should preempt the in-flight pointer
511
- // drag and open the menu instead.
512
- pointerDragSource.cancelPending();
557
+ // drag and open the menu instead. Resolve the source from the
558
+ // entry so a post-move re-armed source is cancelled, not the
559
+ // stale one captured at build time. (#1410)
560
+ (_b = (_a = _this._chipRenderers
561
+ .get(tabGroup.id)) === null || _a === void 0 ? void 0 : _a.pointerDragSource) === null || _b === void 0 ? void 0 : _b.cancelPending();
513
562
  _this._callbacks.onChipContextMenu(tabGroup, event);
514
563
  };
515
564
  if (chip instanceof tabGroupChip_1.TabGroupChip) {
@@ -541,8 +590,8 @@ var TabGroupManager = /** @class */ (function () {
541
590
  if (_this._ctx.accessor.options.disableDnd) {
542
591
  return false;
543
592
  }
544
- var data = (0, dataTransfer_2.getPanelData)();
545
- if (data && _this._ctx.accessor.id === data.viewId) {
593
+ var data = (0, dataTransfer_1.getPanelData)();
594
+ if (_this._ctx.accessor.id === (data === null || data === void 0 ? void 0 : data.viewId)) {
546
595
  if (((_a = _this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) ===
547
596
  'smooth') {
548
597
  return false;
@@ -558,8 +607,9 @@ var TabGroupManager = /** @class */ (function () {
558
607
  var disposable = new (lifecycle_1.CompositeDisposable.bind.apply(lifecycle_1.CompositeDisposable, __spreadArray([void 0], __read(disposables), false)))();
559
608
  this._chipRenderers.set(tabGroup.id, {
560
609
  chip: chip,
561
- html5DragSource: html5DragSource,
562
- pointerDragSource: pointerDragSource,
610
+ html5DragSource: dragSources.html5DragSource,
611
+ pointerDragSource: dragSources.pointerDragSource,
612
+ dragSourcesDisposable: dragSources.disposable,
563
613
  disposable: disposable,
564
614
  dropTarget: dropTarget,
565
615
  });