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
@@ -1,14 +1,18 @@
1
- import { CompositeDisposable, MutableDisposable, } from '../../../lifecycle';
1
+ import { CompositeDisposable, Disposable, MutableDisposable, } from '../../../lifecycle';
2
2
  import { Emitter } from '../../../events';
3
3
  import { trackFocus } from '../../../dom';
4
4
  import { Droptarget } from '../../../dnd/droptarget';
5
5
  import { pointerBackend } from '../../../dnd/backend';
6
6
  import { getPanelData } from '../../../dnd/dataTransfer';
7
+ let _contentId = 0;
8
+ /** Stable DOM id so each tab's `aria-controls` can reference its tabpanel. */
9
+ const nextContentId = () => `dv-tabpanel-${_contentId++}`;
7
10
  export class ContentContainer extends CompositeDisposable {
8
11
  get element() {
9
12
  return this._element;
10
13
  }
11
14
  constructor(accessor, group) {
15
+ var _a, _b, _c, _d, _e, _f, _g;
12
16
  super();
13
17
  this.accessor = accessor;
14
18
  this.group = group;
@@ -20,8 +24,17 @@ export class ContentContainer extends CompositeDisposable {
20
24
  this._element = document.createElement('div');
21
25
  this._element.className = 'dv-content-container';
22
26
  this._element.tabIndex = -1;
27
+ // WAI-ARIA Tabs pattern: the single content area per group is the
28
+ // tabpanel; `aria-labelledby` is pointed at the active tab in
29
+ // `setLabelledBy` (driven from the group model on activation).
30
+ this._element.id = nextContentId();
31
+ this._element.setAttribute('role', 'tabpanel');
23
32
  this.addDisposables(this._onDidFocus, this._onDidBlur);
24
- const target = group.dropTargetContainer;
33
+ // Resolve the override anchor dynamically: a group can be relocated
34
+ // between roots (grid / floating / popout) after construction, and the
35
+ // popout anchor in particular lives in another window — a value
36
+ // captured here would mount overlays in the wrong window.
37
+ const getOverrideTarget = () => { var _a; return (_a = group.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; };
25
38
  const canDisplayOverlay = (event, position) => {
26
39
  if (this.group.locked === 'no-drop-target' ||
27
40
  (this.group.locked && position === 'center')) {
@@ -51,7 +64,8 @@ export class ContentContainer extends CompositeDisposable {
51
64
  className: 'dv-drop-target-content',
52
65
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
53
66
  canDisplayOverlay,
54
- getOverrideTarget: target ? () => target.model : undefined,
67
+ getOverrideTarget,
68
+ overlayModel: (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content'),
55
69
  });
56
70
  this.pointerDropTarget = pointerBackend.createDropTarget(this.element, {
57
71
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
@@ -63,9 +77,18 @@ export class ContentContainer extends CompositeDisposable {
63
77
  : null;
64
78
  },
65
79
  className: 'dv-drop-target-content',
66
- getOverrideTarget: target ? () => target.model : undefined,
80
+ getOverrideTarget,
81
+ overlayModel: (_d = (_c = this.accessor).resolveDropOverlayModel) === null || _d === void 0 ? void 0 : _d.call(_c, 'content'),
67
82
  });
68
- this.addDisposables(this.dropTarget, this.pointerDropTarget);
83
+ this.addDisposables(this.dropTarget, this.pointerDropTarget,
84
+ // Re-apply the app-supplied overlay model when options change.
85
+ // `{}` resets to the built-in default (all fields optional).
86
+ (_g = (_f = (_e = this.accessor).onDidOptionsChange) === null || _f === void 0 ? void 0 : _f.call(_e, () => {
87
+ var _a, _b, _c;
88
+ const model = (_c = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content')) !== null && _c !== void 0 ? _c : {};
89
+ this.dropTarget.setOverlayModel(model);
90
+ this.pointerDropTarget.setOverlayModel(model);
91
+ })) !== null && _g !== void 0 ? _g : Disposable.NONE);
69
92
  }
70
93
  show() {
71
94
  this.element.style.display = '';
@@ -73,6 +96,14 @@ export class ContentContainer extends CompositeDisposable {
73
96
  hide() {
74
97
  this.element.style.display = 'none';
75
98
  }
99
+ setLabelledBy(tabElementId) {
100
+ if (tabElementId) {
101
+ this._element.setAttribute('aria-labelledby', tabElementId);
102
+ }
103
+ else {
104
+ this._element.removeAttribute('aria-labelledby');
105
+ }
106
+ }
76
107
  renderPanel(panel, options = { asActive: true }) {
77
108
  var _a, _b, _c, _d;
78
109
  const doRender = options.asActive ||
@@ -5,11 +5,15 @@ import { toggleClass } from '../../../dom';
5
5
  import { html5Backend, pointerBackend, } from '../../../dnd/backend';
6
6
  import { LongPressDetector } from '../../../dnd/pointer/longPress';
7
7
  import { resolveDndCapabilities } from '../../dndCapabilities';
8
+ let _tabId = 0;
9
+ /** Stable DOM id referenced by the tabpanel's `aria-labelledby`. */
10
+ const nextTabId = () => `dv-tab-${_tabId++}`;
8
11
  export class Tab extends CompositeDisposable {
9
12
  get element() {
10
13
  return this._element;
11
14
  }
12
15
  constructor(panel, accessor, group) {
16
+ var _a, _b;
13
17
  super();
14
18
  this.panel = panel;
15
19
  this.accessor = accessor;
@@ -30,8 +34,20 @@ export class Tab extends CompositeDisposable {
30
34
  const caps = resolveDndCapabilities(this.accessor.options);
31
35
  this._element = document.createElement('div');
32
36
  this._element.className = 'dv-tab';
33
- this._element.tabIndex = 0;
37
+ // Roving tabindex (WAI-ARIA Tabs pattern): only the active tab is in
38
+ // the tab order; `setActive` flips this. Inactive tabs are reachable
39
+ // via arrow keys, handled by the tab strip.
40
+ this._element.tabIndex = -1;
34
41
  this._element.draggable = caps.html5;
42
+ // WAI-ARIA Tabs pattern. `aria-controls` points at the group's single
43
+ // tabpanel (the content container); `aria-selected` tracks activation.
44
+ this._element.id = nextTabId();
45
+ this._element.setAttribute('role', 'tab');
46
+ this._element.setAttribute('aria-selected', 'false');
47
+ const contentContainerId = (_b = (_a = this.group) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.contentContainerId;
48
+ if (contentContainerId) {
49
+ this._element.setAttribute('aria-controls', contentContainerId);
50
+ }
35
51
  toggleClass(this.element, 'dv-inactive-tab', true);
36
52
  const canDisplayOverlay = (event, position) => {
37
53
  var _a;
@@ -114,13 +130,15 @@ export class Tab extends CompositeDisposable {
114
130
  }), addDisposableListener(this._element, 'click', (event) => {
115
131
  this._onTabClick.fire(event);
116
132
  }), addDisposableListener(this._element, 'contextmenu', (event) => {
117
- this.accessor.contextMenuController.show(this.panel, this.group, event);
133
+ var _a;
134
+ (_a = this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(this.panel, this.group, event);
118
135
  }), new LongPressDetector(this._element, {
119
136
  onLongPress: (event) => {
137
+ var _a;
120
138
  // Don't let a subsequent finger move arm a drag on top
121
139
  // of the just-opened menu.
122
140
  this.pointerDragSource.cancelPending();
123
- this.accessor.contextMenuController.show(this.panel, this.group, event);
141
+ (_a = this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(this.panel, this.group, event);
124
142
  },
125
143
  }), this.dropTarget.onDrop((event) => {
126
144
  this._onDropped.fire(event);
@@ -131,6 +149,10 @@ export class Tab extends CompositeDisposable {
131
149
  setActive(isActive) {
132
150
  toggleClass(this.element, 'dv-active-tab', isActive);
133
151
  toggleClass(this.element, 'dv-inactive-tab', !isActive);
152
+ this._element.setAttribute('aria-selected', isActive ? 'true' : 'false');
153
+ // Roving tabindex anchors to the active tab; arrow-key navigation in
154
+ // the tab strip moves the rover from there.
155
+ this._element.tabIndex = isActive ? 0 : -1;
134
156
  }
135
157
  setContent(part) {
136
158
  if (this.content) {
@@ -140,12 +162,18 @@ export class Tab extends CompositeDisposable {
140
162
  this._element.appendChild(this.content.element);
141
163
  }
142
164
  _buildOverlayModel() {
143
- var _a;
165
+ var _a, _b, _c;
166
+ // An app-supplied model (the dropOverlayModel option) takes precedence
167
+ // over the theme-derived default for this tab.
168
+ const custom = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'tab', this.group);
169
+ if (custom) {
170
+ return custom;
171
+ }
144
172
  // 'line' themes render a 4px insertion strip at the tab edge via the
145
173
  // anchor container's small-boundary path. 'fill' themes render a
146
174
  // half-width highlighted area, so we disable the small-boundary path
147
175
  // entirely (boundary = 0 ⟹ isSmall always false).
148
- const smallBoundary = ((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.dndTabIndicator) === 'line'
176
+ const smallBoundary = ((_c = this.accessor.options.theme) === null || _c === void 0 ? void 0 : _c.dndTabIndicator) === 'line'
149
177
  ? Number.POSITIVE_INFINITY
150
178
  : 0;
151
179
  return {
@@ -0,0 +1,35 @@
1
+ import { DockviewComponent } from '../../dockviewComponent';
2
+ import { Event } from '../../../events';
3
+ import { CompositeDisposable } from '../../../lifecycle';
4
+ import { DockviewGroupPanel } from '../../dockviewGroupPanel';
5
+ /**
6
+ * A dedicated, blank drag handle rendered above a floating group's tab bar.
7
+ *
8
+ * It plays the same dual role the tab-bar void container plays today: a plain
9
+ * pointer-drag moves the floating window (wired by the overlay via
10
+ * `setupDrag`), while a shift+drag (mouse) or long-press (touch) detaches the
11
+ * group to redock it into the grid. The redock half is provided by the shared
12
+ * {@link GroupDragSource}; the move half is owned by the overlay.
13
+ *
14
+ * The bar is intentionally contentless — styling is driven entirely through
15
+ * the `--dv-floating-titlebar-*` theme variables.
16
+ */
17
+ export declare class FloatingTitleBar extends CompositeDisposable {
18
+ private readonly accessor;
19
+ private readonly _element;
20
+ private readonly dragSource;
21
+ private _group;
22
+ private readonly _onDragStart;
23
+ readonly onDragStart: Event<PointerEvent | DragEvent>;
24
+ get element(): HTMLElement;
25
+ /** The window's current anchor group — the one this bar drags/activates. */
26
+ get group(): DockviewGroupPanel;
27
+ /**
28
+ * Retarget the bar at a new anchor group. Called when the original anchor
29
+ * leaves a multi-group floating window and another member is promoted, so
30
+ * the bar keeps activating/redocking a group that actually lives here.
31
+ */
32
+ setGroup(group: DockviewGroupPanel): void;
33
+ constructor(accessor: DockviewComponent, group: DockviewGroupPanel);
34
+ updateDragAndDropState(): void;
35
+ }
@@ -0,0 +1,65 @@
1
+ import { addDisposableListener, Emitter } from '../../../events';
2
+ import { CompositeDisposable } from '../../../lifecycle';
3
+ import { quasiPreventDefault } from '../../../dom';
4
+ import { GroupDragSource } from './groupDragSource';
5
+ /**
6
+ * A dedicated, blank drag handle rendered above a floating group's tab bar.
7
+ *
8
+ * It plays the same dual role the tab-bar void container plays today: a plain
9
+ * pointer-drag moves the floating window (wired by the overlay via
10
+ * `setupDrag`), while a shift+drag (mouse) or long-press (touch) detaches the
11
+ * group to redock it into the grid. The redock half is provided by the shared
12
+ * {@link GroupDragSource}; the move half is owned by the overlay.
13
+ *
14
+ * The bar is intentionally contentless — styling is driven entirely through
15
+ * the `--dv-floating-titlebar-*` theme variables.
16
+ */
17
+ export class FloatingTitleBar extends CompositeDisposable {
18
+ get element() {
19
+ return this._element;
20
+ }
21
+ /** The window's current anchor group — the one this bar drags/activates. */
22
+ get group() {
23
+ return this._group;
24
+ }
25
+ /**
26
+ * Retarget the bar at a new anchor group. Called when the original anchor
27
+ * leaves a multi-group floating window and another member is promoted, so
28
+ * the bar keeps activating/redocking a group that actually lives here.
29
+ */
30
+ setGroup(group) {
31
+ this._group = group;
32
+ }
33
+ constructor(accessor, group) {
34
+ super();
35
+ this.accessor = accessor;
36
+ this._onDragStart = new Emitter();
37
+ this.onDragStart = this._onDragStart.event;
38
+ this._group = group;
39
+ this._element = document.createElement('div');
40
+ this._element.className = 'dv-floating-titlebar';
41
+ this.addDisposables(this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
42
+ this.accessor.doSetGroupActive(this._group);
43
+ }),
44
+ // Shift+pointerdown marks the event so the overlay's
45
+ // move-the-float drag doesn't fire alongside the HTML5 redock
46
+ // drag. See VoidContainer for the same disambiguation.
47
+ addDisposableListener(this._element, 'pointerdown', (e) => {
48
+ if (e.shiftKey) {
49
+ quasiPreventDefault(e);
50
+ }
51
+ }, true));
52
+ this.dragSource = new GroupDragSource({
53
+ element: this._element,
54
+ accessor: this.accessor,
55
+ // resolve lazily so the drag source follows anchor reassignment
56
+ group: () => this._group,
57
+ });
58
+ this.addDisposables(this.dragSource, this.dragSource.onDragStart((event) => {
59
+ this._onDragStart.fire(event);
60
+ }));
61
+ }
62
+ updateDragAndDropState() {
63
+ this.dragSource.updateDragAndDropState();
64
+ }
65
+ }
@@ -0,0 +1,52 @@
1
+ import { DockviewComponent } from '../../dockviewComponent';
2
+ import { Event } from '../../../events';
3
+ import { CompositeDisposable } from '../../../lifecycle';
4
+ import { DockviewGroupPanel } from '../../dockviewGroupPanel';
5
+ declare const FLOATING_REDOCK_INITIATION_DELAY_MS = 500;
6
+ export interface GroupDragSourceOptions {
7
+ readonly element: HTMLElement;
8
+ readonly accessor: DockviewComponent;
9
+ /**
10
+ * The group this handle drags. Pass a function when the handle outlives the
11
+ * group it represents and can be retargeted — e.g. a floating window's
12
+ * dedicated title bar, whose anchor group is reassigned when the original
13
+ * anchor leaves a multi-group window. A fixed reference (the tab-bar void
14
+ * container, which lives inside its own group's DOM) is also accepted.
15
+ */
16
+ readonly group: DockviewGroupPanel | (() => DockviewGroupPanel);
17
+ /**
18
+ * Whether this element is the floating window's move handle. Only the move
19
+ * handle needs the floating disambiguation (shift for mouse / long-press
20
+ * for touch) that keeps the redock gesture from firing alongside the
21
+ * move-the-float gesture. Other handles on a floating group (e.g. the tab
22
+ * bar's void container when a dedicated title bar is the move handle) drag
23
+ * to redock with a plain drag, exactly like a group in the main grid.
24
+ * Defaults to `() => true`.
25
+ */
26
+ readonly isFloatingMoveHandle?: () => boolean;
27
+ }
28
+ /**
29
+ * The drag-source half of a group drag handle: html5 + pointer drag sources
30
+ * that publish a group-level `PanelTransfer`, the "Multiple Panels (N)" ghost,
31
+ * and the floating-group disambiguation that keeps the redock gesture from
32
+ * firing alongside the overlay's move-the-float gesture.
33
+ *
34
+ * Shared by the tab-bar void container and the dedicated floating title bar so
35
+ * both grab handles redock identically.
36
+ */
37
+ export declare class GroupDragSource extends CompositeDisposable {
38
+ private readonly _element;
39
+ private readonly accessor;
40
+ private readonly groupAccessor;
41
+ private readonly html5DragSource;
42
+ private readonly pointerDragSource;
43
+ private readonly panelTransfer;
44
+ private readonly _onDragStart;
45
+ readonly onDragStart: Event<PointerEvent | DragEvent>;
46
+ private readonly isFloatingMoveHandle;
47
+ private get group();
48
+ constructor(options: GroupDragSourceOptions);
49
+ updateDragAndDropState(): void;
50
+ private getFloatingOverlay;
51
+ }
52
+ export { FLOATING_REDOCK_INITIATION_DELAY_MS };
@@ -0,0 +1,178 @@
1
+ import { LocalSelectionTransfer, PanelTransfer, } from '../../../dnd/dataTransfer';
2
+ import { html5Backend, pointerBackend, } from '../../../dnd/backend';
3
+ import { Emitter } from '../../../events';
4
+ import { CompositeDisposable, Disposable, MutableDisposable, } from '../../../lifecycle';
5
+ import { toggleClass } from '../../../dom';
6
+ import { resolveDndCapabilities } from '../../dndCapabilities';
7
+ // Floating-group redock via touch: require a deliberate long press so the
8
+ // "move the float around" gesture doesn't double-trigger the redock ghost.
9
+ // Infinity pressTolerance disables the pre-arm flick override; any motion
10
+ // during the wait is treated as drag-the-float, not redock intent.
11
+ const FLOATING_REDOCK_INITIATION_DELAY_MS = 500;
12
+ /**
13
+ * The drag-source half of a group drag handle: html5 + pointer drag sources
14
+ * that publish a group-level `PanelTransfer`, the "Multiple Panels (N)" ghost,
15
+ * and the floating-group disambiguation that keeps the redock gesture from
16
+ * firing alongside the overlay's move-the-float gesture.
17
+ *
18
+ * Shared by the tab-bar void container and the dedicated floating title bar so
19
+ * both grab handles redock identically.
20
+ */
21
+ export class GroupDragSource extends CompositeDisposable {
22
+ // Resolved lazily so a retargetable handle (the floating title bar) always
23
+ // drags the window's *current* anchor group, not the one captured here.
24
+ get group() {
25
+ return this.groupAccessor();
26
+ }
27
+ constructor(options) {
28
+ var _a, _b, _c;
29
+ super();
30
+ this.panelTransfer = LocalSelectionTransfer.getInstance();
31
+ this._onDragStart = new Emitter();
32
+ this.onDragStart = this._onDragStart.event;
33
+ this._element = options.element;
34
+ this.accessor = options.accessor;
35
+ const group = options.group;
36
+ this.groupAccessor = typeof group === 'function' ? group : () => group;
37
+ this.isFloatingMoveHandle =
38
+ (_a = options.isFloatingMoveHandle) !== null && _a !== void 0 ? _a : (() => true);
39
+ const caps = resolveDndCapabilities(this.accessor.options);
40
+ this._element.draggable = caps.html5;
41
+ toggleClass(this._element, 'dv-draggable', caps.html5 || caps.pointer);
42
+ this.addDisposables(this._onDragStart);
43
+ const buildMultiPanelsGhost = () => {
44
+ const ghostEl = document.createElement('div');
45
+ const style = window.getComputedStyle(this._element);
46
+ const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
47
+ const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
48
+ ghostEl.style.backgroundColor = bgColor;
49
+ ghostEl.style.color = color;
50
+ ghostEl.style.padding = '2px 8px';
51
+ ghostEl.style.height = '24px';
52
+ ghostEl.style.fontSize = '11px';
53
+ ghostEl.style.lineHeight = '20px';
54
+ ghostEl.style.borderRadius = '12px';
55
+ ghostEl.style.whiteSpace = 'nowrap';
56
+ ghostEl.style.boxSizing = 'border-box';
57
+ // HTML5 setDragImage snapshots the element as appended to the
58
+ // document; a default block-level div would stretch to the
59
+ // body's width and render as a viewport-wide bar.
60
+ ghostEl.style.display = 'inline-block';
61
+ ghostEl.textContent = `Multiple Panels (${this.group.size})`;
62
+ return ghostEl;
63
+ };
64
+ const buildGhostSpec = () => {
65
+ var _a, _b;
66
+ // The custom-ghost resolution (createGroupDragGhostComponent) is
67
+ // owned by the AdvancedDnD module; core keeps the default chip and
68
+ // falls back to it when no custom ghost is produced (incl. when
69
+ // the module is absent).
70
+ const customGhost = (_b = (_a = this.accessor).buildGroupDragGhost) === null || _b === void 0 ? void 0 : _b.call(_a, this.group);
71
+ if (customGhost) {
72
+ return customGhost;
73
+ }
74
+ return {
75
+ element: buildMultiPanelsGhost(),
76
+ offsetX: 30,
77
+ offsetY: -10,
78
+ };
79
+ };
80
+ const sharedDragOptions = {
81
+ getData: () => {
82
+ this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, null)], PanelTransfer.prototype);
83
+ return {
84
+ dispose: () => {
85
+ this.panelTransfer.clearData(PanelTransfer.prototype);
86
+ },
87
+ };
88
+ },
89
+ createGhost: buildGhostSpec,
90
+ onDragStart: (event) => {
91
+ this._onDragStart.fire(event);
92
+ },
93
+ };
94
+ this.html5DragSource = html5Backend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.html5, isCancelled: (event) => {
95
+ // HTML5: when this element is the floating window's move
96
+ // handle, redock needs shift+drag (otherwise click-and-drag
97
+ // conflicts with moving the float). A non-move-handle (e.g. the
98
+ // void container when a title bar moves the float) redocks with
99
+ // a plain drag, like a group in the main grid.
100
+ if (this.group.api.location.type === 'floating' &&
101
+ this.isFloatingMoveHandle() &&
102
+ !event.shiftKey) {
103
+ return true;
104
+ }
105
+ if (this.group.api.location.type === 'edge' &&
106
+ this.group.size === 0) {
107
+ return true;
108
+ }
109
+ return false;
110
+ } }));
111
+ // Only the move handle needs the touch disambiguation; other handles
112
+ // redock with the normal grid press behaviour.
113
+ const isFloating = () => {
114
+ var _a, _b, _c;
115
+ 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' &&
116
+ this.isFloatingMoveHandle();
117
+ };
118
+ this.pointerDragSource = pointerBackend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.pointer, touchOnly: !caps.pointerHandlesMouse,
119
+ // Floating groups share this element with the overlay's
120
+ // move-the-float drag. Without a longer hold + tolerance
121
+ // override, both gestures commit simultaneously and the
122
+ // user sees the float follow their finger *and* a ghost.
123
+ touchInitiationDelay: () => isFloating() ? FLOATING_REDOCK_INITIATION_DELAY_MS : 250, pressTolerance: () => (isFloating() ? Infinity : 8), isCancelled: () => {
124
+ if (!resolveDndCapabilities(this.accessor.options).pointer) {
125
+ return true;
126
+ }
127
+ // Pointer: long-press IS the deliberate gesture, so
128
+ // floating groups don't need the shift gate.
129
+ if (this.group.api.location.type === 'edge' &&
130
+ this.group.size === 0) {
131
+ return true;
132
+ }
133
+ return false;
134
+ }, onDragStart: (event) => {
135
+ var _a;
136
+ // Redock just committed — abort any in-flight overlay
137
+ // move so the float stops following the finger while
138
+ // the ghost takes over.
139
+ (_a = this.getFloatingOverlay()) === null || _a === void 0 ? void 0 : _a.cancelPendingDrag();
140
+ this._onDragStart.fire(event);
141
+ } }));
142
+ // Mirror direction: once the overlay's move-the-float gesture has
143
+ // actually moved something, cancel the pending redock arm so the
144
+ // ghost doesn't appear mid-drag if the user holds past 500ms.
145
+ const overlayMoveSub = new MutableDisposable();
146
+ const refreshOverlayMoveSub = () => {
147
+ const overlay = this.getFloatingOverlay();
148
+ overlayMoveSub.value = overlay
149
+ ? overlay.onDidStartMoving(() => {
150
+ this.pointerDragSource.cancelPending();
151
+ })
152
+ : Disposable.NONE;
153
+ };
154
+ refreshOverlayMoveSub();
155
+ this.addDisposables(overlayMoveSub);
156
+ const locationChange = (_c = (_b = this.group) === null || _b === void 0 ? void 0 : _b.api) === null || _c === void 0 ? void 0 : _c.onDidLocationChange;
157
+ if (locationChange) {
158
+ this.addDisposables(locationChange(refreshOverlayMoveSub));
159
+ }
160
+ this.addDisposables(this.html5DragSource, this.pointerDragSource);
161
+ }
162
+ updateDragAndDropState() {
163
+ const caps = resolveDndCapabilities(this.accessor.options);
164
+ this._element.draggable = caps.html5;
165
+ toggleClass(this._element, 'dv-draggable', caps.html5 || caps.pointer);
166
+ this.html5DragSource.setDisabled(!caps.html5);
167
+ this.pointerDragSource.setDisabled(!caps.pointer);
168
+ this.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);
169
+ }
170
+ getFloatingOverlay() {
171
+ var _a, _b;
172
+ if (!this.group) {
173
+ return undefined;
174
+ }
175
+ return (_b = (_a = this.accessor.floatingGroups) === null || _a === void 0 ? void 0 : _a.find((fg) => fg.group === this.group)) === null || _b === void 0 ? void 0 : _b.overlay;
176
+ }
177
+ }
178
+ export { FLOATING_REDOCK_INITIATION_DELAY_MS };
@@ -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 {
@@ -276,6 +276,7 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
276
276
  }
277
277
  const r = 6; // corner radius
278
278
  const half = t / 2;
279
+ const headerPosition = this._ctx.getHeaderPosition();
279
280
  if (isVertical) {
280
281
  const svgW = crossSize;
281
282
  const svgH = mainSize;
@@ -283,19 +284,22 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
283
284
  svg.setAttribute('height', String(svgH));
284
285
  underline.style.width = `${svgW}px`;
285
286
  underline.style.height = `${svgH}px`;
286
- const xLeft = half;
287
- const xRight = svgW - half;
287
+ // right header: indicator on the left edge (invert x sides)
288
+ const isRightHeader = headerPosition === 'right';
289
+ const xNear = isRightHeader ? svgW - half : half;
290
+ const xFar = isRightHeader ? half : svgW - half;
291
+ const cd = isRightHeader ? -1 : 1; // curve direction
288
292
  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}`,
293
+ `M ${xNear},0`,
294
+ `L ${xNear},${aStart - r}`,
295
+ `Q ${xNear},${aStart} ${xNear + cd * r},${aStart}`,
296
+ `L ${xFar - cd * r},${aStart}`,
297
+ `Q ${xFar},${aStart} ${xFar},${aStart + r}`,
298
+ `L ${xFar},${aEnd - r}`,
299
+ `Q ${xFar},${aEnd} ${xFar - cd * r},${aEnd}`,
300
+ `L ${xNear + cd * r},${aEnd}`,
301
+ `Q ${xNear},${aEnd} ${xNear},${aEnd + r}`,
302
+ `L ${xNear},${svgH}`,
299
303
  ].join(' ');
300
304
  path.setAttribute('d', d);
301
305
  }
@@ -306,19 +310,22 @@ export class WrapTabGroupIndicator extends BaseTabGroupIndicator {
306
310
  svg.setAttribute('height', String(svgH));
307
311
  underline.style.width = `${svgW}px`;
308
312
  underline.style.height = `${svgH}px`;
309
- const yBot = svgH - half;
310
- const yTop = half;
313
+ // bottom header: indicator on the top edge (invert y sides)
314
+ const isBottomHeader = headerPosition === 'bottom';
315
+ const yNear = isBottomHeader ? half : svgH - half;
316
+ const yFar = isBottomHeader ? svgH - half : half;
317
+ const cd = isBottomHeader ? 1 : -1; // curve direction
311
318
  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}`,
319
+ `M 0,${yNear}`,
320
+ `L ${aStart - r},${yNear}`,
321
+ `Q ${aStart},${yNear} ${aStart},${yNear + cd * r}`,
322
+ `L ${aStart},${yFar - cd * r}`,
323
+ `Q ${aStart},${yFar} ${aStart + r},${yFar}`,
324
+ `L ${aEnd - r},${yFar}`,
325
+ `Q ${aEnd},${yFar} ${aEnd},${yFar - cd * r}`,
326
+ `L ${aEnd},${yNear + cd * r}`,
327
+ `Q ${aEnd},${yNear} ${aEnd + r},${yNear}`,
328
+ `L ${svgW},${yNear}`,
322
329
  ].join(' ');
323
330
  path.setAttribute('d', d);
324
331
  }
@@ -250,6 +250,7 @@ export class TabGroupManager {
250
250
  getTabMap: () => this._ctx.getTabMap(),
251
251
  getChipElement: (id) => { var _a; return (_a = this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },
252
252
  getDirection: () => this._ctx.getDirection(),
253
+ getHeaderPosition: () => this._ctx.group.model.headerPosition,
253
254
  getColorPalette: () => this._ctx.accessor.tabGroupColorPalette,
254
255
  });
255
256
  }
@@ -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;