dockview-react 1.16.1 → 1.17.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 1.16.1
3
+ * @version 1.17.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -551,6 +551,42 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
551
551
  },
552
552
  };
553
553
  }
554
+ function getDockviewTheme(element) {
555
+ function toClassList(element) {
556
+ const list = [];
557
+ for (let i = 0; i < element.classList.length; i++) {
558
+ list.push(element.classList.item(i));
559
+ }
560
+ return list;
561
+ }
562
+ let theme = undefined;
563
+ let parent = element;
564
+ while (parent !== null) {
565
+ theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
566
+ if (typeof theme === 'string') {
567
+ break;
568
+ }
569
+ parent = parent.parentElement;
570
+ }
571
+ return theme;
572
+ }
573
+ class Classnames {
574
+ constructor(element) {
575
+ this.element = element;
576
+ this._classNames = [];
577
+ }
578
+ setClassNames(classNames) {
579
+ for (const className of this._classNames) {
580
+ toggleClass(this.element, className, false);
581
+ }
582
+ this._classNames = classNames
583
+ .split(' ')
584
+ .filter((v) => v.trim().length > 0);
585
+ for (const className of this._classNames) {
586
+ toggleClass(this.element, className, true);
587
+ }
588
+ }
589
+ }
554
590
 
555
591
  function tail(arr) {
556
592
  if (arr.length === 0) {
@@ -2670,8 +2706,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2670
2706
  set locked(value) {
2671
2707
  this.gridview.locked = value;
2672
2708
  }
2673
- constructor(options) {
2674
- var _a, _b;
2709
+ constructor(parentElement, options) {
2710
+ var _a;
2675
2711
  super(document.createElement('div'), options.disableAutoResizing);
2676
2712
  this._id = nextLayoutId$1.next();
2677
2713
  this._groups = new Map();
@@ -2685,14 +2721,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2685
2721
  this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
2686
2722
  this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
2687
2723
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2688
- this.classNames = [];
2689
2724
  this.element.style.height = '100%';
2690
2725
  this.element.style.width = '100%';
2691
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2692
- for (const className of this.classNames) {
2693
- toggleClass(this.element, className, true);
2694
- }
2695
- options.parentElement.appendChild(this.element);
2726
+ this._classNames = new Classnames(this.element);
2727
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
2728
+ parentElement.appendChild(this.element);
2696
2729
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2697
2730
  this.gridview.locked = !!options.locked;
2698
2731
  this.element.appendChild(this.gridview.element);
@@ -2716,15 +2749,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2716
2749
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2717
2750
  }
2718
2751
  updateOptions(options) {
2719
- var _a, _b;
2752
+ var _a, _b, _c, _d;
2753
+ if (typeof options.proportionalLayout === 'boolean') ;
2754
+ if (options.orientation) {
2755
+ this.gridview.orientation = options.orientation;
2756
+ }
2757
+ if ('disableResizing' in options) {
2758
+ this.disableResizing = (_a = options.disableAutoResizing) !== null && _a !== void 0 ? _a : false;
2759
+ }
2760
+ if ('locked' in options) {
2761
+ this.locked = (_b = options.locked) !== null && _b !== void 0 ? _b : false;
2762
+ }
2763
+ if ('margin' in options) {
2764
+ this.gridview.margin = (_c = options.margin) !== null && _c !== void 0 ? _c : 0;
2765
+ }
2720
2766
  if ('className' in options) {
2721
- for (const className of this.classNames) {
2722
- toggleClass(this.element, className, false);
2723
- }
2724
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2725
- for (const className of this.classNames) {
2726
- toggleClass(this.element, className, true);
2727
- }
2767
+ this._classNames.setClassNames((_d = options.className) !== null && _d !== void 0 ? _d : '');
2728
2768
  }
2729
2769
  }
2730
2770
  maximizeGroup(panel) {
@@ -4650,7 +4690,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4650
4690
  this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
4651
4691
  this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
4652
4692
  this._onDragStart.fire(event);
4653
- }), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
4693
+ }), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
4654
4694
  if (event.defaultPrevented) {
4655
4695
  return;
4656
4696
  }
@@ -4692,7 +4732,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4692
4732
  this.accessor = accessor;
4693
4733
  this.group = group;
4694
4734
  this.panelTransfer = LocalSelectionTransfer.getInstance();
4695
- this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
4735
+ this.addDisposables(addDisposableListener(element, 'pointerdown', (e) => {
4696
4736
  if (e.shiftKey) {
4697
4737
  /**
4698
4738
  * You cannot call e.preventDefault() because that will prevent drag events from firing
@@ -4911,7 +4951,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4911
4951
  group: this.group,
4912
4952
  getData: getPanelData,
4913
4953
  }));
4914
- }), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
4954
+ }), addDisposableListener(this.voidContainer.element, 'pointerdown', (event) => {
4915
4955
  const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
4916
4956
  if (isFloatingGroupsEnabled &&
4917
4957
  event.shiftKey &&
@@ -4925,7 +4965,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4925
4965
  inDragMode: true,
4926
4966
  });
4927
4967
  }
4928
- }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
4968
+ }), addDisposableListener(this.tabContainer, 'pointerdown', (event) => {
4929
4969
  if (event.defaultPrevented) {
4930
4970
  return;
4931
4971
  }
@@ -5630,7 +5670,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5630
5670
  });
5631
5671
  this.tabsContainer.hide();
5632
5672
  this.contentContainer.element.appendChild(this.watermark.element);
5633
- this.watermark.updateParentGroup(this.groupPanel, true);
5634
5673
  }
5635
5674
  if (!this.isEmpty && this.watermark) {
5636
5675
  this.watermark.element.remove();
@@ -5993,6 +6032,34 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5993
6032
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
5994
6033
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
5995
6034
  class DockviewGroupPanel extends GridviewPanel {
6035
+ get minimumWidth() {
6036
+ var _a;
6037
+ const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6038
+ return typeof activePanelMinimumWidth === 'number'
6039
+ ? activePanelMinimumWidth
6040
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH;
6041
+ }
6042
+ get minimumHeight() {
6043
+ var _a;
6044
+ const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6045
+ return typeof activePanelMinimumHeight === 'number'
6046
+ ? activePanelMinimumHeight
6047
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT;
6048
+ }
6049
+ get maximumWidth() {
6050
+ var _a;
6051
+ const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6052
+ return typeof activePanelMaximumWidth === 'number'
6053
+ ? activePanelMaximumWidth
6054
+ : Number.MAX_SAFE_INTEGER;
6055
+ }
6056
+ get maximumHeight() {
6057
+ var _a;
6058
+ const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6059
+ return typeof activePanelMaximumHeight === 'number'
6060
+ ? activePanelMaximumHeight
6061
+ : Number.MAX_SAFE_INTEGER;
6062
+ }
5996
6063
  get panels() {
5997
6064
  return this._model.panels;
5998
6065
  }
@@ -6015,9 +6082,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6015
6082
  return this._model.header;
6016
6083
  }
6017
6084
  constructor(accessor, id, options) {
6085
+ var _a, _b, _c, _d, _e, _f;
6018
6086
  super(id, 'groupview_default', {
6019
- minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6020
- minimumWidth: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6087
+ minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6088
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6089
+ maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6090
+ maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6021
6091
  }, new DockviewGroupPanelApiImpl(id, accessor));
6022
6092
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6023
6093
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
@@ -6173,6 +6243,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6173
6243
  var _a;
6174
6244
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
6175
6245
  }
6246
+ get minimumWidth() {
6247
+ return this._minimumWidth;
6248
+ }
6249
+ get minimumHeight() {
6250
+ return this._minimumHeight;
6251
+ }
6252
+ get maximumWidth() {
6253
+ return this._maximumWidth;
6254
+ }
6255
+ get maximumHeight() {
6256
+ return this._maximumHeight;
6257
+ }
6176
6258
  constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
6177
6259
  super();
6178
6260
  this.id = id;
@@ -6181,6 +6263,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6181
6263
  this.view = view;
6182
6264
  this._renderer = options.renderer;
6183
6265
  this._group = group;
6266
+ this._minimumWidth = options.minimumWidth;
6267
+ this._minimumHeight = options.minimumHeight;
6268
+ this._maximumWidth = options.maximumWidth;
6269
+ this._maximumHeight = options.maximumHeight;
6184
6270
  this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
6185
6271
  this.addDisposables(this.api.onActiveChange(() => {
6186
6272
  accessor.setActivePanel(this);
@@ -6217,6 +6303,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6217
6303
  : undefined,
6218
6304
  title: this.title,
6219
6305
  renderer: this._renderer,
6306
+ minimumHeight: this._minimumHeight,
6307
+ maximumHeight: this._maximumHeight,
6308
+ minimumWidth: this._minimumWidth,
6309
+ maximumWidth: this._maximumWidth,
6220
6310
  };
6221
6311
  }
6222
6312
  setTitle(title) {
@@ -6346,7 +6436,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6346
6436
  this.action.appendChild(createCloseButton());
6347
6437
  this._element.appendChild(this._content);
6348
6438
  this._element.appendChild(this.action);
6349
- this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
6439
+ this.addDisposables(addDisposableListener(this.action, 'pointerdown', (ev) => {
6350
6440
  ev.preventDefault();
6351
6441
  }));
6352
6442
  this.render();
@@ -6356,7 +6446,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6356
6446
  this.addDisposables(params.api.onDidTitleChange((event) => {
6357
6447
  this._title = event.title;
6358
6448
  this.render();
6359
- }), addDisposableListener(this.action, 'mousedown', (ev) => {
6449
+ }), addDisposableListener(this.action, 'pointerdown', (ev) => {
6360
6450
  ev.preventDefault();
6361
6451
  }), addDisposableListener(this.action, 'click', (ev) => {
6362
6452
  if (ev.defaultPrevented) {
@@ -6457,6 +6547,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6457
6547
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6458
6548
  const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6459
6549
  renderer: panelData.renderer,
6550
+ minimumWidth: panelData.minimumWidth,
6551
+ minimumHeight: panelData.minimumHeight,
6552
+ maximumWidth: panelData.maximumWidth,
6553
+ maximumHeight: panelData.maximumHeight,
6460
6554
  });
6461
6555
  panel.init({
6462
6556
  title: title !== null && title !== void 0 ? title : panelId,
@@ -6490,34 +6584,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6490
6584
  actionsContainer.appendChild(closeAnchor);
6491
6585
  title.appendChild(emptySpace);
6492
6586
  title.appendChild(actionsContainer);
6493
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
6587
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (event) => {
6494
6588
  var _a;
6495
- ev.preventDefault();
6589
+ event.preventDefault();
6496
6590
  if (this._group) {
6497
6591
  (_a = this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(this._group);
6498
6592
  }
6499
6593
  }));
6500
6594
  }
6501
- update(_event) {
6502
- // noop
6503
- }
6504
- focus() {
6505
- // noop
6506
- }
6507
- layout(_width, _height) {
6508
- // noop
6509
- }
6510
6595
  init(_params) {
6511
6596
  this._api = _params.containerApi;
6597
+ this._group = _params.group;
6512
6598
  this.render();
6513
6599
  }
6514
- updateParentGroup(group, _visible) {
6515
- this._group = group;
6516
- this.render();
6517
- }
6518
- dispose() {
6519
- super.dispose();
6520
- }
6521
6600
  render() {
6522
6601
  const isOneGroup = !!(this._api && this._api.size <= 1);
6523
6602
  toggleClass(this.element, 'has-actions', isOneGroup);
@@ -6676,7 +6755,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6676
6755
  dispose: () => {
6677
6756
  iframes.release();
6678
6757
  },
6679
- }, addDisposableWindowListener(window, 'mousemove', (e) => {
6758
+ }, addDisposableWindowListener(window, 'pointermove', (e) => {
6680
6759
  const containerRect = this.options.container.getBoundingClientRect();
6681
6760
  const x = e.clientX - containerRect.left;
6682
6761
  const y = e.clientY - containerRect.top;
@@ -6719,7 +6798,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6719
6798
  this._onDidChangeEnd.fire();
6720
6799
  }));
6721
6800
  };
6722
- this.addDisposables(move, addDisposableListener(dragTarget, 'mousedown', (event) => {
6801
+ this.addDisposables(move, addDisposableListener(dragTarget, 'pointerdown', (event) => {
6723
6802
  if (event.defaultPrevented) {
6724
6803
  event.preventDefault();
6725
6804
  return;
@@ -6730,7 +6809,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6730
6809
  return;
6731
6810
  }
6732
6811
  track();
6733
- }), addDisposableListener(this.options.content, 'mousedown', (event) => {
6812
+ }), addDisposableListener(this.options.content, 'pointerdown', (event) => {
6734
6813
  if (event.defaultPrevented) {
6735
6814
  return;
6736
6815
  }
@@ -6742,7 +6821,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6742
6821
  if (event.shiftKey) {
6743
6822
  track();
6744
6823
  }
6745
- }), addDisposableListener(this.options.content, 'mousedown', () => {
6824
+ }), addDisposableListener(this.options.content, 'pointerdown', () => {
6746
6825
  arialLevelTracker.push(this._element);
6747
6826
  }, true));
6748
6827
  if (options.inDragMode) {
@@ -6754,11 +6833,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6754
6833
  resizeHandleElement.className = `dv-resize-handle-${direction}`;
6755
6834
  this._element.appendChild(resizeHandleElement);
6756
6835
  const move = new MutableDisposable();
6757
- this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6836
+ this.addDisposables(move, addDisposableListener(resizeHandleElement, 'pointerdown', (e) => {
6758
6837
  e.preventDefault();
6759
6838
  let startPosition = null;
6760
6839
  const iframes = disableIframePointEvents();
6761
- move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6840
+ move.value = new CompositeDisposable(addDisposableWindowListener(window, 'pointermove', (e) => {
6762
6841
  const containerRect = this.options.container.getBoundingClientRect();
6763
6842
  const overlayRect = this._element.getBoundingClientRect();
6764
6843
  const y = e.clientY - containerRect.top;
@@ -7240,25 +7319,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7240
7319
  });
7241
7320
  });
7242
7321
  }
7243
- function getDockviewTheme(element) {
7244
- function toClassList(element) {
7245
- const list = [];
7246
- for (let i = 0; i < element.classList.length; i++) {
7247
- list.push(element.classList.item(i));
7248
- }
7249
- return list;
7250
- }
7251
- let theme = undefined;
7252
- let parent = element;
7253
- while (parent !== null) {
7254
- theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
7255
- if (typeof theme === 'string') {
7256
- break;
7257
- }
7258
- parent = parent.parentElement;
7259
- }
7260
- return theme;
7261
- }
7262
7322
  class DockviewComponent extends BaseGrid {
7263
7323
  get orientation() {
7264
7324
  return this.gridview.orientation;
@@ -7294,13 +7354,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7294
7354
  }
7295
7355
  constructor(parentElement, options) {
7296
7356
  var _a;
7297
- super({
7357
+ super(parentElement, {
7298
7358
  proportionalLayout: true,
7299
7359
  orientation: exports.Orientation.HORIZONTAL,
7300
7360
  styles: options.hideBorders
7301
7361
  ? { separatorBorder: 'transparent' }
7302
7362
  : undefined,
7303
- parentElement: parentElement,
7304
7363
  disableAutoResizing: options.disableAutoResizing,
7305
7364
  locked: options.locked,
7306
7365
  margin: options.gap,
@@ -7340,9 +7399,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7340
7399
  this._onDidActiveGroupChange = new Emitter();
7341
7400
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7342
7401
  this._moving = false;
7343
- // const gready = document.createElement('div');
7344
- // gready.className = 'dv-overlay-render-container';
7345
- // this.gridview.element.appendChild(gready);
7346
7402
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7347
7403
  toggleClass(this.gridview.element, 'dv-dockview', true);
7348
7404
  toggleClass(this.element, 'dv-debug', !!options.debug);
@@ -7791,16 +7847,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7791
7847
  }
7792
7848
  }
7793
7849
  updateOptions(options) {
7794
- var _a, _b;
7850
+ var _a, _b, _c, _d;
7795
7851
  super.updateOptions(options);
7796
- const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7797
- options.floatingGroupBounds !== this.options.floatingGroupBounds;
7798
- const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
7799
- options.rootOverlayModel !== this.options.rootOverlayModel;
7800
- this._options = Object.assign(Object.assign({}, this.options), options);
7801
- if (changed_floatingGroupBounds) {
7852
+ if ('floatingGroupBounds' in options) {
7802
7853
  for (const group of this._floatingGroups) {
7803
- switch (this.options.floatingGroupBounds) {
7854
+ switch (options.floatingGroupBounds) {
7804
7855
  case 'boundedWithinViewport':
7805
7856
  group.overlay.minimumInViewportHeight = undefined;
7806
7857
  group.overlay.minimumInViewportWidth = undefined;
@@ -7813,25 +7864,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7813
7864
  break;
7814
7865
  default:
7815
7866
  group.overlay.minimumInViewportHeight =
7816
- (_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7867
+ (_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7817
7868
  group.overlay.minimumInViewportWidth =
7818
- (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7869
+ (_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7819
7870
  }
7820
7871
  group.overlay.setBounds();
7821
7872
  }
7822
7873
  }
7823
- if (changed_rootOverlayOptions) {
7824
- this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
7874
+ if ('rootOverlayModel' in options) {
7875
+ this._rootDropTarget.setOverlayModel((_c = options.rootOverlayModel) !== null && _c !== void 0 ? _c : DEFAULT_ROOT_OVERLAY_MODEL);
7825
7876
  }
7826
- if (
7827
- // if explicitly set as `undefined`
7828
- 'gap' in options &&
7829
- options.gap === undefined) {
7830
- this.gridview.margin = 0;
7831
- }
7832
- if (typeof options.gap === 'number') {
7833
- this.gridview.margin = options.gap;
7877
+ if ('gap' in options) {
7878
+ this.gridview.margin = (_d = options.gap) !== null && _d !== void 0 ? _d : 0;
7834
7879
  }
7880
+ this._options = Object.assign(Object.assign({}, this.options), options);
7835
7881
  this.layout(this.gridview.width, this.gridview.height, true);
7836
7882
  }
7837
7883
  layout(width, height, forceResize) {
@@ -8088,6 +8134,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8088
8134
  if (options.position && options.floating) {
8089
8135
  throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
8090
8136
  }
8137
+ const initial = {
8138
+ width: options.initialWidth,
8139
+ height: options.initialHeight,
8140
+ };
8091
8141
  if (options.position) {
8092
8142
  if (isPanelOptionsWithPanel(options.position)) {
8093
8143
  const referencePanel = typeof options.position.referencePanel === 'string'
@@ -8117,6 +8167,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8117
8167
  if (!options.inactive) {
8118
8168
  this.doSetGroupAndPanelActive(group);
8119
8169
  }
8170
+ group.api.setSize({
8171
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8172
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8173
+ });
8120
8174
  return panel;
8121
8175
  }
8122
8176
  }
@@ -8147,6 +8201,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8147
8201
  skipSetActive: options.inactive,
8148
8202
  skipSetGroupActive: options.inactive,
8149
8203
  });
8204
+ referenceGroup.api.setSize({
8205
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8206
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8207
+ });
8150
8208
  if (!options.inactive) {
8151
8209
  this.doSetGroupAndPanelActive(referenceGroup);
8152
8210
  }
@@ -8154,7 +8212,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8154
8212
  else {
8155
8213
  const location = getGridLocation(referenceGroup.element);
8156
8214
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8157
- const group = this.createGroupAtLocation(relativeLocation);
8215
+ const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) ===
8216
+ exports.Orientation.VERTICAL
8217
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8218
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8158
8219
  panel = this.createPanel(options, group);
8159
8220
  group.model.openPanel(panel, {
8160
8221
  skipSetActive: options.inactive,
@@ -8180,7 +8241,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8180
8241
  });
8181
8242
  }
8182
8243
  else {
8183
- const group = this.createGroupAtLocation();
8244
+ const group = this.createGroupAtLocation([0], this.gridview.orientation === exports.Orientation.VERTICAL
8245
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8246
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8184
8247
  panel = this.createPanel(options, group);
8185
8248
  group.model.openPanel(panel, {
8186
8249
  skipSetActive: options.inactive,
@@ -8274,7 +8337,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8274
8337
  const location = getGridLocation(referenceGroup.element);
8275
8338
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8276
8339
  const group = this.createGroup(options);
8277
- this.doAddGroup(group, relativeLocation);
8340
+ const size = this.getLocationOrientation(relativeLocation) ===
8341
+ exports.Orientation.VERTICAL
8342
+ ? options.initialHeight
8343
+ : options.initialWidth;
8344
+ this.doAddGroup(group, relativeLocation, size);
8278
8345
  if (!options.skipSetActive) {
8279
8346
  this.doSetGroupAndPanelActive(group);
8280
8347
  }
@@ -8287,6 +8354,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8287
8354
  return group;
8288
8355
  }
8289
8356
  }
8357
+ getLocationOrientation(location) {
8358
+ return location.length % 2 == 0 &&
8359
+ this.gridview.orientation === exports.Orientation.HORIZONTAL
8360
+ ? exports.Orientation.HORIZONTAL
8361
+ : exports.Orientation.VERTICAL;
8362
+ }
8290
8363
  removeGroup(group, options) {
8291
8364
  this.doRemoveGroup(group, options);
8292
8365
  }
@@ -8558,7 +8631,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8558
8631
  }
8559
8632
  const referenceLocation = getGridLocation(to.element);
8560
8633
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
8561
- this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
8634
+ let size;
8635
+ switch (this.gridview.orientation) {
8636
+ case exports.Orientation.VERTICAL:
8637
+ size =
8638
+ referenceLocation.length % 2 == 0
8639
+ ? from.api.width
8640
+ : from.api.height;
8641
+ break;
8642
+ case exports.Orientation.HORIZONTAL:
8643
+ size =
8644
+ referenceLocation.length % 2 == 0
8645
+ ? from.api.height
8646
+ : from.api.width;
8647
+ break;
8648
+ }
8649
+ this.gridview.addView(from, size, dropLocation);
8562
8650
  }
8563
8651
  from.panels.forEach((panel) => {
8564
8652
  this._onDidMovePanel.fire({ panel, from });
@@ -8670,22 +8758,34 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8670
8758
  const contentComponent = options.component;
8671
8759
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8672
8760
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8673
- const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8761
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {
8762
+ renderer: options.renderer,
8763
+ minimumWidth: options.minimumWidth,
8764
+ minimumHeight: options.minimumHeight,
8765
+ maximumWidth: options.maximumWidth,
8766
+ maximumHeight: options.maximumHeight,
8767
+ });
8674
8768
  panel.init({
8675
8769
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8676
8770
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
8677
8771
  });
8678
8772
  return panel;
8679
8773
  }
8680
- createGroupAtLocation(location = [0]) {
8774
+ createGroupAtLocation(location, size) {
8681
8775
  const group = this.createGroup();
8682
- this.doAddGroup(group, location);
8776
+ this.doAddGroup(group, location, size);
8683
8777
  return group;
8684
8778
  }
8685
8779
  findGroup(panel) {
8686
8780
  var _a;
8687
8781
  return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
8688
8782
  }
8783
+ orientationAtLocation(location) {
8784
+ const rootOrientation = this.gridview.orientation;
8785
+ return location.length % 2 == 1
8786
+ ? rootOrientation
8787
+ : orthogonal(rootOrientation);
8788
+ }
8689
8789
  }
8690
8790
 
8691
8791
  class GridviewComponent extends BaseGrid {
@@ -8705,8 +8805,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8705
8805
  this._deserializer = value;
8706
8806
  }
8707
8807
  constructor(parentElement, options) {
8708
- super({
8709
- parentElement: parentElement,
8808
+ super(parentElement, {
8710
8809
  proportionalLayout: options.proportionalLayout,
8711
8810
  orientation: options.orientation,
8712
8811
  styles: options.styles,
@@ -9005,7 +9104,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9005
9104
  : this.splitview.orthogonalSize;
9006
9105
  }
9007
9106
  constructor(parentElement, options) {
9008
- var _a, _b;
9107
+ var _a;
9009
9108
  super(parentElement, options.disableAutoResizing);
9010
9109
  this._splitviewChangeDisposable = new MutableDisposable();
9011
9110
  this._panels = new Map();
@@ -9017,11 +9116,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9017
9116
  this.onDidRemoveView = this._onDidRemoveView.event;
9018
9117
  this._onDidLayoutChange = new Emitter();
9019
9118
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9020
- this.classNames = [];
9021
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9022
- for (const className of this.classNames) {
9023
- toggleClass(this.element, className, true);
9024
- }
9119
+ this._classNames = new Classnames(this.element);
9120
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9025
9121
  this._options = options;
9026
9122
  if (!options.components) {
9027
9123
  options.components = {};
@@ -9035,20 +9131,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9035
9131
  updateOptions(options) {
9036
9132
  var _a, _b;
9037
9133
  if ('className' in options) {
9038
- for (const className of this.classNames) {
9039
- toggleClass(this.element, className, false);
9040
- }
9041
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9042
- for (const className of this.classNames) {
9043
- toggleClass(this.element, className, true);
9044
- }
9134
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9045
9135
  }
9046
- const hasOrientationChanged = typeof options.orientation === 'string' &&
9047
- this.options.orientation !== options.orientation;
9048
- this._options = Object.assign(Object.assign({}, this.options), options);
9049
- if (hasOrientationChanged) {
9136
+ if ('disableResizing' in options) {
9137
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9138
+ }
9139
+ if (typeof options.orientation === 'string') {
9050
9140
  this.splitview.orientation = options.orientation;
9051
9141
  }
9142
+ this._options = Object.assign(Object.assign({}, this.options), options);
9052
9143
  this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
9053
9144
  }
9054
9145
  focus() {
@@ -9345,7 +9436,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9345
9436
  return this._options;
9346
9437
  }
9347
9438
  constructor(parentElement, options) {
9348
- var _a, _b;
9439
+ var _a;
9349
9440
  super(parentElement, options.disableAutoResizing);
9350
9441
  this._id = nextLayoutId.next();
9351
9442
  this._disposable = new MutableDisposable();
@@ -9360,12 +9451,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9360
9451
  this.onDidAddView = this._onDidAddView.event;
9361
9452
  this._onDidRemoveView = new Emitter();
9362
9453
  this.onDidRemoveView = this._onDidRemoveView.event;
9363
- this.classNames = [];
9364
9454
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9365
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9366
- for (const className of this.classNames) {
9367
- toggleClass(this.element, className, true);
9368
- }
9455
+ this._classNames = new Classnames(this.element);
9456
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9369
9457
  this._options = options;
9370
9458
  if (!options.components) {
9371
9459
  options.components = {};
@@ -9389,13 +9477,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9389
9477
  updateOptions(options) {
9390
9478
  var _a, _b;
9391
9479
  if ('className' in options) {
9392
- for (const className of this.classNames) {
9393
- toggleClass(this.element, className, false);
9394
- }
9395
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9396
- for (const className of this.classNames) {
9397
- toggleClass(this.element, className, true);
9398
- }
9480
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9481
+ }
9482
+ if ('disableResizing' in options) {
9483
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9399
9484
  }
9400
9485
  this._options = Object.assign(Object.assign({}, this.options), options);
9401
9486
  }
@@ -9945,9 +10030,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9945
10030
  layout(_width, _height) {
9946
10031
  // noop - retrieval from api
9947
10032
  }
9948
- updateParentGroup(_group, _isPanelVisible) {
9949
- // noop
9950
- }
9951
10033
  dispose() {
9952
10034
  var _a;
9953
10035
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
@@ -10260,7 +10342,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10260
10342
  api.close();
10261
10343
  }
10262
10344
  }, [api, closeActionOverride]);
10263
- const onMouseDown = React.useCallback((e) => {
10345
+ const onPointerDown = React.useCallback((e) => {
10264
10346
  e.preventDefault();
10265
10347
  }, []);
10266
10348
  const onClick = React.useCallback((event) => {
@@ -10274,7 +10356,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10274
10356
  }, [api, rest.onClick]);
10275
10357
  return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onClick: onClick, className: "dv-default-tab" }),
10276
10358
  React.createElement("span", { className: "dv-default-tab-content" }, title),
10277
- !hideClose && (React.createElement("div", { className: "dv-default-tab-action", onMouseDown: onMouseDown, onClick: onClose },
10359
+ !hideClose && (React.createElement("div", { className: "dv-default-tab-action", onPointerDown: onPointerDown, onClick: onClose },
10278
10360
  React.createElement(CloseButton, null)))));
10279
10361
  };
10280
10362