dockview-react 1.16.1 → 1.17.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 1.16.1
3
+ * @version 1.17.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -555,6 +555,42 @@
555
555
  },
556
556
  };
557
557
  }
558
+ function getDockviewTheme(element) {
559
+ function toClassList(element) {
560
+ const list = [];
561
+ for (let i = 0; i < element.classList.length; i++) {
562
+ list.push(element.classList.item(i));
563
+ }
564
+ return list;
565
+ }
566
+ let theme = undefined;
567
+ let parent = element;
568
+ while (parent !== null) {
569
+ theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
570
+ if (typeof theme === 'string') {
571
+ break;
572
+ }
573
+ parent = parent.parentElement;
574
+ }
575
+ return theme;
576
+ }
577
+ class Classnames {
578
+ constructor(element) {
579
+ this.element = element;
580
+ this._classNames = [];
581
+ }
582
+ setClassNames(classNames) {
583
+ for (const className of this._classNames) {
584
+ toggleClass(this.element, className, false);
585
+ }
586
+ this._classNames = classNames
587
+ .split(' ')
588
+ .filter((v) => v.trim().length > 0);
589
+ for (const className of this._classNames) {
590
+ toggleClass(this.element, className, true);
591
+ }
592
+ }
593
+ }
558
594
 
559
595
  function tail(arr) {
560
596
  if (arr.length === 0) {
@@ -2674,8 +2710,8 @@
2674
2710
  set locked(value) {
2675
2711
  this.gridview.locked = value;
2676
2712
  }
2677
- constructor(options) {
2678
- var _a, _b;
2713
+ constructor(parentElement, options) {
2714
+ var _a;
2679
2715
  super(document.createElement('div'), options.disableAutoResizing);
2680
2716
  this._id = nextLayoutId$1.next();
2681
2717
  this._groups = new Map();
@@ -2689,14 +2725,11 @@
2689
2725
  this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
2690
2726
  this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
2691
2727
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2692
- this.classNames = [];
2693
2728
  this.element.style.height = '100%';
2694
2729
  this.element.style.width = '100%';
2695
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2696
- for (const className of this.classNames) {
2697
- toggleClass(this.element, className, true);
2698
- }
2699
- options.parentElement.appendChild(this.element);
2730
+ this._classNames = new Classnames(this.element);
2731
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
2732
+ parentElement.appendChild(this.element);
2700
2733
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2701
2734
  this.gridview.locked = !!options.locked;
2702
2735
  this.element.appendChild(this.gridview.element);
@@ -2720,15 +2753,22 @@
2720
2753
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2721
2754
  }
2722
2755
  updateOptions(options) {
2723
- var _a, _b;
2756
+ var _a, _b, _c, _d;
2757
+ if (typeof options.proportionalLayout === 'boolean') ;
2758
+ if (options.orientation) {
2759
+ this.gridview.orientation = options.orientation;
2760
+ }
2761
+ if ('disableResizing' in options) {
2762
+ this.disableResizing = (_a = options.disableAutoResizing) !== null && _a !== void 0 ? _a : false;
2763
+ }
2764
+ if ('locked' in options) {
2765
+ this.locked = (_b = options.locked) !== null && _b !== void 0 ? _b : false;
2766
+ }
2767
+ if ('margin' in options) {
2768
+ this.gridview.margin = (_c = options.margin) !== null && _c !== void 0 ? _c : 0;
2769
+ }
2724
2770
  if ('className' in options) {
2725
- for (const className of this.classNames) {
2726
- toggleClass(this.element, className, false);
2727
- }
2728
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2729
- for (const className of this.classNames) {
2730
- toggleClass(this.element, className, true);
2731
- }
2771
+ this._classNames.setClassNames((_d = options.className) !== null && _d !== void 0 ? _d : '');
2732
2772
  }
2733
2773
  }
2734
2774
  maximizeGroup(panel) {
@@ -4654,7 +4694,7 @@
4654
4694
  this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
4655
4695
  this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
4656
4696
  this._onDragStart.fire(event);
4657
- }), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
4697
+ }), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
4658
4698
  if (event.defaultPrevented) {
4659
4699
  return;
4660
4700
  }
@@ -4696,7 +4736,7 @@
4696
4736
  this.accessor = accessor;
4697
4737
  this.group = group;
4698
4738
  this.panelTransfer = LocalSelectionTransfer.getInstance();
4699
- this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
4739
+ this.addDisposables(addDisposableListener(element, 'pointerdown', (e) => {
4700
4740
  if (e.shiftKey) {
4701
4741
  /**
4702
4742
  * You cannot call e.preventDefault() because that will prevent drag events from firing
@@ -4915,7 +4955,7 @@
4915
4955
  group: this.group,
4916
4956
  getData: getPanelData,
4917
4957
  }));
4918
- }), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
4958
+ }), addDisposableListener(this.voidContainer.element, 'pointerdown', (event) => {
4919
4959
  const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
4920
4960
  if (isFloatingGroupsEnabled &&
4921
4961
  event.shiftKey &&
@@ -4929,7 +4969,7 @@
4929
4969
  inDragMode: true,
4930
4970
  });
4931
4971
  }
4932
- }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
4972
+ }), addDisposableListener(this.tabContainer, 'pointerdown', (event) => {
4933
4973
  if (event.defaultPrevented) {
4934
4974
  return;
4935
4975
  }
@@ -5634,7 +5674,6 @@
5634
5674
  });
5635
5675
  this.tabsContainer.hide();
5636
5676
  this.contentContainer.element.appendChild(this.watermark.element);
5637
- this.watermark.updateParentGroup(this.groupPanel, true);
5638
5677
  }
5639
5678
  if (!this.isEmpty && this.watermark) {
5640
5679
  this.watermark.element.remove();
@@ -5997,6 +6036,34 @@
5997
6036
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
5998
6037
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
5999
6038
  class DockviewGroupPanel extends GridviewPanel {
6039
+ get minimumWidth() {
6040
+ var _a;
6041
+ const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6042
+ return typeof activePanelMinimumWidth === 'number'
6043
+ ? activePanelMinimumWidth
6044
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH;
6045
+ }
6046
+ get minimumHeight() {
6047
+ var _a;
6048
+ const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6049
+ return typeof activePanelMinimumHeight === 'number'
6050
+ ? activePanelMinimumHeight
6051
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT;
6052
+ }
6053
+ get maximumWidth() {
6054
+ var _a;
6055
+ const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6056
+ return typeof activePanelMaximumWidth === 'number'
6057
+ ? activePanelMaximumWidth
6058
+ : Number.MAX_SAFE_INTEGER;
6059
+ }
6060
+ get maximumHeight() {
6061
+ var _a;
6062
+ const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6063
+ return typeof activePanelMaximumHeight === 'number'
6064
+ ? activePanelMaximumHeight
6065
+ : Number.MAX_SAFE_INTEGER;
6066
+ }
6000
6067
  get panels() {
6001
6068
  return this._model.panels;
6002
6069
  }
@@ -6019,9 +6086,12 @@
6019
6086
  return this._model.header;
6020
6087
  }
6021
6088
  constructor(accessor, id, options) {
6089
+ var _a, _b, _c, _d, _e, _f;
6022
6090
  super(id, 'groupview_default', {
6023
- minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6024
- minimumWidth: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6091
+ minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6092
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6093
+ maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6094
+ maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6025
6095
  }, new DockviewGroupPanelApiImpl(id, accessor));
6026
6096
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6027
6097
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
@@ -6177,6 +6247,18 @@
6177
6247
  var _a;
6178
6248
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
6179
6249
  }
6250
+ get minimumWidth() {
6251
+ return this._minimumWidth;
6252
+ }
6253
+ get minimumHeight() {
6254
+ return this._minimumHeight;
6255
+ }
6256
+ get maximumWidth() {
6257
+ return this._maximumWidth;
6258
+ }
6259
+ get maximumHeight() {
6260
+ return this._maximumHeight;
6261
+ }
6180
6262
  constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
6181
6263
  super();
6182
6264
  this.id = id;
@@ -6185,6 +6267,10 @@
6185
6267
  this.view = view;
6186
6268
  this._renderer = options.renderer;
6187
6269
  this._group = group;
6270
+ this._minimumWidth = options.minimumWidth;
6271
+ this._minimumHeight = options.minimumHeight;
6272
+ this._maximumWidth = options.maximumWidth;
6273
+ this._maximumHeight = options.maximumHeight;
6188
6274
  this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
6189
6275
  this.addDisposables(this.api.onActiveChange(() => {
6190
6276
  accessor.setActivePanel(this);
@@ -6221,6 +6307,10 @@
6221
6307
  : undefined,
6222
6308
  title: this.title,
6223
6309
  renderer: this._renderer,
6310
+ minimumHeight: this._minimumHeight,
6311
+ maximumHeight: this._maximumHeight,
6312
+ minimumWidth: this._minimumWidth,
6313
+ maximumWidth: this._maximumWidth,
6224
6314
  };
6225
6315
  }
6226
6316
  setTitle(title) {
@@ -6350,7 +6440,7 @@
6350
6440
  this.action.appendChild(createCloseButton());
6351
6441
  this._element.appendChild(this._content);
6352
6442
  this._element.appendChild(this.action);
6353
- this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
6443
+ this.addDisposables(addDisposableListener(this.action, 'pointerdown', (ev) => {
6354
6444
  ev.preventDefault();
6355
6445
  }));
6356
6446
  this.render();
@@ -6360,7 +6450,7 @@
6360
6450
  this.addDisposables(params.api.onDidTitleChange((event) => {
6361
6451
  this._title = event.title;
6362
6452
  this.render();
6363
- }), addDisposableListener(this.action, 'mousedown', (ev) => {
6453
+ }), addDisposableListener(this.action, 'pointerdown', (ev) => {
6364
6454
  ev.preventDefault();
6365
6455
  }), addDisposableListener(this.action, 'click', (ev) => {
6366
6456
  if (ev.defaultPrevented) {
@@ -6461,6 +6551,10 @@
6461
6551
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6462
6552
  const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6463
6553
  renderer: panelData.renderer,
6554
+ minimumWidth: panelData.minimumWidth,
6555
+ minimumHeight: panelData.minimumHeight,
6556
+ maximumWidth: panelData.maximumWidth,
6557
+ maximumHeight: panelData.maximumHeight,
6464
6558
  });
6465
6559
  panel.init({
6466
6560
  title: title !== null && title !== void 0 ? title : panelId,
@@ -6494,34 +6588,19 @@
6494
6588
  actionsContainer.appendChild(closeAnchor);
6495
6589
  title.appendChild(emptySpace);
6496
6590
  title.appendChild(actionsContainer);
6497
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
6591
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (event) => {
6498
6592
  var _a;
6499
- ev.preventDefault();
6593
+ event.preventDefault();
6500
6594
  if (this._group) {
6501
6595
  (_a = this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(this._group);
6502
6596
  }
6503
6597
  }));
6504
6598
  }
6505
- update(_event) {
6506
- // noop
6507
- }
6508
- focus() {
6509
- // noop
6510
- }
6511
- layout(_width, _height) {
6512
- // noop
6513
- }
6514
6599
  init(_params) {
6515
6600
  this._api = _params.containerApi;
6601
+ this._group = _params.group;
6516
6602
  this.render();
6517
6603
  }
6518
- updateParentGroup(group, _visible) {
6519
- this._group = group;
6520
- this.render();
6521
- }
6522
- dispose() {
6523
- super.dispose();
6524
- }
6525
6604
  render() {
6526
6605
  const isOneGroup = !!(this._api && this._api.size <= 1);
6527
6606
  toggleClass(this.element, 'has-actions', isOneGroup);
@@ -6680,7 +6759,7 @@
6680
6759
  dispose: () => {
6681
6760
  iframes.release();
6682
6761
  },
6683
- }, addDisposableWindowListener(window, 'mousemove', (e) => {
6762
+ }, addDisposableWindowListener(window, 'pointermove', (e) => {
6684
6763
  const containerRect = this.options.container.getBoundingClientRect();
6685
6764
  const x = e.clientX - containerRect.left;
6686
6765
  const y = e.clientY - containerRect.top;
@@ -6717,13 +6796,13 @@
6717
6796
  bounds.right = right;
6718
6797
  }
6719
6798
  this.setBounds(bounds);
6720
- }), addDisposableWindowListener(window, 'mouseup', () => {
6799
+ }), addDisposableWindowListener(window, 'pointerup', () => {
6721
6800
  toggleClass(this._element, 'dv-resize-container-dragging', false);
6722
6801
  move.dispose();
6723
6802
  this._onDidChangeEnd.fire();
6724
6803
  }));
6725
6804
  };
6726
- this.addDisposables(move, addDisposableListener(dragTarget, 'mousedown', (event) => {
6805
+ this.addDisposables(move, addDisposableListener(dragTarget, 'pointerdown', (event) => {
6727
6806
  if (event.defaultPrevented) {
6728
6807
  event.preventDefault();
6729
6808
  return;
@@ -6734,7 +6813,7 @@
6734
6813
  return;
6735
6814
  }
6736
6815
  track();
6737
- }), addDisposableListener(this.options.content, 'mousedown', (event) => {
6816
+ }), addDisposableListener(this.options.content, 'pointerdown', (event) => {
6738
6817
  if (event.defaultPrevented) {
6739
6818
  return;
6740
6819
  }
@@ -6746,7 +6825,7 @@
6746
6825
  if (event.shiftKey) {
6747
6826
  track();
6748
6827
  }
6749
- }), addDisposableListener(this.options.content, 'mousedown', () => {
6828
+ }), addDisposableListener(this.options.content, 'pointerdown', () => {
6750
6829
  arialLevelTracker.push(this._element);
6751
6830
  }, true));
6752
6831
  if (options.inDragMode) {
@@ -6758,11 +6837,11 @@
6758
6837
  resizeHandleElement.className = `dv-resize-handle-${direction}`;
6759
6838
  this._element.appendChild(resizeHandleElement);
6760
6839
  const move = new MutableDisposable();
6761
- this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6840
+ this.addDisposables(move, addDisposableListener(resizeHandleElement, 'pointerdown', (e) => {
6762
6841
  e.preventDefault();
6763
6842
  let startPosition = null;
6764
6843
  const iframes = disableIframePointEvents();
6765
- move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6844
+ move.value = new CompositeDisposable(addDisposableWindowListener(window, 'pointermove', (e) => {
6766
6845
  const containerRect = this.options.container.getBoundingClientRect();
6767
6846
  const overlayRect = this._element.getBoundingClientRect();
6768
6847
  const y = e.clientY - containerRect.top;
@@ -6886,7 +6965,7 @@
6886
6965
  dispose: () => {
6887
6966
  iframes.release();
6888
6967
  },
6889
- }, addDisposableWindowListener(window, 'mouseup', () => {
6968
+ }, addDisposableWindowListener(window, 'pointerup', () => {
6890
6969
  move.dispose();
6891
6970
  this._onDidChangeEnd.fire();
6892
6971
  }));
@@ -7244,25 +7323,6 @@
7244
7323
  });
7245
7324
  });
7246
7325
  }
7247
- function getDockviewTheme(element) {
7248
- function toClassList(element) {
7249
- const list = [];
7250
- for (let i = 0; i < element.classList.length; i++) {
7251
- list.push(element.classList.item(i));
7252
- }
7253
- return list;
7254
- }
7255
- let theme = undefined;
7256
- let parent = element;
7257
- while (parent !== null) {
7258
- theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
7259
- if (typeof theme === 'string') {
7260
- break;
7261
- }
7262
- parent = parent.parentElement;
7263
- }
7264
- return theme;
7265
- }
7266
7326
  class DockviewComponent extends BaseGrid {
7267
7327
  get orientation() {
7268
7328
  return this.gridview.orientation;
@@ -7298,13 +7358,12 @@
7298
7358
  }
7299
7359
  constructor(parentElement, options) {
7300
7360
  var _a;
7301
- super({
7361
+ super(parentElement, {
7302
7362
  proportionalLayout: true,
7303
7363
  orientation: exports.Orientation.HORIZONTAL,
7304
7364
  styles: options.hideBorders
7305
7365
  ? { separatorBorder: 'transparent' }
7306
7366
  : undefined,
7307
- parentElement: parentElement,
7308
7367
  disableAutoResizing: options.disableAutoResizing,
7309
7368
  locked: options.locked,
7310
7369
  margin: options.gap,
@@ -7344,9 +7403,6 @@
7344
7403
  this._onDidActiveGroupChange = new Emitter();
7345
7404
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7346
7405
  this._moving = false;
7347
- // const gready = document.createElement('div');
7348
- // gready.className = 'dv-overlay-render-container';
7349
- // this.gridview.element.appendChild(gready);
7350
7406
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7351
7407
  toggleClass(this.gridview.element, 'dv-dockview', true);
7352
7408
  toggleClass(this.element, 'dv-debug', !!options.debug);
@@ -7795,16 +7851,11 @@
7795
7851
  }
7796
7852
  }
7797
7853
  updateOptions(options) {
7798
- var _a, _b;
7854
+ var _a, _b, _c, _d;
7799
7855
  super.updateOptions(options);
7800
- const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7801
- options.floatingGroupBounds !== this.options.floatingGroupBounds;
7802
- const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
7803
- options.rootOverlayModel !== this.options.rootOverlayModel;
7804
- this._options = Object.assign(Object.assign({}, this.options), options);
7805
- if (changed_floatingGroupBounds) {
7856
+ if ('floatingGroupBounds' in options) {
7806
7857
  for (const group of this._floatingGroups) {
7807
- switch (this.options.floatingGroupBounds) {
7858
+ switch (options.floatingGroupBounds) {
7808
7859
  case 'boundedWithinViewport':
7809
7860
  group.overlay.minimumInViewportHeight = undefined;
7810
7861
  group.overlay.minimumInViewportWidth = undefined;
@@ -7817,25 +7868,20 @@
7817
7868
  break;
7818
7869
  default:
7819
7870
  group.overlay.minimumInViewportHeight =
7820
- (_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7871
+ (_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7821
7872
  group.overlay.minimumInViewportWidth =
7822
- (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7873
+ (_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7823
7874
  }
7824
7875
  group.overlay.setBounds();
7825
7876
  }
7826
7877
  }
7827
- if (changed_rootOverlayOptions) {
7828
- this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
7878
+ if ('rootOverlayModel' in options) {
7879
+ this._rootDropTarget.setOverlayModel((_c = options.rootOverlayModel) !== null && _c !== void 0 ? _c : DEFAULT_ROOT_OVERLAY_MODEL);
7829
7880
  }
7830
- if (
7831
- // if explicitly set as `undefined`
7832
- 'gap' in options &&
7833
- options.gap === undefined) {
7834
- this.gridview.margin = 0;
7835
- }
7836
- if (typeof options.gap === 'number') {
7837
- this.gridview.margin = options.gap;
7881
+ if ('gap' in options) {
7882
+ this.gridview.margin = (_d = options.gap) !== null && _d !== void 0 ? _d : 0;
7838
7883
  }
7884
+ this._options = Object.assign(Object.assign({}, this.options), options);
7839
7885
  this.layout(this.gridview.width, this.gridview.height, true);
7840
7886
  }
7841
7887
  layout(width, height, forceResize) {
@@ -8092,6 +8138,10 @@
8092
8138
  if (options.position && options.floating) {
8093
8139
  throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
8094
8140
  }
8141
+ const initial = {
8142
+ width: options.initialWidth,
8143
+ height: options.initialHeight,
8144
+ };
8095
8145
  if (options.position) {
8096
8146
  if (isPanelOptionsWithPanel(options.position)) {
8097
8147
  const referencePanel = typeof options.position.referencePanel === 'string'
@@ -8121,6 +8171,10 @@
8121
8171
  if (!options.inactive) {
8122
8172
  this.doSetGroupAndPanelActive(group);
8123
8173
  }
8174
+ group.api.setSize({
8175
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8176
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8177
+ });
8124
8178
  return panel;
8125
8179
  }
8126
8180
  }
@@ -8151,6 +8205,10 @@
8151
8205
  skipSetActive: options.inactive,
8152
8206
  skipSetGroupActive: options.inactive,
8153
8207
  });
8208
+ referenceGroup.api.setSize({
8209
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8210
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8211
+ });
8154
8212
  if (!options.inactive) {
8155
8213
  this.doSetGroupAndPanelActive(referenceGroup);
8156
8214
  }
@@ -8158,7 +8216,10 @@
8158
8216
  else {
8159
8217
  const location = getGridLocation(referenceGroup.element);
8160
8218
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8161
- const group = this.createGroupAtLocation(relativeLocation);
8219
+ const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) ===
8220
+ exports.Orientation.VERTICAL
8221
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8222
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8162
8223
  panel = this.createPanel(options, group);
8163
8224
  group.model.openPanel(panel, {
8164
8225
  skipSetActive: options.inactive,
@@ -8184,7 +8245,9 @@
8184
8245
  });
8185
8246
  }
8186
8247
  else {
8187
- const group = this.createGroupAtLocation();
8248
+ const group = this.createGroupAtLocation([0], this.gridview.orientation === exports.Orientation.VERTICAL
8249
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8250
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8188
8251
  panel = this.createPanel(options, group);
8189
8252
  group.model.openPanel(panel, {
8190
8253
  skipSetActive: options.inactive,
@@ -8278,7 +8341,11 @@
8278
8341
  const location = getGridLocation(referenceGroup.element);
8279
8342
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8280
8343
  const group = this.createGroup(options);
8281
- this.doAddGroup(group, relativeLocation);
8344
+ const size = this.getLocationOrientation(relativeLocation) ===
8345
+ exports.Orientation.VERTICAL
8346
+ ? options.initialHeight
8347
+ : options.initialWidth;
8348
+ this.doAddGroup(group, relativeLocation, size);
8282
8349
  if (!options.skipSetActive) {
8283
8350
  this.doSetGroupAndPanelActive(group);
8284
8351
  }
@@ -8291,6 +8358,12 @@
8291
8358
  return group;
8292
8359
  }
8293
8360
  }
8361
+ getLocationOrientation(location) {
8362
+ return location.length % 2 == 0 &&
8363
+ this.gridview.orientation === exports.Orientation.HORIZONTAL
8364
+ ? exports.Orientation.HORIZONTAL
8365
+ : exports.Orientation.VERTICAL;
8366
+ }
8294
8367
  removeGroup(group, options) {
8295
8368
  this.doRemoveGroup(group, options);
8296
8369
  }
@@ -8562,7 +8635,22 @@
8562
8635
  }
8563
8636
  const referenceLocation = getGridLocation(to.element);
8564
8637
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
8565
- this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
8638
+ let size;
8639
+ switch (this.gridview.orientation) {
8640
+ case exports.Orientation.VERTICAL:
8641
+ size =
8642
+ referenceLocation.length % 2 == 0
8643
+ ? from.api.width
8644
+ : from.api.height;
8645
+ break;
8646
+ case exports.Orientation.HORIZONTAL:
8647
+ size =
8648
+ referenceLocation.length % 2 == 0
8649
+ ? from.api.height
8650
+ : from.api.width;
8651
+ break;
8652
+ }
8653
+ this.gridview.addView(from, size, dropLocation);
8566
8654
  }
8567
8655
  from.panels.forEach((panel) => {
8568
8656
  this._onDidMovePanel.fire({ panel, from });
@@ -8674,22 +8762,34 @@
8674
8762
  const contentComponent = options.component;
8675
8763
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8676
8764
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8677
- const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8765
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {
8766
+ renderer: options.renderer,
8767
+ minimumWidth: options.minimumWidth,
8768
+ minimumHeight: options.minimumHeight,
8769
+ maximumWidth: options.maximumWidth,
8770
+ maximumHeight: options.maximumHeight,
8771
+ });
8678
8772
  panel.init({
8679
8773
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8680
8774
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
8681
8775
  });
8682
8776
  return panel;
8683
8777
  }
8684
- createGroupAtLocation(location = [0]) {
8778
+ createGroupAtLocation(location, size) {
8685
8779
  const group = this.createGroup();
8686
- this.doAddGroup(group, location);
8780
+ this.doAddGroup(group, location, size);
8687
8781
  return group;
8688
8782
  }
8689
8783
  findGroup(panel) {
8690
8784
  var _a;
8691
8785
  return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
8692
8786
  }
8787
+ orientationAtLocation(location) {
8788
+ const rootOrientation = this.gridview.orientation;
8789
+ return location.length % 2 == 1
8790
+ ? rootOrientation
8791
+ : orthogonal(rootOrientation);
8792
+ }
8693
8793
  }
8694
8794
 
8695
8795
  class GridviewComponent extends BaseGrid {
@@ -8709,8 +8809,7 @@
8709
8809
  this._deserializer = value;
8710
8810
  }
8711
8811
  constructor(parentElement, options) {
8712
- super({
8713
- parentElement: parentElement,
8812
+ super(parentElement, {
8714
8813
  proportionalLayout: options.proportionalLayout,
8715
8814
  orientation: options.orientation,
8716
8815
  styles: options.styles,
@@ -9009,7 +9108,7 @@
9009
9108
  : this.splitview.orthogonalSize;
9010
9109
  }
9011
9110
  constructor(parentElement, options) {
9012
- var _a, _b;
9111
+ var _a;
9013
9112
  super(parentElement, options.disableAutoResizing);
9014
9113
  this._splitviewChangeDisposable = new MutableDisposable();
9015
9114
  this._panels = new Map();
@@ -9021,11 +9120,8 @@
9021
9120
  this.onDidRemoveView = this._onDidRemoveView.event;
9022
9121
  this._onDidLayoutChange = new Emitter();
9023
9122
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9024
- this.classNames = [];
9025
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9026
- for (const className of this.classNames) {
9027
- toggleClass(this.element, className, true);
9028
- }
9123
+ this._classNames = new Classnames(this.element);
9124
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9029
9125
  this._options = options;
9030
9126
  if (!options.components) {
9031
9127
  options.components = {};
@@ -9039,20 +9135,15 @@
9039
9135
  updateOptions(options) {
9040
9136
  var _a, _b;
9041
9137
  if ('className' in options) {
9042
- for (const className of this.classNames) {
9043
- toggleClass(this.element, className, false);
9044
- }
9045
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9046
- for (const className of this.classNames) {
9047
- toggleClass(this.element, className, true);
9048
- }
9138
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9049
9139
  }
9050
- const hasOrientationChanged = typeof options.orientation === 'string' &&
9051
- this.options.orientation !== options.orientation;
9052
- this._options = Object.assign(Object.assign({}, this.options), options);
9053
- if (hasOrientationChanged) {
9140
+ if ('disableResizing' in options) {
9141
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9142
+ }
9143
+ if (typeof options.orientation === 'string') {
9054
9144
  this.splitview.orientation = options.orientation;
9055
9145
  }
9146
+ this._options = Object.assign(Object.assign({}, this.options), options);
9056
9147
  this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
9057
9148
  }
9058
9149
  focus() {
@@ -9349,7 +9440,7 @@
9349
9440
  return this._options;
9350
9441
  }
9351
9442
  constructor(parentElement, options) {
9352
- var _a, _b;
9443
+ var _a;
9353
9444
  super(parentElement, options.disableAutoResizing);
9354
9445
  this._id = nextLayoutId.next();
9355
9446
  this._disposable = new MutableDisposable();
@@ -9364,12 +9455,9 @@
9364
9455
  this.onDidAddView = this._onDidAddView.event;
9365
9456
  this._onDidRemoveView = new Emitter();
9366
9457
  this.onDidRemoveView = this._onDidRemoveView.event;
9367
- this.classNames = [];
9368
9458
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9369
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9370
- for (const className of this.classNames) {
9371
- toggleClass(this.element, className, true);
9372
- }
9459
+ this._classNames = new Classnames(this.element);
9460
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9373
9461
  this._options = options;
9374
9462
  if (!options.components) {
9375
9463
  options.components = {};
@@ -9393,13 +9481,10 @@
9393
9481
  updateOptions(options) {
9394
9482
  var _a, _b;
9395
9483
  if ('className' in options) {
9396
- for (const className of this.classNames) {
9397
- toggleClass(this.element, className, false);
9398
- }
9399
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9400
- for (const className of this.classNames) {
9401
- toggleClass(this.element, className, true);
9402
- }
9484
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9485
+ }
9486
+ if ('disableResizing' in options) {
9487
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9403
9488
  }
9404
9489
  this._options = Object.assign(Object.assign({}, this.options), options);
9405
9490
  }
@@ -9949,9 +10034,6 @@
9949
10034
  layout(_width, _height) {
9950
10035
  // noop - retrieval from api
9951
10036
  }
9952
- updateParentGroup(_group, _isPanelVisible) {
9953
- // noop
9954
- }
9955
10037
  dispose() {
9956
10038
  var _a;
9957
10039
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
@@ -10264,7 +10346,7 @@
10264
10346
  api.close();
10265
10347
  }
10266
10348
  }, [api, closeActionOverride]);
10267
- const onMouseDown = React.useCallback((e) => {
10349
+ const onPointerDown = React.useCallback((e) => {
10268
10350
  e.preventDefault();
10269
10351
  }, []);
10270
10352
  const onClick = React.useCallback((event) => {
@@ -10278,7 +10360,7 @@
10278
10360
  }, [api, rest.onClick]);
10279
10361
  return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onClick: onClick, className: "dv-default-tab" }),
10280
10362
  React.createElement("span", { className: "dv-default-tab-content" }, title),
10281
- !hideClose && (React.createElement("div", { className: "dv-default-tab-action", onMouseDown: onMouseDown, onClick: onClose },
10363
+ !hideClose && (React.createElement("div", { className: "dv-default-tab-action", onPointerDown: onPointerDown, onClick: onClose },
10282
10364
  React.createElement(CloseButton, null)))));
10283
10365
  };
10284
10366