dockview-core 6.6.0 → 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 -993
  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 +3199 -1251
  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 +3198 -1250
  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 +1421 -717
  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 +3234 -1286
  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 +3189 -1252
  148. package/dist/styles/dockview.css +275 -13
  149. package/package.json +10 -1
  150. package/dist/cjs/dockview/contextMenu.d.ts +0 -10
  151. package/dist/cjs/dockview/contextMenu.js +0 -313
  152. package/dist/esm/dockview/contextMenu.d.ts +0 -10
  153. package/dist/esm/dockview/contextMenu.js +0 -228
@@ -0,0 +1,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 @@
1
+ export {};
@@ -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;
@@ -0,0 +1,170 @@
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
+ /**
12
+ * Typed helper for defining a module. Enforces that the factory's return
13
+ * type matches the slot in ServiceCollection at compile time, replacing
14
+ * the manual cast each module file would otherwise need.
15
+ */
16
+ export function defineModule(config) {
17
+ return {
18
+ moduleName: config.name,
19
+ services: {
20
+ [config.serviceKey]: config.create,
21
+ },
22
+ init: config.init
23
+ ? (host, services) => config.init(host, services[config.serviceKey])
24
+ : undefined,
25
+ dependsOn: config.dependsOn,
26
+ };
27
+ }
28
+ const _warnedMissingModule = new Set();
29
+ /**
30
+ * For tests — clears the once-per-key dedup cache used by `assertModule`.
31
+ */
32
+ export function _resetMissingModuleWarnings() {
33
+ _warnedMissingModule.clear();
34
+ }
35
+ /**
36
+ * Returns the service if its module is registered, otherwise logs a
37
+ * deduplicated console error and returns `undefined`. Modelled on AG Grid's
38
+ * `assertModuleRegistered`: missing modules never throw — they degrade the
39
+ * affected feature to a no-op so consuming applications don't crash in
40
+ * production.
41
+ *
42
+ * Use at public-API entry points where the caller wants to surface which
43
+ * module is missing. For internal/lifecycle paths, plain `?.` chaining on
44
+ * the service slot is preferred — no log, just a silent no-op.
45
+ */
46
+ export function assertModule(service, moduleName, context) {
47
+ if (service !== undefined) {
48
+ return service;
49
+ }
50
+ const key = `${moduleName}|${context !== null && context !== void 0 ? context : ''}`;
51
+ if (_warnedMissingModule.has(key)) {
52
+ return undefined;
53
+ }
54
+ _warnedMissingModule.add(key);
55
+ const where = context ? ` for ${context}` : '';
56
+ // eslint-disable-next-line no-console
57
+ console.error(`dockview: module "${moduleName}" is not registered${where}.`);
58
+ return undefined;
59
+ }
60
+ export class ModuleRegistry {
61
+ constructor() {
62
+ this._modules = new Map();
63
+ this._services = {};
64
+ this._initDisposables = [];
65
+ }
66
+ get services() {
67
+ return this._services;
68
+ }
69
+ register(module) {
70
+ if (this._modules.has(module.moduleName)) {
71
+ return;
72
+ }
73
+ if (module.dependsOn) {
74
+ for (const dep of module.dependsOn) {
75
+ this.register(dep);
76
+ }
77
+ }
78
+ this._modules.set(module.moduleName, module);
79
+ }
80
+ initialize(host) {
81
+ for (const module of this._modules.values()) {
82
+ if (!module.services) {
83
+ continue;
84
+ }
85
+ for (const [name, factory] of Object.entries(module.services)) {
86
+ this._services[name] = factory(host);
87
+ }
88
+ }
89
+ }
90
+ postConstruct(host) {
91
+ for (const module of this._modules.values()) {
92
+ if (module.init) {
93
+ this._initDisposables.push(module.init(host, this._services));
94
+ }
95
+ }
96
+ }
97
+ has(moduleName) {
98
+ return this._modules.has(moduleName);
99
+ }
100
+ dispose() {
101
+ // Tear down init() subscriptions first so they stop firing into
102
+ // services that are about to be disposed.
103
+ for (const disposable of this._initDisposables) {
104
+ disposable.dispose();
105
+ }
106
+ this._initDisposables.length = 0;
107
+ for (const service of Object.values(this._services)) {
108
+ if (service !== undefined &&
109
+ typeof service.dispose === 'function') {
110
+ service.dispose();
111
+ }
112
+ }
113
+ }
114
+ }
115
+ /**
116
+ * Process-global list of modules registered via {@link registerModules}.
117
+ * `DockviewComponent` appends these to its built-in set at construction, so
118
+ * importing a package that calls `registerModules(...)` (e.g. `dockview`)
119
+ * makes those modules available to every component in the process —
120
+ * modelled on AG Grid's `ModuleRegistry.registerModules`.
121
+ */
122
+ const _globalModules = [];
123
+ /**
124
+ * Register modules globally. Idempotent per `moduleName` — registering the
125
+ * same module twice is a no-op. Intended to be called once at import time by
126
+ * the package that bundles a given set of modules.
127
+ */
128
+ export function registerModules(modules) {
129
+ for (const module of modules) {
130
+ if (_globalModules.some((m) => m.moduleName === module.moduleName)) {
131
+ continue;
132
+ }
133
+ _globalModules.push(module);
134
+ }
135
+ }
136
+ /**
137
+ * Returns the globally-registered modules (a copy). `DockviewComponent` reads
138
+ * this to extend its built-in module set.
139
+ */
140
+ export function getRegisteredModules() {
141
+ return [..._globalModules];
142
+ }
143
+ /**
144
+ * For tests — clears the global module registry.
145
+ */
146
+ export function clearRegisteredModules() {
147
+ _globalModules.length = 0;
148
+ }
149
+ /**
150
+ * This marker exists for ONE purpose: a developer warning about the v7 package
151
+ * renames. It has no functional effect on dockview's behaviour. Following the
152
+ * renames, `dockview-core` is internal and `dockview` is the public JavaScript
153
+ * package; `dockview` calls {@link markDockviewPackageLoaded} on import so that
154
+ * `dockview-core` can detect — and warn about — being used directly.
155
+ */
156
+ let _dockviewPackageLoaded = false;
157
+ /**
158
+ * Called once by the `dockview` package on import, solely so `dockview-core`
159
+ * can warn when it is used directly (see above). Not used for anything else.
160
+ */
161
+ export function markDockviewPackageLoaded() {
162
+ _dockviewPackageLoaded = true;
163
+ }
164
+ /**
165
+ * Whether the `dockview` package has been loaded in this process. Used only to
166
+ * gate the "don't use dockview-core directly" developer warning.
167
+ */
168
+ export function isDockviewPackageLoaded() {
169
+ return _dockviewPackageLoaded;
170
+ }
@@ -4,8 +4,11 @@ import { IGridView } from '../gridview/gridview';
4
4
  import { IContentRenderer, ITabRenderer, IWatermarkRenderer } from './types';
5
5
  import { Parameters } from '../panel/types';
6
6
  import { DockviewGroupPanel } from './dockviewGroupPanel';
7
+ import { DockviewMessages } from './accessibilityMessages';
8
+ export type { DockviewMessages } from './accessibilityMessages';
7
9
  import { PanelTransfer } from '../dnd/dataTransfer';
8
10
  import { IDisposable } from '../lifecycle';
11
+ import { Box } from '../types';
9
12
  import { DroptargetOverlayModel, Position } from '../dnd/droptarget';
10
13
  import { GroupOptions } from './dockviewGroupPanelModel';
11
14
  import { DockviewGroupDropLocation } from './events';
@@ -13,7 +16,7 @@ import { IDockviewPanel } from './dockviewPanel';
13
16
  import { DockviewPanelRenderer } from '../overlay/overlayRenderContainer';
14
17
  import { IGroupDragGhostRenderer, IGroupHeaderProps, ITabGroupChipRenderer } from './framework';
15
18
  import { FloatingGroupOptions } from './dockviewComponent';
16
- import { Contraints } from '../gridview/gridviewPanel';
19
+ import { Constraints } from '../gridview/gridviewPanel';
17
20
  import { AcceptableEvent, IAcceptableEvent } from '../events';
18
21
  import { DockviewTheme } from './theme';
19
22
  import { ITabGroup } from './tabGroup';
@@ -43,6 +46,54 @@ export interface ContextMenuItemConfig {
43
46
  disabled?: boolean;
44
47
  }
45
48
  export type ContextMenuItem = BuiltInContextMenuItem | ContextMenuItemConfig;
49
+ export interface DropOverlayModelParams {
50
+ /** Which of a group's drop targets the overlay is for. `'edge'` is shaped by `dndEdges`, not this option. */
51
+ location: DockviewGroupDropLocation;
52
+ /** The group the target belongs to, where known (tab / header_space / content). */
53
+ group?: DockviewGroupPanel;
54
+ }
55
+ /** A layout change to be announced — see the `getAnnouncement` option. */
56
+ export interface LiveRegionEvent {
57
+ /**
58
+ * What changed: a panel was added (`'open'`) or removed (`'close'`); a
59
+ * group was maximized (`'maximize'`) / restored (`'restore'`); or a group
60
+ * moved to a floating window (`'float'`), back into the grid (`'dock'`), or
61
+ * out to a popout window (`'popout'`). `panel` is the affected panel — for
62
+ * group events, the group's active panel.
63
+ */
64
+ kind: 'open' | 'close' | 'maximize' | 'restore' | 'float' | 'dock' | 'popout';
65
+ panel: IDockviewPanel;
66
+ }
67
+ /** A resolved announcement handed to a custom `announcer`. */
68
+ export interface AnnouncementEvent {
69
+ /** The (already localised) text to announce. */
70
+ message: string;
71
+ /** `'assertive'` interrupts the screen reader; `'polite'` waits for a pause. */
72
+ politeness: 'polite' | 'assertive';
73
+ }
74
+ /**
75
+ * Key bindings for {@link DockviewComponentOptions.keyboardNavigation}. Each
76
+ * value is a string of `+`-separated parts, modifiers first, e.g. `'ctrl+]'`,
77
+ * `'shift+f6'`. Recognised modifiers: `ctrl`, `shift`, `alt`, `meta` (alias
78
+ * `cmd`). The final part is the `KeyboardEvent.key` to match, case-insensitively
79
+ * (`']'`, `'f6'`, `'arrowleft'`).
80
+ */
81
+ export interface DockviewKeybindings {
82
+ /** Switch to the next tab in the focused group. Default `ctrl+]`. */
83
+ nextTab: string;
84
+ /** Switch to the previous tab in the focused group. Default `ctrl+[`. */
85
+ prevTab: string;
86
+ /** Move focus to the next group. Default `f6`. */
87
+ focusNextGroup: string;
88
+ /** Move focus to the previous group. Default `shift+f6`. */
89
+ focusPrevGroup: string;
90
+ /** Move focus from panel content to the focused group's tab strip. Default `ctrl+shift+\`. */
91
+ focusTabs: string;
92
+ }
93
+ export interface KeyboardNavigationOptions {
94
+ /** Override individual {@link DockviewKeybindings}; unset keys keep their defaults. */
95
+ keymap?: Partial<DockviewKeybindings>;
96
+ }
46
97
  export interface GetTabContextMenuItemsParams {
47
98
  panel: IDockviewPanel;
48
99
  group: DockviewGroupPanel;
@@ -78,6 +129,26 @@ export interface ViewFactoryData {
78
129
  export type DockviewHeaderPosition = 'top' | 'bottom' | 'left' | 'right';
79
130
  export type DockviewHeaderDirection = 'horizontal' | 'vertical';
80
131
  export type DockviewDndStrategy = 'auto' | 'pointer' | 'html5';
132
+ /**
133
+ * Context handed to {@link DockviewOptions.transformFloatingGroupDrag} on each
134
+ * pointer-move frame while a floating group is being dragged.
135
+ */
136
+ export interface FloatingGroupDragContext {
137
+ /** The floating group being dragged. */
138
+ readonly group: DockviewGroupPanel;
139
+ /** Proposed top-left + size this frame, in container pixels (pre-clamp). */
140
+ readonly proposed: Box;
141
+ /** Size of the container the floating group is dragged within. */
142
+ readonly container: {
143
+ width: number;
144
+ height: number;
145
+ };
146
+ /**
147
+ * Bounds of the other floating groups (relative to the same container),
148
+ * snapshotted at drag start.
149
+ */
150
+ readonly others: readonly Box[];
151
+ }
81
152
  export interface DockviewOptions {
82
153
  /**
83
154
  * Disable the auto-resizing which is controlled through a `ResizeObserver`.
@@ -91,16 +162,39 @@ export interface DockviewOptions {
91
162
  minimumHeightWithinViewport?: number;
92
163
  minimumWidthWithinViewport?: number;
93
164
  };
165
+ /**
166
+ * Adjust a floating group's position while it is being dragged. Runs on
167
+ * each pointer-move frame with the proposed top-left (before the container
168
+ * clamp) and returns an adjusted top-left, or nothing to leave it
169
+ * unchanged. Use it for snapping, alignment, or custom bounds. Move only —
170
+ * resizing a floating group is unaffected.
171
+ *
172
+ * `context.others` holds the bounds of the other floating groups (relative
173
+ * to the same container), snapshotted at drag start, so the callback can
174
+ * align the dragged group against its siblings.
175
+ */
176
+ transformFloatingGroupDrag?: (context: FloatingGroupDragContext) => {
177
+ top: number;
178
+ left: number;
179
+ } | void;
180
+ /**
181
+ * Selects which element moves a floating group when dragged.
182
+ *
183
+ * - `'titlebar'` (default): a dedicated, blank drag-handle bar is rendered
184
+ * above the group's tab bar. Dragging it moves the floating window;
185
+ * shift+drag (mouse) / long-press (touch) redocks into the grid. Style
186
+ * it with the `--dv-floating-titlebar-*` theme variables.
187
+ * - `'tabbar'`: the legacy behaviour — the empty space in the tab bar
188
+ * (the "void container") doubles as the move handle. No dedicated bar
189
+ * is rendered.
190
+ */
191
+ floatingGroupDragHandle?: 'titlebar' | 'tabbar';
94
192
  popoutUrl?: string;
95
193
  nonce?: CspNonceProvider;
96
194
  defaultRenderer?: DockviewPanelRenderer;
97
195
  defaultHeaderPosition?: DockviewHeaderPosition;
98
196
  debug?: boolean;
99
197
  dndEdges?: false | DroptargetOverlayModel;
100
- /**
101
- * @deprecated use `dndEdges` instead. To be removed in a future version.
102
- * */
103
- rootOverlayModel?: DroptargetOverlayModel;
104
198
  disableDnd?: boolean;
105
199
  /**
106
200
  * Selects which drag-and-drop implementation is active.
@@ -166,6 +260,65 @@ export interface DockviewOptions {
166
260
  * enabling i18n / custom visuals.
167
261
  */
168
262
  createGroupDragGhostComponent?: (group: DockviewGroupPanel) => IGroupDragGhostRenderer;
263
+ /**
264
+ * Shape the drop overlay shown over a group's drop targets — the tab
265
+ * strip (`'tab'`), the header void space (`'header_space'`) and the
266
+ * panel content area (`'content'`). Return a {@link DroptargetOverlayModel}
267
+ * to override that target's default overlay (size, activation threshold,
268
+ * small-element boundaries), or `undefined` to keep the default.
269
+ *
270
+ * `group` is provided where known (tab / header_space). The outer-layout
271
+ * edge overlay is shaped by `dndEdges`, not this option, so `'edge'` is
272
+ * not dispatched here.
273
+ */
274
+ dropOverlayModel?: (params: DropOverlayModelParams) => DroptargetOverlayModel | undefined;
275
+ /**
276
+ * Built-in screen-reader announcements of layout changes (a visually-hidden
277
+ * `aria-live` region narrating panel open/close etc.). On by default —
278
+ * set to `false` to disable, e.g. when the host app provides its own
279
+ * announcement system. Honoured live via `updateOptions`.
280
+ */
281
+ announcements?: boolean;
282
+ /**
283
+ * Localise or override the built-in announcement strings (the default
284
+ * messages are English). Return a string to use it, `null` / `''` to
285
+ * suppress that announcement, or `undefined` to keep the default. This is
286
+ * how non-English apps translate announcements — core ships no message
287
+ * catalog, only the default strings + this hook.
288
+ */
289
+ getAnnouncement?: (event: LiveRegionEvent) => string | null | undefined;
290
+ /**
291
+ * Route announcements to your own screen-reader infrastructure instead of
292
+ * the built-in `aria-live` regions (e.g. an app-wide live region). When
293
+ * set, dockview hands you each {@link AnnouncementEvent} and writes nothing
294
+ * to its own regions. `getAnnouncement` (localisation) still applies first.
295
+ */
296
+ announcer?: (event: AnnouncementEvent) => void;
297
+ /**
298
+ * Translate / override the strings dockview speaks to assistive technology
299
+ * — both the LiveRegion announcements and the keyboard-docking narration.
300
+ * Provide any subset of {@link DockviewMessages}; unset entries keep the
301
+ * English defaults. (`getAnnouncement` still applies first, per-event, for
302
+ * announcements.)
303
+ */
304
+ messages?: Partial<DockviewMessages>;
305
+ /**
306
+ * Operate the dock with the keyboard. `true` enables the default bindings;
307
+ * pass an object to override individual ones via `keymap`. Off by default
308
+ * (opt-in while the feature matures). Enables:
309
+ *
310
+ * - **Switch tab** within the focused group — `Ctrl`+`]` / `Ctrl`+`[`.
311
+ * - **Move focus between groups** — `F6` / `Shift`+`F6` (sequential) or
312
+ * `Ctrl`+`Shift`+arrow keys (spatial: focus the group in that direction).
313
+ * - **Dock the active panel** without a mouse — `Ctrl`+`M` arms a two-phase
314
+ * move (arrows cycle the target group with a live drop preview +
315
+ * screen-reader narration, `Enter` docks, `Escape` cancels).
316
+ *
317
+ * Defaults avoid `Cmd`-based and browser-reserved combinations (e.g.
318
+ * `Cmd`+`M` is the macOS minimise-window shortcut); use {@link keymap} to
319
+ * rebind for your platform.
320
+ */
321
+ keyboardNavigation?: boolean | KeyboardNavigationOptions;
169
322
  /**
170
323
  * Replace the built-in tab group color palette with a user-defined list.
171
324
  *
@@ -300,7 +453,7 @@ export type AddPanelOptions<P extends object = Parameters> = {
300
453
  inactive?: boolean;
301
454
  initialWidth?: number;
302
455
  initialHeight?: number;
303
- } & Partial<AddPanelOptionsUnion> & Partial<Contraints>;
456
+ } & Partial<AddPanelOptionsUnion> & Partial<Constraints>;
304
457
  type AddGroupOptionsWithPanel = {
305
458
  referencePanel: string | IDockviewPanel;
306
459
  direction?: Omit<Direction, 'within'>;
@@ -20,12 +20,13 @@ export const PROPERTY_KEYS_DOCKVIEW = (() => {
20
20
  singleTabMode: undefined,
21
21
  disableFloatingGroups: undefined,
22
22
  floatingGroupBounds: undefined,
23
+ transformFloatingGroupDrag: undefined,
24
+ floatingGroupDragHandle: undefined,
23
25
  popoutUrl: undefined,
24
26
  nonce: undefined,
25
27
  defaultRenderer: undefined,
26
28
  defaultHeaderPosition: undefined,
27
29
  debug: undefined,
28
- rootOverlayModel: undefined,
29
30
  locked: undefined,
30
31
  disableDnd: undefined,
31
32
  dndStrategy: undefined,
@@ -39,6 +40,12 @@ export const PROPERTY_KEYS_DOCKVIEW = (() => {
39
40
  getTabGroupChipContextMenuItems: undefined,
40
41
  createTabGroupChipComponent: undefined,
41
42
  createGroupDragGhostComponent: undefined,
43
+ dropOverlayModel: undefined,
44
+ announcements: undefined,
45
+ getAnnouncement: undefined,
46
+ announcer: undefined,
47
+ messages: undefined,
48
+ keyboardNavigation: undefined,
42
49
  tabGroupColors: undefined,
43
50
  tabGroupAccent: undefined,
44
51
  };