dockview-core 5.1.0 → 6.0.0

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 (117) hide show
  1. package/README.md +3 -1
  2. package/dist/cjs/api/component.api.d.ts +93 -1
  3. package/dist/cjs/api/component.api.js +146 -0
  4. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +26 -0
  5. package/dist/cjs/api/dockviewGroupPanelApi.js +21 -1
  6. package/dist/cjs/api/entryPoints.js +4 -5
  7. package/dist/cjs/array.js +7 -8
  8. package/dist/cjs/dnd/dataTransfer.d.ts +2 -1
  9. package/dist/cjs/dnd/dataTransfer.js +5 -4
  10. package/dist/cjs/dnd/droptarget.d.ts +12 -0
  11. package/dist/cjs/dnd/droptarget.js +38 -10
  12. package/dist/cjs/dnd/ghost.js +1 -2
  13. package/dist/cjs/dockview/components/panel/content.js +5 -1
  14. package/dist/cjs/dockview/components/popupService.d.ts +9 -2
  15. package/dist/cjs/dockview/components/popupService.js +24 -9
  16. package/dist/cjs/dockview/components/tab/tab.d.ts +8 -1
  17. package/dist/cjs/dockview/components/tab/tab.js +94 -6
  18. package/dist/cjs/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
  19. package/dist/cjs/dockview/components/titlebar/tabGroupChip.js +95 -0
  20. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
  21. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +471 -0
  22. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +57 -0
  23. package/dist/cjs/dockview/components/titlebar/tabGroups.js +612 -0
  24. package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +1 -2
  25. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +67 -0
  26. package/dist/cjs/dockview/components/titlebar/tabs.js +1464 -34
  27. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +6 -0
  28. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +132 -14
  29. package/dist/cjs/dockview/contextMenu.d.ts +10 -0
  30. package/dist/cjs/dockview/contextMenu.js +298 -0
  31. package/dist/cjs/dockview/dockviewComponent.d.ts +60 -3
  32. package/dist/cjs/dockview/dockviewComponent.js +712 -126
  33. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +83 -0
  34. package/dist/cjs/dockview/dockviewGroupPanelModel.js +619 -27
  35. package/dist/cjs/dockview/dockviewShell.d.ts +128 -0
  36. package/dist/cjs/dockview/dockviewShell.js +681 -0
  37. package/dist/cjs/dockview/events.d.ts +9 -0
  38. package/dist/cjs/dockview/framework.d.ts +14 -0
  39. package/dist/cjs/dockview/options.d.ts +97 -2
  40. package/dist/cjs/dockview/options.js +10 -5
  41. package/dist/cjs/dockview/tabGroup.d.ts +99 -0
  42. package/dist/cjs/dockview/tabGroup.js +219 -0
  43. package/dist/cjs/dockview/tabGroupAccent.d.ts +65 -0
  44. package/dist/cjs/dockview/tabGroupAccent.js +128 -0
  45. package/dist/cjs/dockview/theme.d.ts +56 -1
  46. package/dist/cjs/dockview/theme.js +103 -6
  47. package/dist/cjs/dockview/types.d.ts +2 -0
  48. package/dist/cjs/dom.js +19 -19
  49. package/dist/cjs/events.js +2 -2
  50. package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -0
  51. package/dist/cjs/gridview/baseComponentGridview.js +6 -3
  52. package/dist/cjs/gridview/gridview.js +7 -7
  53. package/dist/cjs/index.d.ts +8 -5
  54. package/dist/cjs/index.js +6 -1
  55. package/dist/cjs/popoutWindow.js +3 -3
  56. package/dist/cjs/splitview/splitviewPanel.d.ts +1 -1
  57. package/dist/dockview-core.js +5188 -729
  58. package/dist/dockview-core.min.js +2 -2
  59. package/dist/dockview-core.min.js.map +1 -1
  60. package/dist/dockview-core.min.noStyle.js +2 -2
  61. package/dist/dockview-core.min.noStyle.js.map +1 -1
  62. package/dist/dockview-core.noStyle.js +5186 -727
  63. package/dist/esm/api/component.api.d.ts +93 -1
  64. package/dist/esm/api/component.api.js +118 -0
  65. package/dist/esm/api/dockviewGroupPanelApi.d.ts +26 -0
  66. package/dist/esm/api/dockviewGroupPanelApi.js +21 -1
  67. package/dist/esm/dnd/dataTransfer.d.ts +2 -1
  68. package/dist/esm/dnd/dataTransfer.js +2 -1
  69. package/dist/esm/dnd/droptarget.d.ts +12 -0
  70. package/dist/esm/dnd/droptarget.js +33 -5
  71. package/dist/esm/dockview/components/panel/content.js +5 -1
  72. package/dist/esm/dockview/components/popupService.d.ts +9 -2
  73. package/dist/esm/dockview/components/popupService.js +23 -9
  74. package/dist/esm/dockview/components/tab/tab.d.ts +8 -1
  75. package/dist/esm/dockview/components/tab/tab.js +96 -6
  76. package/dist/esm/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
  77. package/dist/esm/dockview/components/titlebar/tabGroupChip.js +68 -0
  78. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
  79. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +354 -0
  80. package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +57 -0
  81. package/dist/esm/dockview/components/titlebar/tabGroups.js +406 -0
  82. package/dist/esm/dockview/components/titlebar/tabs.d.ts +67 -0
  83. package/dist/esm/dockview/components/titlebar/tabs.js +1212 -25
  84. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +6 -0
  85. package/dist/esm/dockview/components/titlebar/tabsContainer.js +105 -7
  86. package/dist/esm/dockview/contextMenu.d.ts +10 -0
  87. package/dist/esm/dockview/contextMenu.js +213 -0
  88. package/dist/esm/dockview/dockviewComponent.d.ts +60 -3
  89. package/dist/esm/dockview/dockviewComponent.js +460 -35
  90. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +83 -0
  91. package/dist/esm/dockview/dockviewGroupPanelModel.js +460 -4
  92. package/dist/esm/dockview/dockviewShell.d.ts +128 -0
  93. package/dist/esm/dockview/dockviewShell.js +621 -0
  94. package/dist/esm/dockview/events.d.ts +9 -0
  95. package/dist/esm/dockview/framework.d.ts +14 -0
  96. package/dist/esm/dockview/options.d.ts +97 -2
  97. package/dist/esm/dockview/options.js +5 -0
  98. package/dist/esm/dockview/tabGroup.d.ts +99 -0
  99. package/dist/esm/dockview/tabGroup.js +144 -0
  100. package/dist/esm/dockview/tabGroupAccent.d.ts +65 -0
  101. package/dist/esm/dockview/tabGroupAccent.js +116 -0
  102. package/dist/esm/dockview/theme.d.ts +56 -1
  103. package/dist/esm/dockview/theme.js +102 -5
  104. package/dist/esm/dockview/types.d.ts +2 -0
  105. package/dist/esm/dom.js +1 -1
  106. package/dist/esm/gridview/baseComponentGridview.d.ts +1 -0
  107. package/dist/esm/gridview/baseComponentGridview.js +4 -1
  108. package/dist/esm/index.d.ts +8 -5
  109. package/dist/esm/index.js +2 -1
  110. package/dist/esm/popoutWindow.js +1 -1
  111. package/dist/esm/splitview/splitviewPanel.d.ts +1 -1
  112. package/dist/package/main.cjs.js +5182 -753
  113. package/dist/package/main.cjs.min.js +2 -2
  114. package/dist/package/main.esm.min.mjs +2 -2
  115. package/dist/package/main.esm.mjs +5168 -753
  116. package/dist/styles/dockview.css +1968 -195
  117. package/package.json +5 -1
@@ -11,19 +11,63 @@ import { GroupOptions } from './dockviewGroupPanelModel';
11
11
  import { DockviewGroupDropLocation } from './events';
12
12
  import { IDockviewPanel } from './dockviewPanel';
13
13
  import { DockviewPanelRenderer } from '../overlay/overlayRenderContainer';
14
- import { IGroupHeaderProps } from './framework';
14
+ import { IGroupHeaderProps, ITabGroupChipRenderer } from './framework';
15
15
  import { FloatingGroupOptions } from './dockviewComponent';
16
16
  import { Contraints } from '../gridview/gridviewPanel';
17
17
  import { AcceptableEvent, IAcceptableEvent } from '../events';
18
18
  import { DockviewTheme } from './theme';
19
+ import { ITabGroup } from './tabGroup';
20
+ import { DockviewTabGroupColorEntry } from './tabGroupAccent';
19
21
  export interface IHeaderActionsRenderer extends IDisposable {
20
22
  readonly element: HTMLElement;
21
23
  init(params: IGroupHeaderProps): void;
22
24
  }
23
- export interface TabContextMenuEvent {
25
+ export type BuiltInContextMenuItem = 'close' | 'closeOthers' | 'closeAll' | 'separator';
26
+ export type BuiltInChipContextMenuItem = 'separator' | 'colorPicker' | 'rename';
27
+ export interface ContextMenuItemConfig {
28
+ label?: string;
29
+ /**
30
+ * A framework component to render as the menu item.
31
+ * The component type is opaque to core; the framework adapter renders it.
32
+ */
33
+ component?: unknown;
34
+ componentProps?: object;
35
+ /**
36
+ * A raw DOM element to embed as-is in the context menu.
37
+ * Use this when you want to render custom content without a framework component.
38
+ */
39
+ element?: HTMLElement;
40
+ action?: () => void;
41
+ disabled?: boolean;
42
+ }
43
+ export type ContextMenuItem = BuiltInContextMenuItem | ContextMenuItemConfig;
44
+ export interface GetTabContextMenuItemsParams {
45
+ panel: IDockviewPanel;
46
+ group: DockviewGroupPanel;
47
+ api: DockviewApi;
24
48
  event: MouseEvent;
49
+ }
50
+ export interface GetTabGroupChipContextMenuItemsParams {
51
+ tabGroup: ITabGroup;
52
+ group: DockviewGroupPanel;
25
53
  api: DockviewApi;
54
+ event: MouseEvent;
55
+ }
56
+ export interface IContextMenuItemComponentProps {
26
57
  panel: IDockviewPanel;
58
+ group: DockviewGroupPanel;
59
+ api: DockviewApi;
60
+ /** Call to close the context menu */
61
+ close: () => void;
62
+ componentProps?: object;
63
+ }
64
+ export interface IContextMenuItemRenderer extends IDisposable {
65
+ readonly element: HTMLElement;
66
+ init(props: IContextMenuItemComponentProps): void;
67
+ }
68
+ export interface CreateContextMenuItemComponentOptions {
69
+ id: string;
70
+ component: unknown;
27
71
  }
28
72
  export interface ViewFactoryData {
29
73
  content: string;
@@ -69,7 +113,57 @@ export interface DockviewOptions {
69
113
  * This is only applied to the tab header section. Defaults to `custom`.
70
114
  */
71
115
  scrollbars?: 'native' | 'custom';
116
+ /**
117
+ * Return the items to display in the tab context menu on right-click.
118
+ *
119
+ * Use built-in string shortcuts (`'close'`, `'closeOthers'`, `'closeAll'`, `'separator'`)
120
+ * or provide a `ContextMenuItemConfig` object for custom items.
121
+ *
122
+ * If omitted, no context menu is shown.
123
+ * Return an empty array to suppress the menu for specific cases.
124
+ */
125
+ getTabContextMenuItems?: (params: GetTabContextMenuItemsParams) => ContextMenuItem[];
126
+ /**
127
+ * Return the items to display in the tab group chip context menu on right-click.
128
+ *
129
+ * Use built-in string shortcuts (`'separator'`, `'colorPicker'`, `'rename'`) or provide a
130
+ * `ContextMenuItemConfig` object for custom items.
131
+ * `'colorPicker'` renders a native grid of color swatches for the tab group.
132
+ * `'rename'` renders an inline text input to rename the tab group.
133
+ *
134
+ * If omitted, no context menu is shown on chip right-click.
135
+ * Return an empty array to suppress the menu for specific cases.
136
+ */
137
+ getTabGroupChipContextMenuItems?: (params: GetTabGroupChipContextMenuItemsParams) => (BuiltInChipContextMenuItem | ContextMenuItemConfig)[];
138
+ /**
139
+ * Factory to create custom tab group chip renderers.
140
+ * If not provided, the default chip renderer is used.
141
+ */
142
+ createTabGroupChipComponent?: (tabGroup: ITabGroup) => ITabGroupChipRenderer;
143
+ /**
144
+ * Replace the built-in tab group color palette with a user-defined list.
145
+ *
146
+ * Each entry has an `id` (stored on `tabGroup.color` and serialized),
147
+ * a `value` (any CSS color expression — hex, rgb(), `var(...)`, etc.),
148
+ * and an optional `label` shown in the context menu picker.
149
+ *
150
+ * If omitted, the default 9-color palette is used. The list fully
151
+ * replaces the defaults — there is no merge.
152
+ */
153
+ tabGroupColors?: DockviewTabGroupColorEntry[];
154
+ /**
155
+ * Controls how dockview applies tab group color accents.
156
+ *
157
+ * - `'palette'` (default): write `--dv-tab-group-color`, render the
158
+ * color picker, and apply built-in accent styling.
159
+ * - `'off'`: opt out entirely. No `--dv-tab-group-color` is written,
160
+ * the color picker is suppressed, and chips/indicators render
161
+ * without the accent. The `tg.color` data field is preserved so
162
+ * custom chip renderers can still read it and roll their own visual.
163
+ */
164
+ tabGroupAccent?: 'palette' | 'off';
72
165
  }
166
+ export type TabAnimation = 'smooth' | 'default';
73
167
  export interface DockviewDndOverlayEvent extends IAcceptableEvent {
74
168
  nativeEvent: DragEvent;
75
169
  target: DockviewGroupDropLocation;
@@ -104,6 +198,7 @@ export interface DockviewFrameworkOptions {
104
198
  createTabComponent?: (options: CreateComponentOptions) => ITabRenderer | undefined;
105
199
  createComponent: (options: CreateComponentOptions) => IContentRenderer;
106
200
  createWatermarkComponent?: () => IWatermarkRenderer;
201
+ createContextMenuItemComponent?: (options: CreateContextMenuItemComponentOptions) => IContextMenuItemRenderer | undefined;
107
202
  }
108
203
  export type DockviewComponentOptions = DockviewOptions & DockviewFrameworkOptions;
109
204
  export interface PanelOptions<P extends object = Parameters> {
@@ -33,6 +33,11 @@ export const PROPERTY_KEYS_DOCKVIEW = (() => {
33
33
  theme: undefined,
34
34
  disableTabsOverflowList: undefined,
35
35
  scrollbars: undefined,
36
+ getTabContextMenuItems: undefined,
37
+ getTabGroupChipContextMenuItems: undefined,
38
+ createTabGroupChipComponent: undefined,
39
+ tabGroupColors: undefined,
40
+ tabGroupAccent: undefined,
36
41
  };
37
42
  return Object.keys(properties);
38
43
  })();
@@ -0,0 +1,99 @@
1
+ import { Event } from '../events';
2
+ import { CompositeDisposable } from '../lifecycle';
3
+ /**
4
+ * The accent color associated with a tab group.
5
+ *
6
+ * This is any CSS color expression: a palette id (e.g. `'grey'`, `'blue'`),
7
+ * a raw color literal (`'#abc123'`, `'rgb(0,0,0)'`), or `undefined` to inherit
8
+ * the default. Resolution to a concrete CSS value is handled by the
9
+ * dockview's `TabGroupColorPalette` (see `tabGroupAccent.ts`).
10
+ */
11
+ export type DockviewTabGroupColor = string;
12
+ export interface SerializedTabGroup {
13
+ id: string;
14
+ label?: string;
15
+ color?: string;
16
+ collapsed: boolean;
17
+ panelIds: string[];
18
+ componentParams?: Record<string, unknown>;
19
+ }
20
+ export interface TabGroupOptions {
21
+ label?: string;
22
+ color?: string;
23
+ collapsed?: boolean;
24
+ /**
25
+ * Free-form data passed to a custom chip renderer
26
+ * (`createTabGroupChipComponent`). Read via `tabGroup.componentParams`
27
+ * inside the renderer's `init` / `update`. Must be JSON-serializable to
28
+ * round-trip through layout serialization.
29
+ */
30
+ componentParams?: Record<string, unknown>;
31
+ }
32
+ export interface ITabGroup {
33
+ readonly id: string;
34
+ readonly label: string;
35
+ readonly color: string | undefined;
36
+ readonly collapsed: boolean;
37
+ readonly panelIds: readonly string[];
38
+ readonly size: number;
39
+ readonly isEmpty: boolean;
40
+ readonly componentParams: Record<string, unknown> | undefined;
41
+ readonly onDidChange: Event<void>;
42
+ readonly onDidPanelChange: Event<{
43
+ panelId: string;
44
+ type: 'add' | 'remove';
45
+ }>;
46
+ readonly onDidCollapseChange: Event<boolean>;
47
+ readonly onDidDestroy: Event<void>;
48
+ addPanel(panelId: string, index?: number): void;
49
+ removePanel(panelId: string): boolean;
50
+ indexOfPanel(panelId: string): number;
51
+ containsPanel(panelId: string): boolean;
52
+ setLabel(value: string): void;
53
+ setColor(value: string | undefined): void;
54
+ setComponentParams(value: Record<string, unknown> | undefined): void;
55
+ collapse(): void;
56
+ expand(): void;
57
+ toggle(): void;
58
+ toJSON(): SerializedTabGroup;
59
+ dispose(): void;
60
+ }
61
+ export declare class TabGroup extends CompositeDisposable implements ITabGroup {
62
+ readonly id: string;
63
+ private _label;
64
+ private _color;
65
+ private _collapsed;
66
+ private _componentParams;
67
+ private readonly _panelIds;
68
+ private readonly _onDidChange;
69
+ readonly onDidChange: Event<void>;
70
+ private readonly _onDidPanelChange;
71
+ readonly onDidPanelChange: Event<{
72
+ panelId: string;
73
+ type: "add" | "remove";
74
+ }>;
75
+ private readonly _onDidCollapseChange;
76
+ readonly onDidCollapseChange: Event<boolean>;
77
+ private readonly _onDidDestroy;
78
+ readonly onDidDestroy: Event<void>;
79
+ get label(): string;
80
+ get color(): string | undefined;
81
+ get componentParams(): Record<string, unknown> | undefined;
82
+ setLabel(value: string): void;
83
+ setColor(value: string | undefined): void;
84
+ setComponentParams(value: Record<string, unknown> | undefined): void;
85
+ get collapsed(): boolean;
86
+ get panelIds(): readonly string[];
87
+ get size(): number;
88
+ get isEmpty(): boolean;
89
+ constructor(id: string, options?: TabGroupOptions);
90
+ addPanel(panelId: string, index?: number): void;
91
+ removePanel(panelId: string): boolean;
92
+ indexOfPanel(panelId: string): number;
93
+ containsPanel(panelId: string): boolean;
94
+ collapse(): void;
95
+ expand(): void;
96
+ toggle(): void;
97
+ toJSON(): SerializedTabGroup;
98
+ dispose(): void;
99
+ }
@@ -0,0 +1,144 @@
1
+ import { Emitter } from '../events';
2
+ import { CompositeDisposable } from '../lifecycle';
3
+ export class TabGroup extends CompositeDisposable {
4
+ get label() {
5
+ return this._label;
6
+ }
7
+ get color() {
8
+ return this._color;
9
+ }
10
+ get componentParams() {
11
+ return this._componentParams;
12
+ }
13
+ setLabel(value) {
14
+ if (this.isDisposed || this._label === value) {
15
+ return;
16
+ }
17
+ this._label = value;
18
+ this._onDidChange.fire();
19
+ }
20
+ setColor(value) {
21
+ if (this.isDisposed) {
22
+ return;
23
+ }
24
+ const next = value === '' ? undefined : value;
25
+ if (this._color === next) {
26
+ return;
27
+ }
28
+ this._color = next;
29
+ this._onDidChange.fire();
30
+ }
31
+ setComponentParams(value) {
32
+ if (this.isDisposed) {
33
+ return;
34
+ }
35
+ this._componentParams = value;
36
+ this._onDidChange.fire();
37
+ }
38
+ get collapsed() {
39
+ return this._collapsed;
40
+ }
41
+ get panelIds() {
42
+ return this._panelIds;
43
+ }
44
+ get size() {
45
+ return this._panelIds.length;
46
+ }
47
+ get isEmpty() {
48
+ return this._panelIds.length === 0;
49
+ }
50
+ constructor(id, options) {
51
+ var _a, _b;
52
+ super();
53
+ this.id = id;
54
+ this._collapsed = false;
55
+ this._panelIds = [];
56
+ this._onDidChange = new Emitter();
57
+ this.onDidChange = this._onDidChange.event;
58
+ this._onDidPanelChange = new Emitter();
59
+ this.onDidPanelChange = this._onDidPanelChange.event;
60
+ this._onDidCollapseChange = new Emitter();
61
+ this.onDidCollapseChange = this._onDidCollapseChange.event;
62
+ this._onDidDestroy = new Emitter();
63
+ this.onDidDestroy = this._onDidDestroy.event;
64
+ this._label = (_a = options === null || options === void 0 ? void 0 : options.label) !== null && _a !== void 0 ? _a : '';
65
+ this._color = (options === null || options === void 0 ? void 0 : options.color) === '' ? undefined : options === null || options === void 0 ? void 0 : options.color;
66
+ this._collapsed = (_b = options === null || options === void 0 ? void 0 : options.collapsed) !== null && _b !== void 0 ? _b : false;
67
+ this._componentParams = options === null || options === void 0 ? void 0 : options.componentParams;
68
+ this.addDisposables(this._onDidChange, this._onDidPanelChange, this._onDidCollapseChange, this._onDidDestroy);
69
+ }
70
+ addPanel(panelId, index) {
71
+ if (this.isDisposed) {
72
+ return;
73
+ }
74
+ if (this._panelIds.includes(panelId)) {
75
+ return;
76
+ }
77
+ const insertIndex = index !== undefined
78
+ ? Math.max(0, Math.min(index, this._panelIds.length))
79
+ : this._panelIds.length;
80
+ this._panelIds.splice(insertIndex, 0, panelId);
81
+ this._onDidPanelChange.fire({ panelId, type: 'add' });
82
+ }
83
+ removePanel(panelId) {
84
+ if (this.isDisposed) {
85
+ return false;
86
+ }
87
+ const index = this._panelIds.indexOf(panelId);
88
+ if (index === -1) {
89
+ return false;
90
+ }
91
+ this._panelIds.splice(index, 1);
92
+ this._onDidPanelChange.fire({ panelId, type: 'remove' });
93
+ return true;
94
+ }
95
+ indexOfPanel(panelId) {
96
+ return this._panelIds.indexOf(panelId);
97
+ }
98
+ containsPanel(panelId) {
99
+ return this._panelIds.includes(panelId);
100
+ }
101
+ collapse() {
102
+ if (this.isDisposed || this._collapsed) {
103
+ return;
104
+ }
105
+ this._collapsed = true;
106
+ this._onDidCollapseChange.fire(true);
107
+ }
108
+ expand() {
109
+ if (this.isDisposed || !this._collapsed) {
110
+ return;
111
+ }
112
+ this._collapsed = false;
113
+ this._onDidCollapseChange.fire(false);
114
+ }
115
+ toggle() {
116
+ if (this._collapsed) {
117
+ this.expand();
118
+ }
119
+ else {
120
+ this.collapse();
121
+ }
122
+ }
123
+ toJSON() {
124
+ const result = {
125
+ id: this.id,
126
+ collapsed: this._collapsed,
127
+ panelIds: [...this._panelIds],
128
+ };
129
+ if (this._label) {
130
+ result.label = this._label;
131
+ }
132
+ if (this._color !== undefined) {
133
+ result.color = this._color;
134
+ }
135
+ if (this._componentParams !== undefined) {
136
+ result.componentParams = this._componentParams;
137
+ }
138
+ return result;
139
+ }
140
+ dispose() {
141
+ this._onDidDestroy.fire();
142
+ super.dispose();
143
+ }
144
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * A single entry in the tab-group color palette.
3
+ *
4
+ * `id` is the value stored on `ITabGroup.color` and serialized in
5
+ * `SerializedTabGroup.color`. `value` is any CSS color expression — a hex
6
+ * literal, an rgb()/hsl()/oklch() function, or a `var(...)` reference.
7
+ *
8
+ * The default palette ships with `var(--dv-tab-group-color-${id})` values so
9
+ * themes can override the defaults purely in CSS. User-supplied palettes
10
+ * typically use raw color literals.
11
+ */
12
+ export interface DockviewTabGroupColorEntry {
13
+ id: string;
14
+ value: string;
15
+ label?: string;
16
+ }
17
+ export declare const DEFAULT_TAB_GROUP_COLORS: readonly DockviewTabGroupColorEntry[];
18
+ /**
19
+ * Runtime palette for tab-group color accents.
20
+ *
21
+ * Resolves a stored `color` string to a CSS color expression, with three
22
+ * fall-through modes:
23
+ * 1. `id` matches an entry → entry's `value`
24
+ * 2. `id` doesn't match → `id` itself (raw CSS literal pass-through)
25
+ * 3. `id` is empty or undefined → undefined (caller skips assignment)
26
+ *
27
+ * When `enabled` is false the palette returns undefined for everything; this
28
+ * is the `tabGroupAccent: 'off'` opt-out path.
29
+ */
30
+ export declare class TabGroupColorPalette {
31
+ private _entries;
32
+ private _byId;
33
+ private _enabled;
34
+ constructor(entries: readonly DockviewTabGroupColorEntry[], enabled?: boolean);
35
+ get enabled(): boolean;
36
+ set enabled(value: boolean);
37
+ /**
38
+ * Replace the entry list in place. Used by `updateOptions` so that
39
+ * existing palette references (held by chips, indicators, etc.) see
40
+ * the new palette without needing to be re-wired.
41
+ */
42
+ setEntries(entries: readonly DockviewTabGroupColorEntry[]): void;
43
+ entries(): readonly DockviewTabGroupColorEntry[];
44
+ has(id: string): boolean;
45
+ get(id: string): DockviewTabGroupColorEntry | undefined;
46
+ /** First entry's id; used as the default when a color is unset. */
47
+ defaultId(): string | undefined;
48
+ /**
49
+ * Resolve a stored color to its CSS value, or undefined if no value
50
+ * should be written (palette disabled, or color empty/undefined).
51
+ */
52
+ resolveValue(color: string | undefined): string | undefined;
53
+ }
54
+ /**
55
+ * Set the `--dv-tab-group-color` custom property on `el` to the resolved
56
+ * accent value, or remove it when the palette is disabled / color is unset.
57
+ */
58
+ export declare function applyTabGroupAccent(el: HTMLElement, color: string | undefined, palette: TabGroupColorPalette | undefined): void;
59
+ /**
60
+ * Return the resolved CSS color for a tab group, or undefined when the
61
+ * palette is disabled or no color is set. Use this when you need the raw
62
+ * value to assign to a non-custom-property style (e.g. SVG stroke,
63
+ * backgroundColor on the indicator underline).
64
+ */
65
+ export declare function resolveTabGroupAccent(color: string | undefined, palette: TabGroupColorPalette | undefined): string | undefined;
@@ -0,0 +1,116 @@
1
+ export const DEFAULT_TAB_GROUP_COLORS = [
2
+ { id: 'grey', value: 'var(--dv-tab-group-color-grey)', label: 'Grey' },
3
+ { id: 'blue', value: 'var(--dv-tab-group-color-blue)', label: 'Blue' },
4
+ { id: 'red', value: 'var(--dv-tab-group-color-red)', label: 'Red' },
5
+ {
6
+ id: 'yellow',
7
+ value: 'var(--dv-tab-group-color-yellow)',
8
+ label: 'Yellow',
9
+ },
10
+ { id: 'green', value: 'var(--dv-tab-group-color-green)', label: 'Green' },
11
+ { id: 'pink', value: 'var(--dv-tab-group-color-pink)', label: 'Pink' },
12
+ {
13
+ id: 'purple',
14
+ value: 'var(--dv-tab-group-color-purple)',
15
+ label: 'Purple',
16
+ },
17
+ { id: 'cyan', value: 'var(--dv-tab-group-color-cyan)', label: 'Cyan' },
18
+ {
19
+ id: 'orange',
20
+ value: 'var(--dv-tab-group-color-orange)',
21
+ label: 'Orange',
22
+ },
23
+ ];
24
+ /**
25
+ * Runtime palette for tab-group color accents.
26
+ *
27
+ * Resolves a stored `color` string to a CSS color expression, with three
28
+ * fall-through modes:
29
+ * 1. `id` matches an entry → entry's `value`
30
+ * 2. `id` doesn't match → `id` itself (raw CSS literal pass-through)
31
+ * 3. `id` is empty or undefined → undefined (caller skips assignment)
32
+ *
33
+ * When `enabled` is false the palette returns undefined for everything; this
34
+ * is the `tabGroupAccent: 'off'` opt-out path.
35
+ */
36
+ export class TabGroupColorPalette {
37
+ constructor(entries, enabled = true) {
38
+ this._entries = entries.slice();
39
+ this._byId = new Map(entries.map((e) => [e.id, e]));
40
+ this._enabled = enabled;
41
+ }
42
+ get enabled() {
43
+ return this._enabled;
44
+ }
45
+ set enabled(value) {
46
+ this._enabled = value;
47
+ }
48
+ /**
49
+ * Replace the entry list in place. Used by `updateOptions` so that
50
+ * existing palette references (held by chips, indicators, etc.) see
51
+ * the new palette without needing to be re-wired.
52
+ */
53
+ setEntries(entries) {
54
+ this._entries = entries.slice();
55
+ this._byId = new Map(entries.map((e) => [e.id, e]));
56
+ }
57
+ entries() {
58
+ return this._entries;
59
+ }
60
+ has(id) {
61
+ return this._byId.has(id);
62
+ }
63
+ get(id) {
64
+ return this._byId.get(id);
65
+ }
66
+ /** First entry's id; used as the default when a color is unset. */
67
+ defaultId() {
68
+ var _a;
69
+ return (_a = this._entries[0]) === null || _a === void 0 ? void 0 : _a.id;
70
+ }
71
+ /**
72
+ * Resolve a stored color to its CSS value, or undefined if no value
73
+ * should be written (palette disabled, or color empty/undefined).
74
+ */
75
+ resolveValue(color) {
76
+ if (!this._enabled || !color) {
77
+ return undefined;
78
+ }
79
+ const entry = this._byId.get(color);
80
+ return entry ? entry.value : color;
81
+ }
82
+ }
83
+ let _fallbackPalette;
84
+ /**
85
+ * Lazy-built palette used when the accessor isn't available (test mocks,
86
+ * isolated chip construction). Production code paths always pass a real
87
+ * palette through.
88
+ */
89
+ function getFallbackPalette() {
90
+ if (!_fallbackPalette) {
91
+ _fallbackPalette = new TabGroupColorPalette(DEFAULT_TAB_GROUP_COLORS, true);
92
+ }
93
+ return _fallbackPalette;
94
+ }
95
+ /**
96
+ * Set the `--dv-tab-group-color` custom property on `el` to the resolved
97
+ * accent value, or remove it when the palette is disabled / color is unset.
98
+ */
99
+ export function applyTabGroupAccent(el, color, palette) {
100
+ const value = (palette !== null && palette !== void 0 ? palette : getFallbackPalette()).resolveValue(color);
101
+ if (value === undefined) {
102
+ el.style.removeProperty('--dv-tab-group-color');
103
+ }
104
+ else {
105
+ el.style.setProperty('--dv-tab-group-color', value);
106
+ }
107
+ }
108
+ /**
109
+ * Return the resolved CSS color for a tab group, or undefined when the
110
+ * palette is disabled or no color is set. Use this when you need the raw
111
+ * value to assign to a non-custom-property style (e.g. SVG stroke,
112
+ * backgroundColor on the indicator underline).
113
+ */
114
+ export function resolveTabGroupAccent(color, palette) {
115
+ return (palette !== null && palette !== void 0 ? palette : getFallbackPalette()).resolveValue(color);
116
+ }
@@ -1,3 +1,5 @@
1
+ import { TabAnimation } from './options';
2
+ export type DockviewTabGroupIndicator = 'wrap' | 'none';
1
3
  export interface DockviewTheme {
2
4
  /**
3
5
  * The name of the theme
@@ -7,10 +9,20 @@ export interface DockviewTheme {
7
9
  * The class name to apply to the theme containing the CSS variables settings.
8
10
  */
9
11
  className: string;
12
+ /**
13
+ * Whether the theme is light or dark. Useful for adapting panel content colors.
14
+ */
15
+ colorScheme?: 'light' | 'dark';
10
16
  /**
11
17
  * The gap between the groups
12
18
  */
13
19
  gap?: number;
20
+ /**
21
+ * The collapsed size (in px) for edge groups when using this theme.
22
+ * When set, this overrides the default 35px collapsed size so that
23
+ * collapsed edge groups match the theme's tab strip height.
24
+ */
25
+ edgeGroupCollapsedSize?: number;
14
26
  /**
15
27
  * The mouting position of the overlay shown when dragging a panel. `absolute`
16
28
  * will mount the overlay to root of the dockview component whereas `relative` will mount the overlay to the group container.
@@ -20,12 +32,55 @@ export interface DockviewTheme {
20
32
  * When dragging a panel, the overlay can either encompass the panel contents or the entire group including the tab header space.
21
33
  */
22
34
  dndPanelOverlay?: 'content' | 'group';
35
+ /**
36
+ * The style of the drop indicator shown when dragging a tab over another tab.
37
+ * `'line'` renders a thin 4px insertion strip at the tab edge (suited to bordered/spaced themes).
38
+ * `'fill'` renders a half-width highlighted area (suited to themes that use a background fill).
39
+ * Defaults to `'fill'`.
40
+ */
41
+ dndTabIndicator?: 'line' | 'fill';
42
+ /**
43
+ * The CSS value applied to `--dv-drag-over-border` when this theme is active.
44
+ * For example `'2px solid var(--dv-active-sash-color)'`.
45
+ * When unset the CSS variable is left to the stylesheet default (`none`).
46
+ */
47
+ dndOverlayBorder?: string;
48
+ /**
49
+ * Controls how tab groups are visually indicated in the tab bar.
50
+ *
51
+ * - `'wrap'` (default): Chrome-style SVG underline that wraps around the active tab
52
+ * with rounded corners. Requires JavaScript for positioning and path computation.
53
+ * - `'none'`: Flat continuous colored bar spanning the full tab group width.
54
+ * Unlike `'wrap'`, the bar does not curve around the active tab.
55
+ */
56
+ tabGroupIndicator?: DockviewTabGroupIndicator;
57
+ /**
58
+ * Controls tab drag-and-drop reorder animation style.
59
+ *
60
+ * - `"smooth"`: tabs animate smoothly during drag-and-drop reorder —
61
+ * tabs slide apart to reveal the insertion gap, then animate to their
62
+ * final positions on drop (Chrome-like behavior).
63
+ * - `"default"`: standard tab reorder behavior without animation.
64
+ *
65
+ * Defaults to `"default"`.
66
+ */
67
+ tabAnimation?: TabAnimation;
23
68
  }
24
69
  export declare const themeDark: DockviewTheme;
25
70
  export declare const themeLight: DockviewTheme;
26
71
  export declare const themeVisualStudio: DockviewTheme;
27
72
  export declare const themeAbyss: DockviewTheme;
28
73
  export declare const themeDracula: DockviewTheme;
29
- export declare const themeReplit: DockviewTheme;
30
74
  export declare const themeAbyssSpaced: DockviewTheme;
31
75
  export declare const themeLightSpaced: DockviewTheme;
76
+ export declare const themeNord: DockviewTheme;
77
+ export declare const themeNordSpaced: DockviewTheme;
78
+ export declare const themeCatppuccinMocha: DockviewTheme;
79
+ export declare const themeCatppuccinMochaSpaced: DockviewTheme;
80
+ export declare const themeMonokai: DockviewTheme;
81
+ export declare const themeSolarizedLight: DockviewTheme;
82
+ export declare const themeSolarizedLightSpaced: DockviewTheme;
83
+ export declare const themeGithubDark: DockviewTheme;
84
+ export declare const themeGithubDarkSpaced: DockviewTheme;
85
+ export declare const themeGithubLight: DockviewTheme;
86
+ export declare const themeGithubLightSpaced: DockviewTheme;