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
@@ -0,0 +1,32 @@
1
+ import { IDisposable } from '../lifecycle';
2
+ import { Event } from '../events';
3
+ import { DockviewComponentOptions } from './options';
4
+ import { DockviewGroupPanel } from './dockviewGroupPanel';
5
+ import { DockviewApi } from '../api/component.api';
6
+ export interface IHeaderActionsHost {
7
+ readonly api: DockviewApi;
8
+ readonly options: DockviewComponentOptions;
9
+ readonly groups: DockviewGroupPanel[];
10
+ readonly onDidAddGroup: Event<DockviewGroupPanel>;
11
+ readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
12
+ }
13
+ export interface IHeaderActionsService extends IDisposable {
14
+ /** Re-mount the three header action slots on a single group. */
15
+ refresh(group: DockviewGroupPanel): void;
16
+ /** Re-mount on every group; used when one of the three options changes. */
17
+ refreshAll(): void;
18
+ /** Tear down per-group renderer state. */
19
+ disposeGroup(group: DockviewGroupPanel): void;
20
+ }
21
+ export declare class HeaderActionsService implements IHeaderActionsService {
22
+ private readonly _host;
23
+ private readonly _perGroup;
24
+ constructor(host: IHeaderActionsHost);
25
+ refresh(group: DockviewGroupPanel): void;
26
+ refreshAll(): void;
27
+ disposeGroup(group: DockviewGroupPanel): void;
28
+ dispose(): void;
29
+ private _ensureState;
30
+ private _refreshSlot;
31
+ }
32
+ export declare const HeaderActionsModule: import("./modules").DockviewModule<IHeaderActionsHost>;
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ var __values = (this && this.__values) || function(o) {
3
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
+ if (m) return m.call(o);
5
+ if (o && typeof o.length === "number") return {
6
+ next: function () {
7
+ if (o && i >= o.length) o = void 0;
8
+ return { value: o && o[i++], done: !o };
9
+ }
10
+ };
11
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
+ };
13
+ var __read = (this && this.__read) || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o), r, ar = [], e;
17
+ try {
18
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
+ }
20
+ catch (error) { e = { error: error }; }
21
+ finally {
22
+ try {
23
+ if (r && !r.done && (m = i["return"])) m.call(i);
24
+ }
25
+ finally { if (e) throw e.error; }
26
+ }
27
+ return ar;
28
+ };
29
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.HeaderActionsModule = exports.HeaderActionsService = void 0;
40
+ var lifecycle_1 = require("../lifecycle");
41
+ var modules_1 = require("./modules");
42
+ var SLOT_OPTION_KEY = {
43
+ left: 'createLeftHeaderActionComponent',
44
+ right: 'createRightHeaderActionComponent',
45
+ prefix: 'createPrefixHeaderActionComponent',
46
+ };
47
+ var HeaderActionsService = /** @class */ (function () {
48
+ function HeaderActionsService(host) {
49
+ this._perGroup = new Map();
50
+ this._host = host;
51
+ }
52
+ HeaderActionsService.prototype.refresh = function (group) {
53
+ // The headerPosition setter on DockviewGroupPanelModel fires inside
54
+ // the model's constructor — before the parent DockviewGroupPanel has
55
+ // assigned its `_model` field, and in tests where the parent panel
56
+ // may be null. Skip; DockviewGroupPanel.initialize() will refresh
57
+ // once construction completes for real groups.
58
+ if (!(group === null || group === void 0 ? void 0 : group.model)) {
59
+ return;
60
+ }
61
+ var state = this._ensureState(group);
62
+ this._refreshSlot('left', group, state.left);
63
+ this._refreshSlot('right', group, state.right);
64
+ this._refreshSlot('prefix', group, state.prefix);
65
+ };
66
+ HeaderActionsService.prototype.refreshAll = function () {
67
+ var e_1, _a;
68
+ try {
69
+ for (var _b = __values(this._host.groups), _c = _b.next(); !_c.done; _c = _b.next()) {
70
+ var group = _c.value;
71
+ this.refresh(group);
72
+ }
73
+ }
74
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
75
+ finally {
76
+ try {
77
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
78
+ }
79
+ finally { if (e_1) throw e_1.error; }
80
+ }
81
+ };
82
+ HeaderActionsService.prototype.disposeGroup = function (group) {
83
+ var state = this._perGroup.get(group);
84
+ if (!state) {
85
+ return;
86
+ }
87
+ state.left.dispose();
88
+ state.right.dispose();
89
+ state.prefix.dispose();
90
+ this._perGroup.delete(group);
91
+ };
92
+ HeaderActionsService.prototype.dispose = function () {
93
+ var e_2, _a;
94
+ try {
95
+ for (var _b = __values(__spreadArray([], __read(this._perGroup.keys()), false)), _c = _b.next(); !_c.done; _c = _b.next()) {
96
+ var group = _c.value;
97
+ this.disposeGroup(group);
98
+ }
99
+ }
100
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
101
+ finally {
102
+ try {
103
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
104
+ }
105
+ finally { if (e_2) throw e_2.error; }
106
+ }
107
+ };
108
+ HeaderActionsService.prototype._ensureState = function (group) {
109
+ var state = this._perGroup.get(group);
110
+ if (!state) {
111
+ state = {
112
+ left: new lifecycle_1.MutableDisposable(),
113
+ right: new lifecycle_1.MutableDisposable(),
114
+ prefix: new lifecycle_1.MutableDisposable(),
115
+ };
116
+ this._perGroup.set(group, state);
117
+ }
118
+ return state;
119
+ };
120
+ HeaderActionsService.prototype._refreshSlot = function (slot, group, disposable) {
121
+ var factory = this._host.options[SLOT_OPTION_KEY[slot]];
122
+ if (factory) {
123
+ var renderer = factory(group);
124
+ disposable.value = renderer;
125
+ renderer.init({
126
+ containerApi: this._host.api,
127
+ api: group.api,
128
+ group: group,
129
+ });
130
+ group.model.attachHeaderAction(slot, renderer.element);
131
+ }
132
+ else {
133
+ disposable.dispose();
134
+ group.model.attachHeaderAction(slot, undefined);
135
+ }
136
+ };
137
+ return HeaderActionsService;
138
+ }());
139
+ exports.HeaderActionsService = HeaderActionsService;
140
+ exports.HeaderActionsModule = (0, modules_1.defineModule)({
141
+ name: 'HeaderActions',
142
+ serviceKey: 'headerActionsService',
143
+ create: function (host) { return new HeaderActionsService(host); },
144
+ init: function (host, service) {
145
+ return new lifecycle_1.CompositeDisposable(host.onDidRemoveGroup(function (group) {
146
+ service.disposeGroup(group);
147
+ }));
148
+ },
149
+ });
@@ -0,0 +1,53 @@
1
+ import { CompositeDisposable, IDisposable } from '../lifecycle';
2
+ import { Event } from '../events';
3
+ import { IDockviewPanel } from './dockviewPanel';
4
+ import { DockviewGroupPanel } from './dockviewGroupPanel';
5
+ import { DockviewLayoutMutationEvent, DockviewMaximizedGroupChangeEvent } from './dockviewComponent';
6
+ import { DockviewComponentOptions } from './options';
7
+ /**
8
+ * The narrow surface the {@link LiveRegionService} needs from the host
9
+ * (the `DockviewComponent`) — somewhere to mount the region and the layout
10
+ * events to narrate. `onWill/onDidMutateLayout` are used to suppress the
11
+ * bulk-load / clear burst (one transaction, not N panel announcements).
12
+ */
13
+ export interface ILiveRegionHost {
14
+ readonly element: HTMLElement;
15
+ readonly options: DockviewComponentOptions;
16
+ readonly onDidAddPanel: Event<IDockviewPanel>;
17
+ readonly onDidRemovePanel: Event<IDockviewPanel>;
18
+ readonly onWillMutateLayout: Event<DockviewLayoutMutationEvent>;
19
+ readonly onDidMutateLayout: Event<DockviewLayoutMutationEvent>;
20
+ readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChangeEvent>;
21
+ readonly onDidAddGroup: Event<DockviewGroupPanel>;
22
+ readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
23
+ }
24
+ export interface ILiveRegionService extends IDisposable {
25
+ /**
26
+ * Announce a message to assistive technology via the live region. The
27
+ * shared sink — the accessibility module writes keyboard-docking
28
+ * narration here too, so all announcements use one region.
29
+ */
30
+ announce(message: string, politeness?: 'polite' | 'assertive'): void;
31
+ }
32
+ /**
33
+ * Narrates layout state changes to screen readers via visually-hidden
34
+ * `aria-live` regions. Free / core (WCAG 4.1.3). Announces panel open/close +
35
+ * the shared `announce()` sink (the accessibility module narrates docking here too).
36
+ * Two regions: a **polite** one for routine status and an **assertive** one
37
+ * for errors/cancellations. The bulk load/clear burst is suppressed via the
38
+ * mutation-transaction events, and an app can take over delivery entirely with
39
+ * the `announcer` option.
40
+ */
41
+ export declare class LiveRegionService extends CompositeDisposable implements ILiveRegionService {
42
+ private readonly _host;
43
+ private readonly _polite;
44
+ private readonly _assertive;
45
+ private _suppressDepth;
46
+ private readonly _locationSubs;
47
+ constructor(host: ILiveRegionHost);
48
+ private _trackLocation;
49
+ announce(message: string, politeness?: 'polite' | 'assertive'): void;
50
+ private _announce;
51
+ private _defaultMessage;
52
+ }
53
+ export declare const LiveRegionModule: import("./modules").DockviewModule<ILiveRegionHost>;
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.LiveRegionModule = exports.LiveRegionService = void 0;
19
+ var lifecycle_1 = require("../lifecycle");
20
+ var accessibilityMessages_1 = require("./accessibilityMessages");
21
+ var modules_1 = require("./modules");
22
+ /** Bulk transactions whose per-panel events should not each be announced. */
23
+ var isBulk = function (kind) {
24
+ return kind === 'load' || kind === 'clear';
25
+ };
26
+ function createLiveRegion(politeness) {
27
+ var el = document.createElement('div');
28
+ el.className =
29
+ politeness === 'assertive'
30
+ ? 'dv-live-region-assertive'
31
+ : 'dv-live-region';
32
+ // assertive interrupts the SR (errors / cancellations); polite waits for a
33
+ // pause (routine status). `alert` implies assertive, `status` implies polite.
34
+ el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');
35
+ el.setAttribute('aria-live', politeness);
36
+ el.setAttribute('aria-atomic', 'true');
37
+ // Visually hidden but kept in the accessibility tree (never display:none /
38
+ // visibility:hidden, which would drop it from AT). Standard clip pattern.
39
+ Object.assign(el.style, {
40
+ position: 'absolute',
41
+ width: '1px',
42
+ height: '1px',
43
+ margin: '-1px',
44
+ padding: '0',
45
+ overflow: 'hidden',
46
+ clip: 'rect(0 0 0 0)',
47
+ clipPath: 'inset(50%)',
48
+ whiteSpace: 'nowrap',
49
+ border: '0',
50
+ });
51
+ return el;
52
+ }
53
+ /**
54
+ * Narrates layout state changes to screen readers via visually-hidden
55
+ * `aria-live` regions. Free / core (WCAG 4.1.3). Announces panel open/close +
56
+ * the shared `announce()` sink (the accessibility module narrates docking here too).
57
+ * Two regions: a **polite** one for routine status and an **assertive** one
58
+ * for errors/cancellations. The bulk load/clear burst is suppressed via the
59
+ * mutation-transaction events, and an app can take over delivery entirely with
60
+ * the `announcer` option.
61
+ */
62
+ var LiveRegionService = /** @class */ (function (_super) {
63
+ __extends(LiveRegionService, _super);
64
+ function LiveRegionService(host) {
65
+ var _this = _super.call(this) || this;
66
+ _this._suppressDepth = 0;
67
+ _this._locationSubs = new Map();
68
+ _this._host = host;
69
+ _this._polite = createLiveRegion('polite');
70
+ _this._assertive = createLiveRegion('assertive');
71
+ host.element.appendChild(_this._polite);
72
+ host.element.appendChild(_this._assertive);
73
+ _this.addDisposables({ dispose: function () { return _this._polite.remove(); } }, { dispose: function () { return _this._assertive.remove(); } }, host.onDidAddPanel(function (panel) { return _this._announce(panel, 'open'); }), host.onDidRemovePanel(function (panel) { return _this._announce(panel, 'close'); }),
74
+ // Bracket bulk transactions so a fromJSON / clear doesn't announce
75
+ // every nested add/remove.
76
+ host.onWillMutateLayout(function (e) {
77
+ if (isBulk(e.kind)) {
78
+ _this._suppressDepth++;
79
+ }
80
+ }), host.onDidMutateLayout(function (e) {
81
+ if (isBulk(e.kind)) {
82
+ _this._suppressDepth = Math.max(0, _this._suppressDepth - 1);
83
+ }
84
+ }), host.onDidMaximizedGroupChange(function (e) {
85
+ var panel = e.group.activePanel;
86
+ if (panel) {
87
+ _this._announce(panel, e.isMaximized ? 'maximize' : 'restore');
88
+ }
89
+ }),
90
+ // Narrate a group floating / docking back / popping out. A group is
91
+ // born in the grid then transitions, so track each group's previous
92
+ // location and ignore the no-op initial `-> grid`.
93
+ host.onDidAddGroup(function (group) { return _this._trackLocation(group); }), host.onDidRemoveGroup(function (group) {
94
+ var _a;
95
+ (_a = _this._locationSubs.get(group.id)) === null || _a === void 0 ? void 0 : _a.dispose();
96
+ _this._locationSubs.delete(group.id);
97
+ }), {
98
+ dispose: function () {
99
+ _this._locationSubs.forEach(function (sub) { return sub.dispose(); });
100
+ _this._locationSubs.clear();
101
+ },
102
+ });
103
+ return _this;
104
+ }
105
+ LiveRegionService.prototype._trackLocation = function (group) {
106
+ var _this = this;
107
+ var prev = group.api.location.type;
108
+ var sub = group.api.onDidLocationChange(function (e) {
109
+ var next = e.location.type;
110
+ if (next === prev) {
111
+ return;
112
+ }
113
+ prev = next;
114
+ var panel = group.activePanel;
115
+ if (!panel) {
116
+ return;
117
+ }
118
+ var kind = next === 'floating'
119
+ ? 'float'
120
+ : next === 'popout'
121
+ ? 'popout'
122
+ : 'dock';
123
+ _this._announce(panel, kind);
124
+ });
125
+ this._locationSubs.set(group.id, sub);
126
+ };
127
+ LiveRegionService.prototype.announce = function (message, politeness) {
128
+ if (politeness === void 0) { politeness = 'polite'; }
129
+ // Opt-out (read live so `updateOptions({ announcements })` applies).
130
+ if (this._host.options.announcements === false ||
131
+ this._suppressDepth > 0 ||
132
+ !message) {
133
+ return;
134
+ }
135
+ // Apps can route announcements into their own SR system instead of the
136
+ // built-in regions (e.g. a shared app-wide live region).
137
+ var announcer = this._host.options.announcer;
138
+ if (announcer) {
139
+ announcer({ message: message, politeness: politeness });
140
+ return;
141
+ }
142
+ // Clearing first forces SRs to re-announce an identical message.
143
+ var region = politeness === 'assertive' ? this._assertive : this._polite;
144
+ region.textContent = '';
145
+ region.textContent = message;
146
+ };
147
+ LiveRegionService.prototype._announce = function (panel, kind) {
148
+ var _a, _b;
149
+ // The app may localise/override the message, suppress it (null / ''),
150
+ // or fall through to the default (undefined).
151
+ var custom = (_b = (_a = this._host.options).getAnnouncement) === null || _b === void 0 ? void 0 : _b.call(_a, { kind: kind, panel: panel });
152
+ if (custom === null || custom === '') {
153
+ return;
154
+ }
155
+ this.announce(custom !== null && custom !== void 0 ? custom : this._defaultMessage(panel, kind));
156
+ };
157
+ LiveRegionService.prototype._defaultMessage = function (panel, kind) {
158
+ var _a;
159
+ var m = (0, accessibilityMessages_1.resolveMessages)(this._host.options.messages);
160
+ var name = (_a = panel.title) !== null && _a !== void 0 ? _a : panel.id;
161
+ switch (kind) {
162
+ case 'open':
163
+ return m.panelOpened(name);
164
+ case 'close':
165
+ return m.panelClosed(name);
166
+ case 'maximize':
167
+ return m.groupMaximized(name);
168
+ case 'restore':
169
+ return m.groupRestored(name);
170
+ case 'float':
171
+ return m.groupFloated(name);
172
+ case 'dock':
173
+ return m.groupDocked(name);
174
+ case 'popout':
175
+ return m.groupPoppedOut(name);
176
+ }
177
+ };
178
+ return LiveRegionService;
179
+ }(lifecycle_1.CompositeDisposable));
180
+ exports.LiveRegionService = LiveRegionService;
181
+ exports.LiveRegionModule = (0, modules_1.defineModule)({
182
+ name: 'LiveRegion',
183
+ serviceKey: 'liveRegionService',
184
+ create: function (host) { return new LiveRegionService(host); },
185
+ });
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Service + host interfaces for the pluggable feature modules. Core references
3
+ * only these interfaces — never a module's implementation — so each module is
4
+ * decoupled from core and independently testable / removable. Keep this file
5
+ * implementation-free.
6
+ */
7
+ import { IDisposable } from '../lifecycle';
8
+ import { Event } from '../events';
9
+ import { DroptargetOverlayModel, Position } from '../dnd/droptarget';
10
+ import { IDragGhostSpec } from '../dnd/backend';
11
+ import { DockviewApi } from '../api/component.api';
12
+ import { DockviewGroupPanel } from './dockviewGroupPanel';
13
+ import { IDockviewPanel } from './dockviewPanel';
14
+ import { ITabGroup } from './tabGroup';
15
+ import { TabGroupColorPalette } from './tabGroupAccent';
16
+ import { PopupService } from './components/popupService';
17
+ import { DockviewComponentOptions } from './options';
18
+ import { DockviewLayoutMutationEvent, GroupNavigationDirection } from './dockviewComponent';
19
+ import { DockviewWillDropEvent } from './dockviewGroupPanelModel';
20
+ import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
21
+ import { DockviewGroupDropLocation, DockviewTabGroupChangeEvent, DockviewTabGroupPanelChangeEvent, DockviewTabGroupCollapsedChangeEvent, DockviewWillShowOverlayLocationEvent } from './events';
22
+ export interface IContextMenuHost {
23
+ readonly options: DockviewComponentOptions;
24
+ readonly api: DockviewApi;
25
+ readonly tabGroupColorPalette: TabGroupColorPalette;
26
+ getPopupServiceForGroup(group: DockviewGroupPanel): PopupService;
27
+ }
28
+ export interface IContextMenuService {
29
+ show(panel: IDockviewPanel, group: DockviewGroupPanel, event: MouseEvent): void;
30
+ showForChip(tabGroup: ITabGroup, group: DockviewGroupPanel, event: MouseEvent): void;
31
+ }
32
+ export interface ITabGroupChipsHost {
33
+ readonly onDidAddGroup: Event<DockviewGroupPanel>;
34
+ readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
35
+ fireDidCreateTabGroup(event: DockviewTabGroupChangeEvent): void;
36
+ fireDidDestroyTabGroup(event: DockviewTabGroupChangeEvent): void;
37
+ fireDidAddPanelToTabGroup(event: DockviewTabGroupPanelChangeEvent): void;
38
+ fireDidRemovePanelFromTabGroup(event: DockviewTabGroupPanelChangeEvent): void;
39
+ fireDidTabGroupChange(event: DockviewTabGroupChangeEvent): void;
40
+ fireDidTabGroupCollapsedChange(event: DockviewTabGroupCollapsedChangeEvent): void;
41
+ }
42
+ export interface ITabGroupChipsService extends IDisposable {
43
+ /**
44
+ * Subscribe to the per-group tab-group events on the given group and
45
+ * re-fire them on the host's component-level emitters. Returns a
46
+ * disposable that detaches the subscriptions; intended to be bundled
47
+ * into the per-group CompositeDisposable so cleanup happens when the
48
+ * group is removed.
49
+ */
50
+ attachToGroup(group: DockviewGroupPanel): IDisposable;
51
+ }
52
+ export interface IAccessibilityHost {
53
+ /**
54
+ * The outermost dockview element (the shell, which also contains edge
55
+ * groups). A getter — it must resolve to the shell once that exists, not
56
+ * the inner gridview, or keydowns from edge groups are missed.
57
+ */
58
+ readonly rootElement: HTMLElement;
59
+ readonly options: DockviewComponentOptions;
60
+ readonly groups: DockviewGroupPanel[];
61
+ readonly activeGroup: DockviewGroupPanel | undefined;
62
+ readonly activePanel: IDockviewPanel | undefined;
63
+ /**
64
+ * The next / previous group in gridview (spatial) order, wrapping round —
65
+ * the one piece of navigation that needs the grid internals. All other
66
+ * focus logic lives in the service, using the public group API.
67
+ */
68
+ adjacentGroup(group: DockviewGroupPanel, reverse: boolean): DockviewGroupPanel | undefined;
69
+ /** The nearest grid group in a spatial direction — drives Alt+Arrow nav. */
70
+ adjacentGroupInDirection(group: DockviewGroupPanel, direction: GroupNavigationDirection): DockviewGroupPanel | undefined;
71
+ /** Fires before / after a structural layout change — used to restore focus on close. */
72
+ readonly onWillMutateLayout: Event<DockviewLayoutMutationEvent>;
73
+ readonly onDidMutateLayout: Event<DockviewLayoutMutationEvent>;
74
+ showDropPreview(group: DockviewGroupPanel, position: Position): IDisposable;
75
+ announce(message: string): void;
76
+ dockPanel(panel: IDockviewPanel, group: DockviewGroupPanel, position: Position): void;
77
+ }
78
+ export interface IAccessibilityService extends IDisposable {
79
+ }
80
+ /**
81
+ * Marker for the advanced keyboard docking service (spatial group focus +
82
+ * keyboard move mode). Self-driven; the component never calls into it.
83
+ */
84
+ export interface IKeyboardDockingService extends IDisposable {
85
+ }
86
+ export interface IAdvancedDnDHost {
87
+ readonly options: DockviewComponentOptions;
88
+ readonly api: DockviewApi;
89
+ fireWillDragPanel(event: TabDragEvent): void;
90
+ fireWillDragGroup(event: GroupDragEvent): void;
91
+ fireWillDrop(event: DockviewWillDropEvent): void;
92
+ fireWillShowOverlay(event: DockviewWillShowOverlayLocationEvent): void;
93
+ }
94
+ export interface IAdvancedDnDService extends IDisposable {
95
+ dispatchWillDragPanel(event: TabDragEvent): void;
96
+ dispatchWillDragGroup(event: GroupDragEvent): void;
97
+ dispatchWillDrop(event: DockviewWillDropEvent): void;
98
+ dispatchWillShowOverlay(event: DockviewWillShowOverlayLocationEvent): void;
99
+ /**
100
+ * Resolve the custom group drag ghost from
101
+ * `createGroupDragGhostComponent`, or `undefined` when no factory is
102
+ * configured (the caller then renders the default chip). Returning
103
+ * `undefined` is also what happens when this module is absent.
104
+ */
105
+ buildGroupDragGhost(group: DockviewGroupPanel): IDragGhostSpec | undefined;
106
+ /**
107
+ * Resolve the app-supplied overlay model for a group drop target via the
108
+ * `dropOverlayModel` option, or `undefined` to keep the target's default.
109
+ */
110
+ resolveOverlayModel(location: DockviewGroupDropLocation, group?: DockviewGroupPanel): DroptargetOverlayModel | undefined;
111
+ /**
112
+ * Render the drop-preview overlay on a group at `position` — the same
113
+ * overlay a mouse drag shows — without a live drag. Returns a disposable
114
+ * that clears it. Used by keyboard docking so keyboard and mouse previews
115
+ * are identical (single source of truth). Commit the move via the public
116
+ * `api.moveGroupOrPanel({ to: { group, position } })`.
117
+ */
118
+ showPreviewOverlay(group: DockviewGroupPanel, position: Position): IDisposable;
119
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Internal module system for dockview.
3
+ *
4
+ * Modules are feature bundles that register services into the dockview
5
+ * component. `registerModules(...)` is the one public entry point — it lets a
6
+ * sibling package contribute modules that `DockviewComponent` picks up at
7
+ * construction. The richer opt-in surface (a per-component `modules` option,
8
+ * framework wrappers) is still reserved for a future version; the module
9
+ * authoring API (`defineModule`, the service contracts) remains internal.
10
+ */
11
+ import { IDisposable } from '../lifecycle';
12
+ import { IFloatingGroupService } from './floatingGroupService';
13
+ import { IPopoutWindowService } from './popoutWindowService';
14
+ import { IWatermarkService } from './watermarkService';
15
+ import { IEdgeGroupService } from './edgeGroupService';
16
+ import { IRootDropTargetService } from './rootDropTargetService';
17
+ import { IHeaderActionsService } from './headerActionsService';
18
+ import { ILiveRegionService } from './liveRegionService';
19
+ import { IAccessibilityService, IAdvancedDnDService, IContextMenuService, IKeyboardDockingService, ITabGroupChipsService } from './moduleContracts';
20
+ export interface ServiceCollection {
21
+ floatingGroupService?: IFloatingGroupService;
22
+ popoutWindowService?: IPopoutWindowService;
23
+ watermarkService?: IWatermarkService;
24
+ edgeGroupService?: IEdgeGroupService;
25
+ tabGroupChipsService?: ITabGroupChipsService;
26
+ contextMenuService?: IContextMenuService;
27
+ rootDropTargetService?: IRootDropTargetService;
28
+ headerActionsService?: IHeaderActionsService;
29
+ advancedDnDService?: IAdvancedDnDService;
30
+ liveRegionService?: ILiveRegionService;
31
+ accessibilityService?: IAccessibilityService;
32
+ keyboardDockingService?: IKeyboardDockingService;
33
+ }
34
+ export interface DockviewModule<THost = unknown> {
35
+ moduleName: string;
36
+ services?: Record<string, (host: THost) => unknown>;
37
+ /**
38
+ * Optional post-construct hook called once after the host is fully
39
+ * constructed and all module services are instantiated. Use this to
40
+ * subscribe to host events — the returned disposable runs at host
41
+ * teardown. Components don't need to call into the service from event
42
+ * handlers; the module owns its own reactivity.
43
+ */
44
+ init?: (host: THost, services: ServiceCollection) => IDisposable;
45
+ dependsOn?: DockviewModule<any>[];
46
+ }
47
+ /**
48
+ * Typed helper for defining a module. Enforces that the factory's return
49
+ * type matches the slot in ServiceCollection at compile time, replacing
50
+ * the manual cast each module file would otherwise need.
51
+ */
52
+ export declare function defineModule<K extends keyof ServiceCollection, THost>(config: {
53
+ name: string;
54
+ serviceKey: K;
55
+ create: (host: THost) => NonNullable<ServiceCollection[K]>;
56
+ init?: (host: THost, service: NonNullable<ServiceCollection[K]>) => IDisposable;
57
+ dependsOn?: DockviewModule<any>[];
58
+ }): DockviewModule<THost>;
59
+ /**
60
+ * For tests — clears the once-per-key dedup cache used by `assertModule`.
61
+ */
62
+ export declare function _resetMissingModuleWarnings(): void;
63
+ /**
64
+ * Returns the service if its module is registered, otherwise logs a
65
+ * deduplicated console error and returns `undefined`. Modelled on AG Grid's
66
+ * `assertModuleRegistered`: missing modules never throw — they degrade the
67
+ * affected feature to a no-op so consuming applications don't crash in
68
+ * production.
69
+ *
70
+ * Use at public-API entry points where the caller wants to surface which
71
+ * module is missing. For internal/lifecycle paths, plain `?.` chaining on
72
+ * the service slot is preferred — no log, just a silent no-op.
73
+ */
74
+ export declare function assertModule<T>(service: T | undefined, moduleName: string, context?: string): T | undefined;
75
+ export declare class ModuleRegistry<THost> implements IDisposable {
76
+ private readonly _modules;
77
+ private readonly _services;
78
+ private readonly _initDisposables;
79
+ get services(): ServiceCollection;
80
+ register<H>(module: DockviewModule<H>): void;
81
+ initialize(host: THost): void;
82
+ postConstruct(host: THost): void;
83
+ has(moduleName: string): boolean;
84
+ dispose(): void;
85
+ }
86
+ /**
87
+ * Register modules globally. Idempotent per `moduleName` — registering the
88
+ * same module twice is a no-op. Intended to be called once at import time by
89
+ * the package that bundles a given set of modules.
90
+ */
91
+ export declare function registerModules(modules: DockviewModule<any>[]): void;
92
+ /**
93
+ * Returns the globally-registered modules (a copy). `DockviewComponent` reads
94
+ * this to extend its built-in module set.
95
+ */
96
+ export declare function getRegisteredModules(): DockviewModule<any>[];
97
+ /**
98
+ * For tests — clears the global module registry.
99
+ */
100
+ export declare function clearRegisteredModules(): void;
101
+ /**
102
+ * Called once by the `dockview` package on import, solely so `dockview-core`
103
+ * can warn when it is used directly (see above). Not used for anything else.
104
+ */
105
+ export declare function markDockviewPackageLoaded(): void;
106
+ /**
107
+ * Whether the `dockview` package has been loaded in this process. Used only to
108
+ * gate the "don't use dockview-core directly" developer warning.
109
+ */
110
+ export declare function isDockviewPackageLoaded(): boolean;