dockview 2.1.3 → 3.0.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 (49) hide show
  1. package/dist/cjs/dockview/dockview.d.ts +0 -1
  2. package/dist/cjs/dockview/dockview.js +3 -3
  3. package/dist/cjs/dockview/headerActionsRenderer.js +1 -1
  4. package/dist/cjs/dockview/reactContentPart.js +1 -1
  5. package/dist/cjs/dockview/reactHeaderPart.js +1 -1
  6. package/dist/cjs/dockview/reactWatermarkPart.js +1 -1
  7. package/dist/cjs/gridview/gridview.d.ts +2 -7
  8. package/dist/cjs/gridview/gridview.js +47 -20
  9. package/dist/cjs/paneview/paneview.d.ts +2 -6
  10. package/dist/cjs/paneview/paneview.js +54 -36
  11. package/dist/cjs/paneview/view.d.ts +2 -2
  12. package/dist/cjs/splitview/splitview.d.ts +2 -7
  13. package/dist/cjs/splitview/splitview.js +52 -20
  14. package/dist/dockview.amd.js +295 -251
  15. package/dist/dockview.amd.js.map +1 -1
  16. package/dist/dockview.amd.min.js +2 -2
  17. package/dist/dockview.amd.min.js.map +1 -1
  18. package/dist/dockview.amd.min.noStyle.js +2 -2
  19. package/dist/dockview.amd.min.noStyle.js.map +1 -1
  20. package/dist/dockview.amd.noStyle.js +295 -251
  21. package/dist/dockview.amd.noStyle.js.map +1 -1
  22. package/dist/dockview.cjs.js +295 -251
  23. package/dist/dockview.cjs.js.map +1 -1
  24. package/dist/dockview.esm.js +291 -251
  25. package/dist/dockview.esm.js.map +1 -1
  26. package/dist/dockview.esm.min.js +2 -2
  27. package/dist/dockview.esm.min.js.map +1 -1
  28. package/dist/dockview.js +295 -251
  29. package/dist/dockview.js.map +1 -1
  30. package/dist/dockview.min.js +2 -2
  31. package/dist/dockview.min.js.map +1 -1
  32. package/dist/dockview.min.noStyle.js +2 -2
  33. package/dist/dockview.min.noStyle.js.map +1 -1
  34. package/dist/dockview.noStyle.js +295 -251
  35. package/dist/dockview.noStyle.js.map +1 -1
  36. package/dist/esm/dockview/dockview.d.ts +0 -1
  37. package/dist/esm/dockview/dockview.js +4 -4
  38. package/dist/esm/dockview/headerActionsRenderer.js +1 -1
  39. package/dist/esm/dockview/reactContentPart.js +1 -1
  40. package/dist/esm/dockview/reactHeaderPart.js +1 -1
  41. package/dist/esm/dockview/reactWatermarkPart.js +1 -1
  42. package/dist/esm/gridview/gridview.d.ts +2 -7
  43. package/dist/esm/gridview/gridview.js +36 -20
  44. package/dist/esm/paneview/paneview.d.ts +2 -6
  45. package/dist/esm/paneview/paneview.js +53 -33
  46. package/dist/esm/paneview/view.d.ts +2 -2
  47. package/dist/esm/splitview/splitview.d.ts +2 -7
  48. package/dist/esm/splitview/splitview.js +41 -20
  49. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview
3
- * @version 2.1.3
3
+ * @version 3.0.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -103,6 +103,17 @@
103
103
  this._defaultPrevented = true;
104
104
  }
105
105
  }
106
+ class AcceptableEvent {
107
+ constructor() {
108
+ this._isAccepted = false;
109
+ }
110
+ get isAccepted() {
111
+ return this._isAccepted;
112
+ }
113
+ accept() {
114
+ this._isAccepted = true;
115
+ }
116
+ }
106
117
  class LeakageMonitor {
107
118
  constructor() {
108
119
  this.events = new Map();
@@ -1494,6 +1505,23 @@
1494
1505
  }
1495
1506
  }
1496
1507
 
1508
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1509
+ /**
1510
+ * by readong the keys from an empty value object TypeScript will error
1511
+ * when we add or remove new properties to `DockviewOptions`
1512
+ */
1513
+ const properties = {
1514
+ orientation: undefined,
1515
+ descriptor: undefined,
1516
+ proportionalLayout: undefined,
1517
+ styles: undefined,
1518
+ margin: undefined,
1519
+ disableAutoResizing: undefined,
1520
+ className: undefined,
1521
+ };
1522
+ return Object.keys(properties);
1523
+ })();
1524
+
1497
1525
  class Paneview extends CompositeDisposable {
1498
1526
  get onDidAddView() {
1499
1527
  return this.splitview.onDidAddView;
@@ -2623,6 +2651,21 @@
2623
2651
  }
2624
2652
  }
2625
2653
 
2654
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2655
+ /**
2656
+ * by readong the keys from an empty value object TypeScript will error
2657
+ * when we add or remove new properties to `DockviewOptions`
2658
+ */
2659
+ const properties = {
2660
+ disableAutoResizing: undefined,
2661
+ proportionalLayout: undefined,
2662
+ orientation: undefined,
2663
+ hideBorders: undefined,
2664
+ className: undefined,
2665
+ };
2666
+ return Object.keys(properties);
2667
+ })();
2668
+
2626
2669
  class Resizable extends CompositeDisposable {
2627
2670
  get element() {
2628
2671
  return this._element;
@@ -3100,15 +3143,10 @@
3100
3143
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3101
3144
  */
3102
3145
  get onDidDrop() {
3103
- const emitter = new Emitter();
3104
- const disposable = this.component.onDidDrop((e) => {
3105
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3106
- });
3107
- emitter.dispose = () => {
3108
- disposable.dispose();
3109
- emitter.dispose();
3110
- };
3111
- return emitter.event;
3146
+ return this.component.onDidDrop;
3147
+ }
3148
+ get onUnhandledDragOverEvent() {
3149
+ return this.component.onUnhandledDragOverEvent;
3112
3150
  }
3113
3151
  constructor(component) {
3114
3152
  this.component = component;
@@ -4035,6 +4073,28 @@
4035
4073
  return 'center';
4036
4074
  }
4037
4075
 
4076
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4077
+ /**
4078
+ * by readong the keys from an empty value object TypeScript will error
4079
+ * when we add or remove new properties to `DockviewOptions`
4080
+ */
4081
+ const properties = {
4082
+ disableAutoResizing: undefined,
4083
+ disableDnd: undefined,
4084
+ className: undefined,
4085
+ };
4086
+ return Object.keys(properties);
4087
+ })();
4088
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4089
+ constructor(nativeEvent, position, getData, panel) {
4090
+ super();
4091
+ this.nativeEvent = nativeEvent;
4092
+ this.position = position;
4093
+ this.getData = getData;
4094
+ this.panel = panel;
4095
+ }
4096
+ }
4097
+
4038
4098
  class WillFocusEvent extends DockviewEvent {
4039
4099
  constructor() {
4040
4100
  super();
@@ -4458,6 +4518,9 @@
4458
4518
  this.accessor = accessor;
4459
4519
  this._onDidDrop = new Emitter();
4460
4520
  this.onDidDrop = this._onDidDrop.event;
4521
+ this._onUnhandledDragOverEvent = new Emitter();
4522
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4523
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4461
4524
  if (!disableDnd) {
4462
4525
  this.initDragFeatures();
4463
4526
  }
@@ -4484,7 +4547,7 @@
4484
4547
  overlayModel: {
4485
4548
  activationSize: { type: 'percentage', value: 50 },
4486
4549
  },
4487
- canDisplayOverlay: (event) => {
4550
+ canDisplayOverlay: (event, position) => {
4488
4551
  const data = getPaneData();
4489
4552
  if (data) {
4490
4553
  if (data.paneId !== this.id &&
@@ -4492,14 +4555,9 @@
4492
4555
  return true;
4493
4556
  }
4494
4557
  }
4495
- if (this.accessor.options.showDndOverlay) {
4496
- return this.accessor.options.showDndOverlay({
4497
- nativeEvent: event,
4498
- getData: getPaneData,
4499
- panel: this,
4500
- });
4501
- }
4502
- return false;
4558
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4559
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4560
+ return firedEvent.isAccepted;
4503
4561
  },
4504
4562
  });
4505
4563
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4954,15 +5012,7 @@
4954
5012
  this._element.appendChild(this.leftActionsContainer);
4955
5013
  this._element.appendChild(this.voidContainer.element);
4956
5014
  this._element.appendChild(this.rightActionsContainer);
4957
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4958
- if (e.api.group === this.group) {
4959
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4960
- }
4961
- }), this.accessor.onDidRemovePanel((e) => {
4962
- if (e.api.group === this.group) {
4963
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4964
- }
4965
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5015
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4966
5016
  this._onGroupDragStart.fire({
4967
5017
  nativeEvent: event,
4968
5018
  group: this.group,
@@ -5007,20 +5057,6 @@
5007
5057
  setActive(_isGroupActive) {
5008
5058
  // noop
5009
5059
  }
5010
- addTab(tab, index = this.tabs.length) {
5011
- if (index < 0 || index > this.tabs.length) {
5012
- throw new Error('invalid location');
5013
- }
5014
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5015
- this.tabs = [
5016
- ...this.tabs.slice(0, index),
5017
- tab,
5018
- ...this.tabs.slice(index),
5019
- ];
5020
- if (this.selectedIndex < 0) {
5021
- this.selectedIndex = index;
5022
- }
5023
- }
5024
5060
  delete(id) {
5025
5061
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5026
5062
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5028,6 +5064,7 @@
5028
5064
  disposable.dispose();
5029
5065
  value.dispose();
5030
5066
  value.element.remove();
5067
+ this.updateClassnames();
5031
5068
  }
5032
5069
  setActivePanel(panel) {
5033
5070
  this.tabs.forEach((tab) => {
@@ -5096,25 +5133,37 @@
5096
5133
  }
5097
5134
  this.tabs = [];
5098
5135
  }
5136
+ addTab(tab, index = this.tabs.length) {
5137
+ if (index < 0 || index > this.tabs.length) {
5138
+ throw new Error('invalid location');
5139
+ }
5140
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5141
+ this.tabs = [
5142
+ ...this.tabs.slice(0, index),
5143
+ tab,
5144
+ ...this.tabs.slice(index),
5145
+ ];
5146
+ if (this.selectedIndex < 0) {
5147
+ this.selectedIndex = index;
5148
+ }
5149
+ this.updateClassnames();
5150
+ }
5151
+ updateClassnames() {
5152
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5153
+ }
5099
5154
  }
5100
5155
 
5101
- class DockviewUnhandledDragOverEvent {
5102
- get isAccepted() {
5103
- return this._isAccepted;
5104
- }
5156
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5105
5157
  constructor(nativeEvent, target, position, getData, group) {
5158
+ super();
5106
5159
  this.nativeEvent = nativeEvent;
5107
5160
  this.target = target;
5108
5161
  this.position = position;
5109
5162
  this.getData = getData;
5110
5163
  this.group = group;
5111
- this._isAccepted = false;
5112
- }
5113
- accept() {
5114
- this._isAccepted = true;
5115
5164
  }
5116
5165
  }
5117
- const PROPERTY_KEYS = (() => {
5166
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5118
5167
  /**
5119
5168
  * by readong the keys from an empty value object TypeScript will error
5120
5169
  * when we add or remove new properties to `DockviewOptions`
@@ -7614,10 +7663,6 @@
7614
7663
  this._api = new DockviewApi(this);
7615
7664
  this.updateWatermark();
7616
7665
  }
7617
- dispose() {
7618
- this.clear(); // explicitly clear the layout before cleaning up
7619
- super.dispose();
7620
- }
7621
7666
  setVisible(panel, visible) {
7622
7667
  switch (panel.api.location.type) {
7623
7668
  case 'grid':
@@ -7801,30 +7846,29 @@
7801
7846
  }
7802
7847
  }
7803
7848
  else if (this.getPanel(group.id)) {
7804
- const removedGroup = group;
7849
+ group.model.renderContainer =
7850
+ this.overlayRenderContainer;
7851
+ returnedGroup = group;
7805
7852
  if (floatingBox) {
7806
- this.addFloatingGroup(removedGroup, {
7853
+ this.addFloatingGroup(group, {
7807
7854
  height: floatingBox.height,
7808
7855
  width: floatingBox.width,
7809
7856
  position: floatingBox,
7810
7857
  });
7811
7858
  }
7812
7859
  else {
7813
- this.doRemoveGroup(removedGroup, {
7860
+ this.doRemoveGroup(group, {
7814
7861
  skipDispose: true,
7815
7862
  skipActive: true,
7816
7863
  skipPopoutReturn: true,
7817
7864
  });
7818
- removedGroup.model.renderContainer =
7819
- this.overlayRenderContainer;
7820
- removedGroup.model.location = { type: 'grid' };
7821
- returnedGroup = removedGroup;
7865
+ group.model.location = { type: 'grid' };
7822
7866
  this.movingLock(() => {
7823
7867
  // suppress group add events since the group already exists
7824
- this.doAddGroup(removedGroup, [0]);
7868
+ this.doAddGroup(group, [0]);
7825
7869
  });
7826
7870
  }
7827
- this.doSetGroupAndPanelActive(removedGroup);
7871
+ this.doSetGroupAndPanelActive(group);
7828
7872
  }
7829
7873
  }));
7830
7874
  this._popoutGroups.push(value);
@@ -8965,31 +9009,6 @@
8965
9009
  }
8966
9010
  }
8967
9011
 
8968
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8969
- const Component = typeof componentName === 'string'
8970
- ? components[componentName]
8971
- : undefined;
8972
- const FrameworkComponent = typeof componentName === 'string'
8973
- ? frameworkComponents[componentName]
8974
- : undefined;
8975
- if (Component && FrameworkComponent) {
8976
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
8977
- }
8978
- if (FrameworkComponent) {
8979
- if (!createFrameworkComponent) {
8980
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
8981
- }
8982
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
8983
- }
8984
- if (!Component) {
8985
- if (fallback) {
8986
- return fallback();
8987
- }
8988
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
8989
- }
8990
- return new Component(id, componentName);
8991
- }
8992
-
8993
9012
  class GridviewComponent extends BaseGrid {
8994
9013
  get orientation() {
8995
9014
  return this.gridview.orientation;
@@ -9007,10 +9026,13 @@
9007
9026
  this._deserializer = value;
9008
9027
  }
9009
9028
  constructor(parentElement, options) {
9029
+ var _a;
9010
9030
  super(parentElement, {
9011
- proportionalLayout: options.proportionalLayout,
9031
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9012
9032
  orientation: options.orientation,
9013
- styles: options.styles,
9033
+ styles: options.hideBorders
9034
+ ? { separatorBorder: 'transparent' }
9035
+ : undefined,
9014
9036
  disableAutoResizing: options.disableAutoResizing,
9015
9037
  className: options.className,
9016
9038
  });
@@ -9030,12 +9052,6 @@
9030
9052
  }), this.onDidActiveChange((event) => {
9031
9053
  this._onDidActiveGroupChange.fire(event);
9032
9054
  }));
9033
- if (!this.options.components) {
9034
- this.options.components = {};
9035
- }
9036
- if (!this.options.frameworkComponents) {
9037
- this.options.frameworkComponents = {};
9038
- }
9039
9055
  }
9040
9056
  updateOptions(options) {
9041
9057
  super.updateOptions(options);
@@ -9085,14 +9101,11 @@
9085
9101
  const height = this.height;
9086
9102
  this.gridview.deserialize(grid, {
9087
9103
  fromJSON: (node) => {
9088
- var _a, _b;
9089
9104
  const { data } = node;
9090
- const view = createComponent(data.id, data.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkComponentFactory
9091
- ? {
9092
- createComponent: this.options.frameworkComponentFactory
9093
- .createComponent,
9094
- }
9095
- : undefined);
9105
+ const view = this.options.createComponent({
9106
+ id: data.id,
9107
+ name: data.component,
9108
+ });
9096
9109
  queue.push(() => view.init({
9097
9110
  params: data.params,
9098
9111
  minimumWidth: data.minimumWidth,
@@ -9170,7 +9183,7 @@
9170
9183
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9171
9184
  }
9172
9185
  addPanel(options) {
9173
- var _a, _b, _c, _d, _e, _f;
9186
+ var _a, _b, _c, _d;
9174
9187
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9175
9188
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9176
9189
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9186,14 +9199,12 @@
9186
9199
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9187
9200
  }
9188
9201
  }
9189
- const view = createComponent(options.id, options.component, (_d = this.options.components) !== null && _d !== void 0 ? _d : {}, (_e = this.options.frameworkComponents) !== null && _e !== void 0 ? _e : {}, this.options.frameworkComponentFactory
9190
- ? {
9191
- createComponent: this.options.frameworkComponentFactory
9192
- .createComponent,
9193
- }
9194
- : undefined);
9202
+ const view = this.options.createComponent({
9203
+ id: options.id,
9204
+ name: options.component,
9205
+ });
9195
9206
  view.init({
9196
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9207
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9197
9208
  minimumWidth: options.minimumWidth,
9198
9209
  maximumWidth: options.maximumWidth,
9199
9210
  minimumHeight: options.minimumHeight,
@@ -9321,12 +9332,6 @@
9321
9332
  this._classNames = new Classnames(this.element);
9322
9333
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9323
9334
  this._options = options;
9324
- if (!options.components) {
9325
- options.components = {};
9326
- }
9327
- if (!options.frameworkComponents) {
9328
- options.frameworkComponents = {};
9329
- }
9330
9335
  this.splitview = new Splitview(this.element, options);
9331
9336
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9332
9337
  }
@@ -9389,18 +9394,17 @@
9389
9394
  return this.panels.find((view) => view.id === id);
9390
9395
  }
9391
9396
  addPanel(options) {
9392
- var _a, _b, _c;
9397
+ var _a;
9393
9398
  if (this._panels.has(options.id)) {
9394
9399
  throw new Error(`panel ${options.id} already exists`);
9395
9400
  }
9396
- const view = createComponent(options.id, options.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9397
- ? {
9398
- createComponent: this.options.frameworkWrapper.createComponent,
9399
- }
9400
- : undefined);
9401
+ const view = this.options.createComponent({
9402
+ id: options.id,
9403
+ name: options.component,
9404
+ });
9401
9405
  view.orientation = this.splitview.orientation;
9402
9406
  view.init({
9403
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9407
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9404
9408
  minimumSize: options.minimumSize,
9405
9409
  maximumSize: options.maximumSize,
9406
9410
  snap: options.snap,
@@ -9462,17 +9466,14 @@
9462
9466
  descriptor: {
9463
9467
  size,
9464
9468
  views: views.map((view) => {
9465
- var _a, _b;
9466
9469
  const data = view.data;
9467
9470
  if (this._panels.has(data.id)) {
9468
9471
  throw new Error(`panel ${data.id} already exists`);
9469
9472
  }
9470
- const panel = createComponent(data.id, data.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9471
- ? {
9472
- createComponent: this.options.frameworkWrapper
9473
- .createComponent,
9474
- }
9475
- : undefined);
9473
+ const panel = this.options.createComponent({
9474
+ id: data.id,
9475
+ name: data.component,
9476
+ });
9476
9477
  queue.push(() => {
9477
9478
  var _a;
9478
9479
  panel.init({
@@ -9655,16 +9656,12 @@
9655
9656
  this.onDidAddView = this._onDidAddView.event;
9656
9657
  this._onDidRemoveView = new Emitter();
9657
9658
  this.onDidRemoveView = this._onDidRemoveView.event;
9658
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9659
+ this._onUnhandledDragOverEvent = new Emitter();
9660
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9661
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9659
9662
  this._classNames = new Classnames(this.element);
9660
9663
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9661
9664
  this._options = options;
9662
- if (!options.components) {
9663
- options.components = {};
9664
- }
9665
- if (!options.frameworkComponents) {
9666
- options.frameworkComponents = {};
9667
- }
9668
9665
  this.paneview = new Paneview(this.element, {
9669
9666
  // only allow paneview in the vertical orientation for now
9670
9667
  orientation: exports.Orientation.VERTICAL,
@@ -9689,22 +9686,19 @@
9689
9686
  this._options = Object.assign(Object.assign({}, this.options), options);
9690
9687
  }
9691
9688
  addPanel(options) {
9692
- var _a, _b, _c, _d;
9693
- const body = createComponent(options.id, options.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9694
- ? {
9695
- createComponent: this.options.frameworkWrapper.body.createComponent,
9696
- }
9697
- : undefined);
9689
+ var _a;
9690
+ const body = this.options.createComponent({
9691
+ id: options.id,
9692
+ name: options.component,
9693
+ });
9698
9694
  let header;
9699
- if (options.headerComponent) {
9700
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9701
- ? {
9702
- createComponent: this.options.frameworkWrapper.header
9703
- .createComponent,
9704
- }
9705
- : undefined);
9695
+ if (options.headerComponent && this.options.createHeaderComponent) {
9696
+ header = this.options.createHeaderComponent({
9697
+ id: options.id,
9698
+ name: options.headerComponent,
9699
+ });
9706
9700
  }
9707
- else {
9701
+ if (!header) {
9708
9702
  header = new DefaultHeader();
9709
9703
  }
9710
9704
  const view = new PaneFramework({
@@ -9722,7 +9716,7 @@
9722
9716
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9723
9717
  const index = typeof options.index === 'number' ? options.index : undefined;
9724
9718
  view.init({
9725
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9719
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9726
9720
  minimumBodySize: options.minimumBodySize,
9727
9721
  maximumBodySize: options.maximumBodySize,
9728
9722
  isExpanded: options.isExpanded,
@@ -9787,24 +9781,20 @@
9787
9781
  descriptor: {
9788
9782
  size,
9789
9783
  views: views.map((view) => {
9790
- var _a, _b, _c, _d;
9791
9784
  const data = view.data;
9792
- const body = createComponent(data.id, data.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9793
- ? {
9794
- createComponent: this.options.frameworkWrapper.body
9795
- .createComponent,
9796
- }
9797
- : undefined);
9785
+ const body = this.options.createComponent({
9786
+ id: data.id,
9787
+ name: data.component,
9788
+ });
9798
9789
  let header;
9799
- if (data.headerComponent) {
9800
- header = createComponent(data.id, data.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, (_d = this.options.headerframeworkComponents) !== null && _d !== void 0 ? _d : {}, this.options.frameworkWrapper
9801
- ? {
9802
- createComponent: this.options.frameworkWrapper.header
9803
- .createComponent,
9804
- }
9805
- : undefined);
9790
+ if (data.headerComponent &&
9791
+ this.options.createHeaderComponent) {
9792
+ header = this.options.createHeaderComponent({
9793
+ id: data.id,
9794
+ name: data.headerComponent,
9795
+ });
9806
9796
  }
9807
- else {
9797
+ if (!header) {
9808
9798
  header = new DefaultHeader();
9809
9799
  }
9810
9800
  const panel = new PaneFramework({
@@ -9852,9 +9842,11 @@
9852
9842
  this.paneview.dispose();
9853
9843
  }
9854
9844
  doAddPanel(panel) {
9855
- const disposable = panel.onDidDrop((event) => {
9845
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9856
9846
  this._onDidDrop.fire(event);
9857
- });
9847
+ }), panel.onUnhandledDragOverEvent((event) => {
9848
+ this._onUnhandledDragOverEvent.fire(event);
9849
+ }));
9858
9850
  this._viewDisposables.set(panel.id, disposable);
9859
9851
  }
9860
9852
  doRemovePanel(panel) {
@@ -10137,7 +10129,7 @@
10137
10129
  this._onDidBlur = new Emitter();
10138
10130
  this.onDidBlur = this._onDidBlur.event;
10139
10131
  this._element = document.createElement('div');
10140
- this._element.className = 'dockview-react-part';
10132
+ this._element.className = 'dv-react-part';
10141
10133
  this._element.style.height = '100%';
10142
10134
  this._element.style.width = '100%';
10143
10135
  }
@@ -10175,7 +10167,7 @@
10175
10167
  this.component = component;
10176
10168
  this.reactPortalStore = reactPortalStore;
10177
10169
  this._element = document.createElement('div');
10178
- this._element.className = 'dockview-react-part';
10170
+ this._element.className = 'dv-react-part';
10179
10171
  this._element.style.height = '100%';
10180
10172
  this._element.style.width = '100%';
10181
10173
  }
@@ -10211,7 +10203,7 @@
10211
10203
  this.component = component;
10212
10204
  this.reactPortalStore = reactPortalStore;
10213
10205
  this._element = document.createElement('div');
10214
- this._element.className = 'dockview-react-part';
10206
+ this._element.className = 'dv-react-part';
10215
10207
  this._element.style.height = '100%';
10216
10208
  this._element.style.width = '100%';
10217
10209
  }
@@ -10253,7 +10245,7 @@
10253
10245
  this._group = _group;
10254
10246
  this.mutableDisposable = new MutableDisposable();
10255
10247
  this._element = document.createElement('div');
10256
- this._element.className = 'dockview-react-part';
10248
+ this._element.className = 'dv-react-part';
10257
10249
  this._element.style.height = '100%';
10258
10250
  this._element.style.width = '100%';
10259
10251
  }
@@ -10312,8 +10304,8 @@
10312
10304
  : undefined;
10313
10305
  }
10314
10306
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10315
- function extractCoreOptions(props) {
10316
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10307
+ function extractCoreOptions$3(props) {
10308
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10317
10309
  if (key in props) {
10318
10310
  obj[key] = props[key];
10319
10311
  }
@@ -10329,7 +10321,7 @@
10329
10321
  const prevProps = React.useRef({});
10330
10322
  React.useEffect(() => {
10331
10323
  const changes = {};
10332
- PROPERTY_KEYS.forEach((propKey) => {
10324
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10333
10325
  const key = propKey;
10334
10326
  const propValue = props[key];
10335
10327
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10340,7 +10332,7 @@
10340
10332
  dockviewRef.current.updateOptions(changes);
10341
10333
  }
10342
10334
  prevProps.current = props;
10343
- }, PROPERTY_KEYS.map((key) => props[key]));
10335
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10344
10336
  React.useEffect(() => {
10345
10337
  var _a;
10346
10338
  if (!domRef.current) {
@@ -10376,7 +10368,7 @@
10376
10368
  ? DEFAULT_REACT_TAB
10377
10369
  : undefined,
10378
10370
  };
10379
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10371
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10380
10372
  const { clientWidth, clientHeight } = domRef.current;
10381
10373
  api.layout(clientWidth, clientHeight);
10382
10374
  if (props.onReady) {
@@ -10587,31 +10579,47 @@
10587
10579
  }
10588
10580
  }
10589
10581
 
10582
+ function extractCoreOptions$2(props) {
10583
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10584
+ if (key in props) {
10585
+ obj[key] = props[key];
10586
+ }
10587
+ return obj;
10588
+ }, {});
10589
+ return coreOptions;
10590
+ }
10590
10591
  const SplitviewReact = React.forwardRef((props, ref) => {
10591
10592
  const domRef = React.useRef(null);
10592
10593
  const splitviewRef = React.useRef();
10593
10594
  const [portals, addPortal] = usePortalsLifecycle();
10594
10595
  React.useImperativeHandle(ref, () => domRef.current, []);
10596
+ const prevProps = React.useRef({});
10595
10597
  React.useEffect(() => {
10596
- var _a;
10597
- const api = createSplitview(domRef.current, {
10598
- disableAutoResizing: props.disableAutoResizing,
10599
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10600
- frameworkComponents: props.components,
10601
- frameworkWrapper: {
10602
- createComponent: (id, componentId, component) => {
10603
- return new ReactPanelView(id, componentId, component, {
10604
- addPortal,
10605
- });
10606
- },
10607
- },
10608
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10609
- ? props.proportionalLayout
10610
- : true,
10611
- styles: props.hideBorders
10612
- ? { separatorBorder: 'transparent' }
10613
- : undefined,
10598
+ const changes = {};
10599
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10600
+ const key = propKey;
10601
+ const propValue = props[key];
10602
+ if (key in props && propValue !== prevProps.current[key]) {
10603
+ changes[key] = propValue;
10604
+ }
10614
10605
  });
10606
+ if (splitviewRef.current) {
10607
+ splitviewRef.current.updateOptions(changes);
10608
+ }
10609
+ prevProps.current = props;
10610
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10611
+ React.useEffect(() => {
10612
+ if (!domRef.current) {
10613
+ return () => {
10614
+ // noop
10615
+ };
10616
+ }
10617
+ const frameworkOptions = {
10618
+ createComponent: (options) => {
10619
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10620
+ },
10621
+ };
10622
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10615
10623
  const { clientWidth, clientHeight } = domRef.current;
10616
10624
  api.layout(clientWidth, clientHeight);
10617
10625
  if (props.onReady) {
@@ -10627,7 +10635,9 @@
10627
10635
  return;
10628
10636
  }
10629
10637
  splitviewRef.current.updateOptions({
10630
- frameworkComponents: props.components,
10638
+ createComponent: (options) => {
10639
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10640
+ },
10631
10641
  });
10632
10642
  }, [props.components]);
10633
10643
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10652,36 +10662,47 @@
10652
10662
  }
10653
10663
  }
10654
10664
 
10665
+ function extractCoreOptions$1(props) {
10666
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10667
+ if (key in props) {
10668
+ obj[key] = props[key];
10669
+ }
10670
+ return obj;
10671
+ }, {});
10672
+ return coreOptions;
10673
+ }
10655
10674
  const GridviewReact = React.forwardRef((props, ref) => {
10656
10675
  const domRef = React.useRef(null);
10657
10676
  const gridviewRef = React.useRef();
10658
10677
  const [portals, addPortal] = usePortalsLifecycle();
10659
10678
  React.useImperativeHandle(ref, () => domRef.current, []);
10679
+ const prevProps = React.useRef({});
10680
+ React.useEffect(() => {
10681
+ const changes = {};
10682
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10683
+ const key = propKey;
10684
+ const propValue = props[key];
10685
+ if (key in props && propValue !== prevProps.current[key]) {
10686
+ changes[key] = propValue;
10687
+ }
10688
+ });
10689
+ if (gridviewRef.current) {
10690
+ gridviewRef.current.updateOptions(changes);
10691
+ }
10692
+ prevProps.current = props;
10693
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10660
10694
  React.useEffect(() => {
10661
- var _a;
10662
10695
  if (!domRef.current) {
10663
10696
  return () => {
10664
10697
  // noop
10665
10698
  };
10666
10699
  }
10667
- const api = createGridview(domRef.current, {
10668
- disableAutoResizing: props.disableAutoResizing,
10669
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10670
- ? props.proportionalLayout
10671
- : true,
10672
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10673
- frameworkComponents: props.components,
10674
- frameworkComponentFactory: {
10675
- createComponent: (id, componentId, component) => {
10676
- return new ReactGridPanelView(id, componentId, component, {
10677
- addPortal,
10678
- });
10679
- },
10700
+ const frameworkOptions = {
10701
+ createComponent: (options) => {
10702
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10680
10703
  },
10681
- styles: props.hideBorders
10682
- ? { separatorBorder: 'transparent' }
10683
- : undefined,
10684
- });
10704
+ };
10705
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10685
10706
  const { clientWidth, clientHeight } = domRef.current;
10686
10707
  api.layout(clientWidth, clientHeight);
10687
10708
  if (props.onReady) {
@@ -10697,7 +10718,9 @@
10697
10718
  return;
10698
10719
  }
10699
10720
  gridviewRef.current.updateOptions({
10700
- frameworkComponents: props.components,
10721
+ createComponent: (options) => {
10722
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10723
+ },
10701
10724
  });
10702
10725
  }, [props.components]);
10703
10726
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10739,32 +10762,52 @@
10739
10762
  }
10740
10763
  }
10741
10764
 
10765
+ function extractCoreOptions(props) {
10766
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10767
+ if (key in props) {
10768
+ obj[key] = props[key];
10769
+ }
10770
+ return obj;
10771
+ }, {});
10772
+ return coreOptions;
10773
+ }
10742
10774
  const PaneviewReact = React.forwardRef((props, ref) => {
10743
10775
  const domRef = React.useRef(null);
10744
10776
  const paneviewRef = React.useRef();
10745
10777
  const [portals, addPortal] = usePortalsLifecycle();
10746
10778
  React.useImperativeHandle(ref, () => domRef.current, []);
10779
+ const prevProps = React.useRef({});
10747
10780
  React.useEffect(() => {
10748
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10749
- addPortal,
10781
+ const changes = {};
10782
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10783
+ const key = propKey;
10784
+ const propValue = props[key];
10785
+ if (key in props && propValue !== prevProps.current[key]) {
10786
+ changes[key] = propValue;
10787
+ }
10750
10788
  });
10751
- const api = createPaneview(domRef.current, {
10752
- disableAutoResizing: props.disableAutoResizing,
10753
- frameworkComponents: props.components,
10754
- components: {},
10755
- headerComponents: {},
10756
- disableDnd: props.disableDnd,
10757
- headerframeworkComponents: props.headerComponents,
10758
- frameworkWrapper: {
10759
- header: {
10760
- createComponent,
10761
- },
10762
- body: {
10763
- createComponent,
10764
- },
10789
+ if (paneviewRef.current) {
10790
+ paneviewRef.current.updateOptions(changes);
10791
+ }
10792
+ prevProps.current = props;
10793
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10794
+ React.useEffect(() => {
10795
+ var _a;
10796
+ if (!domRef.current) {
10797
+ return () => {
10798
+ // noop
10799
+ };
10800
+ }
10801
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10802
+ const frameworkOptions = {
10803
+ createComponent: (options) => {
10804
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10765
10805
  },
10766
- showDndOverlay: props.showDndOverlay,
10767
- });
10806
+ createHeaderComponent: (options) => {
10807
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10808
+ },
10809
+ };
10810
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10768
10811
  const { clientWidth, clientHeight } = domRef.current;
10769
10812
  api.layout(clientWidth, clientHeight);
10770
10813
  if (props.onReady) {
@@ -10780,41 +10823,38 @@
10780
10823
  return;
10781
10824
  }
10782
10825
  paneviewRef.current.updateOptions({
10783
- frameworkComponents: props.components,
10826
+ createComponent: (options) => {
10827
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10828
+ },
10784
10829
  });
10785
10830
  }, [props.components]);
10786
10831
  React.useEffect(() => {
10832
+ var _a;
10787
10833
  if (!paneviewRef.current) {
10788
10834
  return;
10789
10835
  }
10836
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10790
10837
  paneviewRef.current.updateOptions({
10791
- headerframeworkComponents: props.headerComponents,
10838
+ createHeaderComponent: (options) => {
10839
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10840
+ },
10792
10841
  });
10793
10842
  }, [props.headerComponents]);
10794
10843
  React.useEffect(() => {
10795
10844
  if (!paneviewRef.current) {
10796
10845
  return () => {
10797
- //
10846
+ // noop
10798
10847
  };
10799
10848
  }
10800
- const api = paneviewRef.current;
10801
- const disposable = api.onDidDrop((event) => {
10849
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10802
10850
  if (props.onDidDrop) {
10803
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10851
+ props.onDidDrop(event);
10804
10852
  }
10805
10853
  });
10806
10854
  return () => {
10807
10855
  disposable.dispose();
10808
10856
  };
10809
10857
  }, [props.onDidDrop]);
10810
- React.useEffect(() => {
10811
- if (!paneviewRef.current) {
10812
- return;
10813
- }
10814
- paneviewRef.current.updateOptions({
10815
- showDndOverlay: props.showDndOverlay,
10816
- });
10817
- }, [props.showDndOverlay]);
10818
10858
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10819
10859
  });
10820
10860
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10842,7 +10882,10 @@
10842
10882
  exports.GridviewComponent = GridviewComponent;
10843
10883
  exports.GridviewPanel = GridviewPanel;
10844
10884
  exports.GridviewReact = GridviewReact;
10845
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10885
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10886
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10887
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10888
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10846
10889
  exports.PaneFramework = PaneFramework;
10847
10890
  exports.PaneTransfer = PaneTransfer;
10848
10891
  exports.PanelTransfer = PanelTransfer;
@@ -10851,6 +10894,7 @@
10851
10894
  exports.PaneviewComponent = PaneviewComponent;
10852
10895
  exports.PaneviewPanel = PaneviewPanel;
10853
10896
  exports.PaneviewReact = PaneviewReact;
10897
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10854
10898
  exports.ReactPart = ReactPart;
10855
10899
  exports.ReactPartContext = ReactPartContext;
10856
10900
  exports.Splitview = Splitview;