dockview-core 1.11.0 → 1.13.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 (73) hide show
  1. package/dist/cjs/api/component.api.d.ts +2 -1
  2. package/dist/cjs/api/component.api.js +7 -0
  3. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +5 -1
  4. package/dist/cjs/api/dockviewGroupPanelApi.js +19 -1
  5. package/dist/cjs/api/dockviewPanelApi.d.ts +6 -0
  6. package/dist/cjs/api/panelApi.d.ts +4 -0
  7. package/dist/cjs/dnd/droptarget.d.ts +1 -1
  8. package/dist/cjs/dnd/droptarget.js +4 -10
  9. package/dist/cjs/dockview/components/panel/content.js +2 -10
  10. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +12 -1
  11. package/dist/cjs/dockview/dockviewComponent.d.ts +8 -4
  12. package/dist/cjs/dockview/dockviewComponent.js +83 -68
  13. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +12 -1
  14. package/dist/cjs/dockview/dockviewGroupPanelModel.js +48 -21
  15. package/dist/cjs/dockview/dockviewPanelModel.js +21 -24
  16. package/dist/cjs/dockview/framework.d.ts +38 -0
  17. package/dist/cjs/dockview/framework.js +2 -0
  18. package/dist/cjs/dockview/options.d.ts +68 -46
  19. package/dist/cjs/dockview/options.js +43 -1
  20. package/dist/cjs/dockview/types.d.ts +4 -10
  21. package/dist/cjs/framwork.d.ts +4 -0
  22. package/dist/cjs/framwork.js +2 -0
  23. package/dist/cjs/index.d.ts +2 -1
  24. package/dist/cjs/index.js +1 -1
  25. package/dist/cjs/overlayRenderContainer.d.ts +1 -1
  26. package/dist/dockview-core.amd.js +1972 -1886
  27. package/dist/dockview-core.amd.js.map +1 -1
  28. package/dist/dockview-core.amd.min.js +2 -2
  29. package/dist/dockview-core.amd.min.js.map +1 -1
  30. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  31. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  32. package/dist/dockview-core.amd.noStyle.js +1972 -1886
  33. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  34. package/dist/dockview-core.cjs.js +1972 -1886
  35. package/dist/dockview-core.cjs.js.map +1 -1
  36. package/dist/dockview-core.esm.js +1971 -1887
  37. package/dist/dockview-core.esm.js.map +1 -1
  38. package/dist/dockview-core.esm.min.js +2 -2
  39. package/dist/dockview-core.esm.min.js.map +1 -1
  40. package/dist/dockview-core.js +1972 -1886
  41. package/dist/dockview-core.js.map +1 -1
  42. package/dist/dockview-core.min.js +2 -2
  43. package/dist/dockview-core.min.js.map +1 -1
  44. package/dist/dockview-core.min.noStyle.js +2 -2
  45. package/dist/dockview-core.min.noStyle.js.map +1 -1
  46. package/dist/dockview-core.noStyle.js +1972 -1886
  47. package/dist/dockview-core.noStyle.js.map +1 -1
  48. package/dist/esm/api/component.api.d.ts +2 -1
  49. package/dist/esm/api/component.api.js +3 -0
  50. package/dist/esm/api/dockviewGroupPanelApi.d.ts +5 -1
  51. package/dist/esm/api/dockviewGroupPanelApi.js +18 -1
  52. package/dist/esm/api/dockviewPanelApi.d.ts +6 -0
  53. package/dist/esm/api/panelApi.d.ts +4 -0
  54. package/dist/esm/dnd/droptarget.d.ts +1 -1
  55. package/dist/esm/dnd/droptarget.js +4 -10
  56. package/dist/esm/dockview/components/panel/content.js +2 -10
  57. package/dist/esm/dockview/components/titlebar/tabsContainer.js +12 -1
  58. package/dist/esm/dockview/dockviewComponent.d.ts +8 -4
  59. package/dist/esm/dockview/dockviewComponent.js +78 -69
  60. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +12 -1
  61. package/dist/esm/dockview/dockviewGroupPanelModel.js +36 -21
  62. package/dist/esm/dockview/dockviewPanelModel.js +21 -13
  63. package/dist/esm/dockview/framework.d.ts +38 -0
  64. package/dist/esm/dockview/framework.js +1 -0
  65. package/dist/esm/dockview/options.d.ts +68 -46
  66. package/dist/esm/dockview/options.js +36 -0
  67. package/dist/esm/dockview/types.d.ts +4 -10
  68. package/dist/esm/framwork.d.ts +4 -0
  69. package/dist/esm/framwork.js +1 -0
  70. package/dist/esm/index.d.ts +2 -1
  71. package/dist/esm/index.js +1 -1
  72. package/dist/esm/overlayRenderContainer.d.ts +1 -1
  73. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { IDockviewComponent, SerializedDockview } from '../dockview/dockviewComponent';
2
- import { AddGroupOptions, AddPanelOptions, MovementOptions } from '../dockview/options';
2
+ import { AddGroupOptions, AddPanelOptions, DockviewDndOverlayEvent, MovementOptions } from '../dockview/options';
3
3
  import { Parameters } from '../panel/types';
4
4
  import { Direction } from '../gridview/baseComponentGridview';
5
5
  import { AddComponentOptions, IGridviewComponent, SerializedGridviewComponent } from '../gridview/gridviewComponent';
@@ -393,6 +393,7 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
393
393
  * Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
394
394
  */
395
395
  get onWillDragPanel(): Event<TabDragEvent>;
396
+ get onUnhandledDragOverEvent(): Event<DockviewDndOverlayEvent>;
396
397
  /**
397
398
  * All panel objects.
398
399
  */
@@ -541,6 +541,9 @@ export class DockviewApi {
541
541
  get onWillDragPanel() {
542
542
  return this.component.onWillDragPanel;
543
543
  }
544
+ get onUnhandledDragOverEvent() {
545
+ return this.component.onUnhandledDragOverEvent;
546
+ }
544
547
  /**
545
548
  * All panel objects.
546
549
  */
@@ -1,11 +1,12 @@
1
1
  import { Position } from '../dnd/droptarget';
2
2
  import { DockviewComponent } from '../dockview/dockviewComponent';
3
3
  import { DockviewGroupPanel } from '../dockview/dockviewGroupPanel';
4
- import { DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
4
+ import { DockviewGroupChangeEvent, DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
5
5
  import { Emitter, Event } from '../events';
6
6
  import { GridviewPanelApi, GridviewPanelApiImpl } from './gridviewPanelApi';
7
7
  export interface DockviewGroupPanelApi extends GridviewPanelApi {
8
8
  readonly onDidLocationChange: Event<DockviewGroupPanelFloatingChangeEvent>;
9
+ readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
9
10
  readonly location: DockviewGroupLocation;
10
11
  /**
11
12
  * If you require the Window object
@@ -25,9 +26,12 @@ export interface DockviewGroupPanelFloatingChangeEvent {
25
26
  }
26
27
  export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
27
28
  private readonly accessor;
29
+ private readonly _mutableDisposable;
28
30
  private _group;
29
31
  readonly _onDidLocationChange: Emitter<DockviewGroupPanelFloatingChangeEvent>;
30
32
  readonly onDidLocationChange: Event<DockviewGroupPanelFloatingChangeEvent>;
33
+ private readonly _onDidActivePanelChange;
34
+ readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
31
35
  get location(): DockviewGroupLocation;
32
36
  constructor(id: string, accessor: DockviewComponent);
33
37
  close(): void;
@@ -1,5 +1,6 @@
1
1
  import { positionToDirection } from '../dnd/droptarget';
2
2
  import { Emitter } from '../events';
3
+ import { MutableDisposable } from '../lifecycle';
3
4
  import { GridviewPanelApiImpl } from './gridviewPanelApi';
4
5
  // TODO find a better way to initialize and avoid needing null checks
5
6
  const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
@@ -13,9 +14,12 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
13
14
  constructor(id, accessor) {
14
15
  super(id, '__dockviewgroup__');
15
16
  this.accessor = accessor;
17
+ this._mutableDisposable = new MutableDisposable();
16
18
  this._onDidLocationChange = new Emitter();
17
19
  this.onDidLocationChange = this._onDidLocationChange.event;
18
- this.addDisposables(this._onDidLocationChange);
20
+ this._onDidActivePanelChange = new Emitter();
21
+ this.onDidActivePanelChange = this._onDidActivePanelChange.event;
22
+ this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._mutableDisposable);
19
23
  }
20
24
  close() {
21
25
  if (!this._group) {
@@ -73,5 +77,18 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
73
77
  }
74
78
  initialize(group) {
75
79
  this._group = group;
80
+ /**
81
+ * TODO: Annoying initialization order caveat
82
+ *
83
+ * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
84
+ * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
85
+ * finished ensuring the `model` is defined.
86
+ */
87
+ queueMicrotask(() => {
88
+ this._mutableDisposable.value =
89
+ this._group.model.onDidActivePanelChange((event) => {
90
+ this._onDidActivePanelChange.fire(event);
91
+ });
92
+ });
76
93
  }
77
94
  }
@@ -19,6 +19,12 @@ export interface ActiveGroupEvent {
19
19
  export interface GroupChangedEvent {
20
20
  }
21
21
  export interface DockviewPanelApi extends Omit<GridviewPanelApi, 'setVisible' | 'onDidConstraintsChange' | 'setConstraints'> {
22
+ /**
23
+ * The id of the tab component renderer
24
+ *
25
+ * Undefined if no custom tab renderer is provided
26
+ */
27
+ readonly tabComponent: string | undefined;
22
28
  readonly group: DockviewGroupPanel;
23
29
  readonly isGroupActive: boolean;
24
30
  readonly renderer: DockviewPanelRenderer;
@@ -23,6 +23,10 @@ export interface PanelApi {
23
23
  setActive(): void;
24
24
  setVisible(isVisible: boolean): void;
25
25
  updateParameters(parameters: Parameters): void;
26
+ /**
27
+ * The id of the component renderer
28
+ */
29
+ readonly component: string;
26
30
  /**
27
31
  * The id of the panel that would have been assigned when the panel was created
28
32
  */
@@ -18,7 +18,7 @@ export declare class WillShowOverlayEvent extends DockviewEvent implements Dropt
18
18
  export declare function directionToPosition(direction: Direction): Position;
19
19
  export declare function positionToDirection(position: Position): Direction;
20
20
  export type Position = 'top' | 'bottom' | 'left' | 'right' | 'center';
21
- export type CanDisplayOverlay = boolean | ((dragEvent: DragEvent, state: Position) => boolean);
21
+ export type CanDisplayOverlay = (dragEvent: DragEvent, state: Position) => boolean;
22
22
  export type MeasuredValue = {
23
23
  value: number;
24
24
  type: 'pixels' | 'percentage';
@@ -97,6 +97,10 @@ export class Droptarget extends CompositeDisposable {
97
97
  this.removeDropTarget();
98
98
  return;
99
99
  }
100
+ if (!this.options.canDisplayOverlay(e, quadrant)) {
101
+ this.removeDropTarget();
102
+ return;
103
+ }
100
104
  const willShowOverlayEvent = new WillShowOverlayEvent({
101
105
  nativeEvent: e,
102
106
  position: quadrant,
@@ -110,16 +114,6 @@ export class Droptarget extends CompositeDisposable {
110
114
  this.removeDropTarget();
111
115
  return;
112
116
  }
113
- if (typeof this.options.canDisplayOverlay === 'boolean') {
114
- if (!this.options.canDisplayOverlay) {
115
- this.removeDropTarget();
116
- return;
117
- }
118
- }
119
- else if (!this.options.canDisplayOverlay(e, quadrant)) {
120
- this.removeDropTarget();
121
- return;
122
- }
123
117
  this.markAsUsed(e);
124
118
  if (!this.targetElement) {
125
119
  this.targetElement = document.createElement('div');
@@ -72,7 +72,7 @@ export class ContentContainer extends CompositeDisposable {
72
72
  this.panel = panel;
73
73
  let container;
74
74
  switch (panel.api.renderer) {
75
- case 'onlyWhenVisibile':
75
+ case 'onlyWhenVisible':
76
76
  this.group.renderContainer.detatch(panel);
77
77
  if (this.panel) {
78
78
  if (doRender) {
@@ -92,17 +92,9 @@ export class ContentContainer extends CompositeDisposable {
92
92
  break;
93
93
  }
94
94
  if (doRender) {
95
- const _onDidFocus = panel.view.content.onDidFocus;
96
- const _onDidBlur = panel.view.content.onDidBlur;
97
95
  const focusTracker = trackFocus(container);
98
96
  const disposable = new CompositeDisposable();
99
97
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
100
- if (_onDidFocus) {
101
- disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
102
- }
103
- if (_onDidBlur) {
104
- disposable.addDisposables(_onDidBlur(() => this._onDidBlur.fire()));
105
- }
106
98
  this.disposable.value = disposable;
107
99
  }
108
100
  }
@@ -118,7 +110,7 @@ export class ContentContainer extends CompositeDisposable {
118
110
  closePanel() {
119
111
  var _a;
120
112
  if (this.panel) {
121
- if (this.panel.api.renderer === 'onlyWhenVisibile') {
113
+ if (this.panel.api.renderer === 'onlyWhenVisible') {
122
114
  (_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
123
115
  }
124
116
  }
@@ -4,6 +4,7 @@ import { Tab } from '../tab/tab';
4
4
  import { VoidContainer } from './voidContainer';
5
5
  import { toggleClass } from '../../../dom';
6
6
  import { WillShowOverlayLocationEvent, } from '../../dockviewGroupPanelModel';
7
+ import { getPanelData } from '../../../dnd/dataTransfer';
7
8
  export class TabsContainer extends CompositeDisposable {
8
9
  get panels() {
9
10
  return this.tabs.map((_) => _.value.panel.id);
@@ -128,6 +129,10 @@ export class TabsContainer extends CompositeDisposable {
128
129
  }), this.voidContainer.onWillShowOverlay((event) => {
129
130
  this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
130
131
  kind: 'header_space',
132
+ panel: this.group.activePanel,
133
+ api: this.accessor.api,
134
+ group: this.group,
135
+ getData: getPanelData,
131
136
  }));
132
137
  }), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
133
138
  const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
@@ -225,7 +230,13 @@ export class TabsContainer extends CompositeDisposable {
225
230
  index: this.tabs.findIndex((x) => x.value === tab),
226
231
  });
227
232
  }), tab.onWillShowOverlay((event) => {
228
- this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, { kind: 'tab' }));
233
+ this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
234
+ kind: 'tab',
235
+ panel: this.group.activePanel,
236
+ api: this.accessor.api,
237
+ group: this.group,
238
+ getData: getPanelData,
239
+ }));
229
240
  }));
230
241
  const value = { value: tab, disposable };
231
242
  this.addTab(value, index);
@@ -3,8 +3,9 @@ import { Position } from '../dnd/droptarget';
3
3
  import { DockviewPanel, IDockviewPanel } from './dockviewPanel';
4
4
  import { Event, Emitter } from '../events';
5
5
  import { IWatermarkRenderer, GroupviewPanelState } from './types';
6
- import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, MovementOptions } from './options';
6
+ import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, DockviewOptions, MovementOptions } from './options';
7
7
  import { BaseGrid, IBaseGrid } from '../gridview/baseComponentGridview';
8
+ import { DockviewApi } from '../api/component.api';
8
9
  import { Orientation } from '../splitview/splitview';
9
10
  import { GroupOptions, GroupPanelViewState, DockviewDidDropEvent, DockviewWillDropEvent, WillShowOverlayLocationEvent } from './dockviewGroupPanelModel';
10
11
  import { DockviewGroupPanel } from './dockviewGroupPanel';
@@ -41,7 +42,6 @@ export interface SerializedDockview {
41
42
  floatingGroups?: SerializedFloatingGroup[];
42
43
  popoutGroups?: SerializedPopoutGroup[];
43
44
  }
44
- export type DockviewComponentUpdateOptions = Pick<DockviewComponentOptions, 'orientation' | 'components' | 'frameworkComponents' | 'tabComponents' | 'frameworkTabComponents' | 'showDndOverlay' | 'watermarkFrameworkComponent' | 'defaultTabComponent' | 'createLeftHeaderActionsElement' | 'createRightHeaderActionsElement' | 'createPrefixHeaderActionsElement' | 'disableFloatingGroups' | 'floatingGroupBounds' | 'rootOverlayModel' | 'disableDnd'>;
45
45
  type MoveGroupOptions = {
46
46
  from: {
47
47
  group: DockviewGroupPanel;
@@ -79,8 +79,9 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
79
79
  readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
80
80
  readonly onDidAddGroup: Event<DockviewGroupPanel>;
81
81
  readonly onDidActiveGroupChange: Event<DockviewGroupPanel | undefined>;
82
+ readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
82
83
  readonly options: DockviewComponentOptions;
83
- updateOptions(options: DockviewComponentUpdateOptions): void;
84
+ updateOptions(options: DockviewOptions): void;
84
85
  moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
85
86
  moveGroup(options: MoveGroupOptions): void;
86
87
  doSetGroupActive: (group: DockviewGroupPanel, skipFocus?: boolean) => void;
@@ -131,6 +132,8 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
131
132
  readonly onWillDrop: Event<DockviewWillDropEvent>;
132
133
  private readonly _onWillShowOverlay;
133
134
  readonly onWillShowOverlay: Event<WillShowOverlayLocationEvent>;
135
+ private readonly _onUnhandledDragOverEvent;
136
+ readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
134
137
  private readonly _onDidRemovePanel;
135
138
  readonly onDidRemovePanel: Event<IDockviewPanel>;
136
139
  private readonly _onDidAddPanel;
@@ -156,6 +159,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
156
159
  get options(): DockviewComponentOptions;
157
160
  get activePanel(): IDockviewPanel | undefined;
158
161
  get renderer(): DockviewPanelRenderer;
162
+ get api(): DockviewApi;
159
163
  constructor(options: DockviewComponentOptions);
160
164
  addPopoutGroup(itemToPopout: DockviewPanel | DockviewGroupPanel, options?: {
161
165
  skipRemoveGroup?: boolean;
@@ -182,7 +186,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
182
186
  skipActiveGroup?: boolean;
183
187
  }): void;
184
188
  private orthogonalize;
185
- updateOptions(options: DockviewComponentUpdateOptions): void;
189
+ updateOptions(options: Partial<DockviewComponentOptions>): void;
186
190
  layout(width: number, height: number, forceResize?: boolean | undefined): void;
187
191
  focus(): void;
188
192
  getGroupPanel(id: string): IDockviewPanel | undefined;
@@ -7,8 +7,7 @@ import { Event, Emitter, addDisposableWindowListener } from '../events';
7
7
  import { Watermark } from './components/watermark/watermark';
8
8
  import { sequentialNumberGenerator } from '../math';
9
9
  import { DefaultDockviewDeserialzier } from './deserializer';
10
- import { createComponent } from '../panel/componentFactory';
11
- import { isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, } from './options';
10
+ import { DockviewUnhandledDragOverEvent, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, } from './options';
12
11
  import { BaseGrid, toTarget, } from '../gridview/baseComponentGridview';
13
12
  import { DockviewApi } from '../api/component.api';
14
13
  import { Orientation, Sizing } from '../splitview/splitview';
@@ -141,14 +140,19 @@ export class DockviewComponent extends BaseGrid {
141
140
  }
142
141
  get renderer() {
143
142
  var _a;
144
- return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisibile';
143
+ return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisible';
144
+ }
145
+ get api() {
146
+ return this._api;
145
147
  }
146
148
  constructor(options) {
147
- var _a, _b;
149
+ var _a;
148
150
  super({
149
151
  proportionalLayout: true,
150
- orientation: (_a = options.orientation) !== null && _a !== void 0 ? _a : Orientation.HORIZONTAL,
151
- styles: options.styles,
152
+ orientation: Orientation.HORIZONTAL,
153
+ styles: options.hideBorders
154
+ ? { separatorBorder: 'transparent' }
155
+ : undefined,
152
156
  parentElement: options.parentElement,
153
157
  disableAutoResizing: options.disableAutoResizing,
154
158
  locked: options.locked,
@@ -166,6 +170,8 @@ export class DockviewComponent extends BaseGrid {
166
170
  this.onWillDrop = this._onWillDrop.event;
167
171
  this._onWillShowOverlay = new Emitter();
168
172
  this.onWillShowOverlay = this._onWillShowOverlay.event;
173
+ this._onUnhandledDragOverEvent = new Emitter();
174
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
169
175
  this._onDidRemovePanel = new Emitter();
170
176
  this.onDidRemovePanel = this._onDidRemovePanel.event;
171
177
  this._onDidAddPanel = new Emitter();
@@ -191,7 +197,7 @@ export class DockviewComponent extends BaseGrid {
191
197
  this.overlayRenderContainer = new OverlayRenderContainer(gready);
192
198
  toggleClass(this.gridview.element, 'dv-dockview', true);
193
199
  toggleClass(this.element, 'dv-debug', !!options.debug);
194
- this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
200
+ this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this.onDidAdd((event) => {
195
201
  if (!this._moving) {
196
202
  this._onDidAddGroup.fire(event);
197
203
  }
@@ -218,22 +224,6 @@ export class DockviewComponent extends BaseGrid {
218
224
  }
219
225
  }));
220
226
  this._options = options;
221
- if (!this.options.components) {
222
- this.options.components = {};
223
- }
224
- if (!this.options.frameworkComponents) {
225
- this.options.frameworkComponents = {};
226
- }
227
- if (!this.options.frameworkTabComponents) {
228
- this.options.frameworkTabComponents = {};
229
- }
230
- if (!this.options.tabComponents) {
231
- this.options.tabComponents = {};
232
- }
233
- if (!this.options.watermarkComponent &&
234
- !this.options.watermarkFrameworkComponent) {
235
- this.options.watermarkComponent = Watermark;
236
- }
237
227
  this._rootDropTarget = new Droptarget(this.element, {
238
228
  canDisplayOverlay: (event, position) => {
239
229
  const data = getPanelData();
@@ -248,26 +238,20 @@ export class DockviewComponent extends BaseGrid {
248
238
  }
249
239
  return true;
250
240
  }
251
- if (this.options.showDndOverlay) {
252
- if (position === 'center' && this.gridview.length !== 0) {
253
- /**
254
- * for external events only show the four-corner drag overlays, disable
255
- * the center position so that external drag events can fall through to the group
256
- * and panel drop target handlers
257
- */
258
- return false;
259
- }
260
- return this.options.showDndOverlay({
261
- nativeEvent: event,
262
- position: position,
263
- target: 'edge',
264
- getData: getPanelData,
265
- });
241
+ if (position === 'center' && this.gridview.length !== 0) {
242
+ /**
243
+ * for external events only show the four-corner drag overlays, disable
244
+ * the center position so that external drag events can fall through to the group
245
+ * and panel drop target handlers
246
+ */
247
+ return false;
266
248
  }
267
- return false;
249
+ const firedEvent = new DockviewUnhandledDragOverEvent(event, 'edge', position, getPanelData);
250
+ this._onUnhandledDragOverEvent.fire(firedEvent);
251
+ return firedEvent.isAccepted;
268
252
  },
269
253
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
270
- overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
254
+ overlayModel: (_a = this.options.rootOverlayModel) !== null && _a !== void 0 ? _a : DEFAULT_ROOT_OVERLAY_MODEL,
271
255
  });
272
256
  this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
273
257
  if (this.gridview.length > 0 && event.position === 'center') {
@@ -276,6 +260,10 @@ export class DockviewComponent extends BaseGrid {
276
260
  }
277
261
  this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
278
262
  kind: 'edge',
263
+ panel: undefined,
264
+ api: this._api,
265
+ group: undefined,
266
+ getData: getPanelData,
279
267
  }));
280
268
  }), this._rootDropTarget.onDrop((event) => {
281
269
  var _a;
@@ -487,7 +475,7 @@ export class DockviewComponent extends BaseGrid {
487
475
  skipDispose: true,
488
476
  skipSetActiveGroup: true,
489
477
  }));
490
- group.model.openPanel(item, { skipSetGroupActive: true });
478
+ this.movingLock(() => group.model.openPanel(item, { skipSetGroupActive: true }));
491
479
  }
492
480
  else {
493
481
  group = item;
@@ -560,7 +548,7 @@ export class DockviewComponent extends BaseGrid {
560
548
  // this is either a resize or a move
561
549
  // to inform the panels .layout(...) the group with it's current size
562
550
  // don't care about resize since the above watcher handles that
563
- group.layout(group.height, group.width);
551
+ group.layout(group.width, group.height);
564
552
  }), overlay.onDidChangeEnd(() => {
565
553
  this._bufferOnDidLayoutChange.fire();
566
554
  }), group.onDidChange((event) => {
@@ -617,16 +605,11 @@ export class DockviewComponent extends BaseGrid {
617
605
  }
618
606
  updateOptions(options) {
619
607
  var _a, _b;
620
- const changed_orientation = typeof options.orientation === 'string' &&
621
- this.gridview.orientation !== options.orientation;
622
- const changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
608
+ const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
623
609
  options.floatingGroupBounds !== this.options.floatingGroupBounds;
624
- const changed_rootOverlayOptions = options.rootOverlayModel !== undefined &&
610
+ const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
625
611
  options.rootOverlayModel !== this.options.rootOverlayModel;
626
612
  this._options = Object.assign(Object.assign({}, this.options), options);
627
- if (changed_orientation) {
628
- this.gridview.orientation = options.orientation;
629
- }
630
613
  if (changed_floatingGroupBounds) {
631
614
  for (const group of this._floatingGroups) {
632
615
  switch (this.options.floatingGroupBounds) {
@@ -914,7 +897,7 @@ export class DockviewComponent extends BaseGrid {
914
897
  ? this.getGroupPanel(options.position.referencePanel)
915
898
  : options.position.referencePanel;
916
899
  if (!referencePanel) {
917
- throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
900
+ throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
918
901
  }
919
902
  referenceGroup = this.findGroup(referencePanel);
920
903
  }
@@ -924,14 +907,19 @@ export class DockviewComponent extends BaseGrid {
924
907
  ? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
925
908
  : options.position.referenceGroup;
926
909
  if (!referenceGroup) {
927
- throw new Error(`referencePanel ${options.position.referenceGroup} does not exist`);
910
+ throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
928
911
  }
929
912
  }
930
913
  else {
931
914
  const group = this.orthogonalize(directionToPosition(options.position.direction));
932
915
  const panel = this.createPanel(options, group);
933
- group.model.openPanel(panel);
934
- this.doSetGroupAndPanelActive(group);
916
+ group.model.openPanel(panel, {
917
+ skipSetActive: options.inactive,
918
+ skipSetGroupActive: options.inactive,
919
+ });
920
+ if (!options.inactive) {
921
+ this.doSetGroupAndPanelActive(group);
922
+ }
935
923
  return panel;
936
924
  }
937
925
  }
@@ -954,43 +942,64 @@ export class DockviewComponent extends BaseGrid {
954
942
  skipActiveGroup: true,
955
943
  });
956
944
  panel = this.createPanel(options, group);
957
- group.model.openPanel(panel);
945
+ group.model.openPanel(panel, {
946
+ skipSetActive: options.inactive,
947
+ skipSetGroupActive: options.inactive,
948
+ });
958
949
  }
959
950
  else if (referenceGroup.api.location.type === 'floating' ||
960
951
  target === 'center') {
961
952
  panel = this.createPanel(options, referenceGroup);
962
- referenceGroup.model.openPanel(panel);
963
- this.doSetGroupAndPanelActive(referenceGroup);
953
+ referenceGroup.model.openPanel(panel, {
954
+ skipSetActive: options.inactive,
955
+ skipSetGroupActive: options.inactive,
956
+ });
957
+ if (!options.inactive) {
958
+ this.doSetGroupAndPanelActive(referenceGroup);
959
+ }
964
960
  }
965
961
  else {
966
962
  const location = getGridLocation(referenceGroup.element);
967
963
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
968
964
  const group = this.createGroupAtLocation(relativeLocation);
969
965
  panel = this.createPanel(options, group);
970
- group.model.openPanel(panel);
971
- this.doSetGroupAndPanelActive(group);
966
+ group.model.openPanel(panel, {
967
+ skipSetActive: options.inactive,
968
+ skipSetGroupActive: options.inactive,
969
+ });
970
+ if (!options.inactive) {
971
+ this.doSetGroupAndPanelActive(group);
972
+ }
972
973
  }
973
974
  }
974
975
  else if (options.floating) {
975
976
  const group = this.createGroup();
976
977
  this._onDidAddGroup.fire(group);
977
- const o = typeof options.floating === 'object' &&
978
+ const coordinates = typeof options.floating === 'object' &&
978
979
  options.floating !== null
979
980
  ? options.floating
980
981
  : {};
981
- this.addFloatingGroup(group, o, {
982
+ this.addFloatingGroup(group, coordinates, {
982
983
  inDragMode: false,
983
984
  skipRemoveGroup: true,
984
985
  skipActiveGroup: true,
985
986
  });
986
987
  panel = this.createPanel(options, group);
987
- group.model.openPanel(panel);
988
+ group.model.openPanel(panel, {
989
+ skipSetActive: options.inactive,
990
+ skipSetGroupActive: options.inactive,
991
+ });
988
992
  }
989
993
  else {
990
994
  const group = this.createGroupAtLocation();
991
995
  panel = this.createPanel(options, group);
992
- group.model.openPanel(panel);
993
- this.doSetGroupAndPanelActive(group);
996
+ group.model.openPanel(panel, {
997
+ skipSetActive: options.inactive,
998
+ skipSetGroupActive: options.inactive,
999
+ });
1000
+ if (!options.inactive) {
1001
+ this.doSetGroupAndPanelActive(group);
1002
+ }
994
1003
  }
995
1004
  return panel;
996
1005
  }
@@ -1014,12 +1023,10 @@ export class DockviewComponent extends BaseGrid {
1014
1023
  }
1015
1024
  }
1016
1025
  createWatermarkComponent() {
1017
- var _a;
1018
- return createComponent('watermark-id', 'watermark-name', this.options.watermarkComponent
1019
- ? { 'watermark-name': this.options.watermarkComponent }
1020
- : {}, this.options.watermarkFrameworkComponent
1021
- ? { 'watermark-name': this.options.watermarkFrameworkComponent }
1022
- : {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
1026
+ if (this.options.createWatermarkComponent) {
1027
+ return this.options.createWatermarkComponent();
1028
+ }
1029
+ return new Watermark();
1023
1030
  }
1024
1031
  updateWatermark() {
1025
1032
  var _a, _b;
@@ -1400,6 +1407,8 @@ export class DockviewComponent extends BaseGrid {
1400
1407
  return;
1401
1408
  }
1402
1409
  this._onWillShowOverlay.fire(event);
1410
+ }), view.model.onUnhandledDragOverEvent((event) => {
1411
+ this._onUnhandledDragOverEvent.fire(event);
1403
1412
  }), view.model.onDidAddPanel((event) => {
1404
1413
  if (this._moving) {
1405
1414
  return;
@@ -9,6 +9,7 @@ import { IPanel, PanelInitParameters, PanelUpdateEvent, Parameters } from '../pa
9
9
  import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
10
10
  import { DockviewGroupPanel } from './dockviewGroupPanel';
11
11
  import { IDockviewPanel } from './dockviewPanel';
12
+ import { DockviewDndOverlayEvent } from './options';
12
13
  import { OverlayRenderContainer } from '../overlayRenderContainer';
13
14
  import { TitleEvent } from '../api/dockviewPanelApi';
14
15
  interface GroupMoveEvent {
@@ -118,14 +119,22 @@ export type DockviewGroupLocation = {
118
119
  };
119
120
  export declare class WillShowOverlayLocationEvent implements IDockviewEvent {
120
121
  private readonly event;
121
- private _kind;
122
+ private readonly options;
122
123
  get kind(): DockviewGroupDropLocation;
123
124
  get nativeEvent(): DragEvent;
124
125
  get position(): Position;
125
126
  get defaultPrevented(): boolean;
127
+ get panel(): IDockviewPanel | undefined;
128
+ get api(): DockviewApi;
129
+ get group(): DockviewGroupPanel | undefined;
126
130
  preventDefault(): void;
131
+ getData(): PanelTransfer | undefined;
127
132
  constructor(event: WillShowOverlayEvent, options: {
128
133
  kind: DockviewGroupDropLocation;
134
+ panel: IDockviewPanel | undefined;
135
+ api: DockviewApi;
136
+ group: DockviewGroupPanel | undefined;
137
+ getData: () => PanelTransfer | undefined;
129
138
  });
130
139
  }
131
140
  export declare class DockviewGroupPanelModel extends CompositeDisposable implements IDockviewGroupPanelModel {
@@ -173,6 +182,8 @@ export declare class DockviewGroupPanelModel extends CompositeDisposable impleme
173
182
  readonly onDidRemovePanel: Event<DockviewGroupChangeEvent>;
174
183
  private readonly _onDidActivePanelChange;
175
184
  readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
185
+ private readonly _onUnhandledDragOverEvent;
186
+ readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
176
187
  private readonly _api;
177
188
  get element(): HTMLElement;
178
189
  get activePanel(): IDockviewPanel | undefined;