dockview-core 1.15.0 → 1.15.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 (37) hide show
  1. package/dist/cjs/api/component.api.d.ts +1 -0
  2. package/dist/cjs/api/component.api.js +7 -0
  3. package/dist/cjs/dockview/dockviewComponent.d.ts +7 -3
  4. package/dist/cjs/dockview/dockviewComponent.js +18 -8
  5. package/dist/cjs/dockview/options.d.ts +2 -2
  6. package/dist/cjs/gridview/baseComponentGridview.js +1 -1
  7. package/dist/cjs/types.d.ts +1 -1
  8. package/dist/dockview-core.amd.js +19 -10
  9. package/dist/dockview-core.amd.js.map +1 -1
  10. package/dist/dockview-core.amd.min.js +2 -2
  11. package/dist/dockview-core.amd.min.js.map +1 -1
  12. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  13. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  14. package/dist/dockview-core.amd.noStyle.js +19 -10
  15. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  16. package/dist/dockview-core.cjs.js +19 -10
  17. package/dist/dockview-core.cjs.js.map +1 -1
  18. package/dist/dockview-core.esm.js +19 -10
  19. package/dist/dockview-core.esm.js.map +1 -1
  20. package/dist/dockview-core.esm.min.js +2 -2
  21. package/dist/dockview-core.esm.min.js.map +1 -1
  22. package/dist/dockview-core.js +19 -10
  23. package/dist/dockview-core.js.map +1 -1
  24. package/dist/dockview-core.min.js +2 -2
  25. package/dist/dockview-core.min.js.map +1 -1
  26. package/dist/dockview-core.min.noStyle.js +2 -2
  27. package/dist/dockview-core.min.noStyle.js.map +1 -1
  28. package/dist/dockview-core.noStyle.js +19 -10
  29. package/dist/dockview-core.noStyle.js.map +1 -1
  30. package/dist/esm/api/component.api.d.ts +1 -0
  31. package/dist/esm/api/component.api.js +3 -0
  32. package/dist/esm/dockview/dockviewComponent.d.ts +7 -3
  33. package/dist/esm/dockview/dockviewComponent.js +14 -8
  34. package/dist/esm/dockview/options.d.ts +2 -2
  35. package/dist/esm/gridview/baseComponentGridview.js +1 -1
  36. package/dist/esm/types.d.ts +1 -1
  37. package/package.json +1 -1
@@ -330,6 +330,7 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
330
330
  * Total number of panels.
331
331
  */
332
332
  get totalPanels(): number;
333
+ get gap(): number;
333
334
  /**
334
335
  * Invoked when the active group changes. May be undefined if no group is active.
335
336
  */
@@ -452,6 +452,9 @@ export class DockviewApi {
452
452
  get totalPanels() {
453
453
  return this.component.totalPanels;
454
454
  }
455
+ get gap() {
456
+ return this.component.gap;
457
+ }
455
458
  /**
456
459
  * Invoked when the active group changes. May be undefined if no group is active.
457
460
  */
@@ -11,7 +11,7 @@ import { GroupOptions, GroupPanelViewState, DockviewDidDropEvent, DockviewWillDr
11
11
  import { DockviewGroupPanel } from './dockviewGroupPanel';
12
12
  import { Parameters } from '../panel/types';
13
13
  import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
14
- import { AnchoredBox, Box } from '../types';
14
+ import { AnchoredBox, AnchorPosition, Box } from '../types';
15
15
  import { DockviewPanelRenderer, OverlayRenderContainer } from '../overlayRenderContainer';
16
16
  export interface PanelReference {
17
17
  update: (event: {
@@ -71,7 +71,9 @@ export interface FloatingGroupOptions {
71
71
  y?: number;
72
72
  height?: number;
73
73
  width?: number;
74
- position?: AnchoredBox;
74
+ position?: AnchorPosition;
75
+ }
76
+ export interface FloatingGroupOptionsInternal extends FloatingGroupOptions {
75
77
  skipRemoveGroup?: boolean;
76
78
  inDragMode?: boolean;
77
79
  skipActiveGroup?: boolean;
@@ -81,6 +83,7 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
81
83
  readonly totalPanels: number;
82
84
  readonly panels: IDockviewPanel[];
83
85
  readonly orientation: Orientation;
86
+ readonly gap: number;
84
87
  readonly onDidDrop: Event<DockviewDidDropEvent>;
85
88
  readonly onWillDrop: Event<DockviewWillDropEvent>;
86
89
  readonly onWillShowOverlay: Event<WillShowOverlayLocationEvent>;
@@ -172,6 +175,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
172
175
  get activePanel(): IDockviewPanel | undefined;
173
176
  get renderer(): DockviewPanelRenderer;
174
177
  get api(): DockviewApi;
178
+ get gap(): number;
175
179
  constructor(options: DockviewComponentOptions);
176
180
  addPopoutGroup(itemToPopout: DockviewPanel | DockviewGroupPanel, options?: {
177
181
  skipRemoveGroup?: boolean;
@@ -187,7 +191,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
187
191
  }) => void;
188
192
  overridePopoutGroup?: DockviewGroupPanel;
189
193
  }): Promise<void>;
190
- addFloatingGroup(item: DockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptions): void;
194
+ addFloatingGroup(item: DockviewPanel | DockviewGroupPanel, options?: FloatingGroupOptionsInternal): void;
191
195
  private orthogonalize;
192
196
  updateOptions(options: Partial<DockviewComponentOptions>): void;
193
197
  layout(width: number, height: number, forceResize?: boolean | undefined): void;
@@ -85,6 +85,9 @@ export class DockviewComponent extends BaseGrid {
85
85
  get api() {
86
86
  return this._api;
87
87
  }
88
+ get gap() {
89
+ return this.gridview.margin;
90
+ }
88
91
  constructor(options) {
89
92
  var _a;
90
93
  super({
@@ -254,7 +257,7 @@ export class DockviewComponent extends BaseGrid {
254
257
  var _a, _b, _c;
255
258
  if (itemToPopout instanceof DockviewPanel &&
256
259
  itemToPopout.group.size === 1) {
257
- return this.addPopoutGroup(itemToPopout.group);
260
+ return this.addPopoutGroup(itemToPopout.group, options);
258
261
  }
259
262
  const theme = getDockviewTheme(this.gridview.element);
260
263
  const element = this.element;
@@ -472,14 +475,14 @@ export class DockviewComponent extends BaseGrid {
472
475
  else {
473
476
  result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
474
477
  }
475
- if ('width' in options.position) {
476
- result.width = Math.max(options.position.width, 0);
478
+ if (typeof options.width === 'number') {
479
+ result.width = Math.max(options.width, 0);
477
480
  }
478
481
  else {
479
482
  result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
480
483
  }
481
- if ('height' in options.position) {
482
- result.height = Math.max(options.position.height, 0);
484
+ if (typeof options.height === 'number') {
485
+ result.height = Math.max(options.height, 0);
483
486
  }
484
487
  else {
485
488
  result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
@@ -612,7 +615,10 @@ export class DockviewComponent extends BaseGrid {
612
615
  if (changed_rootOverlayOptions) {
613
616
  this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
614
617
  }
615
- if (this.gridview.margin !== 0 && options.gap === undefined) {
618
+ if (
619
+ // if explicitly set as `undefined`
620
+ 'gap' in options &&
621
+ options.gap === undefined) {
616
622
  this.gridview.margin = 0;
617
623
  }
618
624
  if (typeof options.gap === 'number') {
@@ -913,11 +919,11 @@ export class DockviewComponent extends BaseGrid {
913
919
  if (options.floating) {
914
920
  const group = this.createGroup();
915
921
  this._onDidAddGroup.fire(group);
916
- const o = typeof options.floating === 'object' &&
922
+ const floatingGroupOptions = typeof options.floating === 'object' &&
917
923
  options.floating !== null
918
924
  ? options.floating
919
925
  : {};
920
- this.addFloatingGroup(group, Object.assign(Object.assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
926
+ this.addFloatingGroup(group, Object.assign(Object.assign({}, floatingGroupOptions), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
921
927
  panel = this.createPanel(options, group);
922
928
  group.model.openPanel(panel, {
923
929
  skipSetActive: options.inactive,
@@ -11,7 +11,7 @@ import { DockviewGroupDropLocation, GroupOptions } from './dockviewGroupPanelMod
11
11
  import { IDockviewPanel } from './dockviewPanel';
12
12
  import { DockviewPanelRenderer } from '../overlayRenderContainer';
13
13
  import { IGroupHeaderProps } from './framework';
14
- import { AnchoredBox } from '../types';
14
+ import { FloatingGroupOptions } from './dockviewComponent';
15
15
  export interface IHeaderActionsRenderer extends IDisposable {
16
16
  readonly element: HTMLElement;
17
17
  init(params: IGroupHeaderProps): void;
@@ -109,7 +109,7 @@ export type AddPanelPositionOptions = RelativePanel | RelativeGroup | AbsolutePo
109
109
  export declare function isPanelOptionsWithPanel(data: AddPanelPositionOptions): data is RelativePanel;
110
110
  export declare function isPanelOptionsWithGroup(data: AddPanelPositionOptions): data is RelativeGroup;
111
111
  type AddPanelFloatingGroupUnion = {
112
- floating: Partial<AnchoredBox> | true;
112
+ floating: Partial<FloatingGroupOptions> | true;
113
113
  position: never;
114
114
  };
115
115
  type AddPanelPositionUnion = {
@@ -185,7 +185,7 @@ export class BaseGrid extends Resizable {
185
185
  this.doSetGroupActive(next);
186
186
  }
187
187
  layout(width, height, forceResize) {
188
- const different = forceResize !== null && forceResize !== void 0 ? forceResize : (width !== this.width || height !== this.height);
188
+ const different = forceResize || width !== this.width || height !== this.height;
189
189
  if (!different) {
190
190
  return;
191
191
  }
@@ -22,7 +22,7 @@ type BottomRight = {
22
22
  bottom: number;
23
23
  right: number;
24
24
  };
25
- type AnchorPosition = TopLeft | TopRight | BottomLeft | BottomRight;
25
+ export type AnchorPosition = TopLeft | TopRight | BottomLeft | BottomRight;
26
26
  type Size = {
27
27
  width: number;
28
28
  height: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-core",
3
- "version": "1.15.0",
3
+ "version": "1.15.2",
4
4
  "description": "Zero dependency layout manager supporting tabs, grids and splitviews",
5
5
  "keywords": [
6
6
  "splitview",