dockview-core 1.15.0 → 1.15.1

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 (35) 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/types.d.ts +1 -1
  7. package/dist/dockview-core.amd.js +18 -9
  8. package/dist/dockview-core.amd.js.map +1 -1
  9. package/dist/dockview-core.amd.min.js +2 -2
  10. package/dist/dockview-core.amd.min.js.map +1 -1
  11. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  12. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  13. package/dist/dockview-core.amd.noStyle.js +18 -9
  14. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  15. package/dist/dockview-core.cjs.js +18 -9
  16. package/dist/dockview-core.cjs.js.map +1 -1
  17. package/dist/dockview-core.esm.js +18 -9
  18. package/dist/dockview-core.esm.js.map +1 -1
  19. package/dist/dockview-core.esm.min.js +2 -2
  20. package/dist/dockview-core.esm.min.js.map +1 -1
  21. package/dist/dockview-core.js +18 -9
  22. package/dist/dockview-core.js.map +1 -1
  23. package/dist/dockview-core.min.js +2 -2
  24. package/dist/dockview-core.min.js.map +1 -1
  25. package/dist/dockview-core.min.noStyle.js +2 -2
  26. package/dist/dockview-core.min.noStyle.js.map +1 -1
  27. package/dist/dockview-core.noStyle.js +18 -9
  28. package/dist/dockview-core.noStyle.js.map +1 -1
  29. package/dist/esm/api/component.api.d.ts +1 -0
  30. package/dist/esm/api/component.api.js +3 -0
  31. package/dist/esm/dockview/dockviewComponent.d.ts +7 -3
  32. package/dist/esm/dockview/dockviewComponent.js +14 -8
  33. package/dist/esm/dockview/options.d.ts +2 -2
  34. package/dist/esm/types.d.ts +1 -1
  35. 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
  */
@@ -649,6 +649,13 @@ var DockviewApi = /** @class */ (function () {
649
649
  enumerable: false,
650
650
  configurable: true
651
651
  });
652
+ Object.defineProperty(DockviewApi.prototype, "gap", {
653
+ get: function () {
654
+ return this.component.gap;
655
+ },
656
+ enumerable: false,
657
+ configurable: true
658
+ });
652
659
  Object.defineProperty(DockviewApi.prototype, "onDidActiveGroupChange", {
653
660
  /**
654
661
  * Invoked when the active group changes. May be undefined if no group is active.
@@ -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;
@@ -368,12 +368,19 @@ var DockviewComponent = /** @class */ (function (_super) {
368
368
  enumerable: false,
369
369
  configurable: true
370
370
  });
371
+ Object.defineProperty(DockviewComponent.prototype, "gap", {
372
+ get: function () {
373
+ return this.gridview.margin;
374
+ },
375
+ enumerable: false,
376
+ configurable: true
377
+ });
371
378
  DockviewComponent.prototype.addPopoutGroup = function (itemToPopout, options) {
372
379
  var _this = this;
373
380
  var _a, _b, _c;
374
381
  if (itemToPopout instanceof dockviewPanel_1.DockviewPanel &&
375
382
  itemToPopout.group.size === 1) {
376
- return this.addPopoutGroup(itemToPopout.group);
383
+ return this.addPopoutGroup(itemToPopout.group, options);
377
384
  }
378
385
  var theme = getDockviewTheme(this.gridview.element);
379
386
  var element = this.element;
@@ -602,14 +609,14 @@ var DockviewComponent = /** @class */ (function (_super) {
602
609
  else {
603
610
  result.top = constants_1.DEFAULT_FLOATING_GROUP_POSITION.top;
604
611
  }
605
- if ('width' in options.position) {
606
- result.width = Math.max(options.position.width, 0);
612
+ if (typeof options.width === 'number') {
613
+ result.width = Math.max(options.width, 0);
607
614
  }
608
615
  else {
609
616
  result.width = constants_1.DEFAULT_FLOATING_GROUP_POSITION.width;
610
617
  }
611
- if ('height' in options.position) {
612
- result.height = Math.max(options.position.height, 0);
618
+ if (typeof options.height === 'number') {
619
+ result.height = Math.max(options.height, 0);
613
620
  }
614
621
  else {
615
622
  result.height = constants_1.DEFAULT_FLOATING_GROUP_POSITION.height;
@@ -753,7 +760,10 @@ var DockviewComponent = /** @class */ (function (_super) {
753
760
  if (changed_rootOverlayOptions) {
754
761
  this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
755
762
  }
756
- if (this.gridview.margin !== 0 && options.gap === undefined) {
763
+ if (
764
+ // if explicitly set as `undefined`
765
+ 'gap' in options &&
766
+ options.gap === undefined) {
757
767
  this.gridview.margin = 0;
758
768
  }
759
769
  if (typeof options.gap === 'number') {
@@ -1172,11 +1182,11 @@ var DockviewComponent = /** @class */ (function (_super) {
1172
1182
  if (options.floating) {
1173
1183
  var group = this.createGroup();
1174
1184
  this._onDidAddGroup.fire(group);
1175
- var o = typeof options.floating === 'object' &&
1185
+ var floatingGroupOptions = typeof options.floating === 'object' &&
1176
1186
  options.floating !== null
1177
1187
  ? options.floating
1178
1188
  : {};
1179
- this.addFloatingGroup(group, __assign(__assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
1189
+ this.addFloatingGroup(group, __assign(__assign({}, floatingGroupOptions), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
1180
1190
  panel = this.createPanel(options, group);
1181
1191
  group.model.openPanel(panel, {
1182
1192
  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 = {
@@ -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;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 1.15.0
3
+ * @version 1.15.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3271,6 +3271,9 @@ define(['exports'], (function (exports) { 'use strict';
3271
3271
  get totalPanels() {
3272
3272
  return this.component.totalPanels;
3273
3273
  }
3274
+ get gap() {
3275
+ return this.component.gap;
3276
+ }
3274
3277
  /**
3275
3278
  * Invoked when the active group changes. May be undefined if no group is active.
3276
3279
  */
@@ -7223,6 +7226,9 @@ define(['exports'], (function (exports) { 'use strict';
7223
7226
  get api() {
7224
7227
  return this._api;
7225
7228
  }
7229
+ get gap() {
7230
+ return this.gridview.margin;
7231
+ }
7226
7232
  constructor(options) {
7227
7233
  var _a;
7228
7234
  super({
@@ -7392,7 +7398,7 @@ define(['exports'], (function (exports) { 'use strict';
7392
7398
  var _a, _b, _c;
7393
7399
  if (itemToPopout instanceof DockviewPanel &&
7394
7400
  itemToPopout.group.size === 1) {
7395
- return this.addPopoutGroup(itemToPopout.group);
7401
+ return this.addPopoutGroup(itemToPopout.group, options);
7396
7402
  }
7397
7403
  const theme = getDockviewTheme(this.gridview.element);
7398
7404
  const element = this.element;
@@ -7610,14 +7616,14 @@ define(['exports'], (function (exports) { 'use strict';
7610
7616
  else {
7611
7617
  result.top = DEFAULT_FLOATING_GROUP_POSITION.top;
7612
7618
  }
7613
- if ('width' in options.position) {
7614
- result.width = Math.max(options.position.width, 0);
7619
+ if (typeof options.width === 'number') {
7620
+ result.width = Math.max(options.width, 0);
7615
7621
  }
7616
7622
  else {
7617
7623
  result.width = DEFAULT_FLOATING_GROUP_POSITION.width;
7618
7624
  }
7619
- if ('height' in options.position) {
7620
- result.height = Math.max(options.position.height, 0);
7625
+ if (typeof options.height === 'number') {
7626
+ result.height = Math.max(options.height, 0);
7621
7627
  }
7622
7628
  else {
7623
7629
  result.height = DEFAULT_FLOATING_GROUP_POSITION.height;
@@ -7748,7 +7754,10 @@ define(['exports'], (function (exports) { 'use strict';
7748
7754
  if (changed_rootOverlayOptions) {
7749
7755
  this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
7750
7756
  }
7751
- if (this.gridview.margin !== 0 && options.gap === undefined) {
7757
+ if (
7758
+ // if explicitly set as `undefined`
7759
+ 'gap' in options &&
7760
+ options.gap === undefined) {
7752
7761
  this.gridview.margin = 0;
7753
7762
  }
7754
7763
  if (typeof options.gap === 'number') {
@@ -8049,11 +8058,11 @@ define(['exports'], (function (exports) { 'use strict';
8049
8058
  if (options.floating) {
8050
8059
  const group = this.createGroup();
8051
8060
  this._onDidAddGroup.fire(group);
8052
- const o = typeof options.floating === 'object' &&
8061
+ const floatingGroupOptions = typeof options.floating === 'object' &&
8053
8062
  options.floating !== null
8054
8063
  ? options.floating
8055
8064
  : {};
8056
- this.addFloatingGroup(group, Object.assign(Object.assign({}, o), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
8065
+ this.addFloatingGroup(group, Object.assign(Object.assign({}, floatingGroupOptions), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));
8057
8066
  panel = this.createPanel(options, group);
8058
8067
  group.model.openPanel(panel, {
8059
8068
  skipSetActive: options.inactive,