dockview-core 1.16.1 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +6 -6
  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 +219 -134
  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 +218 -133
  36. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  37. package/dist/dockview-core.cjs.js +219 -134
  38. package/dist/dockview-core.cjs.js.map +1 -1
  39. package/dist/dockview-core.esm.js +219 -134
  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 +219 -134
  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 +218 -133
  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 +6 -6
  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.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -551,6 +551,42 @@ define(['exports'], (function (exports) { 'use strict';
551
551
  },
552
552
  };
553
553
  }
554
+ function getDockviewTheme(element) {
555
+ function toClassList(element) {
556
+ const list = [];
557
+ for (let i = 0; i < element.classList.length; i++) {
558
+ list.push(element.classList.item(i));
559
+ }
560
+ return list;
561
+ }
562
+ let theme = undefined;
563
+ let parent = element;
564
+ while (parent !== null) {
565
+ theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
566
+ if (typeof theme === 'string') {
567
+ break;
568
+ }
569
+ parent = parent.parentElement;
570
+ }
571
+ return theme;
572
+ }
573
+ class Classnames {
574
+ constructor(element) {
575
+ this.element = element;
576
+ this._classNames = [];
577
+ }
578
+ setClassNames(classNames) {
579
+ for (const className of this._classNames) {
580
+ toggleClass(this.element, className, false);
581
+ }
582
+ this._classNames = classNames
583
+ .split(' ')
584
+ .filter((v) => v.trim().length > 0);
585
+ for (const className of this._classNames) {
586
+ toggleClass(this.element, className, true);
587
+ }
588
+ }
589
+ }
554
590
 
555
591
  function tail(arr) {
556
592
  if (arr.length === 0) {
@@ -2670,8 +2706,8 @@ define(['exports'], (function (exports) { 'use strict';
2670
2706
  set locked(value) {
2671
2707
  this.gridview.locked = value;
2672
2708
  }
2673
- constructor(options) {
2674
- var _a, _b;
2709
+ constructor(parentElement, options) {
2710
+ var _a;
2675
2711
  super(document.createElement('div'), options.disableAutoResizing);
2676
2712
  this._id = nextLayoutId$1.next();
2677
2713
  this._groups = new Map();
@@ -2685,14 +2721,11 @@ define(['exports'], (function (exports) { 'use strict';
2685
2721
  this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
2686
2722
  this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();
2687
2723
  this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;
2688
- this.classNames = [];
2689
2724
  this.element.style.height = '100%';
2690
2725
  this.element.style.width = '100%';
2691
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2692
- for (const className of this.classNames) {
2693
- toggleClass(this.element, className, true);
2694
- }
2695
- options.parentElement.appendChild(this.element);
2726
+ this._classNames = new Classnames(this.element);
2727
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
2728
+ parentElement.appendChild(this.element);
2696
2729
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2697
2730
  this.gridview.locked = !!options.locked;
2698
2731
  this.element.appendChild(this.gridview.element);
@@ -2716,15 +2749,22 @@ define(['exports'], (function (exports) { 'use strict';
2716
2749
  return this.gridview.isViewVisible(getGridLocation(panel.element));
2717
2750
  }
2718
2751
  updateOptions(options) {
2719
- var _a, _b;
2752
+ var _a, _b, _c, _d;
2753
+ if (typeof options.proportionalLayout === 'boolean') ;
2754
+ if (options.orientation) {
2755
+ this.gridview.orientation = options.orientation;
2756
+ }
2757
+ if ('disableResizing' in options) {
2758
+ this.disableResizing = (_a = options.disableAutoResizing) !== null && _a !== void 0 ? _a : false;
2759
+ }
2760
+ if ('locked' in options) {
2761
+ this.locked = (_b = options.locked) !== null && _b !== void 0 ? _b : false;
2762
+ }
2763
+ if ('margin' in options) {
2764
+ this.gridview.margin = (_c = options.margin) !== null && _c !== void 0 ? _c : 0;
2765
+ }
2720
2766
  if ('className' in options) {
2721
- for (const className of this.classNames) {
2722
- toggleClass(this.element, className, false);
2723
- }
2724
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
2725
- for (const className of this.classNames) {
2726
- toggleClass(this.element, className, true);
2727
- }
2767
+ this._classNames.setClassNames((_d = options.className) !== null && _d !== void 0 ? _d : '');
2728
2768
  }
2729
2769
  }
2730
2770
  maximizeGroup(panel) {
@@ -4650,7 +4690,7 @@ define(['exports'], (function (exports) { 'use strict';
4650
4690
  this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
4651
4691
  this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
4652
4692
  this._onDragStart.fire(event);
4653
- }), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
4693
+ }), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
4654
4694
  if (event.defaultPrevented) {
4655
4695
  return;
4656
4696
  }
@@ -4692,7 +4732,7 @@ define(['exports'], (function (exports) { 'use strict';
4692
4732
  this.accessor = accessor;
4693
4733
  this.group = group;
4694
4734
  this.panelTransfer = LocalSelectionTransfer.getInstance();
4695
- this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
4735
+ this.addDisposables(addDisposableListener(element, 'pointerdown', (e) => {
4696
4736
  if (e.shiftKey) {
4697
4737
  /**
4698
4738
  * You cannot call e.preventDefault() because that will prevent drag events from firing
@@ -4911,7 +4951,7 @@ define(['exports'], (function (exports) { 'use strict';
4911
4951
  group: this.group,
4912
4952
  getData: getPanelData,
4913
4953
  }));
4914
- }), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
4954
+ }), addDisposableListener(this.voidContainer.element, 'pointerdown', (event) => {
4915
4955
  const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
4916
4956
  if (isFloatingGroupsEnabled &&
4917
4957
  event.shiftKey &&
@@ -4925,7 +4965,7 @@ define(['exports'], (function (exports) { 'use strict';
4925
4965
  inDragMode: true,
4926
4966
  });
4927
4967
  }
4928
- }), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
4968
+ }), addDisposableListener(this.tabContainer, 'pointerdown', (event) => {
4929
4969
  if (event.defaultPrevented) {
4930
4970
  return;
4931
4971
  }
@@ -5630,7 +5670,6 @@ define(['exports'], (function (exports) { 'use strict';
5630
5670
  });
5631
5671
  this.tabsContainer.hide();
5632
5672
  this.contentContainer.element.appendChild(this.watermark.element);
5633
- this.watermark.updateParentGroup(this.groupPanel, true);
5634
5673
  }
5635
5674
  if (!this.isEmpty && this.watermark) {
5636
5675
  this.watermark.element.remove();
@@ -5993,6 +6032,34 @@ define(['exports'], (function (exports) { 'use strict';
5993
6032
  const MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;
5994
6033
  const MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;
5995
6034
  class DockviewGroupPanel extends GridviewPanel {
6035
+ get minimumWidth() {
6036
+ var _a;
6037
+ const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;
6038
+ return typeof activePanelMinimumWidth === 'number'
6039
+ ? activePanelMinimumWidth
6040
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH;
6041
+ }
6042
+ get minimumHeight() {
6043
+ var _a;
6044
+ const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;
6045
+ return typeof activePanelMinimumHeight === 'number'
6046
+ ? activePanelMinimumHeight
6047
+ : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT;
6048
+ }
6049
+ get maximumWidth() {
6050
+ var _a;
6051
+ const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;
6052
+ return typeof activePanelMaximumWidth === 'number'
6053
+ ? activePanelMaximumWidth
6054
+ : Number.MAX_SAFE_INTEGER;
6055
+ }
6056
+ get maximumHeight() {
6057
+ var _a;
6058
+ const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;
6059
+ return typeof activePanelMaximumHeight === 'number'
6060
+ ? activePanelMaximumHeight
6061
+ : Number.MAX_SAFE_INTEGER;
6062
+ }
5996
6063
  get panels() {
5997
6064
  return this._model.panels;
5998
6065
  }
@@ -6015,9 +6082,12 @@ define(['exports'], (function (exports) { 'use strict';
6015
6082
  return this._model.header;
6016
6083
  }
6017
6084
  constructor(accessor, id, options) {
6085
+ var _a, _b, _c, _d, _e, _f;
6018
6086
  super(id, 'groupview_default', {
6019
- minimumHeight: MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6020
- minimumWidth: MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6087
+ minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,
6088
+ minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.maximumHeight) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,
6089
+ maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,
6090
+ maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,
6021
6091
  }, new DockviewGroupPanelApiImpl(id, accessor));
6022
6092
  this.api.initialize(this); // cannot use 'this' after after 'super' call
6023
6093
  this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
@@ -6173,6 +6243,18 @@ define(['exports'], (function (exports) { 'use strict';
6173
6243
  var _a;
6174
6244
  return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;
6175
6245
  }
6246
+ get minimumWidth() {
6247
+ return this._minimumWidth;
6248
+ }
6249
+ get minimumHeight() {
6250
+ return this._minimumHeight;
6251
+ }
6252
+ get maximumWidth() {
6253
+ return this._maximumWidth;
6254
+ }
6255
+ get maximumHeight() {
6256
+ return this._maximumHeight;
6257
+ }
6176
6258
  constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {
6177
6259
  super();
6178
6260
  this.id = id;
@@ -6181,6 +6263,10 @@ define(['exports'], (function (exports) { 'use strict';
6181
6263
  this.view = view;
6182
6264
  this._renderer = options.renderer;
6183
6265
  this._group = group;
6266
+ this._minimumWidth = options.minimumWidth;
6267
+ this._minimumHeight = options.minimumHeight;
6268
+ this._maximumWidth = options.maximumWidth;
6269
+ this._maximumHeight = options.maximumHeight;
6184
6270
  this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);
6185
6271
  this.addDisposables(this.api.onActiveChange(() => {
6186
6272
  accessor.setActivePanel(this);
@@ -6217,6 +6303,10 @@ define(['exports'], (function (exports) { 'use strict';
6217
6303
  : undefined,
6218
6304
  title: this.title,
6219
6305
  renderer: this._renderer,
6306
+ minimumHeight: this._minimumHeight,
6307
+ maximumHeight: this._maximumHeight,
6308
+ minimumWidth: this._minimumWidth,
6309
+ maximumWidth: this._maximumWidth,
6220
6310
  };
6221
6311
  }
6222
6312
  setTitle(title) {
@@ -6346,7 +6436,7 @@ define(['exports'], (function (exports) { 'use strict';
6346
6436
  this.action.appendChild(createCloseButton());
6347
6437
  this._element.appendChild(this._content);
6348
6438
  this._element.appendChild(this.action);
6349
- this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
6439
+ this.addDisposables(addDisposableListener(this.action, 'pointerdown', (ev) => {
6350
6440
  ev.preventDefault();
6351
6441
  }));
6352
6442
  this.render();
@@ -6356,7 +6446,7 @@ define(['exports'], (function (exports) { 'use strict';
6356
6446
  this.addDisposables(params.api.onDidTitleChange((event) => {
6357
6447
  this._title = event.title;
6358
6448
  this.render();
6359
- }), addDisposableListener(this.action, 'mousedown', (ev) => {
6449
+ }), addDisposableListener(this.action, 'pointerdown', (ev) => {
6360
6450
  ev.preventDefault();
6361
6451
  }), addDisposableListener(this.action, 'click', (ev) => {
6362
6452
  if (ev.defaultPrevented) {
@@ -6457,6 +6547,10 @@ define(['exports'], (function (exports) { 'use strict';
6457
6547
  const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);
6458
6548
  const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {
6459
6549
  renderer: panelData.renderer,
6550
+ minimumWidth: panelData.minimumWidth,
6551
+ minimumHeight: panelData.minimumHeight,
6552
+ maximumWidth: panelData.maximumWidth,
6553
+ maximumHeight: panelData.maximumHeight,
6460
6554
  });
6461
6555
  panel.init({
6462
6556
  title: title !== null && title !== void 0 ? title : panelId,
@@ -6490,34 +6584,19 @@ define(['exports'], (function (exports) { 'use strict';
6490
6584
  actionsContainer.appendChild(closeAnchor);
6491
6585
  title.appendChild(emptySpace);
6492
6586
  title.appendChild(actionsContainer);
6493
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
6587
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (event) => {
6494
6588
  var _a;
6495
- ev.preventDefault();
6589
+ event.preventDefault();
6496
6590
  if (this._group) {
6497
6591
  (_a = this._api) === null || _a === void 0 ? void 0 : _a.removeGroup(this._group);
6498
6592
  }
6499
6593
  }));
6500
6594
  }
6501
- update(_event) {
6502
- // noop
6503
- }
6504
- focus() {
6505
- // noop
6506
- }
6507
- layout(_width, _height) {
6508
- // noop
6509
- }
6510
6595
  init(_params) {
6511
6596
  this._api = _params.containerApi;
6597
+ this._group = _params.group;
6512
6598
  this.render();
6513
6599
  }
6514
- updateParentGroup(group, _visible) {
6515
- this._group = group;
6516
- this.render();
6517
- }
6518
- dispose() {
6519
- super.dispose();
6520
- }
6521
6600
  render() {
6522
6601
  const isOneGroup = !!(this._api && this._api.size <= 1);
6523
6602
  toggleClass(this.element, 'has-actions', isOneGroup);
@@ -6676,7 +6755,7 @@ define(['exports'], (function (exports) { 'use strict';
6676
6755
  dispose: () => {
6677
6756
  iframes.release();
6678
6757
  },
6679
- }, addDisposableWindowListener(window, 'mousemove', (e) => {
6758
+ }, addDisposableWindowListener(window, 'pointermove', (e) => {
6680
6759
  const containerRect = this.options.container.getBoundingClientRect();
6681
6760
  const x = e.clientX - containerRect.left;
6682
6761
  const y = e.clientY - containerRect.top;
@@ -6719,7 +6798,7 @@ define(['exports'], (function (exports) { 'use strict';
6719
6798
  this._onDidChangeEnd.fire();
6720
6799
  }));
6721
6800
  };
6722
- this.addDisposables(move, addDisposableListener(dragTarget, 'mousedown', (event) => {
6801
+ this.addDisposables(move, addDisposableListener(dragTarget, 'pointerdown', (event) => {
6723
6802
  if (event.defaultPrevented) {
6724
6803
  event.preventDefault();
6725
6804
  return;
@@ -6730,7 +6809,7 @@ define(['exports'], (function (exports) { 'use strict';
6730
6809
  return;
6731
6810
  }
6732
6811
  track();
6733
- }), addDisposableListener(this.options.content, 'mousedown', (event) => {
6812
+ }), addDisposableListener(this.options.content, 'pointerdown', (event) => {
6734
6813
  if (event.defaultPrevented) {
6735
6814
  return;
6736
6815
  }
@@ -6742,7 +6821,7 @@ define(['exports'], (function (exports) { 'use strict';
6742
6821
  if (event.shiftKey) {
6743
6822
  track();
6744
6823
  }
6745
- }), addDisposableListener(this.options.content, 'mousedown', () => {
6824
+ }), addDisposableListener(this.options.content, 'pointerdown', () => {
6746
6825
  arialLevelTracker.push(this._element);
6747
6826
  }, true));
6748
6827
  if (options.inDragMode) {
@@ -6754,11 +6833,11 @@ define(['exports'], (function (exports) { 'use strict';
6754
6833
  resizeHandleElement.className = `dv-resize-handle-${direction}`;
6755
6834
  this._element.appendChild(resizeHandleElement);
6756
6835
  const move = new MutableDisposable();
6757
- this.addDisposables(move, addDisposableListener(resizeHandleElement, 'mousedown', (e) => {
6836
+ this.addDisposables(move, addDisposableListener(resizeHandleElement, 'pointerdown', (e) => {
6758
6837
  e.preventDefault();
6759
6838
  let startPosition = null;
6760
6839
  const iframes = disableIframePointEvents();
6761
- move.value = new CompositeDisposable(addDisposableWindowListener(window, 'mousemove', (e) => {
6840
+ move.value = new CompositeDisposable(addDisposableWindowListener(window, 'pointermove', (e) => {
6762
6841
  const containerRect = this.options.container.getBoundingClientRect();
6763
6842
  const overlayRect = this._element.getBoundingClientRect();
6764
6843
  const y = e.clientY - containerRect.top;
@@ -7263,25 +7342,6 @@ define(['exports'], (function (exports) { 'use strict';
7263
7342
  });
7264
7343
  });
7265
7344
  }
7266
- function getDockviewTheme(element) {
7267
- function toClassList(element) {
7268
- const list = [];
7269
- for (let i = 0; i < element.classList.length; i++) {
7270
- list.push(element.classList.item(i));
7271
- }
7272
- return list;
7273
- }
7274
- let theme = undefined;
7275
- let parent = element;
7276
- while (parent !== null) {
7277
- theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));
7278
- if (typeof theme === 'string') {
7279
- break;
7280
- }
7281
- parent = parent.parentElement;
7282
- }
7283
- return theme;
7284
- }
7285
7345
  class DockviewComponent extends BaseGrid {
7286
7346
  get orientation() {
7287
7347
  return this.gridview.orientation;
@@ -7317,13 +7377,12 @@ define(['exports'], (function (exports) { 'use strict';
7317
7377
  }
7318
7378
  constructor(parentElement, options) {
7319
7379
  var _a;
7320
- super({
7380
+ super(parentElement, {
7321
7381
  proportionalLayout: true,
7322
7382
  orientation: exports.Orientation.HORIZONTAL,
7323
7383
  styles: options.hideBorders
7324
7384
  ? { separatorBorder: 'transparent' }
7325
7385
  : undefined,
7326
- parentElement: parentElement,
7327
7386
  disableAutoResizing: options.disableAutoResizing,
7328
7387
  locked: options.locked,
7329
7388
  margin: options.gap,
@@ -7363,9 +7422,6 @@ define(['exports'], (function (exports) { 'use strict';
7363
7422
  this._onDidActiveGroupChange = new Emitter();
7364
7423
  this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
7365
7424
  this._moving = false;
7366
- // const gready = document.createElement('div');
7367
- // gready.className = 'dv-overlay-render-container';
7368
- // this.gridview.element.appendChild(gready);
7369
7425
  this.overlayRenderContainer = new OverlayRenderContainer(this.gridview.element, this);
7370
7426
  toggleClass(this.gridview.element, 'dv-dockview', true);
7371
7427
  toggleClass(this.element, 'dv-debug', !!options.debug);
@@ -7814,16 +7870,11 @@ define(['exports'], (function (exports) { 'use strict';
7814
7870
  }
7815
7871
  }
7816
7872
  updateOptions(options) {
7817
- var _a, _b;
7873
+ var _a, _b, _c, _d;
7818
7874
  super.updateOptions(options);
7819
- const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
7820
- options.floatingGroupBounds !== this.options.floatingGroupBounds;
7821
- const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
7822
- options.rootOverlayModel !== this.options.rootOverlayModel;
7823
- this._options = Object.assign(Object.assign({}, this.options), options);
7824
- if (changed_floatingGroupBounds) {
7875
+ if ('floatingGroupBounds' in options) {
7825
7876
  for (const group of this._floatingGroups) {
7826
- switch (this.options.floatingGroupBounds) {
7877
+ switch (options.floatingGroupBounds) {
7827
7878
  case 'boundedWithinViewport':
7828
7879
  group.overlay.minimumInViewportHeight = undefined;
7829
7880
  group.overlay.minimumInViewportWidth = undefined;
@@ -7836,25 +7887,20 @@ define(['exports'], (function (exports) { 'use strict';
7836
7887
  break;
7837
7888
  default:
7838
7889
  group.overlay.minimumInViewportHeight =
7839
- (_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7890
+ (_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
7840
7891
  group.overlay.minimumInViewportWidth =
7841
- (_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7892
+ (_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
7842
7893
  }
7843
7894
  group.overlay.setBounds();
7844
7895
  }
7845
7896
  }
7846
- if (changed_rootOverlayOptions) {
7847
- this._rootDropTarget.setOverlayModel(options.rootOverlayModel);
7897
+ if ('rootOverlayModel' in options) {
7898
+ this._rootDropTarget.setOverlayModel((_c = options.rootOverlayModel) !== null && _c !== void 0 ? _c : DEFAULT_ROOT_OVERLAY_MODEL);
7848
7899
  }
7849
- if (
7850
- // if explicitly set as `undefined`
7851
- 'gap' in options &&
7852
- options.gap === undefined) {
7853
- this.gridview.margin = 0;
7854
- }
7855
- if (typeof options.gap === 'number') {
7856
- this.gridview.margin = options.gap;
7900
+ if ('gap' in options) {
7901
+ this.gridview.margin = (_d = options.gap) !== null && _d !== void 0 ? _d : 0;
7857
7902
  }
7903
+ this._options = Object.assign(Object.assign({}, this.options), options);
7858
7904
  this.layout(this.gridview.width, this.gridview.height, true);
7859
7905
  }
7860
7906
  layout(width, height, forceResize) {
@@ -8111,6 +8157,10 @@ define(['exports'], (function (exports) { 'use strict';
8111
8157
  if (options.position && options.floating) {
8112
8158
  throw new Error('you can only provide one of: position, floating as arguments to .addPanel(...)');
8113
8159
  }
8160
+ const initial = {
8161
+ width: options.initialWidth,
8162
+ height: options.initialHeight,
8163
+ };
8114
8164
  if (options.position) {
8115
8165
  if (isPanelOptionsWithPanel(options.position)) {
8116
8166
  const referencePanel = typeof options.position.referencePanel === 'string'
@@ -8140,6 +8190,10 @@ define(['exports'], (function (exports) { 'use strict';
8140
8190
  if (!options.inactive) {
8141
8191
  this.doSetGroupAndPanelActive(group);
8142
8192
  }
8193
+ group.api.setSize({
8194
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8195
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8196
+ });
8143
8197
  return panel;
8144
8198
  }
8145
8199
  }
@@ -8170,6 +8224,10 @@ define(['exports'], (function (exports) { 'use strict';
8170
8224
  skipSetActive: options.inactive,
8171
8225
  skipSetGroupActive: options.inactive,
8172
8226
  });
8227
+ referenceGroup.api.setSize({
8228
+ width: initial === null || initial === void 0 ? void 0 : initial.width,
8229
+ height: initial === null || initial === void 0 ? void 0 : initial.height,
8230
+ });
8173
8231
  if (!options.inactive) {
8174
8232
  this.doSetGroupAndPanelActive(referenceGroup);
8175
8233
  }
@@ -8177,7 +8235,10 @@ define(['exports'], (function (exports) { 'use strict';
8177
8235
  else {
8178
8236
  const location = getGridLocation(referenceGroup.element);
8179
8237
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8180
- const group = this.createGroupAtLocation(relativeLocation);
8238
+ const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) ===
8239
+ exports.Orientation.VERTICAL
8240
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8241
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8181
8242
  panel = this.createPanel(options, group);
8182
8243
  group.model.openPanel(panel, {
8183
8244
  skipSetActive: options.inactive,
@@ -8203,7 +8264,9 @@ define(['exports'], (function (exports) { 'use strict';
8203
8264
  });
8204
8265
  }
8205
8266
  else {
8206
- const group = this.createGroupAtLocation();
8267
+ const group = this.createGroupAtLocation([0], this.gridview.orientation === exports.Orientation.VERTICAL
8268
+ ? initial === null || initial === void 0 ? void 0 : initial.height
8269
+ : initial === null || initial === void 0 ? void 0 : initial.width);
8207
8270
  panel = this.createPanel(options, group);
8208
8271
  group.model.openPanel(panel, {
8209
8272
  skipSetActive: options.inactive,
@@ -8297,7 +8360,11 @@ define(['exports'], (function (exports) { 'use strict';
8297
8360
  const location = getGridLocation(referenceGroup.element);
8298
8361
  const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
8299
8362
  const group = this.createGroup(options);
8300
- this.doAddGroup(group, relativeLocation);
8363
+ const size = this.getLocationOrientation(relativeLocation) ===
8364
+ exports.Orientation.VERTICAL
8365
+ ? options.initialHeight
8366
+ : options.initialWidth;
8367
+ this.doAddGroup(group, relativeLocation, size);
8301
8368
  if (!options.skipSetActive) {
8302
8369
  this.doSetGroupAndPanelActive(group);
8303
8370
  }
@@ -8310,6 +8377,12 @@ define(['exports'], (function (exports) { 'use strict';
8310
8377
  return group;
8311
8378
  }
8312
8379
  }
8380
+ getLocationOrientation(location) {
8381
+ return location.length % 2 == 0 &&
8382
+ this.gridview.orientation === exports.Orientation.HORIZONTAL
8383
+ ? exports.Orientation.HORIZONTAL
8384
+ : exports.Orientation.VERTICAL;
8385
+ }
8313
8386
  removeGroup(group, options) {
8314
8387
  this.doRemoveGroup(group, options);
8315
8388
  }
@@ -8581,7 +8654,22 @@ define(['exports'], (function (exports) { 'use strict';
8581
8654
  }
8582
8655
  const referenceLocation = getGridLocation(to.element);
8583
8656
  const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
8584
- this.gridview.addView(from, exports.Sizing.Distribute, dropLocation);
8657
+ let size;
8658
+ switch (this.gridview.orientation) {
8659
+ case exports.Orientation.VERTICAL:
8660
+ size =
8661
+ referenceLocation.length % 2 == 0
8662
+ ? from.api.width
8663
+ : from.api.height;
8664
+ break;
8665
+ case exports.Orientation.HORIZONTAL:
8666
+ size =
8667
+ referenceLocation.length % 2 == 0
8668
+ ? from.api.height
8669
+ : from.api.width;
8670
+ break;
8671
+ }
8672
+ this.gridview.addView(from, size, dropLocation);
8585
8673
  }
8586
8674
  from.panels.forEach((panel) => {
8587
8675
  this._onDidMovePanel.fire({ panel, from });
@@ -8693,22 +8781,34 @@ define(['exports'], (function (exports) { 'use strict';
8693
8781
  const contentComponent = options.component;
8694
8782
  const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;
8695
8783
  const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
8696
- const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, { renderer: options.renderer });
8784
+ const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {
8785
+ renderer: options.renderer,
8786
+ minimumWidth: options.minimumWidth,
8787
+ minimumHeight: options.minimumHeight,
8788
+ maximumWidth: options.maximumWidth,
8789
+ maximumHeight: options.maximumHeight,
8790
+ });
8697
8791
  panel.init({
8698
8792
  title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,
8699
8793
  params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},
8700
8794
  });
8701
8795
  return panel;
8702
8796
  }
8703
- createGroupAtLocation(location = [0]) {
8797
+ createGroupAtLocation(location, size) {
8704
8798
  const group = this.createGroup();
8705
- this.doAddGroup(group, location);
8799
+ this.doAddGroup(group, location, size);
8706
8800
  return group;
8707
8801
  }
8708
8802
  findGroup(panel) {
8709
8803
  var _a;
8710
8804
  return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
8711
8805
  }
8806
+ orientationAtLocation(location) {
8807
+ const rootOrientation = this.gridview.orientation;
8808
+ return location.length % 2 == 1
8809
+ ? rootOrientation
8810
+ : orthogonal(rootOrientation);
8811
+ }
8712
8812
  }
8713
8813
 
8714
8814
  class GridviewComponent extends BaseGrid {
@@ -8728,8 +8828,7 @@ define(['exports'], (function (exports) { 'use strict';
8728
8828
  this._deserializer = value;
8729
8829
  }
8730
8830
  constructor(parentElement, options) {
8731
- super({
8732
- parentElement: parentElement,
8831
+ super(parentElement, {
8733
8832
  proportionalLayout: options.proportionalLayout,
8734
8833
  orientation: options.orientation,
8735
8834
  styles: options.styles,
@@ -9028,7 +9127,7 @@ define(['exports'], (function (exports) { 'use strict';
9028
9127
  : this.splitview.orthogonalSize;
9029
9128
  }
9030
9129
  constructor(parentElement, options) {
9031
- var _a, _b;
9130
+ var _a;
9032
9131
  super(parentElement, options.disableAutoResizing);
9033
9132
  this._splitviewChangeDisposable = new MutableDisposable();
9034
9133
  this._panels = new Map();
@@ -9040,11 +9139,8 @@ define(['exports'], (function (exports) { 'use strict';
9040
9139
  this.onDidRemoveView = this._onDidRemoveView.event;
9041
9140
  this._onDidLayoutChange = new Emitter();
9042
9141
  this.onDidLayoutChange = this._onDidLayoutChange.event;
9043
- this.classNames = [];
9044
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9045
- for (const className of this.classNames) {
9046
- toggleClass(this.element, className, true);
9047
- }
9142
+ this._classNames = new Classnames(this.element);
9143
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9048
9144
  this._options = options;
9049
9145
  if (!options.components) {
9050
9146
  options.components = {};
@@ -9058,20 +9154,15 @@ define(['exports'], (function (exports) { 'use strict';
9058
9154
  updateOptions(options) {
9059
9155
  var _a, _b;
9060
9156
  if ('className' in options) {
9061
- for (const className of this.classNames) {
9062
- toggleClass(this.element, className, false);
9063
- }
9064
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9065
- for (const className of this.classNames) {
9066
- toggleClass(this.element, className, true);
9067
- }
9157
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9068
9158
  }
9069
- const hasOrientationChanged = typeof options.orientation === 'string' &&
9070
- this.options.orientation !== options.orientation;
9071
- this._options = Object.assign(Object.assign({}, this.options), options);
9072
- if (hasOrientationChanged) {
9159
+ if ('disableResizing' in options) {
9160
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9161
+ }
9162
+ if (typeof options.orientation === 'string') {
9073
9163
  this.splitview.orientation = options.orientation;
9074
9164
  }
9165
+ this._options = Object.assign(Object.assign({}, this.options), options);
9075
9166
  this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
9076
9167
  }
9077
9168
  focus() {
@@ -9368,7 +9459,7 @@ define(['exports'], (function (exports) { 'use strict';
9368
9459
  return this._options;
9369
9460
  }
9370
9461
  constructor(parentElement, options) {
9371
- var _a, _b;
9462
+ var _a;
9372
9463
  super(parentElement, options.disableAutoResizing);
9373
9464
  this._id = nextLayoutId.next();
9374
9465
  this._disposable = new MutableDisposable();
@@ -9383,12 +9474,9 @@ define(['exports'], (function (exports) { 'use strict';
9383
9474
  this.onDidAddView = this._onDidAddView.event;
9384
9475
  this._onDidRemoveView = new Emitter();
9385
9476
  this.onDidRemoveView = this._onDidRemoveView.event;
9386
- this.classNames = [];
9387
9477
  this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9388
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9389
- for (const className of this.classNames) {
9390
- toggleClass(this.element, className, true);
9391
- }
9478
+ this._classNames = new Classnames(this.element);
9479
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9392
9480
  this._options = options;
9393
9481
  if (!options.components) {
9394
9482
  options.components = {};
@@ -9412,13 +9500,10 @@ define(['exports'], (function (exports) { 'use strict';
9412
9500
  updateOptions(options) {
9413
9501
  var _a, _b;
9414
9502
  if ('className' in options) {
9415
- for (const className of this.classNames) {
9416
- toggleClass(this.element, className, false);
9417
- }
9418
- this.classNames = (_b = (_a = options.className) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : [];
9419
- for (const className of this.classNames) {
9420
- toggleClass(this.element, className, true);
9421
- }
9503
+ this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9504
+ }
9505
+ if ('disableResizing' in options) {
9506
+ this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;
9422
9507
  }
9423
9508
  this._options = Object.assign(Object.assign({}, this.options), options);
9424
9509
  }