@aptre/flex-layout 0.2.1 → 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 (74) 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 +819 -510
  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/model/Utils.d.ts +1 -1
  16. package/dist/view/Layout.d.ts +10 -10
  17. package/package.json +32 -20
  18. package/tsconfig.json +5 -3
  19. package/typedoc/assets/icons.js +15 -0
  20. package/typedoc/assets/icons.svg +1 -0
  21. package/typedoc/assets/main.js +4 -4
  22. package/typedoc/assets/style.css +40 -22
  23. package/typedoc/classes/Action.html +4 -4
  24. package/typedoc/classes/Actions.html +63 -63
  25. package/typedoc/classes/BorderNode.html +29 -29
  26. package/typedoc/classes/BorderSet.html +2 -2
  27. package/typedoc/classes/DockLocation.html +10 -10
  28. package/typedoc/classes/DragDrop.html +10 -10
  29. package/typedoc/classes/DropInfo.html +7 -7
  30. package/typedoc/classes/Layout.html +87 -82
  31. package/typedoc/classes/Model.html +41 -41
  32. package/typedoc/classes/Node.html +12 -12
  33. package/typedoc/classes/Orientation.html +6 -6
  34. package/typedoc/classes/Rect.html +19 -19
  35. package/typedoc/classes/RowNode.html +17 -17
  36. package/typedoc/classes/SplitterNode.html +13 -13
  37. package/typedoc/classes/TabNode.html +33 -33
  38. package/typedoc/classes/TabSetNode.html +40 -40
  39. package/typedoc/enums/CLASSES.html +78 -78
  40. package/typedoc/enums/I18nLabel.html +13 -13
  41. package/typedoc/enums/ICloseType.html +4 -4
  42. package/typedoc/hierarchy.html +1 -0
  43. package/typedoc/index.html +51 -51
  44. package/typedoc/interfaces/IBorderAttributes.html +13 -13
  45. package/typedoc/interfaces/ICustomDropDestination.html +10 -10
  46. package/typedoc/interfaces/IDraggable.html +1 -1
  47. package/typedoc/interfaces/IDropTarget.html +1 -1
  48. package/typedoc/interfaces/IFontValues.html +5 -5
  49. package/typedoc/interfaces/IGlobalAttributes.html +47 -47
  50. package/typedoc/interfaces/IIcons.html +8 -8
  51. package/typedoc/interfaces/IJsonBorderNode.html +15 -15
  52. package/typedoc/interfaces/IJsonModel.html +4 -4
  53. package/typedoc/interfaces/IJsonRowNode.html +7 -7
  54. package/typedoc/interfaces/IJsonTabNode.html +21 -21
  55. package/typedoc/interfaces/IJsonTabSetNode.html +30 -30
  56. package/typedoc/interfaces/ILayoutProps.html +25 -25
  57. package/typedoc/interfaces/ILayoutState.html +9 -9
  58. package/typedoc/interfaces/IRowAttributes.html +6 -6
  59. package/typedoc/interfaces/ITabAttributes.html +21 -21
  60. package/typedoc/interfaces/ITabRenderValues.html +5 -5
  61. package/typedoc/interfaces/ITabSetAttributes.html +29 -29
  62. package/typedoc/interfaces/ITabSetRenderValues.html +7 -7
  63. package/typedoc/interfaces/ITitleObject.html +3 -3
  64. package/typedoc/types/CustomDragCallback.html +1 -1
  65. package/typedoc/types/DragRectRenderCallback.html +1 -1
  66. package/typedoc/types/FloatingTabPlaceholderRenderCallback.html +1 -1
  67. package/typedoc/types/IBorderLocation.html +1 -1
  68. package/typedoc/types/IInsets.html +1 -1
  69. package/typedoc/types/ITabLocation.html +1 -1
  70. package/typedoc/types/IconFactory.html +1 -1
  71. package/typedoc/types/NodeMouseEvent.html +1 -1
  72. package/typedoc/types/ShowOverflowMenuCallback.html +1 -1
  73. package/typedoc/types/TabSetPlaceHolderCallback.html +1 -1
  74. 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;
@@ -41,7 +43,7 @@ var Rect = class _Rect {
41
43
  this.height = height;
42
44
  }
43
45
  static fromElement(element) {
44
- let { x, y, width, height } = element.getBoundingClientRect();
46
+ const { x, y, width, height } = element.getBoundingClientRect();
45
47
  return new _Rect(x, y, width, height);
46
48
  }
47
49
  clone() {
@@ -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 = {};
@@ -768,7 +770,7 @@ var AttributeDefinitions = class {
768
770
  }
769
771
  update(jsonObj, obj) {
770
772
  for (const attr of this.attributes) {
771
- if (jsonObj.hasOwnProperty(attr.name)) {
773
+ if (attr.name in jsonObj) {
772
774
  const fromValue = jsonObj[attr.name];
773
775
  if (fromValue === void 0) {
774
776
  delete obj[attr.name];
@@ -801,7 +803,7 @@ var AttributeDefinitions = class {
801
803
  defaultValue = attr.defaultValue;
802
804
  type = attr.type;
803
805
  }
804
- let defValue = JSON.stringify(defaultValue);
806
+ const defValue = JSON.stringify(defaultValue);
805
807
  const required = attr.required || attr.fixed ? "" : "?";
806
808
  if (c.fixed) {
807
809
  lines.push(" " + c.name + ": " + defValue + ";");
@@ -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,27 +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
- /** @internal */
1197
- constructor(model, json, addToModel = true) {
1198
- super(model);
1199
- this._extra = {};
1200
- _TabNode._attributeDefinitions.fromJson(json, this._attributes);
1201
- if (addToModel === true) {
1202
- model._addNode(this);
1203
- }
1204
- }
1205
- static {
1206
- this.TYPE = "tab";
1207
- }
1217
+ static TYPE = "tab";
1208
1218
  /** @internal */
1209
1219
  static _fromJson(json, model, addToModel = true) {
1210
1220
  const newLayoutNode = new _TabNode(model, json, addToModel);
1211
1221
  return newLayoutNode;
1212
1222
  }
1213
- static {
1214
- /** @internal */
1215
- this._attributeDefinitions = _TabNode._createAttributeDefinitions();
1216
- }
1223
+ /** @internal */
1224
+ static _attributeDefinitions = _TabNode._createAttributeDefinitions();
1217
1225
  /** @internal */
1218
1226
  static _createAttributeDefinitions() {
1219
1227
  const attributeDefinitions = new AttributeDefinitions();
@@ -1239,6 +1247,23 @@ var TabNode = class _TabNode extends Node {
1239
1247
  attributeDefinitions.addInherited("borderHeight", "tabBorderHeight").setType(Attribute.NUMBER);
1240
1248
  return attributeDefinitions;
1241
1249
  }
1250
+ /** @internal */
1251
+ _tabRect;
1252
+ /** @internal */
1253
+ _renderedName;
1254
+ /** @internal */
1255
+ _extra;
1256
+ /** @internal */
1257
+ _window;
1258
+ /** @internal */
1259
+ constructor(model, json, addToModel = true) {
1260
+ super(model);
1261
+ this._extra = {};
1262
+ _TabNode._attributeDefinitions.fromJson(json, this._attributes);
1263
+ if (addToModel === true) {
1264
+ model._addNode(this);
1265
+ }
1266
+ }
1242
1267
  getWindow() {
1243
1268
  return this._window;
1244
1269
  }
@@ -1374,21 +1399,218 @@ var TabNode = class _TabNode extends Node {
1374
1399
  }
1375
1400
  };
1376
1401
 
1377
- // src/model/RowNode.ts
1378
- var RowNode = class _RowNode extends Node {
1379
- /** @internal */
1380
- constructor(model, json) {
1381
- super(model);
1382
- this._dirty = true;
1383
- this._drawChildren = [];
1384
- this._minHeight = 0;
1385
- this._minWidth = 0;
1386
- _RowNode._attributeDefinitions.fromJson(json, this._attributes);
1387
- model._addNode(this);
1402
+ // node_modules/layerr/dist/error.js
1403
+ function assertError(err) {
1404
+ if (!isError(err)) {
1405
+ throw new Error("Parameter was not an error");
1406
+ }
1407
+ }
1408
+ function isError(err) {
1409
+ return objectToString(err) === "[object Error]" || err instanceof Error;
1410
+ }
1411
+ function objectToString(obj) {
1412
+ return Object.prototype.toString.call(obj);
1413
+ }
1414
+
1415
+ // node_modules/layerr/dist/tools.js
1416
+ function parseArguments(args) {
1417
+ let options, shortMessage = "";
1418
+ if (args.length === 0) {
1419
+ options = {};
1420
+ } else if (isError(args[0])) {
1421
+ options = {
1422
+ cause: args[0]
1423
+ };
1424
+ shortMessage = args.slice(1).join(" ") || "";
1425
+ } else if (args[0] && typeof args[0] === "object") {
1426
+ options = Object.assign({}, args[0]);
1427
+ shortMessage = args.slice(1).join(" ") || "";
1428
+ } else if (typeof args[0] === "string") {
1429
+ options = {};
1430
+ shortMessage = shortMessage = args.join(" ") || "";
1431
+ } else {
1432
+ throw new Error("Invalid arguments passed to Layerr");
1433
+ }
1434
+ return {
1435
+ options,
1436
+ shortMessage
1437
+ };
1438
+ }
1439
+
1440
+ // node_modules/layerr/dist/layerr.js
1441
+ var Layerr = class _Layerr extends Error {
1442
+ constructor(errorOptionsOrMessage, messageText) {
1443
+ const args = [...arguments];
1444
+ const { options, shortMessage } = parseArguments(args);
1445
+ let message = shortMessage;
1446
+ if (options.cause) {
1447
+ message = `${message}: ${options.cause.message}`;
1448
+ }
1449
+ super(message);
1450
+ this.message = message;
1451
+ if (options.name && typeof options.name === "string") {
1452
+ this.name = options.name;
1453
+ } else {
1454
+ this.name = "Layerr";
1455
+ }
1456
+ if (options.cause) {
1457
+ Object.defineProperty(this, "_cause", { value: options.cause });
1458
+ }
1459
+ Object.defineProperty(this, "_info", { value: {} });
1460
+ if (options.info && typeof options.info === "object") {
1461
+ Object.assign(this._info, options.info);
1462
+ }
1463
+ if (Error.captureStackTrace) {
1464
+ const ctor = options.constructorOpt || this.constructor;
1465
+ Error.captureStackTrace(this, ctor);
1466
+ }
1467
+ }
1468
+ static cause(err) {
1469
+ assertError(err);
1470
+ if (!err._cause)
1471
+ return null;
1472
+ return isError(err._cause) ? err._cause : null;
1473
+ }
1474
+ static fullStack(err) {
1475
+ assertError(err);
1476
+ const cause = _Layerr.cause(err);
1477
+ if (cause) {
1478
+ return `${err.stack}
1479
+ caused by: ${_Layerr.fullStack(cause)}`;
1480
+ }
1481
+ return err.stack;
1482
+ }
1483
+ static info(err) {
1484
+ assertError(err);
1485
+ const output = {};
1486
+ const cause = _Layerr.cause(err);
1487
+ if (cause) {
1488
+ Object.assign(output, _Layerr.info(cause));
1489
+ }
1490
+ if (err._info) {
1491
+ Object.assign(output, err._info);
1492
+ }
1493
+ return output;
1494
+ }
1495
+ cause() {
1496
+ return _Layerr.cause(this);
1497
+ }
1498
+ toString() {
1499
+ let output = this.name || this.constructor.name || this.constructor.prototype.name;
1500
+ if (this.message) {
1501
+ output = `${output}: ${this.message}`;
1502
+ }
1503
+ return output;
1388
1504
  }
1389
- static {
1390
- this.TYPE = "row";
1505
+ };
1506
+
1507
+ // node_modules/ulidx/dist/browser/index.js
1508
+ var ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
1509
+ var ENCODING_LEN = 32;
1510
+ var TIME_MAX = 281474976710655;
1511
+ var TIME_LEN = 10;
1512
+ var RANDOM_LEN = 16;
1513
+ var ERROR_INFO = Object.freeze({
1514
+ source: "ulid"
1515
+ });
1516
+ function detectPRNG(root) {
1517
+ const rootLookup = root || detectRoot();
1518
+ const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || null;
1519
+ if (typeof globalCrypto?.getRandomValues === "function") {
1520
+ return () => {
1521
+ const buffer = new Uint8Array(1);
1522
+ globalCrypto.getRandomValues(buffer);
1523
+ return buffer[0] / 255;
1524
+ };
1525
+ } else if (typeof globalCrypto?.randomBytes === "function") {
1526
+ return () => globalCrypto.randomBytes(1).readUInt8() / 255;
1527
+ } else
1528
+ ;
1529
+ throw new Layerr({
1530
+ info: {
1531
+ code: "PRNG_DETECT",
1532
+ ...ERROR_INFO
1533
+ }
1534
+ }, "Failed to find a reliable PRNG");
1535
+ }
1536
+ function detectRoot() {
1537
+ if (inWebWorker())
1538
+ return self;
1539
+ if (typeof window !== "undefined") {
1540
+ return window;
1541
+ }
1542
+ if (typeof global !== "undefined") {
1543
+ return global;
1544
+ }
1545
+ if (typeof globalThis !== "undefined") {
1546
+ return globalThis;
1547
+ }
1548
+ return null;
1549
+ }
1550
+ function encodeRandom(len, prng) {
1551
+ let str = "";
1552
+ for (; len > 0; len--) {
1553
+ str = randomChar(prng) + str;
1554
+ }
1555
+ return str;
1556
+ }
1557
+ function encodeTime(now, len) {
1558
+ if (isNaN(now)) {
1559
+ throw new Layerr({
1560
+ info: {
1561
+ code: "ENC_TIME_NAN",
1562
+ ...ERROR_INFO
1563
+ }
1564
+ }, `Time must be a number: ${now}`);
1565
+ } else if (now > TIME_MAX) {
1566
+ throw new Layerr({
1567
+ info: {
1568
+ code: "ENC_TIME_SIZE_EXCEED",
1569
+ ...ERROR_INFO
1570
+ }
1571
+ }, `Cannot encode a time larger than ${TIME_MAX}: ${now}`);
1572
+ } else if (now < 0) {
1573
+ throw new Layerr({
1574
+ info: {
1575
+ code: "ENC_TIME_NEG",
1576
+ ...ERROR_INFO
1577
+ }
1578
+ }, `Time must be positive: ${now}`);
1579
+ } else if (Number.isInteger(now) === false) {
1580
+ throw new Layerr({
1581
+ info: {
1582
+ code: "ENC_TIME_TYPE",
1583
+ ...ERROR_INFO
1584
+ }
1585
+ }, `Time must be an integer: ${now}`);
1586
+ }
1587
+ let mod, str = "";
1588
+ for (let currentLen = len; currentLen > 0; currentLen--) {
1589
+ mod = now % ENCODING_LEN;
1590
+ str = ENCODING.charAt(mod) + str;
1591
+ now = (now - mod) / ENCODING_LEN;
1592
+ }
1593
+ return str;
1594
+ }
1595
+ function inWebWorker() {
1596
+ return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
1597
+ }
1598
+ function randomChar(prng) {
1599
+ let rand = Math.floor(prng() * ENCODING_LEN);
1600
+ if (rand === ENCODING_LEN) {
1601
+ rand = ENCODING_LEN - 1;
1391
1602
  }
1603
+ return ENCODING.charAt(rand);
1604
+ }
1605
+ function ulid(seedTime, prng) {
1606
+ const currentPRNG = prng || detectPRNG();
1607
+ const seed = isNaN(seedTime) ? Date.now() : seedTime;
1608
+ return encodeTime(seed, TIME_LEN) + encodeRandom(RANDOM_LEN, currentPRNG);
1609
+ }
1610
+
1611
+ // src/model/RowNode.ts
1612
+ var RowNode = class _RowNode extends Node {
1613
+ static TYPE = "row";
1392
1614
  /** @internal */
1393
1615
  static _fromJson(json, model) {
1394
1616
  const newLayoutNode = new _RowNode(model, json);
@@ -1405,10 +1627,8 @@ var RowNode = class _RowNode extends Node {
1405
1627
  }
1406
1628
  return newLayoutNode;
1407
1629
  }
1408
- static {
1409
- /** @internal */
1410
- this._attributeDefinitions = _RowNode._createAttributeDefinitions();
1411
- }
1630
+ /** @internal */
1631
+ static _attributeDefinitions = _RowNode._createAttributeDefinitions();
1412
1632
  /** @internal */
1413
1633
  static _createAttributeDefinitions() {
1414
1634
  const attributeDefinitions = new AttributeDefinitions();
@@ -1419,6 +1639,22 @@ var RowNode = class _RowNode extends Node {
1419
1639
  attributeDefinitions.add("height", void 0).setType(Attribute.NUMBER);
1420
1640
  return attributeDefinitions;
1421
1641
  }
1642
+ /** @internal */
1643
+ _drawChildren;
1644
+ /** @internal */
1645
+ _minHeight;
1646
+ /** @internal */
1647
+ _minWidth;
1648
+ /** @internal */
1649
+ constructor(model, json) {
1650
+ super(model);
1651
+ this._dirty = true;
1652
+ this._drawChildren = [];
1653
+ this._minHeight = 0;
1654
+ this._minWidth = 0;
1655
+ _RowNode._attributeDefinitions.fromJson(json, this._attributes);
1656
+ model._addNode(this);
1657
+ }
1422
1658
  getWeight() {
1423
1659
  return this._attributes.weight;
1424
1660
  }
@@ -1838,17 +2074,7 @@ var RowNode = class _RowNode extends Node {
1838
2074
 
1839
2075
  // src/model/TabSetNode.ts
1840
2076
  var TabSetNode = class _TabSetNode extends Node {
1841
- /** @internal */
1842
- constructor(model, json) {
1843
- super(model);
1844
- _TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
1845
- model._addNode(this);
1846
- this._calculatedTabBarHeight = 0;
1847
- this._calculatedHeaderBarHeight = 0;
1848
- }
1849
- static {
1850
- this.TYPE = "tabset";
1851
- }
2077
+ static TYPE = "tabset";
1852
2078
  /** @internal */
1853
2079
  static _fromJson(json, model) {
1854
2080
  const newLayoutNode = new _TabSetNode(model, json);
@@ -1869,10 +2095,8 @@ var TabSetNode = class _TabSetNode extends Node {
1869
2095
  }
1870
2096
  return newLayoutNode;
1871
2097
  }
1872
- static {
1873
- /** @internal */
1874
- this._attributeDefinitions = _TabSetNode._createAttributeDefinitions();
1875
- }
2098
+ /** @internal */
2099
+ static _attributeDefinitions = _TabSetNode._createAttributeDefinitions();
1876
2100
  /** @internal */
1877
2101
  static _createAttributeDefinitions() {
1878
2102
  const attributeDefinitions = new AttributeDefinitions();
@@ -1904,6 +2128,22 @@ var TabSetNode = class _TabSetNode extends Node {
1904
2128
  attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN);
1905
2129
  return attributeDefinitions;
1906
2130
  }
2131
+ /** @internal */
2132
+ _contentRect;
2133
+ /** @internal */
2134
+ _tabHeaderRect;
2135
+ /** @internal */
2136
+ _calculatedTabBarHeight;
2137
+ /** @internal */
2138
+ _calculatedHeaderBarHeight;
2139
+ /** @internal */
2140
+ constructor(model, json) {
2141
+ super(model);
2142
+ _TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
2143
+ model._addNode(this);
2144
+ this._calculatedTabBarHeight = 0;
2145
+ this._calculatedHeaderBarHeight = 0;
2146
+ }
1907
2147
  getName() {
1908
2148
  return this._getAttr("name");
1909
2149
  }
@@ -2301,27 +2541,12 @@ function adjustSelectedIndex(parent, removedIndex) {
2301
2541
  }
2302
2542
  }
2303
2543
  function randomUUID() {
2304
- return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
2544
+ return ulid();
2305
2545
  }
2306
2546
 
2307
2547
  // src/model/BorderNode.ts
2308
2548
  var BorderNode = class _BorderNode extends Node {
2309
- /** @internal */
2310
- constructor(location, json, model) {
2311
- super(model);
2312
- /** @internal */
2313
- this._adjustedSize = 0;
2314
- /** @internal */
2315
- this._calculatedBorderBarSize = 0;
2316
- this._location = location;
2317
- this._drawChildren = [];
2318
- this._attributes.id = `border_${location.getName()}`;
2319
- _BorderNode._attributeDefinitions.fromJson(json, this._attributes);
2320
- model._addNode(this);
2321
- }
2322
- static {
2323
- this.TYPE = "border";
2324
- }
2549
+ static TYPE = "border";
2325
2550
  /** @internal */
2326
2551
  static _fromJson(json, model) {
2327
2552
  const location = DockLocation.getByName(json.location);
@@ -2335,10 +2560,8 @@ var BorderNode = class _BorderNode extends Node {
2335
2560
  }
2336
2561
  return border;
2337
2562
  }
2338
- static {
2339
- /** @internal */
2340
- this._attributeDefinitions = _BorderNode._createAttributeDefinitions();
2341
- }
2563
+ /** @internal */
2564
+ static _attributeDefinitions = _BorderNode._createAttributeDefinitions();
2342
2565
  /** @internal */
2343
2566
  static _createAttributeDefinitions() {
2344
2567
  const attributeDefinitions = new AttributeDefinitions();
@@ -2356,6 +2579,27 @@ var BorderNode = class _BorderNode extends Node {
2356
2579
  attributeDefinitions.addInherited("enableAutoHide", "borderEnableAutoHide").setType(Attribute.BOOLEAN);
2357
2580
  return attributeDefinitions;
2358
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
+ }
2359
2603
  getLocation() {
2360
2604
  return this._location;
2361
2605
  }
@@ -2743,7 +2987,7 @@ function getRenderStateEx(layout, node, iconFactory, titleFactory, iconAngle) {
2743
2987
  leadingContent = /* @__PURE__ */ React.createElement("img", { style: { width: "1em", height: "1em" }, src: node.getIcon(), alt: "leadingContent" });
2744
2988
  }
2745
2989
  }
2746
- let buttons = [];
2990
+ const buttons = [];
2747
2991
  const renderState = { leading: leadingContent, content: titleContent, name, buttons };
2748
2992
  layout.customizeTab(node, renderState);
2749
2993
  node._setRenderedName(renderState.name);
@@ -2925,9 +3169,9 @@ var TabButtonStamp = (props) => {
2925
3169
  const { layout, node, iconFactory, titleFactory } = props;
2926
3170
  const selfRef = React3.useRef(null);
2927
3171
  const cm = layout.getClassName;
2928
- let classNames = cm("flexlayout__tab_button_stamp" /* FLEXLAYOUT__TAB_BUTTON_STAMP */);
3172
+ const classNames = cm("flexlayout__tab_button_stamp" /* FLEXLAYOUT__TAB_BUTTON_STAMP */);
2929
3173
  const renderState = getRenderStateEx(layout, node, iconFactory, titleFactory);
2930
- let content = renderState.content ? /* @__PURE__ */ React3.createElement("div", { className: cm("flexlayout__tab_button_content" /* FLEXLAYOUT__TAB_BUTTON_CONTENT */) }, renderState.content) : node._getNameForOverflowMenu();
3174
+ const content = renderState.content ? /* @__PURE__ */ React3.createElement("div", { className: cm("flexlayout__tab_button_content" /* FLEXLAYOUT__TAB_BUTTON_CONTENT */) }, renderState.content) : node._getNameForOverflowMenu();
2931
3175
  const leading = renderState.leading ? /* @__PURE__ */ React3.createElement("div", { className: cm("flexlayout__tab_button_leading" /* FLEXLAYOUT__TAB_BUTTON_LEADING */) }, renderState.leading) : null;
2932
3176
  return /* @__PURE__ */ React3.createElement("div", { ref: selfRef, className: classNames, title: node.getHelpText() }, leading, content);
2933
3177
  };
@@ -2968,9 +3212,7 @@ function showPopup(triggerElement, items, onSelect, layout, iconFactory, titleFa
2968
3212
  const onElementMouseDown = (event) => {
2969
3213
  event.stopPropagation();
2970
3214
  };
2971
- const onDocMouseDown = (_event) => {
2972
- onHide();
2973
- };
3215
+ const onDocMouseDown = () => onHide();
2974
3216
  elm.addEventListener("mousedown", onElementMouseDown);
2975
3217
  currentDocument.addEventListener("mousedown", onDocMouseDown);
2976
3218
  layout.showPortal(
@@ -3068,7 +3310,7 @@ var useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {
3068
3310
  tabsTruncated.current = false;
3069
3311
  }
3070
3312
  const nodeRect = node instanceof TabSetNode ? node.getRect() : node.getTabHeaderRect();
3071
- let lastChild = node.getChildren()[node.getChildren().length - 1];
3313
+ const lastChild = node.getChildren()[node.getChildren().length - 1];
3072
3314
  const stickyButtonsSize = stickyButtonsRef.current === null ? 0 : getSize(stickyButtonsRef.current.getBoundingClientRect());
3073
3315
  if (firstRender.current === true || lastHiddenCount.current === 0 && hiddenTabs.length !== 0 || nodeRect.width !== lastRect.current.width || // incase rect changed between first render and second
3074
3316
  nodeRect.height !== lastRect.current.height) {
@@ -3183,8 +3425,8 @@ var BorderTabSet = (props) => {
3183
3425
  let style2 = border.getTabHeaderRect().styleWithPosition({});
3184
3426
  const tabs = [];
3185
3427
  const layoutTab = (i) => {
3186
- let isSelected = border.getSelected() === i;
3187
- let child = border.getChildren()[i];
3428
+ const isSelected = border.getSelected() === i;
3429
+ const child = border.getChildren()[i];
3188
3430
  tabs.push(
3189
3431
  /* @__PURE__ */ React6.createElement(
3190
3432
  BorderButton,
@@ -3213,7 +3455,7 @@ var BorderTabSet = (props) => {
3213
3455
  borderClasses += " " + border.getClassName();
3214
3456
  }
3215
3457
  let buttons = [];
3216
- let stickyButtons = [];
3458
+ const stickyButtons = [];
3217
3459
  const renderState = { headerContent: void 0, buttons, stickyButtons, headerButtons: [], overflowPosition: void 0 };
3218
3460
  layout.customizeTabSet(border, renderState);
3219
3461
  buttons = renderState.buttons;
@@ -3412,7 +3654,7 @@ var Splitter = (props) => {
3412
3654
  return rtn;
3413
3655
  };
3414
3656
  const cm = layout.getClassName;
3415
- let r = node.getRect();
3657
+ const r = node.getRect();
3416
3658
  const style2 = r.styleWithPosition({
3417
3659
  cursor: node.getOrientation() === Orientation.HORZ ? "ns-resize" : "ew-resize"
3418
3660
  });
@@ -3428,7 +3670,7 @@ var Splitter = (props) => {
3428
3670
  if (extra === 0) {
3429
3671
  return /* @__PURE__ */ React7.createElement("div", { style: style2, "data-layout-path": path, className, onTouchStart: onMouseDown, onMouseDown });
3430
3672
  } else {
3431
- let r2 = r.clone();
3673
+ const r2 = r.clone();
3432
3674
  r2.x = 0;
3433
3675
  r2.y = 0;
3434
3676
  if (node.getOrientation() === Orientation.VERT) {
@@ -3609,7 +3851,7 @@ var TabButton = (props) => {
3609
3851
  const cm = layout.getClassName;
3610
3852
  const parentNode = node.getParent();
3611
3853
  const isStretch = parentNode.isEnableSingleTabStretch() && parentNode.getChildren().length === 1;
3612
- let baseClassName = isStretch ? "flexlayout__tab_button_stretch" /* FLEXLAYOUT__TAB_BUTTON_STRETCH */ : "flexlayout__tab_button" /* FLEXLAYOUT__TAB_BUTTON */;
3854
+ const baseClassName = isStretch ? "flexlayout__tab_button_stretch" /* FLEXLAYOUT__TAB_BUTTON_STRETCH */ : "flexlayout__tab_button" /* FLEXLAYOUT__TAB_BUTTON */;
3613
3855
  let classNames = cm(baseClassName);
3614
3856
  classNames += " " + cm(baseClassName + "_" + parentNode.getTabLocation());
3615
3857
  if (!isStretch) {
@@ -3779,7 +4021,7 @@ var TabSet = (props) => {
3779
4021
  if (node.isEnableTabStrip()) {
3780
4022
  for (let i = 0; i < node.getChildren().length; i++) {
3781
4023
  const child = node.getChildren()[i];
3782
- let isSelected = node.getSelected() === i;
4024
+ const isSelected = node.getSelected() === i;
3783
4025
  tabs.push(/* @__PURE__ */ React11.createElement(TabButton, { layout, node: child, path: path + "/tb" + i, key: child.getId(), selected: isSelected, iconFactory, titleFactory, icons }));
3784
4026
  if (i < node.getChildren().length - 1) {
3785
4027
  tabs.push(/* @__PURE__ */ React11.createElement("div", { key: "divider" + i, className: cm("flexlayout__tabset_tab_divider" /* FLEXLAYOUT__TABSET_TAB_DIVIDER */) }));
@@ -3922,7 +4164,6 @@ var TabSet = (props) => {
3922
4164
  buttons
3923
4165
  );
3924
4166
  let header;
3925
- let tabStrip;
3926
4167
  let tabStripClasses = cm("flexlayout__tabset_tabbar_outer" /* FLEXLAYOUT__TABSET_TABBAR_OUTER */);
3927
4168
  if (node.getClassNameTabStrip() !== void 0) {
3928
4169
  tabStripClasses += " " + node.getClassNameTabStrip();
@@ -3982,7 +4223,7 @@ var TabSet = (props) => {
3982
4223
  );
3983
4224
  }
3984
4225
  const tabStripStyle = { height: node.getTabStripHeight() + "px" };
3985
- tabStrip = /* @__PURE__ */ React11.createElement(
4226
+ const tabStrip = /* @__PURE__ */ React11.createElement(
3986
4227
  "div",
3987
4228
  {
3988
4229
  className: tabStripClasses,
@@ -4005,7 +4246,7 @@ var TabSet = (props) => {
4005
4246
  toolbar
4006
4247
  );
4007
4248
  style2 = layout.styleFont(style2);
4008
- var placeHolder = void 0;
4249
+ let placeHolder = void 0;
4009
4250
  if (node.getChildren().length === 0) {
4010
4251
  const placeHolderCallback = layout.getTabSetPlaceHolderCallback();
4011
4252
  if (placeHolderCallback) {
@@ -4013,7 +4254,7 @@ var TabSet = (props) => {
4013
4254
  }
4014
4255
  }
4015
4256
  const center = /* @__PURE__ */ React11.createElement("div", { className: cm("flexlayout__tabset_content" /* FLEXLAYOUT__TABSET_CONTENT */) }, placeHolder);
4016
- var content;
4257
+ let content;
4017
4258
  if (node.getTabLocation() === "top") {
4018
4259
  content = /* @__PURE__ */ React11.createElement(React11.Fragment, null, header, tabStrip, center);
4019
4260
  } else {
@@ -4228,307 +4469,62 @@ var defaultIcons = {
4228
4469
  var isDesktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
4229
4470
  var defaultSupportsPopout = isDesktop;
4230
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;
4231
4526
  constructor(props) {
4232
4527
  super(props);
4233
- /** @internal */
4234
- this.firstMove = false;
4235
- /** @internal */
4236
- this.dragRectRendered = true;
4237
- /** @internal */
4238
- this.dragDivText = void 0;
4239
- /** @internal */
4240
- this.edgeRectLength = 100;
4241
- /** @internal */
4242
- this.edgeRectWidth = 10;
4243
- /** @internal */
4244
- this.onModelChange = (action) => {
4245
- this.forceUpdate();
4246
- if (this.props.onModelChange) {
4247
- this.props.onModelChange(this.props.model, action);
4248
- }
4249
- };
4250
- /** @internal */
4251
- this.updateRect = (domRect) => {
4252
- if (!domRect) {
4253
- domRect = this.getDomRect();
4254
- }
4255
- if (!domRect) {
4256
- return;
4257
- }
4258
- const rect = new Rect(0, 0, domRect.width, domRect.height);
4259
- if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
4260
- this.setState({ rect });
4261
- }
4262
- };
4263
- /** @internal */
4264
- this.updateLayoutMetrics = () => {
4265
- if (this.findHeaderBarSizeRef.current) {
4266
- const headerBarSize = this.findHeaderBarSizeRef.current.getBoundingClientRect().height;
4267
- if (headerBarSize !== this.state.calculatedHeaderBarSize) {
4268
- this.setState({ calculatedHeaderBarSize: headerBarSize });
4269
- }
4270
- }
4271
- if (this.findTabBarSizeRef.current) {
4272
- const tabBarSize = this.findTabBarSizeRef.current.getBoundingClientRect().height;
4273
- if (tabBarSize !== this.state.calculatedTabBarSize) {
4274
- this.setState({ calculatedTabBarSize: tabBarSize });
4275
- }
4276
- }
4277
- if (this.findBorderBarSizeRef.current) {
4278
- const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;
4279
- if (borderBarSize !== this.state.calculatedBorderBarSize) {
4280
- this.setState({ calculatedBorderBarSize: borderBarSize });
4281
- }
4282
- }
4283
- };
4284
- /** @internal */
4285
- this.getClassName = (defaultClassName) => {
4286
- if (this.props.classNameMapper === void 0) {
4287
- return defaultClassName;
4288
- } else {
4289
- return this.props.classNameMapper(defaultClassName);
4290
- }
4291
- };
4292
- /** @internal */
4293
- this.onCloseWindow = (id) => {
4294
- this.doAction(Actions.unFloatTab(id));
4295
- try {
4296
- this.props.model.getNodeById(id)._setWindow(void 0);
4297
- } catch (e) {
4298
- }
4299
- };
4300
- /** @internal */
4301
- this.onSetWindow = (id, window2) => {
4302
- this.props.model.getNodeById(id)._setWindow(window2);
4303
- };
4304
- /** @internal */
4305
- this.onCancelAdd = () => {
4306
- const rootdiv = this.selfRef.current;
4307
- if (rootdiv && this.dragDiv) {
4308
- rootdiv.removeChild(this.dragDiv);
4309
- }
4310
- this.dragDiv = void 0;
4311
- this.hidePortal();
4312
- if (this.fnNewNodeDropped != null) {
4313
- this.fnNewNodeDropped();
4314
- this.fnNewNodeDropped = void 0;
4315
- }
4316
- try {
4317
- this.customDrop?.invalidated?.();
4318
- } catch (e) {
4319
- console.error(e);
4320
- }
4321
- DragDrop.instance.hideGlass();
4322
- this.newTabJson = void 0;
4323
- this.customDrop = void 0;
4324
- };
4325
- /** @internal */
4326
- this.onCancelDrag = (wasDragging) => {
4327
- if (wasDragging) {
4328
- const rootdiv = this.selfRef.current;
4329
- const outlineDiv = this.outlineDiv;
4330
- if (rootdiv && outlineDiv) {
4331
- try {
4332
- rootdiv.removeChild(outlineDiv);
4333
- } catch (e) {
4334
- }
4335
- }
4336
- const dragDiv = this.dragDiv;
4337
- if (rootdiv && dragDiv) {
4338
- try {
4339
- rootdiv.removeChild(dragDiv);
4340
- } catch (e) {
4341
- }
4342
- }
4343
- this.dragDiv = void 0;
4344
- this.hidePortal();
4345
- this.setState({ showEdges: false });
4346
- if (this.fnNewNodeDropped != null) {
4347
- this.fnNewNodeDropped();
4348
- this.fnNewNodeDropped = void 0;
4349
- }
4350
- try {
4351
- this.customDrop?.invalidated?.();
4352
- } catch (e) {
4353
- console.error(e);
4354
- }
4355
- DragDrop.instance.hideGlass();
4356
- this.newTabJson = void 0;
4357
- this.customDrop = void 0;
4358
- }
4359
- this.setState({ showHiddenBorder: DockLocation.CENTER });
4360
- };
4361
- /** @internal */
4362
- this.onDragDivMouseDown = (event) => {
4363
- event.preventDefault();
4364
- this.dragStart(event, this.dragDivText, TabNode._fromJson(this.newTabJson, this.props.model, false), true, void 0, void 0);
4365
- };
4366
- /** @internal */
4367
- this.dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {
4368
- if (!allowDrag) {
4369
- DragDrop.instance.startDrag(event, void 0, void 0, void 0, void 0, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
4370
- } else {
4371
- this.dragNode = node;
4372
- this.dragDivText = dragDivText;
4373
- DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current ?? void 0);
4374
- }
4375
- };
4376
- /** @internal */
4377
- this.dragRectRender = (text, node, json, onRendered) => {
4378
- let content;
4379
- if (text !== void 0) {
4380
- content = /* @__PURE__ */ React16.createElement("div", { style: { whiteSpace: "pre" } }, text.replace("<br>", "\n"));
4381
- } else {
4382
- if (node && node instanceof TabNode) {
4383
- content = /* @__PURE__ */ React16.createElement(TabButtonStamp, { node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory });
4384
- }
4385
- }
4386
- if (this.props.onRenderDragRect !== void 0) {
4387
- const customContent = this.props.onRenderDragRect(content, node, json);
4388
- if (customContent !== void 0) {
4389
- content = customContent;
4390
- }
4391
- }
4392
- this.dragRectRendered = false;
4393
- const dragDiv = this.dragDiv;
4394
- if (dragDiv) {
4395
- dragDiv.style.visibility = "hidden";
4396
- this.showPortal(
4397
- /* @__PURE__ */ React16.createElement(
4398
- DragRectRenderWrapper,
4399
- {
4400
- onRendered: () => {
4401
- this.dragRectRendered = true;
4402
- onRendered?.();
4403
- }
4404
- },
4405
- content
4406
- ),
4407
- dragDiv
4408
- );
4409
- }
4410
- };
4411
- /** @internal */
4412
- this.showPortal = (control, element) => {
4413
- const portal = createPortal2(control, element);
4414
- this.setState({ portal });
4415
- };
4416
- /** @internal */
4417
- this.hidePortal = () => {
4418
- this.setState({ portal: void 0 });
4419
- };
4420
- /** @internal */
4421
- this.onDragStart = () => {
4422
- this.dropInfo = void 0;
4423
- this.customDrop = void 0;
4424
- const rootdiv = this.selfRef.current;
4425
- this.outlineDiv = this.currentDocument.createElement("div");
4426
- this.outlineDiv.className = this.getClassName("flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
4427
- this.outlineDiv.style.visibility = "hidden";
4428
- if (rootdiv) {
4429
- rootdiv.appendChild(this.outlineDiv);
4430
- }
4431
- if (this.dragDiv == null) {
4432
- this.dragDiv = this.currentDocument.createElement("div");
4433
- this.dragDiv.className = this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */);
4434
- this.dragDiv.setAttribute("data-layout-path", "/drag-rectangle");
4435
- this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);
4436
- if (rootdiv) {
4437
- rootdiv.appendChild(this.dragDiv);
4438
- }
4439
- }
4440
- if (this.props.model.getMaximizedTabset() === void 0) {
4441
- this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
4442
- }
4443
- if (this.dragNode && this.outlineDiv && this.dragNode instanceof TabNode && this.dragNode.getTabRect() !== void 0) {
4444
- this.dragNode.getTabRect()?.positionElement(this.outlineDiv);
4445
- }
4446
- this.firstMove = true;
4447
- return true;
4448
- };
4449
- /** @internal */
4450
- this.onDragMove = (event) => {
4451
- if (this.firstMove === false) {
4452
- const speed = this.props.model._getAttribute("tabDragSpeed");
4453
- if (this.outlineDiv) {
4454
- this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;
4455
- }
4456
- }
4457
- this.firstMove = false;
4458
- const clientRect = this.selfRef.current?.getBoundingClientRect();
4459
- const pos = {
4460
- x: event.clientX - (clientRect?.left ?? 0),
4461
- y: event.clientY - (clientRect?.top ?? 0)
4462
- };
4463
- this.checkForBorderToShow(pos.x, pos.y);
4464
- const dragRect = this.dragDiv?.getBoundingClientRect() ?? new DOMRect(0, 0, 100, 100);
4465
- let newLeft = pos.x - dragRect.width / 2;
4466
- if (newLeft + dragRect.width > (clientRect?.width ?? 0)) {
4467
- newLeft = (clientRect?.width ?? 0) - dragRect.width;
4468
- }
4469
- newLeft = Math.max(0, newLeft);
4470
- if (this.dragDiv) {
4471
- this.dragDiv.style.left = newLeft + "px";
4472
- this.dragDiv.style.top = pos.y + 5 + "px";
4473
- if (this.dragRectRendered && this.dragDiv.style.visibility === "hidden") {
4474
- this.dragDiv.style.visibility = "visible";
4475
- }
4476
- }
4477
- let dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);
4478
- if (dropInfo) {
4479
- if (this.props.onTabDrag) {
4480
- this.handleCustomTabDrag(dropInfo, pos, event);
4481
- } else {
4482
- this.dropInfo = dropInfo;
4483
- if (this.outlineDiv) {
4484
- this.outlineDiv.className = this.getClassName(dropInfo.className);
4485
- dropInfo.rect.positionElement(this.outlineDiv);
4486
- this.outlineDiv.style.visibility = "visible";
4487
- }
4488
- }
4489
- }
4490
- };
4491
- /** @internal */
4492
- this.onDragEnd = (event) => {
4493
- const rootdiv = this.selfRef.current;
4494
- if (rootdiv) {
4495
- if (this.outlineDiv) {
4496
- rootdiv.removeChild(this.outlineDiv);
4497
- }
4498
- if (this.dragDiv) {
4499
- rootdiv.removeChild(this.dragDiv);
4500
- }
4501
- }
4502
- this.dragDiv = void 0;
4503
- this.hidePortal();
4504
- this.setState({ showEdges: false });
4505
- DragDrop.instance.hideGlass();
4506
- if (this.dropInfo) {
4507
- if (this.customDrop) {
4508
- this.newTabJson = void 0;
4509
- try {
4510
- const { callback, dragging, over, x, y, location } = this.customDrop;
4511
- callback(dragging, over, x, y, location);
4512
- if (this.fnNewNodeDropped != null) {
4513
- this.fnNewNodeDropped();
4514
- this.fnNewNodeDropped = void 0;
4515
- }
4516
- } catch (e) {
4517
- console.error(e);
4518
- }
4519
- } else if (this.newTabJson !== void 0) {
4520
- const newNode = this.doAction(Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
4521
- if (this.fnNewNodeDropped != null) {
4522
- this.fnNewNodeDropped(newNode, event);
4523
- this.fnNewNodeDropped = void 0;
4524
- }
4525
- this.newTabJson = void 0;
4526
- } else if (this.dragNode !== void 0) {
4527
- this.doAction(Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
4528
- }
4529
- }
4530
- this.setState({ showHiddenBorder: DockLocation.CENTER });
4531
- };
4532
4528
  this.props.model._setChangeListener(this.onModelChange);
4533
4529
  this.tabIds = [];
4534
4530
  this.selfRef = React16.createRef();
@@ -4570,6 +4566,13 @@ var Layout = class extends React16.Component {
4570
4566
  return style2;
4571
4567
  }
4572
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 */
4573
4576
  doAction(action) {
4574
4577
  if (this.props.onAction !== void 0) {
4575
4578
  const outcome = this.props.onAction(action);
@@ -4607,6 +4610,48 @@ var Layout = class extends React16.Component {
4607
4610
  }
4608
4611
  }
4609
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 */
4610
4655
  getCurrentDocument() {
4611
4656
  return this.currentDocument;
4612
4657
  }
@@ -4747,6 +4792,18 @@ var Layout = class extends React16.Component {
4747
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"));
4748
4793
  }
4749
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 */
4750
4807
  renderBorder(borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {
4751
4808
  for (const border of borderSet.getBorders()) {
4752
4809
  const borderPath = `/border/${border.getLocation().getName()}`;
@@ -4770,10 +4827,10 @@ var Layout = class extends React16.Component {
4770
4827
  let tabCount = 0;
4771
4828
  for (const child of drawChildren) {
4772
4829
  if (child instanceof SplitterNode) {
4773
- let path = borderPath + "/s";
4830
+ const path = borderPath + "/s";
4774
4831
  splitterComponents.push(/* @__PURE__ */ React16.createElement(Splitter, { key: child.getId(), layout: this, node: child, path }));
4775
4832
  } else if (child instanceof TabNode) {
4776
- let path = borderPath + "/t" + tabCount++;
4833
+ const path = borderPath + "/t" + tabCount++;
4777
4834
  if (this.supportsPopout && child.isFloating()) {
4778
4835
  const rect = this._getScreenRect(child);
4779
4836
  const tabBorderWidth = child._getAttr("borderWidth");
@@ -4950,6 +5007,234 @@ var Layout = class extends React16.Component {
4950
5007
  rootdiv.appendChild(this.dragDiv);
4951
5008
  }
4952
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 */
4953
5238
  handleCustomTabDrag(dropInfo, pos, event) {
4954
5239
  let invalidated = this.customDrop?.invalidated;
4955
5240
  const currentCallback = this.customDrop?.callback;
@@ -5110,6 +5395,10 @@ var BorderSet = class _BorderSet {
5110
5395
  return borderSet;
5111
5396
  }
5112
5397
  /** @internal */
5398
+ _model;
5399
+ /** @internal */
5400
+ _borders;
5401
+ /** @internal */
5113
5402
  constructor(model) {
5114
5403
  this._model = model;
5115
5404
  this._borders = [];
@@ -5212,19 +5501,6 @@ var BorderSet = class _BorderSet {
5212
5501
 
5213
5502
  // src/model/Model.ts
5214
5503
  var Model = class _Model {
5215
- /**
5216
- * 'private' constructor. Use the static method Model.fromJson(json) to create a model
5217
- * @internal
5218
- */
5219
- constructor() {
5220
- /** @internal */
5221
- this._borderRects = { inner: Rect.empty(), outer: Rect.empty() };
5222
- this._attributes = {};
5223
- this._idMap = {};
5224
- this._borders = new BorderSet(this);
5225
- this._pointerFine = true;
5226
- this._showHiddenBorder = DockLocation.CENTER;
5227
- }
5228
5504
  /**
5229
5505
  * Loads the model from the given json object
5230
5506
  * @param json the json model to load
@@ -5240,10 +5516,8 @@ var Model = class _Model {
5240
5516
  model._tidy();
5241
5517
  return model;
5242
5518
  }
5243
- static {
5244
- /** @internal */
5245
- this._attributeDefinitions = _Model._createAttributeDefinitions();
5246
- }
5519
+ /** @internal */
5520
+ static _attributeDefinitions = _Model._createAttributeDefinitions();
5247
5521
  /** @internal */
5248
5522
  static _createAttributeDefinitions() {
5249
5523
  const attributeDefinitions = new AttributeDefinitions();
@@ -5296,6 +5570,41 @@ var Model = class _Model {
5296
5570
  return attributeDefinitions;
5297
5571
  }
5298
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 */
5299
5608
  _setChangeListener(listener) {
5300
5609
  this._changeListener = listener;
5301
5610
  }
@@ -5565,12 +5874,12 @@ var Model = class _Model {
5565
5874
  * @returns {IJsonModel} json object that represents this model
5566
5875
  */
5567
5876
  toJson() {
5568
- const global = {};
5569
- _Model._attributeDefinitions.toJson(global, this._attributes);
5877
+ const global2 = {};
5878
+ _Model._attributeDefinitions.toJson(global2, this._attributes);
5570
5879
  this.visitNodes((node) => {
5571
5880
  node._fireEvent("save", void 0);
5572
5881
  });
5573
- return { global, borders: this._borders._toJson(), layout: this._root.toJson() };
5882
+ return { global: global2, borders: this._borders._toJson(), layout: this._root.toJson() };
5574
5883
  }
5575
5884
  getSplitterSize() {
5576
5885
  let splitterSize = this._attributes.splitterSize;