@aptre/flex-layout 0.2.2 → 0.2.3

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 (73) hide show
  1. package/dist/DockLocation.d.ts +1 -1
  2. package/dist/DropInfo.d.ts +4 -4
  3. package/dist/index.d.ts +22 -22
  4. package/dist/index.mjs +560 -459
  5. package/dist/model/Actions.d.ts +2 -2
  6. package/dist/model/BorderNode.d.ts +6 -6
  7. package/dist/model/BorderSet.d.ts +1 -1
  8. package/dist/model/IJsonModel.d.ts +1 -1
  9. package/dist/model/Model.d.ts +8 -8
  10. package/dist/model/Node.d.ts +4 -4
  11. package/dist/model/RowNode.d.ts +3 -3
  12. package/dist/model/SplitterNode.d.ts +1 -1
  13. package/dist/model/TabNode.d.ts +4 -4
  14. package/dist/model/TabSetNode.d.ts +4 -4
  15. package/dist/view/Layout.d.ts +10 -10
  16. package/package.json +31 -22
  17. package/tsconfig.json +5 -4
  18. package/typedoc/assets/icons.js +15 -0
  19. package/typedoc/assets/icons.svg +1 -0
  20. package/typedoc/assets/main.js +4 -4
  21. package/typedoc/assets/style.css +5 -7
  22. package/typedoc/classes/Action.html +4 -4
  23. package/typedoc/classes/Actions.html +63 -63
  24. package/typedoc/classes/BorderNode.html +29 -29
  25. package/typedoc/classes/BorderSet.html +2 -2
  26. package/typedoc/classes/DockLocation.html +10 -10
  27. package/typedoc/classes/DragDrop.html +10 -10
  28. package/typedoc/classes/DropInfo.html +7 -7
  29. package/typedoc/classes/Layout.html +87 -82
  30. package/typedoc/classes/Model.html +41 -41
  31. package/typedoc/classes/Node.html +12 -12
  32. package/typedoc/classes/Orientation.html +6 -6
  33. package/typedoc/classes/Rect.html +19 -19
  34. package/typedoc/classes/RowNode.html +17 -17
  35. package/typedoc/classes/SplitterNode.html +13 -13
  36. package/typedoc/classes/TabNode.html +33 -33
  37. package/typedoc/classes/TabSetNode.html +40 -40
  38. package/typedoc/enums/CLASSES.html +78 -78
  39. package/typedoc/enums/I18nLabel.html +13 -13
  40. package/typedoc/enums/ICloseType.html +4 -4
  41. package/typedoc/hierarchy.html +1 -1
  42. package/typedoc/index.html +51 -51
  43. package/typedoc/interfaces/IBorderAttributes.html +13 -13
  44. package/typedoc/interfaces/ICustomDropDestination.html +10 -10
  45. package/typedoc/interfaces/IDraggable.html +1 -1
  46. package/typedoc/interfaces/IDropTarget.html +1 -1
  47. package/typedoc/interfaces/IFontValues.html +5 -5
  48. package/typedoc/interfaces/IGlobalAttributes.html +47 -47
  49. package/typedoc/interfaces/IIcons.html +8 -8
  50. package/typedoc/interfaces/IJsonBorderNode.html +15 -15
  51. package/typedoc/interfaces/IJsonModel.html +4 -4
  52. package/typedoc/interfaces/IJsonRowNode.html +7 -7
  53. package/typedoc/interfaces/IJsonTabNode.html +21 -21
  54. package/typedoc/interfaces/IJsonTabSetNode.html +30 -30
  55. package/typedoc/interfaces/ILayoutProps.html +25 -25
  56. package/typedoc/interfaces/ILayoutState.html +9 -9
  57. package/typedoc/interfaces/IRowAttributes.html +6 -6
  58. package/typedoc/interfaces/ITabAttributes.html +21 -21
  59. package/typedoc/interfaces/ITabRenderValues.html +5 -5
  60. package/typedoc/interfaces/ITabSetAttributes.html +29 -29
  61. package/typedoc/interfaces/ITabSetRenderValues.html +7 -7
  62. package/typedoc/interfaces/ITitleObject.html +3 -3
  63. package/typedoc/types/CustomDragCallback.html +1 -1
  64. package/typedoc/types/DragRectRenderCallback.html +1 -1
  65. package/typedoc/types/FloatingTabPlaceholderRenderCallback.html +1 -1
  66. package/typedoc/types/IBorderLocation.html +1 -1
  67. package/typedoc/types/IInsets.html +1 -1
  68. package/typedoc/types/ITabLocation.html +1 -1
  69. package/typedoc/types/IconFactory.html +1 -1
  70. package/typedoc/types/NodeMouseEvent.html +1 -1
  71. package/typedoc/types/ShowOverflowMenuCallback.html +1 -1
  72. package/typedoc/types/TabSetPlaceHolderCallback.html +1 -1
  73. package/typedoc/types/TitleFactory.html +1 -1
package/dist/index.mjs CHANGED
@@ -4,12 +4,8 @@ import { createPortal as createPortal2 } from "react-dom";
4
4
 
5
5
  // src/Orientation.ts
6
6
  var Orientation = class _Orientation {
7
- static {
8
- this.HORZ = new _Orientation("horz");
9
- }
10
- static {
11
- this.VERT = new _Orientation("vert");
12
- }
7
+ static HORZ = new _Orientation("horz");
8
+ static VERT = new _Orientation("vert");
13
9
  static flip(from) {
14
10
  if (from === _Orientation.HORZ) {
15
11
  return _Orientation.VERT;
@@ -18,6 +14,8 @@ var Orientation = class _Orientation {
18
14
  }
19
15
  }
20
16
  /** @internal */
17
+ _name;
18
+ /** @internal */
21
19
  constructor(name) {
22
20
  this._name = name;
23
21
  }
@@ -34,6 +32,10 @@ var Rect = class _Rect {
34
32
  static empty() {
35
33
  return new _Rect(0, 0, 0, 0);
36
34
  }
35
+ x;
36
+ y;
37
+ width;
38
+ height;
37
39
  constructor(x, y, width, height) {
38
40
  this.x = x;
39
41
  this.y = y;
@@ -99,24 +101,12 @@ var Rect = class _Rect {
99
101
 
100
102
  // src/DockLocation.ts
101
103
  var DockLocation = class _DockLocation {
102
- static {
103
- this.values = {};
104
- }
105
- static {
106
- this.TOP = new _DockLocation("top", Orientation.VERT, 0);
107
- }
108
- static {
109
- this.BOTTOM = new _DockLocation("bottom", Orientation.VERT, 1);
110
- }
111
- static {
112
- this.LEFT = new _DockLocation("left", Orientation.HORZ, 0);
113
- }
114
- static {
115
- this.RIGHT = new _DockLocation("right", Orientation.HORZ, 1);
116
- }
117
- static {
118
- this.CENTER = new _DockLocation("center", Orientation.VERT, 0);
119
- }
104
+ static values = {};
105
+ static TOP = new _DockLocation("top", Orientation.VERT, 0);
106
+ static BOTTOM = new _DockLocation("bottom", Orientation.VERT, 1);
107
+ static LEFT = new _DockLocation("left", Orientation.HORZ, 0);
108
+ static RIGHT = new _DockLocation("right", Orientation.HORZ, 1);
109
+ static CENTER = new _DockLocation("center", Orientation.VERT, 0);
120
110
  /** @internal */
121
111
  static getByName(name) {
122
112
  return _DockLocation.values[name];
@@ -137,6 +127,12 @@ var DockLocation = class _DockLocation {
137
127
  }
138
128
  }
139
129
  /** @internal */
130
+ _name;
131
+ /** @internal */
132
+ _orientation;
133
+ /** @internal */
134
+ _indexPlus;
135
+ /** @internal */
140
136
  constructor(name, orientation, indexPlus) {
141
137
  this._name = name;
142
138
  this._orientation = orientation;
@@ -206,22 +202,54 @@ var DockLocation = class _DockLocation {
206
202
  // src/DragDrop.ts
207
203
  var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
208
204
  var DragDrop = class _DragDrop {
205
+ static instance = new _DragDrop();
206
+ /** @internal */
207
+ _fDblClick;
208
+ /** @internal */
209
+ _fClick;
210
+ /** @internal */
211
+ _fDragEnd;
212
+ /** @internal */
213
+ _fDragMove;
214
+ /** @internal */
215
+ _fDragStart;
216
+ /** @internal */
217
+ _fDragCancel;
218
+ /** @internal */
219
+ _glass;
220
+ /** @internal */
221
+ _defaultGlassCursor;
222
+ /** @internal */
223
+ _glassCursorOverride;
224
+ /** @internal */
225
+ _manualGlassManagement = false;
226
+ /** @internal */
227
+ _lastClick;
228
+ /** @internal */
229
+ _clickX;
230
+ /** @internal */
231
+ _clickY;
232
+ /** @internal */
233
+ _startX = 0;
234
+ /** @internal */
235
+ _startY = 0;
236
+ /** @internal */
237
+ _dragDepth = 0;
238
+ /** @internal */
239
+ _glassShowing = false;
240
+ /** @internal */
241
+ _dragging = false;
242
+ /** @internal */
243
+ _active = false;
244
+ // drag and drop is in progress, can be used on ios to prevent body scrolling (see demo)
245
+ /** @internal */
246
+ _document;
247
+ /** @internal */
248
+ _rootElement;
249
+ /** @internal */
250
+ _lastEvent;
209
251
  /** @internal */
210
252
  constructor() {
211
- /** @internal */
212
- this._manualGlassManagement = false;
213
- /** @internal */
214
- this._startX = 0;
215
- /** @internal */
216
- this._startY = 0;
217
- /** @internal */
218
- this._dragDepth = 0;
219
- /** @internal */
220
- this._glassShowing = false;
221
- /** @internal */
222
- this._dragging = false;
223
- /** @internal */
224
- this._active = false;
225
253
  if (canUseDOM) {
226
254
  this._glass = document.createElement("div");
227
255
  this._glass.style.zIndex = "998";
@@ -240,9 +268,6 @@ var DragDrop = class _DragDrop {
240
268
  this._clickX = 0;
241
269
  this._clickY = 0;
242
270
  }
243
- static {
244
- this.instance = new _DragDrop();
245
- }
246
271
  // if you add the glass pane then you should remove it
247
272
  addGlass(fCancel) {
248
273
  if (!this._glassShowing) {
@@ -503,6 +528,8 @@ var DragDrop = class _DragDrop {
503
528
 
504
529
  // src/model/Action.ts
505
530
  var Action = class {
531
+ type;
532
+ data;
506
533
  constructor(type, data) {
507
534
  this.type = type;
508
535
  this.data = data;
@@ -511,48 +538,20 @@ var Action = class {
511
538
 
512
539
  // src/model/Actions.ts
513
540
  var Actions = class _Actions {
514
- static {
515
- this.ADD_NODE = "FlexLayout_AddNode";
516
- }
517
- static {
518
- this.MOVE_NODE = "FlexLayout_MoveNode";
519
- }
520
- static {
521
- this.DELETE_TAB = "FlexLayout_DeleteTab";
522
- }
523
- static {
524
- this.DELETE_TABSET = "FlexLayout_DeleteTabset";
525
- }
526
- static {
527
- this.RENAME_TAB = "FlexLayout_RenameTab";
528
- }
529
- static {
530
- this.SELECT_TAB = "FlexLayout_SelectTab";
531
- }
532
- static {
533
- this.SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
534
- }
535
- static {
536
- this.ADJUST_SPLIT = "FlexLayout_AdjustSplit";
537
- }
538
- static {
539
- this.ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
540
- }
541
- static {
542
- this.MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
543
- }
544
- static {
545
- this.UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
546
- }
547
- static {
548
- this.UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
549
- }
550
- static {
551
- this.FLOAT_TAB = "FlexLayout_FloatTab";
552
- }
553
- static {
554
- this.UNFLOAT_TAB = "FlexLayout_UnFloatTab";
555
- }
541
+ static ADD_NODE = "FlexLayout_AddNode";
542
+ static MOVE_NODE = "FlexLayout_MoveNode";
543
+ static DELETE_TAB = "FlexLayout_DeleteTab";
544
+ static DELETE_TABSET = "FlexLayout_DeleteTabset";
545
+ static RENAME_TAB = "FlexLayout_RenameTab";
546
+ static SELECT_TAB = "FlexLayout_SelectTab";
547
+ static SET_ACTIVE_TABSET = "FlexLayout_SetActiveTabset";
548
+ static ADJUST_SPLIT = "FlexLayout_AdjustSplit";
549
+ static ADJUST_BORDER_SPLIT = "FlexLayout_AdjustBorderSplit";
550
+ static MAXIMIZE_TOGGLE = "FlexLayout_MaximizeToggle";
551
+ static UPDATE_MODEL_ATTRIBUTES = "FlexLayout_UpdateModelAttributes";
552
+ static UPDATE_NODE_ATTRIBUTES = "FlexLayout_UpdateNodeAttributes";
553
+ static FLOAT_TAB = "FlexLayout_FloatTab";
554
+ static UNFLOAT_TAB = "FlexLayout_UnFloatTab";
556
555
  /**
557
556
  * Adds a tab node to the given tabset node
558
557
  * @param json the json for the new tab node e.g {type:"tab", component:"table"}
@@ -688,15 +687,16 @@ var Actions = class _Actions {
688
687
 
689
688
  // src/Attribute.ts
690
689
  var Attribute = class {
691
- static {
692
- this.NUMBER = "number";
693
- }
694
- static {
695
- this.STRING = "string";
696
- }
697
- static {
698
- this.BOOLEAN = "boolean";
699
- }
690
+ static NUMBER = "number";
691
+ static STRING = "string";
692
+ static BOOLEAN = "boolean";
693
+ name;
694
+ modelName;
695
+ defaultValue;
696
+ alwaysWriteJson;
697
+ type;
698
+ required;
699
+ fixed;
700
700
  constructor(name, modelName, defaultValue, alwaysWriteJson) {
701
701
  this.name = name;
702
702
  this.modelName = modelName;
@@ -722,6 +722,8 @@ var Attribute = class {
722
722
 
723
723
  // src/AttributeDefinitions.ts
724
724
  var AttributeDefinitions = class {
725
+ attributes;
726
+ nameToAttribute;
725
727
  constructor() {
726
728
  this.attributes = [];
727
729
  this.nameToAttribute = {};
@@ -817,6 +819,11 @@ var AttributeDefinitions = class {
817
819
 
818
820
  // src/DropInfo.ts
819
821
  var DropInfo = class {
822
+ node;
823
+ rect;
824
+ location;
825
+ index;
826
+ className;
820
827
  constructor(node, rect, location, index, className) {
821
828
  this.node = node;
822
829
  this.rect = rect;
@@ -910,12 +917,28 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
910
917
 
911
918
  // src/model/Node.ts
912
919
  var Node = class {
920
+ /** @internal */
921
+ _model;
922
+ /** @internal */
923
+ _attributes;
924
+ /** @internal */
925
+ _parent;
926
+ /** @internal */
927
+ _children;
928
+ /** @internal */
929
+ _fixed;
930
+ /** @internal */
931
+ _rect;
932
+ /** @internal */
933
+ _visible;
934
+ /** @internal */
935
+ _listeners;
936
+ /** @internal */
937
+ _dirty = false;
938
+ /** @internal */
939
+ _tempSize = 0;
913
940
  /** @internal */
914
941
  constructor(model) {
915
- /** @internal */
916
- this._dirty = false;
917
- /** @internal */
918
- this._tempSize = 0;
919
942
  this._model = model;
920
943
  this._attributes = {};
921
944
  this._children = [];
@@ -1126,9 +1149,7 @@ var Node = class {
1126
1149
 
1127
1150
  // src/model/SplitterNode.ts
1128
1151
  var SplitterNode = class _SplitterNode extends Node {
1129
- static {
1130
- this.TYPE = "splitter";
1131
- }
1152
+ static TYPE = "splitter";
1132
1153
  /** @internal */
1133
1154
  constructor(model) {
1134
1155
  super(model);
@@ -1193,18 +1214,14 @@ var SplitterNode = class _SplitterNode extends Node {
1193
1214
 
1194
1215
  // src/model/TabNode.ts
1195
1216
  var TabNode = class _TabNode extends Node {
1196
- static {
1197
- this.TYPE = "tab";
1198
- }
1217
+ static TYPE = "tab";
1199
1218
  /** @internal */
1200
1219
  static _fromJson(json, model, addToModel = true) {
1201
1220
  const newLayoutNode = new _TabNode(model, json, addToModel);
1202
1221
  return newLayoutNode;
1203
1222
  }
1204
- static {
1205
- /** @internal */
1206
- this._attributeDefinitions = _TabNode._createAttributeDefinitions();
1207
- }
1223
+ /** @internal */
1224
+ static _attributeDefinitions = _TabNode._createAttributeDefinitions();
1208
1225
  /** @internal */
1209
1226
  static _createAttributeDefinitions() {
1210
1227
  const attributeDefinitions = new AttributeDefinitions();
@@ -1231,6 +1248,14 @@ var TabNode = class _TabNode extends Node {
1231
1248
  return attributeDefinitions;
1232
1249
  }
1233
1250
  /** @internal */
1251
+ _tabRect;
1252
+ /** @internal */
1253
+ _renderedName;
1254
+ /** @internal */
1255
+ _extra;
1256
+ /** @internal */
1257
+ _window;
1258
+ /** @internal */
1234
1259
  constructor(model, json, addToModel = true) {
1235
1260
  super(model);
1236
1261
  this._extra = {};
@@ -1585,9 +1610,7 @@ function ulid(seedTime, prng) {
1585
1610
 
1586
1611
  // src/model/RowNode.ts
1587
1612
  var RowNode = class _RowNode extends Node {
1588
- static {
1589
- this.TYPE = "row";
1590
- }
1613
+ static TYPE = "row";
1591
1614
  /** @internal */
1592
1615
  static _fromJson(json, model) {
1593
1616
  const newLayoutNode = new _RowNode(model, json);
@@ -1604,10 +1627,8 @@ var RowNode = class _RowNode extends Node {
1604
1627
  }
1605
1628
  return newLayoutNode;
1606
1629
  }
1607
- static {
1608
- /** @internal */
1609
- this._attributeDefinitions = _RowNode._createAttributeDefinitions();
1610
- }
1630
+ /** @internal */
1631
+ static _attributeDefinitions = _RowNode._createAttributeDefinitions();
1611
1632
  /** @internal */
1612
1633
  static _createAttributeDefinitions() {
1613
1634
  const attributeDefinitions = new AttributeDefinitions();
@@ -1619,6 +1640,12 @@ var RowNode = class _RowNode extends Node {
1619
1640
  return attributeDefinitions;
1620
1641
  }
1621
1642
  /** @internal */
1643
+ _drawChildren;
1644
+ /** @internal */
1645
+ _minHeight;
1646
+ /** @internal */
1647
+ _minWidth;
1648
+ /** @internal */
1622
1649
  constructor(model, json) {
1623
1650
  super(model);
1624
1651
  this._dirty = true;
@@ -2047,9 +2074,7 @@ var RowNode = class _RowNode extends Node {
2047
2074
 
2048
2075
  // src/model/TabSetNode.ts
2049
2076
  var TabSetNode = class _TabSetNode extends Node {
2050
- static {
2051
- this.TYPE = "tabset";
2052
- }
2077
+ static TYPE = "tabset";
2053
2078
  /** @internal */
2054
2079
  static _fromJson(json, model) {
2055
2080
  const newLayoutNode = new _TabSetNode(model, json);
@@ -2070,10 +2095,8 @@ var TabSetNode = class _TabSetNode extends Node {
2070
2095
  }
2071
2096
  return newLayoutNode;
2072
2097
  }
2073
- static {
2074
- /** @internal */
2075
- this._attributeDefinitions = _TabSetNode._createAttributeDefinitions();
2076
- }
2098
+ /** @internal */
2099
+ static _attributeDefinitions = _TabSetNode._createAttributeDefinitions();
2077
2100
  /** @internal */
2078
2101
  static _createAttributeDefinitions() {
2079
2102
  const attributeDefinitions = new AttributeDefinitions();
@@ -2106,6 +2129,14 @@ var TabSetNode = class _TabSetNode extends Node {
2106
2129
  return attributeDefinitions;
2107
2130
  }
2108
2131
  /** @internal */
2132
+ _contentRect;
2133
+ /** @internal */
2134
+ _tabHeaderRect;
2135
+ /** @internal */
2136
+ _calculatedTabBarHeight;
2137
+ /** @internal */
2138
+ _calculatedHeaderBarHeight;
2139
+ /** @internal */
2109
2140
  constructor(model, json) {
2110
2141
  super(model);
2111
2142
  _TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
@@ -2515,22 +2546,7 @@ function randomUUID() {
2515
2546
 
2516
2547
  // src/model/BorderNode.ts
2517
2548
  var BorderNode = class _BorderNode extends Node {
2518
- /** @internal */
2519
- constructor(location, json, model) {
2520
- super(model);
2521
- /** @internal */
2522
- this._adjustedSize = 0;
2523
- /** @internal */
2524
- this._calculatedBorderBarSize = 0;
2525
- this._location = location;
2526
- this._drawChildren = [];
2527
- this._attributes.id = `border_${location.getName()}`;
2528
- _BorderNode._attributeDefinitions.fromJson(json, this._attributes);
2529
- model._addNode(this);
2530
- }
2531
- static {
2532
- this.TYPE = "border";
2533
- }
2549
+ static TYPE = "border";
2534
2550
  /** @internal */
2535
2551
  static _fromJson(json, model) {
2536
2552
  const location = DockLocation.getByName(json.location);
@@ -2544,10 +2560,8 @@ var BorderNode = class _BorderNode extends Node {
2544
2560
  }
2545
2561
  return border;
2546
2562
  }
2547
- static {
2548
- /** @internal */
2549
- this._attributeDefinitions = _BorderNode._createAttributeDefinitions();
2550
- }
2563
+ /** @internal */
2564
+ static _attributeDefinitions = _BorderNode._createAttributeDefinitions();
2551
2565
  /** @internal */
2552
2566
  static _createAttributeDefinitions() {
2553
2567
  const attributeDefinitions = new AttributeDefinitions();
@@ -2565,6 +2579,27 @@ var BorderNode = class _BorderNode extends Node {
2565
2579
  attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(Attribute.BOOLEAN);
2566
2580
  return attributeDefinitions;
2567
2581
  }
2582
+ /** @internal */
2583
+ _contentRect;
2584
+ /** @internal */
2585
+ _tabHeaderRect;
2586
+ /** @internal */
2587
+ _location;
2588
+ /** @internal */
2589
+ _drawChildren;
2590
+ /** @internal */
2591
+ _adjustedSize = 0;
2592
+ /** @internal */
2593
+ _calculatedBorderBarSize = 0;
2594
+ /** @internal */
2595
+ constructor(location, json, model) {
2596
+ super(model);
2597
+ this._location = location;
2598
+ this._drawChildren = [];
2599
+ this._attributes.id = `border_${location.getName()}`;
2600
+ _BorderNode._attributeDefinitions.fromJson(json, this._attributes);
2601
+ model._addNode(this);
2602
+ }
2568
2603
  getLocation() {
2569
2604
  return this._location;
2570
2605
  }
@@ -3177,9 +3212,7 @@ function showPopup(triggerElement, items, onSelect, layout, iconFactory, titleFa
3177
3212
  const onElementMouseDown = (event) => {
3178
3213
  event.stopPropagation();
3179
3214
  };
3180
- const onDocMouseDown = (_event) => {
3181
- onHide();
3182
- };
3215
+ const onDocMouseDown = () => onHide();
3183
3216
  elm.addEventListener("mousedown", onElementMouseDown);
3184
3217
  currentDocument.addEventListener("mousedown", onDocMouseDown);
3185
3218
  layout.showPortal(
@@ -4436,307 +4469,62 @@ var defaultIcons = {
4436
4469
  var isDesktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
4437
4470
  var defaultSupportsPopout = isDesktop;
4438
4471
  var Layout = class extends React16.Component {
4472
+ /** @internal */
4473
+ selfRef;
4474
+ /** @internal */
4475
+ findHeaderBarSizeRef;
4476
+ /** @internal */
4477
+ findTabBarSizeRef;
4478
+ /** @internal */
4479
+ findBorderBarSizeRef;
4480
+ /** @internal */
4481
+ previousModel;
4482
+ /** @internal */
4483
+ centerRect;
4484
+ /** @internal */
4485
+ // private start: number = 0;
4486
+ /** @internal */
4487
+ // private layoutTime: number = 0;
4488
+ /** @internal */
4489
+ tabIds;
4490
+ /** @internal */
4491
+ newTabJson;
4492
+ /** @internal */
4493
+ firstMove = false;
4494
+ /** @internal */
4495
+ dragNode;
4496
+ /** @internal */
4497
+ dragDiv;
4498
+ /** @internal */
4499
+ dragRectRendered = true;
4500
+ /** @internal */
4501
+ dragDivText = void 0;
4502
+ /** @internal */
4503
+ dropInfo;
4504
+ /** @internal */
4505
+ customDrop;
4506
+ /** @internal */
4507
+ outlineDiv;
4508
+ /** @internal */
4509
+ edgeRectLength = 100;
4510
+ /** @internal */
4511
+ edgeRectWidth = 10;
4512
+ /** @internal */
4513
+ fnNewNodeDropped;
4514
+ /** @internal */
4515
+ currentDocument;
4516
+ /** @internal */
4517
+ currentWindow;
4518
+ /** @internal */
4519
+ supportsPopout;
4520
+ /** @internal */
4521
+ popoutURL;
4522
+ /** @internal */
4523
+ icons;
4524
+ /** @internal */
4525
+ resizeObserver;
4439
4526
  constructor(props) {
4440
4527
  super(props);
4441
- /** @internal */
4442
- this.firstMove = false;
4443
- /** @internal */
4444
- this.dragRectRendered = true;
4445
- /** @internal */
4446
- this.dragDivText = void 0;
4447
- /** @internal */
4448
- this.edgeRectLength = 100;
4449
- /** @internal */
4450
- this.edgeRectWidth = 10;
4451
- /** @internal */
4452
- this.onModelChange = (action) => {
4453
- this.forceUpdate();
4454
- if (this.props.onModelChange) {
4455
- this.props.onModelChange(this.props.model, action);
4456
- }
4457
- };
4458
- /** @internal */
4459
- this.updateRect = (domRect) => {
4460
- if (!domRect) {
4461
- domRect = this.getDomRect();
4462
- }
4463
- if (!domRect) {
4464
- return;
4465
- }
4466
- const rect = new Rect(0, 0, domRect.width, domRect.height);
4467
- if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
4468
- this.setState({ rect });
4469
- }
4470
- };
4471
- /** @internal */
4472
- this.updateLayoutMetrics = () => {
4473
- if (this.findHeaderBarSizeRef.current) {
4474
- const headerBarSize = this.findHeaderBarSizeRef.current.getBoundingClientRect().height;
4475
- if (headerBarSize !== this.state.calculatedHeaderBarSize) {
4476
- this.setState({ calculatedHeaderBarSize: headerBarSize });
4477
- }
4478
- }
4479
- if (this.findTabBarSizeRef.current) {
4480
- const tabBarSize = this.findTabBarSizeRef.current.getBoundingClientRect().height;
4481
- if (tabBarSize !== this.state.calculatedTabBarSize) {
4482
- this.setState({ calculatedTabBarSize: tabBarSize });
4483
- }
4484
- }
4485
- if (this.findBorderBarSizeRef.current) {
4486
- const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
4487
- if (borderBarSize !== this.state.calculatedBorderBarSize) {
4488
- this.setState({ calculatedBorderBarSize: borderBarSize });
4489
- }
4490
- }
4491
- };
4492
- /** @internal */
4493
- this.getClassName = (defaultClassName) => {
4494
- if (this.props.classNameMapper === void 0) {
4495
- return defaultClassName;
4496
- } else {
4497
- return this.props.classNameMapper(defaultClassName);
4498
- }
4499
- };
4500
- /** @internal */
4501
- this.onCloseWindow = (id) => {
4502
- this.doAction(Actions.unFloatTab(id));
4503
- try {
4504
- this.props.model.getNodeById(id)._setWindow(void 0);
4505
- } catch (e) {
4506
- }
4507
- };
4508
- /** @internal */
4509
- this.onSetWindow = (id, window2) => {
4510
- this.props.model.getNodeById(id)._setWindow(window2);
4511
- };
4512
- /** @internal */
4513
- this.onCancelAdd = () => {
4514
- const rootdiv = this.selfRef.current;
4515
- if (rootdiv && this.dragDiv) {
4516
- rootdiv.removeChild(this.dragDiv);
4517
- }
4518
- this.dragDiv = void 0;
4519
- this.hidePortal();
4520
- if (this.fnNewNodeDropped != null) {
4521
- this.fnNewNodeDropped();
4522
- this.fnNewNodeDropped = void 0;
4523
- }
4524
- try {
4525
- this.customDrop?.invalidated?.();
4526
- } catch (e) {
4527
- console.error(e);
4528
- }
4529
- DragDrop.instance.hideGlass();
4530
- this.newTabJson = void 0;
4531
- this.customDrop = void 0;
4532
- };
4533
- /** @internal */
4534
- this.onCancelDrag = (wasDragging) => {
4535
- if (wasDragging) {
4536
- const rootdiv = this.selfRef.current;
4537
- const outlineDiv = this.outlineDiv;
4538
- if (rootdiv && outlineDiv) {
4539
- try {
4540
- rootdiv.removeChild(outlineDiv);
4541
- } catch (e) {
4542
- }
4543
- }
4544
- const dragDiv = this.dragDiv;
4545
- if (rootdiv && dragDiv) {
4546
- try {
4547
- rootdiv.removeChild(dragDiv);
4548
- } catch (e) {
4549
- }
4550
- }
4551
- this.dragDiv = void 0;
4552
- this.hidePortal();
4553
- this.setState({ showEdges: false });
4554
- if (this.fnNewNodeDropped != null) {
4555
- this.fnNewNodeDropped();
4556
- this.fnNewNodeDropped = void 0;
4557
- }
4558
- try {
4559
- this.customDrop?.invalidated?.();
4560
- } catch (e) {
4561
- console.error(e);
4562
- }
4563
- DragDrop.instance.hideGlass();
4564
- this.newTabJson = void 0;
4565
- this.customDrop = void 0;
4566
- }
4567
- this.setState({ showHiddenBorder: DockLocation.CENTER });
4568
- };
4569
- /** @internal */
4570
- this.onDragDivMouseDown = (event) => {
4571
- event.preventDefault();
4572
- this.dragStart(event, this.dragDivText, TabNode._fromJson(this.newTabJson, this.props.model, false), true, void 0, void 0);
4573
- };
4574
- /** @internal */
4575
- this.dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
4576
- if (!allowDrag) {
4577
- DragDrop.instance.startDrag(event, void 0, void 0, void 0, void 0, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
4578
- } else {
4579
- this.dragNode = node;
4580
- this.dragDivText = dragDivText;
4581
- DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
4582
- }
4583
- };
4584
- /** @internal */
4585
- this.dragRectRender = (text, node, json, onRendered) => {
4586
- let content;
4587
- if (text !== void 0) {
4588
- content = /* @__PURE__ */ React16.createElement("div", { style: { whiteSpace: "pre" } }, text.replace("<br>", "\n"));
4589
- } else {
4590
- if (node && node instanceof TabNode) {
4591
- content = /* @__PURE__ */ React16.createElement(TabButtonStamp, { node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory });
4592
- }
4593
- }
4594
- if (this.props.onRenderDragRect !== void 0) {
4595
- const customContent = this.props.onRenderDragRect(content, node, json);
4596
- if (customContent !== void 0) {
4597
- content = customContent;
4598
- }
4599
- }
4600
- this.dragRectRendered = false;
4601
- const dragDiv = this.dragDiv;
4602
- if (dragDiv) {
4603
- dragDiv.style.visibility = "hidden";
4604
- this.showPortal(
4605
- /* @__PURE__ */ React16.createElement(
4606
- DragRectRenderWrapper,
4607
- {
4608
- onRendered: () => {
4609
- this.dragRectRendered = true;
4610
- onRendered?.();
4611
- }
4612
- },
4613
- content
4614
- ),
4615
- dragDiv
4616
- );
4617
- }
4618
- };
4619
- /** @internal */
4620
- this.showPortal = (control, element) => {
4621
- const portal = createPortal2(control, element);
4622
- this.setState({ portal });
4623
- };
4624
- /** @internal */
4625
- this.hidePortal = () => {
4626
- this.setState({ portal: void 0 });
4627
- };
4628
- /** @internal */
4629
- this.onDragStart = () => {
4630
- this.dropInfo = void 0;
4631
- this.customDrop = void 0;
4632
- const rootdiv = this.selfRef.current;
4633
- this.outlineDiv = this.currentDocument.createElement("div");
4634
- this.outlineDiv.className = this.getClassName("flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
4635
- this.outlineDiv.style.visibility = "hidden";
4636
- if (rootdiv) {
4637
- rootdiv.appendChild(this.outlineDiv);
4638
- }
4639
- if (this.dragDiv == null) {
4640
- this.dragDiv = this.currentDocument.createElement("div");
4641
- this.dragDiv.className = this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */);
4642
- this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
4643
- this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);
4644
- if (rootdiv) {
4645
- rootdiv.appendChild(this.dragDiv);
4646
- }
4647
- }
4648
- if (this.props.model.getMaximizedTabset() === void 0) {
4649
- this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
4650
- }
4651
- if (this.dragNode && this.outlineDiv && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== void 0) {
4652
- this.dragNode.getTabRect()?.positionElement(this.outlineDiv);
4653
- }
4654
- this.firstMove = true;
4655
- return true;
4656
- };
4657
- /** @internal */
4658
- this.onDragMove = (event) => {
4659
- if (this.firstMove === false) {
4660
- const speed = this.props.model._getAttribute("tabDragSpeed");
4661
- if (this.outlineDiv) {
4662
- this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
4663
- }
4664
- }
4665
- this.firstMove = false;
4666
- const clientRect = this.selfRef.current?.getBoundingClientRect();
4667
- const pos = {
4668
- x: event.clientX - (clientRect?.left ?? 0),
4669
- y: event.clientY - (clientRect?.top ?? 0)
4670
- };
4671
- this.checkForBorderToShow(pos.x, pos.y);
4672
- const dragRect = this.dragDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
4673
- let newLeft = pos.x - dragRect.width / 2;
4674
- if (newLeft + dragRect.width > (clientRect?.width ?? 0)) {
4675
- newLeft = (clientRect?.width ?? 0) - dragRect.width;
4676
- }
4677
- newLeft = Math.max(0, newLeft);
4678
- if (this.dragDiv) {
4679
- this.dragDiv.style.left = newLeft + "px";
4680
- this.dragDiv.style.top = pos.y + 5 + "px";
4681
- if (this.dragRectRendered && this.dragDiv.style.visibility === "hidden") {
4682
- this.dragDiv.style.visibility = "visible";
4683
- }
4684
- }
4685
- const dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);
4686
- if (dropInfo) {
4687
- if (this.props.onTabDrag) {
4688
- this.handleCustomTabDrag(dropInfo, pos, event);
4689
- } else {
4690
- this.dropInfo = dropInfo;
4691
- if (this.outlineDiv) {
4692
- this.outlineDiv.className = this.getClassName(dropInfo.className);
4693
- dropInfo.rect.positionElement(this.outlineDiv);
4694
- this.outlineDiv.style.visibility = "visible";
4695
- }
4696
- }
4697
- }
4698
- };
4699
- /** @internal */
4700
- this.onDragEnd = (event) => {
4701
- const rootdiv = this.selfRef.current;
4702
- if (rootdiv) {
4703
- if (this.outlineDiv) {
4704
- rootdiv.removeChild(this.outlineDiv);
4705
- }
4706
- if (this.dragDiv) {
4707
- rootdiv.removeChild(this.dragDiv);
4708
- }
4709
- }
4710
- this.dragDiv = void 0;
4711
- this.hidePortal();
4712
- this.setState({ showEdges: false });
4713
- DragDrop.instance.hideGlass();
4714
- if (this.dropInfo) {
4715
- if (this.customDrop) {
4716
- this.newTabJson = void 0;
4717
- try {
4718
- const { callback, dragging, over, x, y, location } = this.customDrop;
4719
- callback(dragging, over, x, y, location);
4720
- if (this.fnNewNodeDropped != null) {
4721
- this.fnNewNodeDropped();
4722
- this.fnNewNodeDropped = void 0;
4723
- }
4724
- } catch (e) {
4725
- console.error(e);
4726
- }
4727
- } else if (this.newTabJson !== void 0) {
4728
- const newNode = this.doAction(Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
4729
- if (this.fnNewNodeDropped != null) {
4730
- this.fnNewNodeDropped(newNode, event);
4731
- this.fnNewNodeDropped = void 0;
4732
- }
4733
- this.newTabJson = void 0;
4734
- } else if (this.dragNode !== void 0) {
4735
- this.doAction(Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
4736
- }
4737
- }
4738
- this.setState({ showHiddenBorder: DockLocation.CENTER });
4739
- };
4740
4528
  this.props.model._setChangeListener(this.onModelChange);
4741
4529
  this.tabIds = [];
4742
4530
  this.selfRef = React16.createRef();
@@ -4778,6 +4566,13 @@ var Layout = class extends React16.Component {
4778
4566
  return style2;
4779
4567
  }
4780
4568
  /** @internal */
4569
+ onModelChange = (action) => {
4570
+ this.forceUpdate();
4571
+ if (this.props.onModelChange) {
4572
+ this.props.onModelChange(this.props.model, action);
4573
+ }
4574
+ };
4575
+ /** @internal */
4781
4576
  doAction(action) {
4782
4577
  if (this.props.onAction !== void 0) {
4783
4578
  const outcome = this.props.onAction(action);
@@ -4815,6 +4610,48 @@ var Layout = class extends React16.Component {
4815
4610
  }
4816
4611
  }
4817
4612
  /** @internal */
4613
+ updateRect = (domRect) => {
4614
+ if (!domRect) {
4615
+ domRect = this.getDomRect();
4616
+ }
4617
+ if (!domRect) {
4618
+ return;
4619
+ }
4620
+ const rect = new Rect(0, 0, domRect.width, domRect.height);
4621
+ if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
4622
+ this.setState({ rect });
4623
+ }
4624
+ };
4625
+ /** @internal */
4626
+ updateLayoutMetrics = () => {
4627
+ if (this.findHeaderBarSizeRef.current) {
4628
+ const headerBarSize = this.findHeaderBarSizeRef.current.getBoundingClientRect().height;
4629
+ if (headerBarSize !== this.state.calculatedHeaderBarSize) {
4630
+ this.setState({ calculatedHeaderBarSize: headerBarSize });
4631
+ }
4632
+ }
4633
+ if (this.findTabBarSizeRef.current) {
4634
+ const tabBarSize = this.findTabBarSizeRef.current.getBoundingClientRect().height;
4635
+ if (tabBarSize !== this.state.calculatedTabBarSize) {
4636
+ this.setState({ calculatedTabBarSize: tabBarSize });
4637
+ }
4638
+ }
4639
+ if (this.findBorderBarSizeRef.current) {
4640
+ const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
4641
+ if (borderBarSize !== this.state.calculatedBorderBarSize) {
4642
+ this.setState({ calculatedBorderBarSize: borderBarSize });
4643
+ }
4644
+ }
4645
+ };
4646
+ /** @internal */
4647
+ getClassName = (defaultClassName) => {
4648
+ if (this.props.classNameMapper === void 0) {
4649
+ return defaultClassName;
4650
+ } else {
4651
+ return this.props.classNameMapper(defaultClassName);
4652
+ }
4653
+ };
4654
+ /** @internal */
4818
4655
  getCurrentDocument() {
4819
4656
  return this.currentDocument;
4820
4657
  }
@@ -4955,6 +4792,18 @@ var Layout = class extends React16.Component {
4955
4792
  return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement("div", { key: "findHeaderBarSize", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName("flexlayout__tabset_header_sizer" /* FLEXLAYOUT__TABSET_HEADER_SIZER */) }, "FindHeaderBarSize"), /* @__PURE__ */ React16.createElement("div", { key: "findTabBarSize", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName("flexlayout__tabset_sizer" /* FLEXLAYOUT__TABSET_SIZER */) }, "FindTabBarSize"), /* @__PURE__ */ React16.createElement("div", { key: "findBorderBarSize", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName("flexlayout__border_sizer" /* FLEXLAYOUT__BORDER_SIZER */) }, "FindBorderBarSize"));
4956
4793
  }
4957
4794
  /** @internal */
4795
+ onCloseWindow = (id) => {
4796
+ this.doAction(Actions.unFloatTab(id));
4797
+ try {
4798
+ this.props.model.getNodeById(id)._setWindow(void 0);
4799
+ } catch (e) {
4800
+ }
4801
+ };
4802
+ /** @internal */
4803
+ onSetWindow = (id, window2) => {
4804
+ this.props.model.getNodeById(id)._setWindow(window2);
4805
+ };
4806
+ /** @internal */
4958
4807
  renderBorder(borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {
4959
4808
  for (const border of borderSet.getBorders()) {
4960
4809
  const borderPath = `/border/${border.getLocation().getName()}`;
@@ -5158,6 +5007,234 @@ var Layout = class extends React16.Component {
5158
5007
  rootdiv.appendChild(this.dragDiv);
5159
5008
  }
5160
5009
  /** @internal */
5010
+ onCancelAdd = () => {
5011
+ const rootdiv = this.selfRef.current;
5012
+ if (rootdiv && this.dragDiv) {
5013
+ rootdiv.removeChild(this.dragDiv);
5014
+ }
5015
+ this.dragDiv = void 0;
5016
+ this.hidePortal();
5017
+ if (this.fnNewNodeDropped != null) {
5018
+ this.fnNewNodeDropped();
5019
+ this.fnNewNodeDropped = void 0;
5020
+ }
5021
+ try {
5022
+ this.customDrop?.invalidated?.();
5023
+ } catch (e) {
5024
+ console.error(e);
5025
+ }
5026
+ DragDrop.instance.hideGlass();
5027
+ this.newTabJson = void 0;
5028
+ this.customDrop = void 0;
5029
+ };
5030
+ /** @internal */
5031
+ onCancelDrag = (wasDragging) => {
5032
+ if (wasDragging) {
5033
+ const rootdiv = this.selfRef.current;
5034
+ const outlineDiv = this.outlineDiv;
5035
+ if (rootdiv && outlineDiv) {
5036
+ try {
5037
+ rootdiv.removeChild(outlineDiv);
5038
+ } catch (e) {
5039
+ }
5040
+ }
5041
+ const dragDiv = this.dragDiv;
5042
+ if (rootdiv && dragDiv) {
5043
+ try {
5044
+ rootdiv.removeChild(dragDiv);
5045
+ } catch (e) {
5046
+ }
5047
+ }
5048
+ this.dragDiv = void 0;
5049
+ this.hidePortal();
5050
+ this.setState({ showEdges: false });
5051
+ if (this.fnNewNodeDropped != null) {
5052
+ this.fnNewNodeDropped();
5053
+ this.fnNewNodeDropped = void 0;
5054
+ }
5055
+ try {
5056
+ this.customDrop?.invalidated?.();
5057
+ } catch (e) {
5058
+ console.error(e);
5059
+ }
5060
+ DragDrop.instance.hideGlass();
5061
+ this.newTabJson = void 0;
5062
+ this.customDrop = void 0;
5063
+ }
5064
+ this.setState({ showHiddenBorder: DockLocation.CENTER });
5065
+ };
5066
+ /** @internal */
5067
+ onDragDivMouseDown = (event) => {
5068
+ event.preventDefault();
5069
+ this.dragStart(event, this.dragDivText, TabNode._fromJson(this.newTabJson, this.props.model, false), true, void 0, void 0);
5070
+ };
5071
+ /** @internal */
5072
+ dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
5073
+ if (!allowDrag) {
5074
+ DragDrop.instance.startDrag(event, void 0, void 0, void 0, void 0, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
5075
+ } else {
5076
+ this.dragNode = node;
5077
+ this.dragDivText = dragDivText;
5078
+ DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
5079
+ }
5080
+ };
5081
+ /** @internal */
5082
+ dragRectRender = (text, node, json, onRendered) => {
5083
+ let content;
5084
+ if (text !== void 0) {
5085
+ content = /* @__PURE__ */ React16.createElement("div", { style: { whiteSpace: "pre" } }, text.replace("<br>", "\n"));
5086
+ } else {
5087
+ if (node && node instanceof TabNode) {
5088
+ content = /* @__PURE__ */ React16.createElement(TabButtonStamp, { node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory });
5089
+ }
5090
+ }
5091
+ if (this.props.onRenderDragRect !== void 0) {
5092
+ const customContent = this.props.onRenderDragRect(content, node, json);
5093
+ if (customContent !== void 0) {
5094
+ content = customContent;
5095
+ }
5096
+ }
5097
+ this.dragRectRendered = false;
5098
+ const dragDiv = this.dragDiv;
5099
+ if (dragDiv) {
5100
+ dragDiv.style.visibility = "hidden";
5101
+ this.showPortal(
5102
+ /* @__PURE__ */ React16.createElement(
5103
+ DragRectRenderWrapper,
5104
+ {
5105
+ onRendered: () => {
5106
+ this.dragRectRendered = true;
5107
+ onRendered?.();
5108
+ }
5109
+ },
5110
+ content
5111
+ ),
5112
+ dragDiv
5113
+ );
5114
+ }
5115
+ };
5116
+ /** @internal */
5117
+ showPortal = (control, element) => {
5118
+ const portal = createPortal2(control, element);
5119
+ this.setState({ portal });
5120
+ };
5121
+ /** @internal */
5122
+ hidePortal = () => {
5123
+ this.setState({ portal: void 0 });
5124
+ };
5125
+ /** @internal */
5126
+ onDragStart = () => {
5127
+ this.dropInfo = void 0;
5128
+ this.customDrop = void 0;
5129
+ const rootdiv = this.selfRef.current;
5130
+ this.outlineDiv = this.currentDocument.createElement("div");
5131
+ this.outlineDiv.className = this.getClassName("flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
5132
+ this.outlineDiv.style.visibility = "hidden";
5133
+ if (rootdiv) {
5134
+ rootdiv.appendChild(this.outlineDiv);
5135
+ }
5136
+ if (this.dragDiv == null) {
5137
+ this.dragDiv = this.currentDocument.createElement("div");
5138
+ this.dragDiv.className = this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */);
5139
+ this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
5140
+ this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);
5141
+ if (rootdiv) {
5142
+ rootdiv.appendChild(this.dragDiv);
5143
+ }
5144
+ }
5145
+ if (this.props.model.getMaximizedTabset() === void 0) {
5146
+ this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
5147
+ }
5148
+ if (this.dragNode && this.outlineDiv && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== void 0) {
5149
+ this.dragNode.getTabRect()?.positionElement(this.outlineDiv);
5150
+ }
5151
+ this.firstMove = true;
5152
+ return true;
5153
+ };
5154
+ /** @internal */
5155
+ onDragMove = (event) => {
5156
+ if (this.firstMove === false) {
5157
+ const speed = this.props.model._getAttribute("tabDragSpeed");
5158
+ if (this.outlineDiv) {
5159
+ this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
5160
+ }
5161
+ }
5162
+ this.firstMove = false;
5163
+ const clientRect = this.selfRef.current?.getBoundingClientRect();
5164
+ const pos = {
5165
+ x: event.clientX - (clientRect?.left ?? 0),
5166
+ y: event.clientY - (clientRect?.top ?? 0)
5167
+ };
5168
+ this.checkForBorderToShow(pos.x, pos.y);
5169
+ const dragRect = this.dragDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
5170
+ let newLeft = pos.x - dragRect.width / 2;
5171
+ if (newLeft + dragRect.width > (clientRect?.width ?? 0)) {
5172
+ newLeft = (clientRect?.width ?? 0) - dragRect.width;
5173
+ }
5174
+ newLeft = Math.max(0, newLeft);
5175
+ if (this.dragDiv) {
5176
+ this.dragDiv.style.left = newLeft + "px";
5177
+ this.dragDiv.style.top = pos.y + 5 + "px";
5178
+ if (this.dragRectRendered && this.dragDiv.style.visibility === "hidden") {
5179
+ this.dragDiv.style.visibility = "visible";
5180
+ }
5181
+ }
5182
+ const dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);
5183
+ if (dropInfo) {
5184
+ if (this.props.onTabDrag) {
5185
+ this.handleCustomTabDrag(dropInfo, pos, event);
5186
+ } else {
5187
+ this.dropInfo = dropInfo;
5188
+ if (this.outlineDiv) {
5189
+ this.outlineDiv.className = this.getClassName(dropInfo.className);
5190
+ dropInfo.rect.positionElement(this.outlineDiv);
5191
+ this.outlineDiv.style.visibility = "visible";
5192
+ }
5193
+ }
5194
+ }
5195
+ };
5196
+ /** @internal */
5197
+ onDragEnd = (event) => {
5198
+ const rootdiv = this.selfRef.current;
5199
+ if (rootdiv) {
5200
+ if (this.outlineDiv) {
5201
+ rootdiv.removeChild(this.outlineDiv);
5202
+ }
5203
+ if (this.dragDiv) {
5204
+ rootdiv.removeChild(this.dragDiv);
5205
+ }
5206
+ }
5207
+ this.dragDiv = void 0;
5208
+ this.hidePortal();
5209
+ this.setState({ showEdges: false });
5210
+ DragDrop.instance.hideGlass();
5211
+ if (this.dropInfo) {
5212
+ if (this.customDrop) {
5213
+ this.newTabJson = void 0;
5214
+ try {
5215
+ const { callback, dragging, over, x, y, location } = this.customDrop;
5216
+ callback(dragging, over, x, y, location);
5217
+ if (this.fnNewNodeDropped != null) {
5218
+ this.fnNewNodeDropped();
5219
+ this.fnNewNodeDropped = void 0;
5220
+ }
5221
+ } catch (e) {
5222
+ console.error(e);
5223
+ }
5224
+ } else if (this.newTabJson !== void 0) {
5225
+ const newNode = this.doAction(Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
5226
+ if (this.fnNewNodeDropped != null) {
5227
+ this.fnNewNodeDropped(newNode, event);
5228
+ this.fnNewNodeDropped = void 0;
5229
+ }
5230
+ this.newTabJson = void 0;
5231
+ } else if (this.dragNode !== void 0) {
5232
+ this.doAction(Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
5233
+ }
5234
+ }
5235
+ this.setState({ showHiddenBorder: DockLocation.CENTER });
5236
+ };
5237
+ /** @internal */
5161
5238
  handleCustomTabDrag(dropInfo, pos, event) {
5162
5239
  let invalidated = this.customDrop?.invalidated;
5163
5240
  const currentCallback = this.customDrop?.callback;
@@ -5318,6 +5395,10 @@ var BorderSet = class _BorderSet {
5318
5395
  return borderSet;
5319
5396
  }
5320
5397
  /** @internal */
5398
+ _model;
5399
+ /** @internal */
5400
+ _borders;
5401
+ /** @internal */
5321
5402
  constructor(model) {
5322
5403
  this._model = model;
5323
5404
  this._borders = [];
@@ -5420,19 +5501,6 @@ var BorderSet = class _BorderSet {
5420
5501
 
5421
5502
  // src/model/Model.ts
5422
5503
  var Model = class _Model {
5423
- /**
5424
- * 'private' constructor. Use the static method Model.fromJson(json) to create a model
5425
- * @internal
5426
- */
5427
- constructor() {
5428
- /** @internal */
5429
- this._borderRects = { inner: Rect.empty(), outer: Rect.empty() };
5430
- this._attributes = {};
5431
- this._idMap = {};
5432
- this._borders = new BorderSet(this);
5433
- this._pointerFine = true;
5434
- this._showHiddenBorder = DockLocation.CENTER;
5435
- }
5436
5504
  /**
5437
5505
  * Loads the model from the given json object
5438
5506
  * @param json the json model to load
@@ -5448,10 +5516,8 @@ var Model = class _Model {
5448
5516
  model._tidy();
5449
5517
  return model;
5450
5518
  }
5451
- static {
5452
- /** @internal */
5453
- this._attributeDefinitions = _Model._createAttributeDefinitions();
5454
- }
5519
+ /** @internal */
5520
+ static _attributeDefinitions = _Model._createAttributeDefinitions();
5455
5521
  /** @internal */
5456
5522
  static _createAttributeDefinitions() {
5457
5523
  const attributeDefinitions = new AttributeDefinitions();
@@ -5504,6 +5570,41 @@ var Model = class _Model {
5504
5570
  return attributeDefinitions;
5505
5571
  }
5506
5572
  /** @internal */
5573
+ _attributes;
5574
+ /** @internal */
5575
+ _idMap;
5576
+ /** @internal */
5577
+ _changeListener;
5578
+ /** @internal */
5579
+ _root;
5580
+ /** @internal */
5581
+ _borders;
5582
+ /** @internal */
5583
+ _onAllowDrop;
5584
+ /** @internal */
5585
+ _maximizedTabSet;
5586
+ /** @internal */
5587
+ _activeTabSet;
5588
+ /** @internal */
5589
+ _borderRects = { inner: Rect.empty(), outer: Rect.empty() };
5590
+ /** @internal */
5591
+ _pointerFine;
5592
+ /** @internal */
5593
+ _onCreateTabSet;
5594
+ /** @internal */
5595
+ _showHiddenBorder;
5596
+ /**
5597
+ * 'private' constructor. Use the static method Model.fromJson(json) to create a model
5598
+ * @internal
5599
+ */
5600
+ constructor() {
5601
+ this._attributes = {};
5602
+ this._idMap = {};
5603
+ this._borders = new BorderSet(this);
5604
+ this._pointerFine = true;
5605
+ this._showHiddenBorder = DockLocation.CENTER;
5606
+ }
5607
+ /** @internal */
5507
5608
  _setChangeListener(listener) {
5508
5609
  this._changeListener = listener;
5509
5610
  }