dockview-core 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.
Files changed (80) hide show
  1. package/dist/cjs/dnd/groupDragHandler.js +1 -1
  2. package/dist/cjs/dockview/components/tab/defaultTab.js +2 -2
  3. package/dist/cjs/dockview/components/tab/tab.js +1 -1
  4. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +2 -2
  5. package/dist/cjs/dockview/components/watermark/watermark.d.ts +0 -7
  6. package/dist/cjs/dockview/components/watermark/watermark.js +3 -18
  7. package/dist/cjs/dockview/deserializer.js +4 -0
  8. package/dist/cjs/dockview/dockviewComponent.d.ts +2 -0
  9. package/dist/cjs/dockview/dockviewComponent.js +76 -58
  10. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +4 -0
  11. package/dist/cjs/dockview/dockviewGroupPanel.js +49 -2
  12. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +4 -0
  13. package/dist/cjs/dockview/dockviewGroupPanelModel.js +0 -1
  14. package/dist/cjs/dockview/dockviewPanel.d.ts +14 -1
  15. package/dist/cjs/dockview/dockviewPanel.js +36 -0
  16. package/dist/cjs/dockview/options.d.ts +16 -9
  17. package/dist/cjs/dockview/types.d.ts +5 -2
  18. package/dist/cjs/dom.d.ts +7 -0
  19. package/dist/cjs/dom.js +63 -1
  20. package/dist/cjs/gridview/baseComponentGridview.d.ts +2 -3
  21. package/dist/cjs/gridview/baseComponentGridview.js +28 -51
  22. package/dist/cjs/gridview/gridviewComponent.js +1 -2
  23. package/dist/cjs/gridview/gridviewPanel.d.ts +6 -0
  24. package/dist/cjs/overlay/overlay.js +8 -8
  25. package/dist/cjs/paneview/paneviewComponent.d.ts +1 -1
  26. package/dist/cjs/paneview/paneviewComponent.js +25 -63
  27. package/dist/cjs/splitview/splitviewComponent.d.ts +1 -1
  28. package/dist/cjs/splitview/splitviewComponent.js +29 -69
  29. package/dist/dockview-core.amd.js +221 -136
  30. package/dist/dockview-core.amd.js.map +1 -1
  31. package/dist/dockview-core.amd.min.js +2 -2
  32. package/dist/dockview-core.amd.min.js.map +1 -1
  33. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  34. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  35. package/dist/dockview-core.amd.noStyle.js +220 -135
  36. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  37. package/dist/dockview-core.cjs.js +221 -136
  38. package/dist/dockview-core.cjs.js.map +1 -1
  39. package/dist/dockview-core.esm.js +221 -136
  40. package/dist/dockview-core.esm.js.map +1 -1
  41. package/dist/dockview-core.esm.min.js +2 -2
  42. package/dist/dockview-core.esm.min.js.map +1 -1
  43. package/dist/dockview-core.js +221 -136
  44. package/dist/dockview-core.js.map +1 -1
  45. package/dist/dockview-core.min.js +2 -2
  46. package/dist/dockview-core.min.js.map +1 -1
  47. package/dist/dockview-core.min.noStyle.js +2 -2
  48. package/dist/dockview-core.min.noStyle.js.map +1 -1
  49. package/dist/dockview-core.noStyle.js +220 -135
  50. package/dist/dockview-core.noStyle.js.map +1 -1
  51. package/dist/esm/dnd/groupDragHandler.js +1 -1
  52. package/dist/esm/dockview/components/tab/defaultTab.js +2 -2
  53. package/dist/esm/dockview/components/tab/tab.js +1 -1
  54. package/dist/esm/dockview/components/titlebar/tabsContainer.js +2 -2
  55. package/dist/esm/dockview/components/watermark/watermark.d.ts +0 -7
  56. package/dist/esm/dockview/components/watermark/watermark.js +3 -18
  57. package/dist/esm/dockview/deserializer.js +4 -0
  58. package/dist/esm/dockview/dockviewComponent.d.ts +2 -0
  59. package/dist/esm/dockview/dockviewComponent.js +75 -54
  60. package/dist/esm/dockview/dockviewGroupPanel.d.ts +4 -0
  61. package/dist/esm/dockview/dockviewGroupPanel.js +33 -2
  62. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +4 -0
  63. package/dist/esm/dockview/dockviewGroupPanelModel.js +0 -1
  64. package/dist/esm/dockview/dockviewPanel.d.ts +14 -1
  65. package/dist/esm/dockview/dockviewPanel.js +20 -0
  66. package/dist/esm/dockview/options.d.ts +16 -9
  67. package/dist/esm/dockview/types.d.ts +5 -2
  68. package/dist/esm/dom.d.ts +7 -0
  69. package/dist/esm/dom.js +36 -0
  70. package/dist/esm/gridview/baseComponentGridview.d.ts +2 -3
  71. package/dist/esm/gridview/baseComponentGridview.js +26 -17
  72. package/dist/esm/gridview/gridviewComponent.js +1 -2
  73. package/dist/esm/gridview/gridviewPanel.d.ts +6 -0
  74. package/dist/esm/overlay/overlay.js +8 -8
  75. package/dist/esm/paneview/paneviewComponent.d.ts +1 -1
  76. package/dist/esm/paneview/paneviewComponent.js +8 -14
  77. package/dist/esm/splitview/splitviewComponent.d.ts +1 -1
  78. package/dist/esm/splitview/splitviewComponent.js +10 -18
  79. package/dist/styles/dockview.css +1 -1
  80. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
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
  }));
@@ -7267,25 +7346,6 @@
7267
7346
  });
7268
7347
  });
7269
7348
  }
7270
- function getDockviewTheme(element) {
7271
- function toClassList(element) {
7272
- const list = [];
7273
- for (let i = 0; i < element.classList.length; i++) {
7274
- list.push(element.classList.item(i));
7275
- }
7276
- return list;
7277
- }
7278
- let theme = undefined;
7279
- let parent = element;
7280
- while (parent !== null) {
7281
- theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
7282
- if (typeof theme === 'string') {
7283
- break;
7284
- }
7285
- parent = parent.parentElement;
7286
- }
7287
- return theme;
7288
- }
7289
7349
  class DockviewComponent extends BaseGrid {
7290
7350
  get orientation() {
7291
7351
  return this.gridview.orientation;
@@ -7321,13 +7381,12 @@
7321
7381
  }
7322
7382
  constructor(parentElement, options) {
7323
7383
  var _a;
7324
- super({
7384
+ super(parentElement, {
7325
7385
  proportionalLayout: true,
7326
7386
  orientation: exports.Orientation.HORIZONTAL,
7327
7387
  styles: options.hideBorders
7328
7388
  ? { separatorBorder: 'transparent' }
7329
7389
  : undefined,
7330
- parentElement: parentElement,
7331
7390
  disableAutoResizing: options.disableAutoResizing,
7332
7391
  locked: options.locked,
7333
7392
  margin: options.gap,
@@ -7367,9 +7426,6 @@
7367
7426
  this._onDidActiveGroupChange = new Emitter();
7368
7427
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7369
7428
  this._moving = false;
7370
- // const gready = document.createElement('div');
7371
- // gready.className = 'dv-overlay-render-container';
7372
- // this.gridview.element.appendChild(gready);
7373
7429
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7374
7430
  toggleClass(this.gridview.element, 'dv-dockview', true);
7375
7431
  toggleClass(this.element, 'dv-debug', !!options.debug);
@@ -7818,16 +7874,11 @@
7818
7874
  }
7819
7875
  }
7820
7876
  updateOptions(options) {
7821
- var _a, _b;
7877
+ var _a, _b, _c, _d;
7822
7878
  super.updateOptions(options);
7823
- const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7824
- options.floatingGroupBounds !== this.options.floatingGroupBounds;
7825
- const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
7826
- options.rootOverlayModel !== this.options.rootOverlayModel;
7827
- this._options = Object.assign(Object.assign({}, this.options), options);
7828
- if (changed_floatingGroupBounds) {
7879
+ if ('floatingGroupBounds' in options) {
7829
7880
  for (const group of this._floatingGroups) {
7830
- switch (this.options.floatingGroupBounds) {
7881
+ switch (options.floatingGroupBounds) {
7831
7882
  case 'boundedWithinViewport':
7832
7883
  group.overlay.minimumInViewportHeight = undefined;
7833
7884
  group.overlay.minimumInViewportWidth = undefined;
@@ -7840,25 +7891,20 @@
7840
7891
  break;
7841
7892
  default:
7842
7893
  group.overlay.minimumInViewportHeight =
7843
- (_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7894
+ (_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7844
7895
  group.overlay.minimumInViewportWidth =
7845
- (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7896
+ (_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7846
7897
  }
7847
7898
  group.overlay.setBounds();
7848
7899
  }
7849
7900
  }
7850
- if (changed_rootOverlayOptions) {
7851
- this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
7901
+ if ('rootOverlayModel' in options) {
7902
+ this._rootDropTarget.setOverlayModel((_c = options.rootOverlayModel) !== null && _c !== void 0 ? _c : DEFAULT_ROOT_OVERLAY_MODEL);
7852
7903
  }
7853
- if (
7854
- // if explicitly set as `undefined`
7855
- 'gap' in options &&
7856
- options.gap === undefined) {
7857
- this.gridview.margin = 0;
7858
- }
7859
- if (typeof options.gap === 'number') {
7860
- this.gridview.margin = options.gap;
7904
+ if ('gap' in options) {
7905
+ this.gridview.margin = (_d = options.gap) !== null && _d !== void 0 ? _d : 0;
7861
7906
  }
7907
+ this._options = Object.assign(Object.assign({}, this.options), options);
7862
7908
  this.layout(this.gridview.width, this.gridview.height, true);
7863
7909
  }
7864
7910
  layout(width, height, forceResize) {
@@ -8115,6 +8161,10 @@
8115
8161
  if (options.position && options.floating) {
8116
8162
  throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
8117
8163
  }
8164
+ const initial = {
8165
+ width: options.initialWidth,
8166
+ height: options.initialHeight,
8167
+ };
8118
8168
  if (options.position) {
8119
8169
  if (isPanelOptionsWithPanel(options.position)) {
8120
8170
  const referencePanel = typeof options.position.referencePanel === 'string'
@@ -8144,6 +8194,10 @@
8144
8194
  if (!options.inactive) {
8145
8195
  this.doSetGroupAndPanelActive(group);
8146
8196
  }
8197
+ group.api.setSize({
8198
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8199
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8200
+ });
8147
8201
  return panel;
8148
8202
  }
8149
8203
  }
@@ -8174,6 +8228,10 @@
8174
8228
  skipSetActive: options.inactive,
8175
8229
  skipSetGroupActive: options.inactive,
8176
8230
  });
8231
+ referenceGroup.api.setSize({
8232
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8233
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8234
+ });
8177
8235
  if (!options.inactive) {
8178
8236
  this.doSetGroupAndPanelActive(referenceGroup);
8179
8237
  }
@@ -8181,7 +8239,10 @@
8181
8239
  else {
8182
8240
  const location = getGridLocation(referenceGroup.element);
8183
8241
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8184
- const group = this.createGroupAtLocation(relativeLocation);
8242
+ const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) ===
8243
+ exports.Orientation.VERTICAL
8244
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8245
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8185
8246
  panel = this.createPanel(options, group);
8186
8247
  group.model.openPanel(panel, {
8187
8248
  skipSetActive: options.inactive,
@@ -8207,7 +8268,9 @@
8207
8268
  });
8208
8269
  }
8209
8270
  else {
8210
- const group = this.createGroupAtLocation();
8271
+ const group = this.createGroupAtLocation([0], this.gridview.orientation === exports.Orientation.VERTICAL
8272
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8273
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8211
8274
  panel = this.createPanel(options, group);
8212
8275
  group.model.openPanel(panel, {
8213
8276
  skipSetActive: options.inactive,
@@ -8301,7 +8364,11 @@
8301
8364
  const location = getGridLocation(referenceGroup.element);
8302
8365
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8303
8366
  const group = this.createGroup(options);
8304
- this.doAddGroup(group, relativeLocation);
8367
+ const size = this.getLocationOrientation(relativeLocation) ===
8368
+ exports.Orientation.VERTICAL
8369
+ ? options.initialHeight
8370
+ : options.initialWidth;
8371
+ this.doAddGroup(group, relativeLocation, size);
8305
8372
  if (!options.skipSetActive) {
8306
8373
  this.doSetGroupAndPanelActive(group);
8307
8374
  }
@@ -8314,6 +8381,12 @@
8314
8381
  return group;
8315
8382
  }
8316
8383
  }
8384
+ getLocationOrientation(location) {
8385
+ return location.length % 2 == 0 &&
8386
+ this.gridview.orientation === exports.Orientation.HORIZONTAL
8387
+ ? exports.Orientation.HORIZONTAL
8388
+ : exports.Orientation.VERTICAL;
8389
+ }
8317
8390
  removeGroup(group, options) {
8318
8391
  this.doRemoveGroup(group, options);
8319
8392
  }
@@ -8585,7 +8658,22 @@
8585
8658
  }
8586
8659
  const referenceLocation = getGridLocation(to.element);
8587
8660
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
8588
- this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
8661
+ let size;
8662
+ switch (this.gridview.orientation) {
8663
+ case exports.Orientation.VERTICAL:
8664
+ size =
8665
+ referenceLocation.length % 2 == 0
8666
+ ? from.api.width
8667
+ : from.api.height;
8668
+ break;
8669
+ case exports.Orientation.HORIZONTAL:
8670
+ size =
8671
+ referenceLocation.length % 2 == 0
8672
+ ? from.api.height
8673
+ : from.api.width;
8674
+ break;
8675
+ }
8676
+ this.gridview.addView(from, size, dropLocation);
8589
8677
  }
8590
8678
  from.panels.forEach((panel) => {
8591
8679
  this._onDidMovePanel.fire({ panel, from });
@@ -8697,22 +8785,34 @@
8697
8785
  const contentComponent = options.component;
8698
8786
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8699
8787
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8700
- const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8788
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {
8789
+ renderer: options.renderer,
8790
+ minimumWidth: options.minimumWidth,
8791
+ minimumHeight: options.minimumHeight,
8792
+ maximumWidth: options.maximumWidth,
8793
+ maximumHeight: options.maximumHeight,
8794
+ });
8701
8795
  panel.init({
8702
8796
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8703
8797
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
8704
8798
  });
8705
8799
  return panel;
8706
8800
  }
8707
- createGroupAtLocation(location = [0]) {
8801
+ createGroupAtLocation(location, size) {
8708
8802
  const group = this.createGroup();
8709
- this.doAddGroup(group, location);
8803
+ this.doAddGroup(group, location, size);
8710
8804
  return group;
8711
8805
  }
8712
8806
  findGroup(panel) {
8713
8807
  var _a;
8714
8808
  return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
8715
8809
  }
8810
+ orientationAtLocation(location) {
8811
+ const rootOrientation = this.gridview.orientation;
8812
+ return location.length % 2 == 1
8813
+ ? rootOrientation
8814
+ : orthogonal(rootOrientation);
8815
+ }
8716
8816
  }
8717
8817
 
8718
8818
  class GridviewComponent extends BaseGrid {
@@ -8732,8 +8832,7 @@
8732
8832
  this._deserializer = value;
8733
8833
  }
8734
8834
  constructor(parentElement, options) {
8735
- super({
8736
- parentElement: parentElement,
8835
+ super(parentElement, {
8737
8836
  proportionalLayout: options.proportionalLayout,
8738
8837
  orientation: options.orientation,
8739
8838
  styles: options.styles,
@@ -9032,7 +9131,7 @@
9032
9131
  : this.splitview.orthogonalSize;
9033
9132
  }
9034
9133
  constructor(parentElement, options) {
9035
- var _a, _b;
9134
+ var _a;
9036
9135
  super(parentElement, options.disableAutoResizing);
9037
9136
  this._splitviewChangeDisposable = new MutableDisposable();
9038
9137
  this._panels = new Map();
@@ -9044,11 +9143,8 @@
9044
9143
  this.onDidRemoveView = this._onDidRemoveView.event;
9045
9144
  this._onDidLayoutChange = new Emitter();
9046
9145
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9047
- this.classNames = [];
9048
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9049
- for (const className of this.classNames) {
9050
- toggleClass(this.element, className, true);
9051
- }
9146
+ this._classNames = new Classnames(this.element);
9147
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9052
9148
  this._options = options;
9053
9149
  if (!options.components) {
9054
9150
  options.components = {};
@@ -9062,20 +9158,15 @@
9062
9158
  updateOptions(options) {
9063
9159
  var _a, _b;
9064
9160
  if ('className' in options) {
9065
- for (const className of this.classNames) {
9066
- toggleClass(this.element, className, false);
9067
- }
9068
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9069
- for (const className of this.classNames) {
9070
- toggleClass(this.element, className, true);
9071
- }
9161
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9072
9162
  }
9073
- const hasOrientationChanged = typeof options.orientation === 'string' &&
9074
- this.options.orientation !== options.orientation;
9075
- this._options = Object.assign(Object.assign({}, this.options), options);
9076
- if (hasOrientationChanged) {
9163
+ if ('disableResizing' in options) {
9164
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9165
+ }
9166
+ if (typeof options.orientation === 'string') {
9077
9167
  this.splitview.orientation = options.orientation;
9078
9168
  }
9169
+ this._options = Object.assign(Object.assign({}, this.options), options);
9079
9170
  this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
9080
9171
  }
9081
9172
  focus() {
@@ -9372,7 +9463,7 @@
9372
9463
  return this._options;
9373
9464
  }
9374
9465
  constructor(parentElement, options) {
9375
- var _a, _b;
9466
+ var _a;
9376
9467
  super(parentElement, options.disableAutoResizing);
9377
9468
  this._id = nextLayoutId.next();
9378
9469
  this._disposable = new MutableDisposable();
@@ -9387,12 +9478,9 @@
9387
9478
  this.onDidAddView = this._onDidAddView.event;
9388
9479
  this._onDidRemoveView = new Emitter();
9389
9480
  this.onDidRemoveView = this._onDidRemoveView.event;
9390
- this.classNames = [];
9391
9481
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9392
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9393
- for (const className of this.classNames) {
9394
- toggleClass(this.element, className, true);
9395
- }
9482
+ this._classNames = new Classnames(this.element);
9483
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9396
9484
  this._options = options;
9397
9485
  if (!options.components) {
9398
9486
  options.components = {};
@@ -9416,13 +9504,10 @@
9416
9504
  updateOptions(options) {
9417
9505
  var _a, _b;
9418
9506
  if ('className' in options) {
9419
- for (const className of this.classNames) {
9420
- toggleClass(this.element, className, false);
9421
- }
9422
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9423
- for (const className of this.classNames) {
9424
- toggleClass(this.element, className, true);
9425
- }
9507
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9508
+ }
9509
+ if ('disableResizing' in options) {
9510
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9426
9511
  }
9427
9512
  this._options = Object.assign(Object.assign({}, this.options), options);
9428
9513
  }