dockview-react 2.1.4 → 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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 2.1.4
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`
@@ -8960,31 +9009,6 @@
8960
9009
  }
8961
9010
  }
8962
9011
 
8963
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8964
- const Component = typeof componentName === 'string'
8965
- ? components[componentName]
8966
- : undefined;
8967
- const FrameworkComponent = typeof componentName === 'string'
8968
- ? frameworkComponents[componentName]
8969
- : undefined;
8970
- if (Component && FrameworkComponent) {
8971
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
8972
- }
8973
- if (FrameworkComponent) {
8974
- if (!createFrameworkComponent) {
8975
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
8976
- }
8977
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
8978
- }
8979
- if (!Component) {
8980
- if (fallback) {
8981
- return fallback();
8982
- }
8983
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
8984
- }
8985
- return new Component(id, componentName);
8986
- }
8987
-
8988
9012
  class GridviewComponent extends BaseGrid {
8989
9013
  get orientation() {
8990
9014
  return this.gridview.orientation;
@@ -9002,10 +9026,13 @@
9002
9026
  this._deserializer = value;
9003
9027
  }
9004
9028
  constructor(parentElement, options) {
9029
+ var _a;
9005
9030
  super(parentElement, {
9006
- proportionalLayout: options.proportionalLayout,
9031
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9007
9032
  orientation: options.orientation,
9008
- styles: options.styles,
9033
+ styles: options.hideBorders
9034
+ ? { separatorBorder: 'transparent' }
9035
+ : undefined,
9009
9036
  disableAutoResizing: options.disableAutoResizing,
9010
9037
  className: options.className,
9011
9038
  });
@@ -9025,12 +9052,6 @@
9025
9052
  }), this.onDidActiveChange((event) => {
9026
9053
  this._onDidActiveGroupChange.fire(event);
9027
9054
  }));
9028
- if (!this.options.components) {
9029
- this.options.components = {};
9030
- }
9031
- if (!this.options.frameworkComponents) {
9032
- this.options.frameworkComponents = {};
9033
- }
9034
9055
  }
9035
9056
  updateOptions(options) {
9036
9057
  super.updateOptions(options);
@@ -9080,14 +9101,11 @@
9080
9101
  const height = this.height;
9081
9102
  this.gridview.deserialize(grid, {
9082
9103
  fromJSON: (node) => {
9083
- var _a, _b;
9084
9104
  const { data } = node;
9085
- 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
9086
- ? {
9087
- createComponent: this.options.frameworkComponentFactory
9088
- .createComponent,
9089
- }
9090
- : undefined);
9105
+ const view = this.options.createComponent({
9106
+ id: data.id,
9107
+ name: data.component,
9108
+ });
9091
9109
  queue.push(() => view.init({
9092
9110
  params: data.params,
9093
9111
  minimumWidth: data.minimumWidth,
@@ -9165,7 +9183,7 @@
9165
9183
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9166
9184
  }
9167
9185
  addPanel(options) {
9168
- var _a, _b, _c, _d, _e, _f;
9186
+ var _a, _b, _c, _d;
9169
9187
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9170
9188
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9171
9189
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9181,14 +9199,12 @@
9181
9199
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9182
9200
  }
9183
9201
  }
9184
- 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
9185
- ? {
9186
- createComponent: this.options.frameworkComponentFactory
9187
- .createComponent,
9188
- }
9189
- : undefined);
9202
+ const view = this.options.createComponent({
9203
+ id: options.id,
9204
+ name: options.component,
9205
+ });
9190
9206
  view.init({
9191
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9207
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9192
9208
  minimumWidth: options.minimumWidth,
9193
9209
  maximumWidth: options.maximumWidth,
9194
9210
  minimumHeight: options.minimumHeight,
@@ -9316,12 +9332,6 @@
9316
9332
  this._classNames = new Classnames(this.element);
9317
9333
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9318
9334
  this._options = options;
9319
- if (!options.components) {
9320
- options.components = {};
9321
- }
9322
- if (!options.frameworkComponents) {
9323
- options.frameworkComponents = {};
9324
- }
9325
9335
  this.splitview = new Splitview(this.element, options);
9326
9336
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9327
9337
  }
@@ -9384,18 +9394,17 @@
9384
9394
  return this.panels.find((view) => view.id === id);
9385
9395
  }
9386
9396
  addPanel(options) {
9387
- var _a, _b, _c;
9397
+ var _a;
9388
9398
  if (this._panels.has(options.id)) {
9389
9399
  throw new Error(`panel ${options.id} already exists`);
9390
9400
  }
9391
- 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
9392
- ? {
9393
- createComponent: this.options.frameworkWrapper.createComponent,
9394
- }
9395
- : undefined);
9401
+ const view = this.options.createComponent({
9402
+ id: options.id,
9403
+ name: options.component,
9404
+ });
9396
9405
  view.orientation = this.splitview.orientation;
9397
9406
  view.init({
9398
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9407
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9399
9408
  minimumSize: options.minimumSize,
9400
9409
  maximumSize: options.maximumSize,
9401
9410
  snap: options.snap,
@@ -9457,17 +9466,14 @@
9457
9466
  descriptor: {
9458
9467
  size,
9459
9468
  views: views.map((view) => {
9460
- var _a, _b;
9461
9469
  const data = view.data;
9462
9470
  if (this._panels.has(data.id)) {
9463
9471
  throw new Error(`panel ${data.id} already exists`);
9464
9472
  }
9465
- 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
9466
- ? {
9467
- createComponent: this.options.frameworkWrapper
9468
- .createComponent,
9469
- }
9470
- : undefined);
9473
+ const panel = this.options.createComponent({
9474
+ id: data.id,
9475
+ name: data.component,
9476
+ });
9471
9477
  queue.push(() => {
9472
9478
  var _a;
9473
9479
  panel.init({
@@ -9650,16 +9656,12 @@
9650
9656
  this.onDidAddView = this._onDidAddView.event;
9651
9657
  this._onDidRemoveView = new Emitter();
9652
9658
  this.onDidRemoveView = this._onDidRemoveView.event;
9653
- 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);
9654
9662
  this._classNames = new Classnames(this.element);
9655
9663
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9656
9664
  this._options = options;
9657
- if (!options.components) {
9658
- options.components = {};
9659
- }
9660
- if (!options.frameworkComponents) {
9661
- options.frameworkComponents = {};
9662
- }
9663
9665
  this.paneview = new Paneview(this.element, {
9664
9666
  // only allow paneview in the vertical orientation for now
9665
9667
  orientation: exports.Orientation.VERTICAL,
@@ -9684,22 +9686,19 @@
9684
9686
  this._options = Object.assign(Object.assign({}, this.options), options);
9685
9687
  }
9686
9688
  addPanel(options) {
9687
- var _a, _b, _c, _d;
9688
- 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
9689
- ? {
9690
- createComponent: this.options.frameworkWrapper.body.createComponent,
9691
- }
9692
- : undefined);
9689
+ var _a;
9690
+ const body = this.options.createComponent({
9691
+ id: options.id,
9692
+ name: options.component,
9693
+ });
9693
9694
  let header;
9694
- if (options.headerComponent) {
9695
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9696
- ? {
9697
- createComponent: this.options.frameworkWrapper.header
9698
- .createComponent,
9699
- }
9700
- : undefined);
9695
+ if (options.headerComponent && this.options.createHeaderComponent) {
9696
+ header = this.options.createHeaderComponent({
9697
+ id: options.id,
9698
+ name: options.headerComponent,
9699
+ });
9701
9700
  }
9702
- else {
9701
+ if (!header) {
9703
9702
  header = new DefaultHeader();
9704
9703
  }
9705
9704
  const view = new PaneFramework({
@@ -9717,7 +9716,7 @@
9717
9716
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9718
9717
  const index = typeof options.index === 'number' ? options.index : undefined;
9719
9718
  view.init({
9720
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9719
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9721
9720
  minimumBodySize: options.minimumBodySize,
9722
9721
  maximumBodySize: options.maximumBodySize,
9723
9722
  isExpanded: options.isExpanded,
@@ -9782,24 +9781,20 @@
9782
9781
  descriptor: {
9783
9782
  size,
9784
9783
  views: views.map((view) => {
9785
- var _a, _b, _c, _d;
9786
9784
  const data = view.data;
9787
- 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
9788
- ? {
9789
- createComponent: this.options.frameworkWrapper.body
9790
- .createComponent,
9791
- }
9792
- : undefined);
9785
+ const body = this.options.createComponent({
9786
+ id: data.id,
9787
+ name: data.component,
9788
+ });
9793
9789
  let header;
9794
- if (data.headerComponent) {
9795
- 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
9796
- ? {
9797
- createComponent: this.options.frameworkWrapper.header
9798
- .createComponent,
9799
- }
9800
- : undefined);
9790
+ if (data.headerComponent &&
9791
+ this.options.createHeaderComponent) {
9792
+ header = this.options.createHeaderComponent({
9793
+ id: data.id,
9794
+ name: data.headerComponent,
9795
+ });
9801
9796
  }
9802
- else {
9797
+ if (!header) {
9803
9798
  header = new DefaultHeader();
9804
9799
  }
9805
9800
  const panel = new PaneFramework({
@@ -9847,9 +9842,11 @@
9847
9842
  this.paneview.dispose();
9848
9843
  }
9849
9844
  doAddPanel(panel) {
9850
- const disposable = panel.onDidDrop((event) => {
9845
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9851
9846
  this._onDidDrop.fire(event);
9852
- });
9847
+ }), panel.onUnhandledDragOverEvent((event) => {
9848
+ this._onUnhandledDragOverEvent.fire(event);
9849
+ }));
9853
9850
  this._viewDisposables.set(panel.id, disposable);
9854
9851
  }
9855
9852
  doRemovePanel(panel) {
@@ -10132,7 +10129,7 @@
10132
10129
  this._onDidBlur = new Emitter();
10133
10130
  this.onDidBlur = this._onDidBlur.event;
10134
10131
  this._element = document.createElement('div');
10135
- this._element.className = 'dockview-react-part';
10132
+ this._element.className = 'dv-react-part';
10136
10133
  this._element.style.height = '100%';
10137
10134
  this._element.style.width = '100%';
10138
10135
  }
@@ -10170,7 +10167,7 @@
10170
10167
  this.component = component;
10171
10168
  this.reactPortalStore = reactPortalStore;
10172
10169
  this._element = document.createElement('div');
10173
- this._element.className = 'dockview-react-part';
10170
+ this._element.className = 'dv-react-part';
10174
10171
  this._element.style.height = '100%';
10175
10172
  this._element.style.width = '100%';
10176
10173
  }
@@ -10206,7 +10203,7 @@
10206
10203
  this.component = component;
10207
10204
  this.reactPortalStore = reactPortalStore;
10208
10205
  this._element = document.createElement('div');
10209
- this._element.className = 'dockview-react-part';
10206
+ this._element.className = 'dv-react-part';
10210
10207
  this._element.style.height = '100%';
10211
10208
  this._element.style.width = '100%';
10212
10209
  }
@@ -10248,7 +10245,7 @@
10248
10245
  this._group = _group;
10249
10246
  this.mutableDisposable = new MutableDisposable();
10250
10247
  this._element = document.createElement('div');
10251
- this._element.className = 'dockview-react-part';
10248
+ this._element.className = 'dv-react-part';
10252
10249
  this._element.style.height = '100%';
10253
10250
  this._element.style.width = '100%';
10254
10251
  }
@@ -10307,8 +10304,8 @@
10307
10304
  : undefined;
10308
10305
  }
10309
10306
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10310
- function extractCoreOptions(props) {
10311
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10307
+ function extractCoreOptions$3(props) {
10308
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10312
10309
  if (key in props) {
10313
10310
  obj[key] = props[key];
10314
10311
  }
@@ -10324,7 +10321,7 @@
10324
10321
  const prevProps = React.useRef({});
10325
10322
  React.useEffect(() => {
10326
10323
  const changes = {};
10327
- PROPERTY_KEYS.forEach((propKey) => {
10324
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10328
10325
  const key = propKey;
10329
10326
  const propValue = props[key];
10330
10327
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10335,7 +10332,7 @@
10335
10332
  dockviewRef.current.updateOptions(changes);
10336
10333
  }
10337
10334
  prevProps.current = props;
10338
- }, PROPERTY_KEYS.map((key) => props[key]));
10335
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10339
10336
  React.useEffect(() => {
10340
10337
  var _a;
10341
10338
  if (!domRef.current) {
@@ -10371,7 +10368,7 @@
10371
10368
  ? DEFAULT_REACT_TAB
10372
10369
  : undefined,
10373
10370
  };
10374
- 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));
10375
10372
  const { clientWidth, clientHeight } = domRef.current;
10376
10373
  api.layout(clientWidth, clientHeight);
10377
10374
  if (props.onReady) {
@@ -10559,31 +10556,47 @@
10559
10556
  }
10560
10557
  }
10561
10558
 
10559
+ function extractCoreOptions$2(props) {
10560
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10561
+ if (key in props) {
10562
+ obj[key] = props[key];
10563
+ }
10564
+ return obj;
10565
+ }, {});
10566
+ return coreOptions;
10567
+ }
10562
10568
  const SplitviewReact = React.forwardRef((props, ref) => {
10563
10569
  const domRef = React.useRef(null);
10564
10570
  const splitviewRef = React.useRef();
10565
10571
  const [portals, addPortal] = usePortalsLifecycle();
10566
10572
  React.useImperativeHandle(ref, () => domRef.current, []);
10573
+ const prevProps = React.useRef({});
10567
10574
  React.useEffect(() => {
10568
- var _a;
10569
- const api = createSplitview(domRef.current, {
10570
- disableAutoResizing: props.disableAutoResizing,
10571
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10572
- frameworkComponents: props.components,
10573
- frameworkWrapper: {
10574
- createComponent: (id, componentId, component) => {
10575
- return new ReactPanelView(id, componentId, component, {
10576
- addPortal,
10577
- });
10578
- },
10579
- },
10580
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10581
- ? props.proportionalLayout
10582
- : true,
10583
- styles: props.hideBorders
10584
- ? { separatorBorder: 'transparent' }
10585
- : undefined,
10575
+ const changes = {};
10576
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10577
+ const key = propKey;
10578
+ const propValue = props[key];
10579
+ if (key in props && propValue !== prevProps.current[key]) {
10580
+ changes[key] = propValue;
10581
+ }
10586
10582
  });
10583
+ if (splitviewRef.current) {
10584
+ splitviewRef.current.updateOptions(changes);
10585
+ }
10586
+ prevProps.current = props;
10587
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10588
+ React.useEffect(() => {
10589
+ if (!domRef.current) {
10590
+ return () => {
10591
+ // noop
10592
+ };
10593
+ }
10594
+ const frameworkOptions = {
10595
+ createComponent: (options) => {
10596
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10597
+ },
10598
+ };
10599
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10587
10600
  const { clientWidth, clientHeight } = domRef.current;
10588
10601
  api.layout(clientWidth, clientHeight);
10589
10602
  if (props.onReady) {
@@ -10599,7 +10612,9 @@
10599
10612
  return;
10600
10613
  }
10601
10614
  splitviewRef.current.updateOptions({
10602
- frameworkComponents: props.components,
10615
+ createComponent: (options) => {
10616
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10617
+ },
10603
10618
  });
10604
10619
  }, [props.components]);
10605
10620
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10624,36 +10639,47 @@
10624
10639
  }
10625
10640
  }
10626
10641
 
10642
+ function extractCoreOptions$1(props) {
10643
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10644
+ if (key in props) {
10645
+ obj[key] = props[key];
10646
+ }
10647
+ return obj;
10648
+ }, {});
10649
+ return coreOptions;
10650
+ }
10627
10651
  const GridviewReact = React.forwardRef((props, ref) => {
10628
10652
  const domRef = React.useRef(null);
10629
10653
  const gridviewRef = React.useRef();
10630
10654
  const [portals, addPortal] = usePortalsLifecycle();
10631
10655
  React.useImperativeHandle(ref, () => domRef.current, []);
10656
+ const prevProps = React.useRef({});
10657
+ React.useEffect(() => {
10658
+ const changes = {};
10659
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10660
+ const key = propKey;
10661
+ const propValue = props[key];
10662
+ if (key in props && propValue !== prevProps.current[key]) {
10663
+ changes[key] = propValue;
10664
+ }
10665
+ });
10666
+ if (gridviewRef.current) {
10667
+ gridviewRef.current.updateOptions(changes);
10668
+ }
10669
+ prevProps.current = props;
10670
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10632
10671
  React.useEffect(() => {
10633
- var _a;
10634
10672
  if (!domRef.current) {
10635
10673
  return () => {
10636
10674
  // noop
10637
10675
  };
10638
10676
  }
10639
- const api = createGridview(domRef.current, {
10640
- disableAutoResizing: props.disableAutoResizing,
10641
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10642
- ? props.proportionalLayout
10643
- : true,
10644
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10645
- frameworkComponents: props.components,
10646
- frameworkComponentFactory: {
10647
- createComponent: (id, componentId, component) => {
10648
- return new ReactGridPanelView(id, componentId, component, {
10649
- addPortal,
10650
- });
10651
- },
10677
+ const frameworkOptions = {
10678
+ createComponent: (options) => {
10679
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10652
10680
  },
10653
- styles: props.hideBorders
10654
- ? { separatorBorder: 'transparent' }
10655
- : undefined,
10656
- });
10681
+ };
10682
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10657
10683
  const { clientWidth, clientHeight } = domRef.current;
10658
10684
  api.layout(clientWidth, clientHeight);
10659
10685
  if (props.onReady) {
@@ -10669,7 +10695,9 @@
10669
10695
  return;
10670
10696
  }
10671
10697
  gridviewRef.current.updateOptions({
10672
- frameworkComponents: props.components,
10698
+ createComponent: (options) => {
10699
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10700
+ },
10673
10701
  });
10674
10702
  }, [props.components]);
10675
10703
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10711,32 +10739,52 @@
10711
10739
  }
10712
10740
  }
10713
10741
 
10742
+ function extractCoreOptions(props) {
10743
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10744
+ if (key in props) {
10745
+ obj[key] = props[key];
10746
+ }
10747
+ return obj;
10748
+ }, {});
10749
+ return coreOptions;
10750
+ }
10714
10751
  const PaneviewReact = React.forwardRef((props, ref) => {
10715
10752
  const domRef = React.useRef(null);
10716
10753
  const paneviewRef = React.useRef();
10717
10754
  const [portals, addPortal] = usePortalsLifecycle();
10718
10755
  React.useImperativeHandle(ref, () => domRef.current, []);
10756
+ const prevProps = React.useRef({});
10719
10757
  React.useEffect(() => {
10720
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10721
- addPortal,
10758
+ const changes = {};
10759
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10760
+ const key = propKey;
10761
+ const propValue = props[key];
10762
+ if (key in props && propValue !== prevProps.current[key]) {
10763
+ changes[key] = propValue;
10764
+ }
10722
10765
  });
10723
- const api = createPaneview(domRef.current, {
10724
- disableAutoResizing: props.disableAutoResizing,
10725
- frameworkComponents: props.components,
10726
- components: {},
10727
- headerComponents: {},
10728
- disableDnd: props.disableDnd,
10729
- headerframeworkComponents: props.headerComponents,
10730
- frameworkWrapper: {
10731
- header: {
10732
- createComponent,
10733
- },
10734
- body: {
10735
- createComponent,
10736
- },
10766
+ if (paneviewRef.current) {
10767
+ paneviewRef.current.updateOptions(changes);
10768
+ }
10769
+ prevProps.current = props;
10770
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10771
+ React.useEffect(() => {
10772
+ var _a;
10773
+ if (!domRef.current) {
10774
+ return () => {
10775
+ // noop
10776
+ };
10777
+ }
10778
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10779
+ const frameworkOptions = {
10780
+ createComponent: (options) => {
10781
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10737
10782
  },
10738
- showDndOverlay: props.showDndOverlay,
10739
- });
10783
+ createHeaderComponent: (options) => {
10784
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10785
+ },
10786
+ };
10787
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10740
10788
  const { clientWidth, clientHeight } = domRef.current;
10741
10789
  api.layout(clientWidth, clientHeight);
10742
10790
  if (props.onReady) {
@@ -10752,41 +10800,38 @@
10752
10800
  return;
10753
10801
  }
10754
10802
  paneviewRef.current.updateOptions({
10755
- frameworkComponents: props.components,
10803
+ createComponent: (options) => {
10804
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10805
+ },
10756
10806
  });
10757
10807
  }, [props.components]);
10758
10808
  React.useEffect(() => {
10809
+ var _a;
10759
10810
  if (!paneviewRef.current) {
10760
10811
  return;
10761
10812
  }
10813
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10762
10814
  paneviewRef.current.updateOptions({
10763
- headerframeworkComponents: props.headerComponents,
10815
+ createHeaderComponent: (options) => {
10816
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10817
+ },
10764
10818
  });
10765
10819
  }, [props.headerComponents]);
10766
10820
  React.useEffect(() => {
10767
10821
  if (!paneviewRef.current) {
10768
10822
  return () => {
10769
- //
10823
+ // noop
10770
10824
  };
10771
10825
  }
10772
- const api = paneviewRef.current;
10773
- const disposable = api.onDidDrop((event) => {
10826
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10774
10827
  if (props.onDidDrop) {
10775
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10828
+ props.onDidDrop(event);
10776
10829
  }
10777
10830
  });
10778
10831
  return () => {
10779
10832
  disposable.dispose();
10780
10833
  };
10781
10834
  }, [props.onDidDrop]);
10782
- React.useEffect(() => {
10783
- if (!paneviewRef.current) {
10784
- return;
10785
- }
10786
- paneviewRef.current.updateOptions({
10787
- showDndOverlay: props.showDndOverlay,
10788
- });
10789
- }, [props.showDndOverlay]);
10790
10835
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10791
10836
  });
10792
10837
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10814,7 +10859,10 @@
10814
10859
  exports.GridviewComponent = GridviewComponent;
10815
10860
  exports.GridviewPanel = GridviewPanel;
10816
10861
  exports.GridviewReact = GridviewReact;
10817
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10862
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10863
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10864
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10865
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10818
10866
  exports.PaneFramework = PaneFramework;
10819
10867
  exports.PaneTransfer = PaneTransfer;
10820
10868
  exports.PanelTransfer = PanelTransfer;
@@ -10823,6 +10871,7 @@
10823
10871
  exports.PaneviewComponent = PaneviewComponent;
10824
10872
  exports.PaneviewPanel = PaneviewPanel;
10825
10873
  exports.PaneviewReact = PaneviewReact;
10874
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10826
10875
  exports.ReactPart = ReactPart;
10827
10876
  exports.ReactPartContext = ReactPartContext;
10828
10877
  exports.Splitview = Splitview;