dockview-react 1.16.0 → 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.0
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,7 +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) {
2709
+ constructor(parentElement, options) {
2710
+ var _a;
2674
2711
  super(document.createElement('div'), options.disableAutoResizing);
2675
2712
  this._id = nextLayoutId$1.next();
2676
2713
  this._groups = new Map();
@@ -2686,10 +2723,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2686
2723
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2687
2724
  this.element.style.height = '100%';
2688
2725
  this.element.style.width = '100%';
2689
- if (typeof options.className === 'string') {
2690
- this.element.classList.add(options.className);
2691
- }
2692
- 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);
2693
2729
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2694
2730
  this.gridview.locked = !!options.locked;
2695
2731
  this.element.appendChild(this.gridview.element);
@@ -2712,6 +2748,25 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2712
2748
  isVisible(panel) {
2713
2749
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2714
2750
  }
2751
+ updateOptions(options) {
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
+ }
2766
+ if ('className' in options) {
2767
+ this._classNames.setClassNames((_d = options.className) !== null && _d !== void 0 ? _d : '');
2768
+ }
2769
+ }
2715
2770
  maximizeGroup(panel) {
2716
2771
  this.gridview.maximizeView(panel);
2717
2772
  this.doSetGroupActive(panel);
@@ -4635,7 +4690,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4635
4690
  this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
4636
4691
  this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
4637
4692
  this._onDragStart.fire(event);
4638
- }), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
4693
+ }), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
4639
4694
  if (event.defaultPrevented) {
4640
4695
  return;
4641
4696
  }
@@ -4677,7 +4732,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4677
4732
  this.accessor = accessor;
4678
4733
  this.group = group;
4679
4734
  this.panelTransfer = LocalSelectionTransfer.getInstance();
4680
- this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
4735
+ this.addDisposables(addDisposableListener(element, 'pointerdown', (e) => {
4681
4736
  if (e.shiftKey) {
4682
4737
  /**
4683
4738
  * You cannot call e.preventDefault() because that will prevent drag events from firing
@@ -4896,7 +4951,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4896
4951
  group: this.group,
4897
4952
  getData: getPanelData,
4898
4953
  }));
4899
- }), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
4954
+ }), addDisposableListener(this.voidContainer.element, 'pointerdown', (event) => {
4900
4955
  const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
4901
4956
  if (isFloatingGroupsEnabled &&
4902
4957
  event.shiftKey &&
@@ -4910,7 +4965,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4910
4965
  inDragMode: true,
4911
4966
  });
4912
4967
  }
4913
- }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
4968
+ }), addDisposableListener(this.tabContainer, 'pointerdown', (event) => {
4914
4969
  if (event.defaultPrevented) {
4915
4970
  return;
4916
4971
  }
@@ -5615,7 +5670,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5615
5670
  });
5616
5671
  this.tabsContainer.hide();
5617
5672
  this.contentContainer.element.appendChild(this.watermark.element);
5618
- this.watermark.updateParentGroup(this.groupPanel, true);
5619
5673
  }
5620
5674
  if (!this.isEmpty && this.watermark) {
5621
5675
  this.watermark.element.remove();
@@ -5978,6 +6032,34 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5978
6032
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
5979
6033
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
5980
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
+ }
5981
6063
  get panels() {
5982
6064
  return this._model.panels;
5983
6065
  }
@@ -6000,9 +6082,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6000
6082
  return this._model.header;
6001
6083
  }
6002
6084
  constructor(accessor, id, options) {
6085
+ var _a, _b, _c, _d, _e, _f;
6003
6086
  super(id, 'groupview_default', {
6004
- minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6005
- 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,
6006
6091
  }, new DockviewGroupPanelApiImpl(id, accessor));
6007
6092
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6008
6093
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
@@ -6158,6 +6243,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6158
6243
  var _a;
6159
6244
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
6160
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
+ }
6161
6258
  constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
6162
6259
  super();
6163
6260
  this.id = id;
@@ -6166,6 +6263,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6166
6263
  this.view = view;
6167
6264
  this._renderer = options.renderer;
6168
6265
  this._group = group;
6266
+ this._minimumWidth = options.minimumWidth;
6267
+ this._minimumHeight = options.minimumHeight;
6268
+ this._maximumWidth = options.maximumWidth;
6269
+ this._maximumHeight = options.maximumHeight;
6169
6270
  this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
6170
6271
  this.addDisposables(this.api.onActiveChange(() => {
6171
6272
  accessor.setActivePanel(this);
@@ -6202,6 +6303,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6202
6303
  : undefined,
6203
6304
  title: this.title,
6204
6305
  renderer: this._renderer,
6306
+ minimumHeight: this._minimumHeight,
6307
+ maximumHeight: this._maximumHeight,
6308
+ minimumWidth: this._minimumWidth,
6309
+ maximumWidth: this._maximumWidth,
6205
6310
  };
6206
6311
  }
6207
6312
  setTitle(title) {
@@ -6331,7 +6436,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6331
6436
  this.action.appendChild(createCloseButton());
6332
6437
  this._element.appendChild(this._content);
6333
6438
  this._element.appendChild(this.action);
6334
- this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
6439
+ this.addDisposables(addDisposableListener(this.action, 'pointerdown', (ev) => {
6335
6440
  ev.preventDefault();
6336
6441
  }));
6337
6442
  this.render();
@@ -6341,7 +6446,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6341
6446
  this.addDisposables(params.api.onDidTitleChange((event) => {
6342
6447
  this._title = event.title;
6343
6448
  this.render();
6344
- }), addDisposableListener(this.action, 'mousedown', (ev) => {
6449
+ }), addDisposableListener(this.action, 'pointerdown', (ev) => {
6345
6450
  ev.preventDefault();
6346
6451
  }), addDisposableListener(this.action, 'click', (ev) => {
6347
6452
  if (ev.defaultPrevented) {
@@ -6442,6 +6547,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6442
6547
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6443
6548
  const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6444
6549
  renderer: panelData.renderer,
6550
+ minimumWidth: panelData.minimumWidth,
6551
+ minimumHeight: panelData.minimumHeight,
6552
+ maximumWidth: panelData.maximumWidth,
6553
+ maximumHeight: panelData.maximumHeight,
6445
6554
  });
6446
6555
  panel.init({
6447
6556
  title: title !== null && title !== void 0 ? title : panelId,
@@ -6475,34 +6584,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6475
6584
  actionsContainer.appendChild(closeAnchor);
6476
6585
  title.appendChild(emptySpace);
6477
6586
  title.appendChild(actionsContainer);
6478
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
6587
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (event) => {
6479
6588
  var _a;
6480
- ev.preventDefault();
6589
+ event.preventDefault();
6481
6590
  if (this._group) {
6482
6591
  (_a = this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(this._group);
6483
6592
  }
6484
6593
  }));
6485
6594
  }
6486
- update(_event) {
6487
- // noop
6488
- }
6489
- focus() {
6490
- // noop
6491
- }
6492
- layout(_width, _height) {
6493
- // noop
6494
- }
6495
6595
  init(_params) {
6496
6596
  this._api = _params.containerApi;
6597
+ this._group = _params.group;
6497
6598
  this.render();
6498
6599
  }
6499
- updateParentGroup(group, _visible) {
6500
- this._group = group;
6501
- this.render();
6502
- }
6503
- dispose() {
6504
- super.dispose();
6505
- }
6506
6600
  render() {
6507
6601
  const isOneGroup = !!(this._api && this._api.size <= 1);
6508
6602
  toggleClass(this.element, 'has-actions', isOneGroup);
@@ -6661,7 +6755,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6661
6755
  dispose: () => {
6662
6756
  iframes.release();
6663
6757
  },
6664
- }, addDisposableWindowListener(window, 'mousemove', (e) => {
6758
+ }, addDisposableWindowListener(window, 'pointermove', (e) => {
6665
6759
  const containerRect = this.options.container.getBoundingClientRect();
6666
6760
  const x = e.clientX - containerRect.left;
6667
6761
  const y = e.clientY - containerRect.top;
@@ -6704,7 +6798,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6704
6798
  this._onDidChangeEnd.fire();
6705
6799
  }));
6706
6800
  };
6707
- this.addDisposables(move, addDisposableListener(dragTarget, 'mousedown', (event) => {
6801
+ this.addDisposables(move, addDisposableListener(dragTarget, 'pointerdown', (event) => {
6708
6802
  if (event.defaultPrevented) {
6709
6803
  event.preventDefault();
6710
6804
  return;
@@ -6715,7 +6809,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6715
6809
  return;
6716
6810
  }
6717
6811
  track();
6718
- }), addDisposableListener(this.options.content, 'mousedown', (event) => {
6812
+ }), addDisposableListener(this.options.content, 'pointerdown', (event) => {
6719
6813
  if (event.defaultPrevented) {
6720
6814
  return;
6721
6815
  }
@@ -6727,7 +6821,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6727
6821
  if (event.shiftKey) {
6728
6822
  track();
6729
6823
  }
6730
- }), addDisposableListener(this.options.content, 'mousedown', () => {
6824
+ }), addDisposableListener(this.options.content, 'pointerdown', () => {
6731
6825
  arialLevelTracker.push(this._element);
6732
6826
  }, true));
6733
6827
  if (options.inDragMode) {
@@ -6739,11 +6833,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6739
6833
  resizeHandleElement.className = `dv-resize-handle-${direction}`;
6740
6834
  this._element.appendChild(resizeHandleElement);
6741
6835
  const move = new MutableDisposable();
6742
- this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6836
+ this.addDisposables(move, addDisposableListener(resizeHandleElement, 'pointerdown', (e) => {
6743
6837
  e.preventDefault();
6744
6838
  let startPosition = null;
6745
6839
  const iframes = disableIframePointEvents();
6746
- move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6840
+ move.value = new CompositeDisposable(addDisposableWindowListener(window, 'pointermove', (e) => {
6747
6841
  const containerRect = this.options.container.getBoundingClientRect();
6748
6842
  const overlayRect = this._element.getBoundingClientRect();
6749
6843
  const y = e.clientY - containerRect.top;
@@ -7225,25 +7319,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7225
7319
  });
7226
7320
  });
7227
7321
  }
7228
- function getDockviewTheme(element) {
7229
- function toClassList(element) {
7230
- const list = [];
7231
- for (let i = 0; i < element.classList.length; i++) {
7232
- list.push(element.classList.item(i));
7233
- }
7234
- return list;
7235
- }
7236
- let theme = undefined;
7237
- let parent = element;
7238
- while (parent !== null) {
7239
- theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
7240
- if (typeof theme === 'string') {
7241
- break;
7242
- }
7243
- parent = parent.parentElement;
7244
- }
7245
- return theme;
7246
- }
7247
7322
  class DockviewComponent extends BaseGrid {
7248
7323
  get orientation() {
7249
7324
  return this.gridview.orientation;
@@ -7279,13 +7354,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7279
7354
  }
7280
7355
  constructor(parentElement, options) {
7281
7356
  var _a;
7282
- super({
7357
+ super(parentElement, {
7283
7358
  proportionalLayout: true,
7284
7359
  orientation: exports.Orientation.HORIZONTAL,
7285
7360
  styles: options.hideBorders
7286
7361
  ? { separatorBorder: 'transparent' }
7287
7362
  : undefined,
7288
- parentElement: parentElement,
7289
7363
  disableAutoResizing: options.disableAutoResizing,
7290
7364
  locked: options.locked,
7291
7365
  margin: options.gap,
@@ -7325,9 +7399,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7325
7399
  this._onDidActiveGroupChange = new Emitter();
7326
7400
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7327
7401
  this._moving = false;
7328
- // const gready = document.createElement('div');
7329
- // gready.className = 'dv-overlay-render-container';
7330
- // this.gridview.element.appendChild(gready);
7331
7402
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7332
7403
  toggleClass(this.gridview.element, 'dv-dockview', true);
7333
7404
  toggleClass(this.element, 'dv-debug', !!options.debug);
@@ -7776,15 +7847,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7776
7847
  }
7777
7848
  }
7778
7849
  updateOptions(options) {
7779
- var _a, _b;
7780
- const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7781
- options.floatingGroupBounds !== this.options.floatingGroupBounds;
7782
- const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
7783
- options.rootOverlayModel !== this.options.rootOverlayModel;
7784
- this._options = Object.assign(Object.assign({}, this.options), options);
7785
- if (changed_floatingGroupBounds) {
7850
+ var _a, _b, _c, _d;
7851
+ super.updateOptions(options);
7852
+ if ('floatingGroupBounds' in options) {
7786
7853
  for (const group of this._floatingGroups) {
7787
- switch (this.options.floatingGroupBounds) {
7854
+ switch (options.floatingGroupBounds) {
7788
7855
  case 'boundedWithinViewport':
7789
7856
  group.overlay.minimumInViewportHeight = undefined;
7790
7857
  group.overlay.minimumInViewportWidth = undefined;
@@ -7797,25 +7864,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7797
7864
  break;
7798
7865
  default:
7799
7866
  group.overlay.minimumInViewportHeight =
7800
- (_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7867
+ (_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7801
7868
  group.overlay.minimumInViewportWidth =
7802
- (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7869
+ (_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7803
7870
  }
7804
7871
  group.overlay.setBounds();
7805
7872
  }
7806
7873
  }
7807
- if (changed_rootOverlayOptions) {
7808
- 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);
7809
7876
  }
7810
- if (
7811
- // if explicitly set as `undefined`
7812
- 'gap' in options &&
7813
- options.gap === undefined) {
7814
- this.gridview.margin = 0;
7815
- }
7816
- if (typeof options.gap === 'number') {
7817
- this.gridview.margin = options.gap;
7877
+ if ('gap' in options) {
7878
+ this.gridview.margin = (_d = options.gap) !== null && _d !== void 0 ? _d : 0;
7818
7879
  }
7880
+ this._options = Object.assign(Object.assign({}, this.options), options);
7819
7881
  this.layout(this.gridview.width, this.gridview.height, true);
7820
7882
  }
7821
7883
  layout(width, height, forceResize) {
@@ -8072,6 +8134,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8072
8134
  if (options.position && options.floating) {
8073
8135
  throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
8074
8136
  }
8137
+ const initial = {
8138
+ width: options.initialWidth,
8139
+ height: options.initialHeight,
8140
+ };
8075
8141
  if (options.position) {
8076
8142
  if (isPanelOptionsWithPanel(options.position)) {
8077
8143
  const referencePanel = typeof options.position.referencePanel === 'string'
@@ -8101,6 +8167,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8101
8167
  if (!options.inactive) {
8102
8168
  this.doSetGroupAndPanelActive(group);
8103
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
+ });
8104
8174
  return panel;
8105
8175
  }
8106
8176
  }
@@ -8131,6 +8201,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8131
8201
  skipSetActive: options.inactive,
8132
8202
  skipSetGroupActive: options.inactive,
8133
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
+ });
8134
8208
  if (!options.inactive) {
8135
8209
  this.doSetGroupAndPanelActive(referenceGroup);
8136
8210
  }
@@ -8138,7 +8212,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8138
8212
  else {
8139
8213
  const location = getGridLocation(referenceGroup.element);
8140
8214
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8141
- 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);
8142
8219
  panel = this.createPanel(options, group);
8143
8220
  group.model.openPanel(panel, {
8144
8221
  skipSetActive: options.inactive,
@@ -8164,7 +8241,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8164
8241
  });
8165
8242
  }
8166
8243
  else {
8167
- 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);
8168
8247
  panel = this.createPanel(options, group);
8169
8248
  group.model.openPanel(panel, {
8170
8249
  skipSetActive: options.inactive,
@@ -8258,7 +8337,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8258
8337
  const location = getGridLocation(referenceGroup.element);
8259
8338
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8260
8339
  const group = this.createGroup(options);
8261
- 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);
8262
8345
  if (!options.skipSetActive) {
8263
8346
  this.doSetGroupAndPanelActive(group);
8264
8347
  }
@@ -8271,6 +8354,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8271
8354
  return group;
8272
8355
  }
8273
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
+ }
8274
8363
  removeGroup(group, options) {
8275
8364
  this.doRemoveGroup(group, options);
8276
8365
  }
@@ -8542,7 +8631,22 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8542
8631
  }
8543
8632
  const referenceLocation = getGridLocation(to.element);
8544
8633
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
8545
- 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);
8546
8650
  }
8547
8651
  from.panels.forEach((panel) => {
8548
8652
  this._onDidMovePanel.fire({ panel, from });
@@ -8654,22 +8758,34 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8654
8758
  const contentComponent = options.component;
8655
8759
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8656
8760
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8657
- 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
+ });
8658
8768
  panel.init({
8659
8769
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8660
8770
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
8661
8771
  });
8662
8772
  return panel;
8663
8773
  }
8664
- createGroupAtLocation(location = [0]) {
8774
+ createGroupAtLocation(location, size) {
8665
8775
  const group = this.createGroup();
8666
- this.doAddGroup(group, location);
8776
+ this.doAddGroup(group, location, size);
8667
8777
  return group;
8668
8778
  }
8669
8779
  findGroup(panel) {
8670
8780
  var _a;
8671
8781
  return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
8672
8782
  }
8783
+ orientationAtLocation(location) {
8784
+ const rootOrientation = this.gridview.orientation;
8785
+ return location.length % 2 == 1
8786
+ ? rootOrientation
8787
+ : orthogonal(rootOrientation);
8788
+ }
8673
8789
  }
8674
8790
 
8675
8791
  class GridviewComponent extends BaseGrid {
@@ -8689,8 +8805,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8689
8805
  this._deserializer = value;
8690
8806
  }
8691
8807
  constructor(parentElement, options) {
8692
- super({
8693
- parentElement: parentElement,
8808
+ super(parentElement, {
8694
8809
  proportionalLayout: options.proportionalLayout,
8695
8810
  orientation: options.orientation,
8696
8811
  styles: options.styles,
@@ -8721,6 +8836,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8721
8836
  }
8722
8837
  }
8723
8838
  updateOptions(options) {
8839
+ super.updateOptions(options);
8724
8840
  const hasOrientationChanged = typeof options.orientation === 'string' &&
8725
8841
  this.gridview.orientation !== options.orientation;
8726
8842
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -8988,6 +9104,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8988
9104
  : this.splitview.orthogonalSize;
8989
9105
  }
8990
9106
  constructor(parentElement, options) {
9107
+ var _a;
8991
9108
  super(parentElement, options.disableAutoResizing);
8992
9109
  this._splitviewChangeDisposable = new MutableDisposable();
8993
9110
  this._panels = new Map();
@@ -8999,9 +9116,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8999
9116
  this.onDidRemoveView = this._onDidRemoveView.event;
9000
9117
  this._onDidLayoutChange = new Emitter();
9001
9118
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9002
- if (typeof options.className === 'string') {
9003
- this.element.classList.add(options.className);
9004
- }
9119
+ this._classNames = new Classnames(this.element);
9120
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9005
9121
  this._options = options;
9006
9122
  if (!options.components) {
9007
9123
  options.components = {};
@@ -9013,12 +9129,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9013
9129
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9014
9130
  }
9015
9131
  updateOptions(options) {
9016
- const hasOrientationChanged = typeof options.orientation === 'string' &&
9017
- this.options.orientation !== options.orientation;
9018
- this._options = Object.assign(Object.assign({}, this.options), options);
9019
- if (hasOrientationChanged) {
9132
+ var _a, _b;
9133
+ if ('className' in options) {
9134
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9135
+ }
9136
+ if ('disableResizing' in options) {
9137
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9138
+ }
9139
+ if (typeof options.orientation === 'string') {
9020
9140
  this.splitview.orientation = options.orientation;
9021
9141
  }
9142
+ this._options = Object.assign(Object.assign({}, this.options), options);
9022
9143
  this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
9023
9144
  }
9024
9145
  focus() {
@@ -9315,6 +9436,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9315
9436
  return this._options;
9316
9437
  }
9317
9438
  constructor(parentElement, options) {
9439
+ var _a;
9318
9440
  super(parentElement, options.disableAutoResizing);
9319
9441
  this._id = nextLayoutId.next();
9320
9442
  this._disposable = new MutableDisposable();
@@ -9329,10 +9451,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9329
9451
  this.onDidAddView = this._onDidAddView.event;
9330
9452
  this._onDidRemoveView = new Emitter();
9331
9453
  this.onDidRemoveView = this._onDidRemoveView.event;
9332
- if (typeof options.className === 'string') {
9333
- this.element.classList.add(options.className);
9334
- }
9335
9454
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9455
+ this._classNames = new Classnames(this.element);
9456
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9336
9457
  this._options = options;
9337
9458
  if (!options.components) {
9338
9459
  options.components = {};
@@ -9354,6 +9475,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9354
9475
  //noop
9355
9476
  }
9356
9477
  updateOptions(options) {
9478
+ var _a, _b;
9479
+ if ('className' in options) {
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;
9484
+ }
9357
9485
  this._options = Object.assign(Object.assign({}, this.options), options);
9358
9486
  }
9359
9487
  addPanel(options) {
@@ -9902,9 +10030,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9902
10030
  layout(_width, _height) {
9903
10031
  // noop - retrieval from api
9904
10032
  }
9905
- updateParentGroup(_group, _isPanelVisible) {
9906
- // noop
9907
- }
9908
10033
  dispose() {
9909
10034
  var _a;
9910
10035
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
@@ -10217,7 +10342,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10217
10342
  api.close();
10218
10343
  }
10219
10344
  }, [api, closeActionOverride]);
10220
- const onMouseDown = React.useCallback((e) => {
10345
+ const onPointerDown = React.useCallback((e) => {
10221
10346
  e.preventDefault();
10222
10347
  }, []);
10223
10348
  const onClick = React.useCallback((event) => {
@@ -10231,7 +10356,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10231
10356
  }, [api, rest.onClick]);
10232
10357
  return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onClick: onClick, className: "dv-default-tab" }),
10233
10358
  React.createElement("span", { className: "dv-default-tab-content" }, title),
10234
- !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 },
10235
10360
  React.createElement(CloseButton, null)))));
10236
10361
  };
10237
10362