@aptre/flex-layout 0.5.13 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +11 -59
  2. package/dist/I18nLabel.d.ts +0 -1
  3. package/dist/Types.d.ts +0 -7
  4. package/dist/index.d.ts +0 -1
  5. package/dist/index.mjs +346 -1053
  6. package/dist/model/Action.d.ts +1 -34
  7. package/dist/model/Actions.d.ts +1 -30
  8. package/dist/model/IJsonModel.d.ts +0 -55
  9. package/dist/model/Model.d.ts +4 -7
  10. package/dist/model/RowNode.d.ts +0 -1
  11. package/dist/model/TabNode.d.ts +0 -6
  12. package/dist/model/TabSetNode.d.ts +1 -1
  13. package/dist/view/Icons.d.ts +0 -1
  14. package/dist/view/Layout.d.ts +1 -8
  15. package/dist/view/Utils.d.ts +0 -6
  16. package/package.json +31 -29
  17. package/typedoc/assets/hierarchy.js +1 -1
  18. package/typedoc/assets/navigation.js +1 -1
  19. package/typedoc/assets/search.js +1 -1
  20. package/typedoc/classes/Actions.html +4 -21
  21. package/typedoc/classes/BorderNode.html +1 -1
  22. package/typedoc/classes/Layout.html +1 -1
  23. package/typedoc/classes/Model.html +9 -11
  24. package/typedoc/classes/Node.html +1 -1
  25. package/typedoc/classes/RowNode.html +2 -3
  26. package/typedoc/classes/TabNode.html +2 -8
  27. package/typedoc/classes/TabSetNode.html +1 -1
  28. package/typedoc/enums/CLASSES.html +1 -8
  29. package/typedoc/enums/I18nLabel.html +1 -2
  30. package/typedoc/hierarchy.html +1 -1
  31. package/typedoc/index.html +1 -1
  32. package/typedoc/interfaces/ActionDataMap.html +2 -6
  33. package/typedoc/interfaces/IBorderAttributes.html +1 -1
  34. package/typedoc/interfaces/IGlobalAttributes.html +2 -15
  35. package/typedoc/interfaces/IIcons.html +2 -3
  36. package/typedoc/interfaces/IJsonBorderNode.html +1 -1
  37. package/typedoc/interfaces/IJsonModel.html +2 -3
  38. package/typedoc/interfaces/IJsonRowNode.html +1 -1
  39. package/typedoc/interfaces/IJsonTabNode.html +4 -17
  40. package/typedoc/interfaces/IJsonTabSetNode.html +1 -1
  41. package/typedoc/interfaces/ILayoutProps.html +3 -9
  42. package/typedoc/interfaces/IOptimizedLayoutProps.html +4 -10
  43. package/typedoc/interfaces/IRowAttributes.html +1 -1
  44. package/typedoc/interfaces/ITabAttributes.html +2 -15
  45. package/typedoc/interfaces/ITabSetAttributes.html +1 -1
  46. package/typedoc/types/Action.html +1 -1
  47. package/typedoc/variables/ActionType.html +2 -2
  48. package/dist/model/LayoutWindow.d.ts +0 -28
  49. package/dist/view/PopoutWindow.d.ts +0 -1
  50. package/typedoc/classes/LayoutWindow.html +0 -12
  51. package/typedoc/interfaces/CloseWindowData.html +0 -2
  52. package/typedoc/interfaces/CreateWindowData.html +0 -3
  53. package/typedoc/interfaces/IJsonPopout.html +0 -3
  54. package/typedoc/interfaces/PopoutTabData.html +0 -2
  55. package/typedoc/interfaces/PopoutTabsetData.html +0 -2
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/view/Layout.tsx
2
- import * as React19 from "react";
3
- import { createPortal as createPortal3 } from "react-dom";
2
+ import * as React18 from "react";
3
+ import { createPortal as createPortal2 } from "react-dom";
4
4
  import { createRoot } from "react-dom/client";
5
5
 
6
6
  // src/Orientation.ts
@@ -245,7 +245,6 @@ var I18nLabel = /* @__PURE__ */ ((I18nLabel2) => {
245
245
  I18nLabel2["Move_Tabs"] = "Move tabs(?)";
246
246
  I18nLabel2["Maximize"] = "Maximize tab set";
247
247
  I18nLabel2["Restore"] = "Restore tab set";
248
- I18nLabel2["Popout_Tab"] = "Popout selected tab";
249
248
  I18nLabel2["Overflow_Menu_Tooltip"] = "Hidden tabs";
250
249
  I18nLabel2["Error_rendering_component"] = "Error rendering component";
251
250
  return I18nLabel2;
@@ -274,7 +273,6 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
274
273
  CLASSES2["FLEXLAYOUT__BORDER_TOOLBAR"] = "flexlayout__border_toolbar";
275
274
  CLASSES2["FLEXLAYOUT__BORDER_TOOLBAR_"] = "flexlayout__border_toolbar_";
276
275
  CLASSES2["FLEXLAYOUT__BORDER_TOOLBAR_BUTTON"] = "flexlayout__border_toolbar_button";
277
- CLASSES2["FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT"] = "flexlayout__border_toolbar_button-float";
278
276
  CLASSES2["FLEXLAYOUT__DRAG_RECT"] = "flexlayout__drag_rect";
279
277
  CLASSES2["FLEXLAYOUT__EDGE_RECT"] = "flexlayout__edge_rect";
280
278
  CLASSES2["FLEXLAYOUT__EDGE_RECT_TOP"] = "flexlayout__edge_rect_top";
@@ -283,8 +281,6 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
283
281
  CLASSES2["FLEXLAYOUT__EDGE_RECT_RIGHT"] = "flexlayout__edge_rect_right";
284
282
  CLASSES2["FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER"] = "flexlayout__error_boundary_container";
285
283
  CLASSES2["FLEXLAYOUT__ERROR_BOUNDARY_CONTENT"] = "flexlayout__error_boundary_content";
286
- CLASSES2["FLEXLAYOUT__FLOATING_WINDOW_CONTENT"] = "flexlayout__floating_window_content";
287
- CLASSES2["FLEXLAYOUT__FLOATING_WINDOW_TAB"] = "flexlayout__floating_window_tab";
288
284
  CLASSES2["FLEXLAYOUT__LAYOUT"] = "flexlayout__layout";
289
285
  CLASSES2["FLEXLAYOUT__LAYOUT_MOVEABLES"] = "flexlayout__layout_moveables";
290
286
  CLASSES2["FLEXLAYOUT__LAYOUT_OVERLAY"] = "flexlayout__layout_overlay";
@@ -306,7 +302,6 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
306
302
  CLASSES2["FLEXLAYOUT__TAB"] = "flexlayout__tab";
307
303
  CLASSES2["FLEXLAYOUT__TAB_POSITION"] = "flexlayout__tab_position";
308
304
  CLASSES2["FLEXLAYOUT__TAB_MOVEABLE"] = "flexlayout__tab_moveable";
309
- CLASSES2["FLEXLAYOUT__TAB_OVERLAY"] = "flexlayout__tab_overlay";
310
305
  CLASSES2["FLEXLAYOUT__TABSET"] = "flexlayout__tabset";
311
306
  CLASSES2["FLEXLAYOUT__TABSET_CONTAINER"] = "flexlayout__tabset_container";
312
307
  CLASSES2["FLEXLAYOUT__TABSET_HEADER"] = "flexlayout__tabset_header";
@@ -334,13 +329,10 @@ var CLASSES = /* @__PURE__ */ ((CLASSES2) => {
334
329
  CLASSES2["FLEXLAYOUT__TAB_BUTTON_TEXTBOX"] = "flexlayout__tab_button_textbox";
335
330
  CLASSES2["FLEXLAYOUT__TAB_BUTTON_TRAILING"] = "flexlayout__tab_button_trailing";
336
331
  CLASSES2["FLEXLAYOUT__TAB_BUTTON_STAMP"] = "flexlayout__tab_button_stamp";
337
- CLASSES2["FLEXLAYOUT__TAB_FLOATING"] = "flexlayout__tab_floating";
338
- CLASSES2["FLEXLAYOUT__TAB_FLOATING_INNER"] = "flexlayout__tab_floating_inner";
339
332
  CLASSES2["FLEXLAYOUT__TAB_TOOLBAR"] = "flexlayout__tab_toolbar";
340
333
  CLASSES2["FLEXLAYOUT__TAB_TOOLBAR_BUTTON"] = "flexlayout__tab_toolbar_button";
341
334
  CLASSES2["FLEXLAYOUT__TAB_TOOLBAR_ICON"] = "flexlayout__tab_toolbar_icon";
342
335
  CLASSES2["FLEXLAYOUT__TAB_TOOLBAR_BUTTON_"] = "flexlayout__tab_toolbar_button-";
343
- CLASSES2["FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT"] = "flexlayout__tab_toolbar_button-float";
344
336
  CLASSES2["FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER"] = "flexlayout__tab_toolbar_sticky_buttons_container";
345
337
  CLASSES2["FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE"] = "flexlayout__tab_toolbar_button-close";
346
338
  CLASSES2["FLEXLAYOUT__POPUP_MENU_CONTAINER"] = "flexlayout__popup_menu_container";
@@ -362,11 +354,7 @@ var ActionType = {
362
354
  ADJUST_BORDER_SPLIT: "FlexLayout_AdjustBorderSplit",
363
355
  MAXIMIZE_TOGGLE: "FlexLayout_MaximizeToggle",
364
356
  UPDATE_MODEL_ATTRIBUTES: "FlexLayout_UpdateModelAttributes",
365
- UPDATE_NODE_ATTRIBUTES: "FlexLayout_UpdateNodeAttributes",
366
- POPOUT_TAB: "FlexLayout_PopoutTab",
367
- POPOUT_TABSET: "FlexLayout_PopoutTabset",
368
- CLOSE_WINDOW: "FlexLayout_CloseWindow",
369
- CREATE_WINDOW: "FlexLayout_CreateWindow"
357
+ UPDATE_NODE_ATTRIBUTES: "FlexLayout_UpdateNodeAttributes"
370
358
  };
371
359
  function createAction(type, data) {
372
360
  return { type, data };
@@ -386,10 +374,6 @@ var Actions = class {
386
374
  static MAXIMIZE_TOGGLE = ActionType.MAXIMIZE_TOGGLE;
387
375
  static UPDATE_MODEL_ATTRIBUTES = ActionType.UPDATE_MODEL_ATTRIBUTES;
388
376
  static UPDATE_NODE_ATTRIBUTES = ActionType.UPDATE_NODE_ATTRIBUTES;
389
- static POPOUT_TAB = ActionType.POPOUT_TAB;
390
- static POPOUT_TABSET = ActionType.POPOUT_TABSET;
391
- static CLOSE_WINDOW = ActionType.CLOSE_WINDOW;
392
- static CREATE_WINDOW = ActionType.CREATE_WINDOW;
393
377
  /**
394
378
  * Adds a tab node to the given tabset node
395
379
  * @param json the json for the new tab node e.g {type:"tab", component:"table"}
@@ -504,39 +488,6 @@ var Actions = class {
504
488
  static updateNodeAttributes(nodeId, attributes) {
505
489
  return createAction(ActionType.UPDATE_NODE_ATTRIBUTES, { node: nodeId, json: attributes });
506
490
  }
507
- /**
508
- * Pops out the given tab node into a new browser window
509
- * @param nodeId the tab node to popout
510
- * @returns
511
- */
512
- static popoutTab(nodeId) {
513
- return createAction(ActionType.POPOUT_TAB, { node: nodeId });
514
- }
515
- /**
516
- * Pops out the given tab set node into a new browser window
517
- * @param nodeId the tab set node to popout
518
- * @returns
519
- */
520
- static popoutTabset(nodeId) {
521
- return createAction(ActionType.POPOUT_TABSET, { node: nodeId });
522
- }
523
- /**
524
- * Closes the popout window
525
- * @param windowId the id of the popout window to close
526
- * @returns
527
- */
528
- static closeWindow(windowId) {
529
- return createAction(ActionType.CLOSE_WINDOW, { windowId });
530
- }
531
- /**
532
- * Creates a new empty popout window with the given layout
533
- * @param layout the json layout for the new window
534
- * @param rect the window rectangle in screen coordinates
535
- * @returns
536
- */
537
- static createWindow(layout, rect) {
538
- return createAction(ActionType.CREATE_WINDOW, { layout, rect });
539
- }
540
491
  };
541
492
 
542
493
  // src/Attribute.ts
@@ -1025,9 +976,6 @@ var Node = class {
1025
976
  }
1026
977
  };
1027
978
 
1028
- // src/view/Utils.tsx
1029
- import * as React from "react";
1030
-
1031
979
  // src/model/TabNode.ts
1032
980
  var TabNode = class _TabNode extends Node {
1033
981
  static TYPE = "tab";
@@ -1077,18 +1025,8 @@ var TabNode = class _TabNode extends Node {
1077
1025
  return this.getAttr("component");
1078
1026
  }
1079
1027
  getWindowId() {
1080
- if (this.parent instanceof TabSetNode) {
1081
- return this.parent.getWindowId();
1082
- }
1083
1028
  return Model.MAIN_WINDOW_ID;
1084
1029
  }
1085
- getWindow() {
1086
- const layoutWindow = this.model.getwindowsMap().get(this.getWindowId());
1087
- if (layoutWindow) {
1088
- return layoutWindow.window;
1089
- }
1090
- return void 0;
1091
- }
1092
1030
  /**
1093
1031
  * Returns the config attribute that can be used to store node specific data that
1094
1032
  * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
@@ -1106,9 +1044,6 @@ var TabNode = class _TabNode extends Node {
1106
1044
  getExtraData() {
1107
1045
  return this.extra;
1108
1046
  }
1109
- isPoppedOut() {
1110
- return this.getWindowId() !== Model.MAIN_WINDOW_ID;
1111
- }
1112
1047
  isSelected() {
1113
1048
  return this.getParent().getSelectedNode() === this;
1114
1049
  }
@@ -1121,24 +1056,12 @@ var TabNode = class _TabNode extends Node {
1121
1056
  getCloseType() {
1122
1057
  return this.getAttr("closeType");
1123
1058
  }
1124
- isEnablePopout() {
1125
- return this.getAttr("enablePopout");
1126
- }
1127
- isEnablePopoutIcon() {
1128
- return this.getAttr("enablePopoutIcon");
1129
- }
1130
- isEnablePopoutOverlay() {
1131
- return this.getAttr("enablePopoutOverlay");
1132
- }
1133
1059
  isEnableDrag() {
1134
1060
  return this.getAttr("enableDrag");
1135
1061
  }
1136
1062
  isEnableRename() {
1137
1063
  return this.getAttr("enableRename");
1138
1064
  }
1139
- isEnableWindowReMount() {
1140
- return this.getAttr("enableWindowReMount");
1141
- }
1142
1065
  getClassName() {
1143
1066
  return this.getAttr("className");
1144
1067
  }
@@ -1304,7 +1227,6 @@ var TabNode = class _TabNode extends Node {
1304
1227
  attributeDefinitions.add("component", void 0).setType(Attribute.STRING).setDescription(`string identifying which component to run (for factory)`);
1305
1228
  attributeDefinitions.add("config", void 0).setType("any").setDescription(`a place to hold json config for the hosted component`);
1306
1229
  attributeDefinitions.add("tabsetClassName", void 0).setType(Attribute.STRING).setDescription(`class applied to parent tabset when this is the only tab and it is stretched to fill the tabset`);
1307
- attributeDefinitions.add("enableWindowReMount", false).setType(Attribute.BOOLEAN).setDescription(`if enabled the tab will re-mount when popped out/in`);
1308
1230
  attributeDefinitions.addInherited("enableClose", "tabEnableClose").setType(Attribute.BOOLEAN).setDescription(`allow user to close tab via close button`);
1309
1231
  attributeDefinitions.addInherited("closeType", "tabCloseType").setType("ICloseType").setDescription(`see values in ICloseType`);
1310
1232
  attributeDefinitions.addInherited("enableDrag", "tabEnableDrag").setType(Attribute.BOOLEAN).setDescription(`allow user to drag tab to new location`);
@@ -1313,12 +1235,6 @@ var TabNode = class _TabNode extends Node {
1313
1235
  attributeDefinitions.addInherited("contentClassName", "tabContentClassName").setType(Attribute.STRING).setDescription(`class applied to tab content`);
1314
1236
  attributeDefinitions.addInherited("icon", "tabIcon").setType(Attribute.STRING).setDescription(`the tab icon`);
1315
1237
  attributeDefinitions.addInherited("enableRenderOnDemand", "tabEnableRenderOnDemand").setType(Attribute.BOOLEAN).setDescription(`whether to avoid rendering component until tab is visible`);
1316
- attributeDefinitions.addInherited("enablePopout", "tabEnablePopout").setType(Attribute.BOOLEAN).setAlias("enableFloat").setDescription(`enable popout (in popout capable browser)`);
1317
- attributeDefinitions.addInherited("enablePopoutIcon", "tabEnablePopoutIcon").setType(Attribute.BOOLEAN).setDescription(`whether to show the popout icon in the tabset header if this tab enables popouts`);
1318
- attributeDefinitions.addInherited("enablePopoutOverlay", "tabEnablePopoutOverlay").setType(Attribute.BOOLEAN).setDescription(
1319
- `if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
1320
- then enabling this option will gray out this tab`
1321
- );
1322
1238
  attributeDefinitions.addInherited("borderWidth", "tabBorderWidth").setType(Attribute.NUMBER).setDescription(`width when added to border, -1 will use border size`);
1323
1239
  attributeDefinitions.addInherited("borderHeight", "tabBorderHeight").setType(Attribute.NUMBER).setDescription(`height when added to border, -1 will use border size`);
1324
1240
  attributeDefinitions.addInherited("minWidth", "tabMinWidth").setType(Attribute.NUMBER).setDescription(`the min width of this tab`);
@@ -1329,133 +1245,6 @@ var TabNode = class _TabNode extends Node {
1329
1245
  }
1330
1246
  };
1331
1247
 
1332
- // src/model/ICloseType.ts
1333
- var ICloseType = /* @__PURE__ */ ((ICloseType2) => {
1334
- ICloseType2[ICloseType2["Visible"] = 1] = "Visible";
1335
- ICloseType2[ICloseType2["Always"] = 2] = "Always";
1336
- ICloseType2[ICloseType2["Selected"] = 3] = "Selected";
1337
- return ICloseType2;
1338
- })(ICloseType || {});
1339
-
1340
- // src/view/Utils.tsx
1341
- function isDesktop() {
1342
- const desktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
1343
- return desktop;
1344
- }
1345
- function getRenderStateEx(layout, node, iconAngle) {
1346
- let leadingContent = void 0;
1347
- const titleContent = node.getName();
1348
- const name = node.getName();
1349
- if (iconAngle === void 0) {
1350
- iconAngle = 0;
1351
- }
1352
- if (leadingContent === void 0 && node.getIcon() !== void 0) {
1353
- if (iconAngle !== 0) {
1354
- leadingContent = /* @__PURE__ */ React.createElement("img", { style: { width: "1em", height: "1em", transform: "rotate(" + iconAngle + "deg)" }, src: node.getIcon(), alt: "leadingContent" });
1355
- } else {
1356
- leadingContent = /* @__PURE__ */ React.createElement("img", { style: { width: "1em", height: "1em" }, src: node.getIcon(), alt: "leadingContent" });
1357
- }
1358
- }
1359
- const buttons = [];
1360
- const renderState = { leading: leadingContent, content: titleContent, name, buttons };
1361
- layout.customizeTab(node, renderState);
1362
- node.setRenderedName(renderState.name);
1363
- return renderState;
1364
- }
1365
- function isAuxMouseEvent(event) {
1366
- let auxEvent = false;
1367
- if (event.nativeEvent instanceof MouseEvent) {
1368
- if (event.nativeEvent.button !== 0 || event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) {
1369
- auxEvent = true;
1370
- }
1371
- }
1372
- return auxEvent;
1373
- }
1374
- function enablePointerOnIFrames(enable, currentDocument) {
1375
- const iframes = [...getElementsByTagName("iframe", currentDocument), ...getElementsByTagName("webview", currentDocument)];
1376
- for (const iframe of iframes) {
1377
- iframe.style.pointerEvents = enable ? "auto" : "none";
1378
- }
1379
- }
1380
- function getElementsByTagName(tag, currentDocument) {
1381
- return [...currentDocument.getElementsByTagName(tag)];
1382
- }
1383
- function startDrag(doc, event, drag, dragEnd, dragCancel) {
1384
- event.preventDefault();
1385
- const pointerMove = (ev) => {
1386
- ev.preventDefault();
1387
- drag(ev.clientX, ev.clientY);
1388
- };
1389
- const pointerCancel = (ev) => {
1390
- ev.preventDefault();
1391
- dragCancel();
1392
- };
1393
- const pointerUp = () => {
1394
- doc.removeEventListener("pointermove", pointerMove);
1395
- doc.removeEventListener("pointerup", pointerUp);
1396
- doc.removeEventListener("pointercancel", pointerCancel);
1397
- dragEnd();
1398
- };
1399
- doc.addEventListener("pointermove", pointerMove);
1400
- doc.addEventListener("pointerup", pointerUp);
1401
- doc.addEventListener("pointercancel", pointerCancel);
1402
- }
1403
- function canDockToWindow(node) {
1404
- if (node instanceof TabNode) {
1405
- return node.isEnablePopout();
1406
- } else if (node instanceof TabSetNode) {
1407
- for (const child of node.getChildren()) {
1408
- if (child.isEnablePopout() === false) {
1409
- return false;
1410
- }
1411
- }
1412
- return true;
1413
- }
1414
- return false;
1415
- }
1416
- function keepOnScreen(rect) {
1417
- rect.snap(10);
1418
- const availableScreenWidth = window.screen.availWidth;
1419
- const availableScreenHeight = window.screen.availHeight;
1420
- if (rect.x + rect.width > availableScreenWidth || rect.y + rect.height > availableScreenHeight) {
1421
- rect.x = Math.max(0, Math.min(rect.x, availableScreenWidth - rect.width));
1422
- rect.y = Math.max(0, Math.min(rect.y, availableScreenHeight - rect.height));
1423
- }
1424
- return rect;
1425
- }
1426
- function isOnScreen(rect) {
1427
- const availableScreenWidth = window.screen.availWidth;
1428
- const availableScreenHeight = window.screen.availHeight;
1429
- return rect.x >= 0 && rect.getRight() <= availableScreenWidth && rect.y >= 0 || rect.getBottom() <= availableScreenHeight;
1430
- }
1431
- function copyInlineStyles(source, target) {
1432
- const sourceStyle = source.getAttribute("style");
1433
- const targetStyle = target.getAttribute("style");
1434
- if (sourceStyle === targetStyle) return false;
1435
- if (sourceStyle) {
1436
- target.setAttribute("style", sourceStyle);
1437
- } else {
1438
- target.removeAttribute("style");
1439
- }
1440
- return true;
1441
- }
1442
- function isSafari() {
1443
- const userAgent = navigator.userAgent;
1444
- return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
1445
- }
1446
- function isTabClosable(node, selected) {
1447
- const closeType = node.getCloseType();
1448
- if (selected || closeType === 2 /* Always */) {
1449
- return true;
1450
- }
1451
- if (closeType === 1 /* Visible */) {
1452
- if (window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches) {
1453
- return true;
1454
- }
1455
- }
1456
- return false;
1457
- }
1458
-
1459
1248
  // src/model/Utils.ts
1460
1249
  function adjustSelectedIndex(parent, removedIndex) {
1461
1250
  if (parent !== void 0 && (parent instanceof TabSetNode || parent instanceof BorderNode)) {
@@ -1483,7 +1272,7 @@ function randomUUID() {
1483
1272
  var TabSetNode = class _TabSetNode extends Node {
1484
1273
  static TYPE = "tabset";
1485
1274
  /** @internal */
1486
- static fromJson(json, model, layoutWindow) {
1275
+ static fromJson(json, model) {
1487
1276
  const newLayoutNode = new _TabSetNode(model, json);
1488
1277
  if (json.children != null) {
1489
1278
  for (const jsonChild of json.children) {
@@ -1495,10 +1284,10 @@ var TabSetNode = class _TabSetNode extends Node {
1495
1284
  newLayoutNode.setSelected(-1);
1496
1285
  }
1497
1286
  if (json.maximized && json.maximized === true) {
1498
- layoutWindow.maximizedTabSet = newLayoutNode;
1287
+ model.setMaximizedTabset(newLayoutNode);
1499
1288
  }
1500
1289
  if (json.active && json.active === true) {
1501
- layoutWindow.activeTabSet = newLayoutNode;
1290
+ model.setActiveTabset(newLayoutNode);
1502
1291
  }
1503
1292
  return newLayoutNode;
1504
1293
  }
@@ -1565,9 +1354,8 @@ var TabSetNode = class _TabSetNode extends Node {
1565
1354
  getMinSize(orientation) {
1566
1355
  if (orientation === Orientation.HORZ) {
1567
1356
  return this.getMinWidth();
1568
- } else {
1569
- return this.getMinHeight();
1570
1357
  }
1358
+ return this.getMinHeight();
1571
1359
  }
1572
1360
  getAttrMaxWidth() {
1573
1361
  return this.getAttr("maxWidth");
@@ -1585,9 +1373,8 @@ var TabSetNode = class _TabSetNode extends Node {
1585
1373
  getMaxSize(orientation) {
1586
1374
  if (orientation === Orientation.HORZ) {
1587
1375
  return this.getMaxWidth();
1588
- } else {
1589
- return this.getMaxHeight();
1590
1376
  }
1377
+ return this.getMaxHeight();
1591
1378
  }
1592
1379
  /**
1593
1380
  * Returns the config attribute that can be used to store node specific data that
@@ -1600,10 +1387,10 @@ var TabSetNode = class _TabSetNode extends Node {
1600
1387
  return this.attributes.config;
1601
1388
  }
1602
1389
  isMaximized() {
1603
- return this.model.getMaximizedTabset(this.getWindowId()) === this;
1390
+ return this.model.getMaximizedTabset() === this;
1604
1391
  }
1605
1392
  isActive() {
1606
- return this.model.getActiveTabset(this.getWindowId()) === this;
1393
+ return this.model.getActiveTabset() === this;
1607
1394
  }
1608
1395
  isEnableDeleteWhenEmpty() {
1609
1396
  return this.getAttr("enableDeleteWhenEmpty");
@@ -1641,6 +1428,9 @@ var TabSetNode = class _TabSetNode extends Node {
1641
1428
  getTabLocation() {
1642
1429
  return this.getAttr("tabLocation");
1643
1430
  }
1431
+ getWindowId() {
1432
+ return Model.MAIN_WINDOW_ID;
1433
+ }
1644
1434
  toJson() {
1645
1435
  const json = {};
1646
1436
  _TabSetNode.attributeDefinitions.toJson(json, this.attributes);
@@ -1672,10 +1462,10 @@ var TabSetNode = class _TabSetNode extends Node {
1672
1462
  /** @internal */
1673
1463
  canMaximize() {
1674
1464
  if (this.isEnableMaximize()) {
1675
- if (this.getModel().getMaximizedTabset(this.getWindowId()) === this) {
1465
+ if (this.getModel().getMaximizedTabset() === this) {
1676
1466
  return true;
1677
1467
  }
1678
- if (this.getParent() === this.getModel().getRoot(this.getWindowId()) && this.getModel().getRoot(this.getWindowId()).getChildren().length === 1) {
1468
+ if (this.getParent() === this.getModel().getRoot() && this.getModel().getRoot().getChildren().length === 1) {
1679
1469
  return false;
1680
1470
  }
1681
1471
  return true;
@@ -1710,9 +1500,6 @@ var TabSetNode = class _TabSetNode extends Node {
1710
1500
  setSelected(index) {
1711
1501
  this.attributes.selected = index;
1712
1502
  }
1713
- getWindowId() {
1714
- return this.parent.getWindowId();
1715
- }
1716
1503
  /** @internal */
1717
1504
  canDrop(dragNode, x, y) {
1718
1505
  let dropInfo;
@@ -1720,11 +1507,9 @@ var TabSetNode = class _TabSetNode extends Node {
1720
1507
  const dockLocation = DockLocation.CENTER;
1721
1508
  const outlineRect = this.tabStripRect;
1722
1509
  dropInfo = new DropInfo(this, outlineRect, dockLocation, -1, "flexlayout__outline_rect" /* FLEXLAYOUT__OUTLINE_RECT */);
1723
- } else if (this.getWindowId() !== Model.MAIN_WINDOW_ID && !canDockToWindow(dragNode)) {
1724
- return void 0;
1725
1510
  } else if (this.contentRect.contains(x, y)) {
1726
1511
  let dockLocation = DockLocation.CENTER;
1727
- if (this.model.getMaximizedTabset(this.parent.getWindowId()) === void 0) {
1512
+ if (this.model.getMaximizedTabset() === void 0) {
1728
1513
  dockLocation = DockLocation.getLocation(this.contentRect, x, y);
1729
1514
  }
1730
1515
  const outlineRect = dockLocation.getDockRect(this.rect);
@@ -1744,7 +1529,7 @@ var TabSetNode = class _TabSetNode extends Node {
1744
1529
  yy = r.y;
1745
1530
  h = r.height;
1746
1531
  let p = this.tabStripRect.x;
1747
- let childCenter = 0;
1532
+ let childCenter;
1748
1533
  for (let i = 0; i < this.children.length; i++) {
1749
1534
  child = this.children[i];
1750
1535
  r = child.getTabRect();
@@ -1789,7 +1574,7 @@ var TabSetNode = class _TabSetNode extends Node {
1789
1574
  if (this === dragNode) {
1790
1575
  return;
1791
1576
  }
1792
- let dragParent = dragNode.getParent();
1577
+ const dragParent = dragNode.getParent();
1793
1578
  let fromIndex = 0;
1794
1579
  if (dragParent !== void 0) {
1795
1580
  fromIndex = dragParent.removeChild(dragNode);
@@ -1829,7 +1614,7 @@ var TabSetNode = class _TabSetNode extends Node {
1829
1614
  this.setSelected(0);
1830
1615
  }
1831
1616
  }
1832
- this.model.setActiveTabset(this, this.parent.getWindowId());
1617
+ this.model.setActiveTabset(this);
1833
1618
  } else {
1834
1619
  let moveNode = dragNode;
1835
1620
  if (dragNode instanceof TabNode) {
@@ -1837,11 +1622,10 @@ var TabSetNode = class _TabSetNode extends Node {
1837
1622
  const attrs = callback ? callback(dragNode) : {};
1838
1623
  moveNode = new _TabSetNode(this.model, attrs);
1839
1624
  moveNode.addChild(dragNode);
1840
- dragParent = moveNode;
1841
1625
  } else if (dragNode instanceof RowNode) {
1842
1626
  const parent = this.getParent();
1843
1627
  if (dragNode.getOrientation() === parent.getOrientation() && (location.getOrientation() === parent.getOrientation() || location === DockLocation.CENTER)) {
1844
- const node = new RowNode(this.model, this.getWindowId(), {});
1628
+ const node = new RowNode(this.model, {});
1845
1629
  node.addChild(dragNode);
1846
1630
  moveNode = node;
1847
1631
  }
@@ -1855,7 +1639,7 @@ var TabSetNode = class _TabSetNode extends Node {
1855
1639
  this.setWeight(this.getWeight() / 2);
1856
1640
  parentRow.addChild(moveNode, pos + dockLocation.indexPlus);
1857
1641
  } else {
1858
- const newRow = new RowNode(this.model, this.getWindowId(), {});
1642
+ const newRow = new RowNode(this.model, {});
1859
1643
  newRow.setWeight(this.getWeight());
1860
1644
  newRow.addChild(this);
1861
1645
  this.setWeight(50);
@@ -1865,7 +1649,7 @@ var TabSetNode = class _TabSetNode extends Node {
1865
1649
  parentRow.addChild(newRow, pos);
1866
1650
  }
1867
1651
  if (moveNode instanceof _TabSetNode) {
1868
- this.model.setActiveTabset(moveNode, this.getWindowId());
1652
+ this.model.setActiveTabset(moveNode);
1869
1653
  }
1870
1654
  }
1871
1655
  this.model.tidy();
@@ -1916,15 +1700,15 @@ var TabSetNode = class _TabSetNode extends Node {
1916
1700
  var RowNode = class _RowNode extends Node {
1917
1701
  static TYPE = "row";
1918
1702
  /** @internal */
1919
- static fromJson(json, model, layoutWindow) {
1920
- const newLayoutNode = new _RowNode(model, layoutWindow.windowId, json);
1703
+ static fromJson(json, model) {
1704
+ const newLayoutNode = new _RowNode(model, json);
1921
1705
  if (json.children != null) {
1922
1706
  for (const jsonChild of json.children) {
1923
1707
  if (jsonChild.type === TabSetNode.TYPE) {
1924
- const child = TabSetNode.fromJson(jsonChild, model, layoutWindow);
1708
+ const child = TabSetNode.fromJson(jsonChild, model);
1925
1709
  newLayoutNode.addChild(child);
1926
1710
  } else {
1927
- const child = _RowNode.fromJson(jsonChild, model, layoutWindow);
1711
+ const child = _RowNode.fromJson(jsonChild, model);
1928
1712
  newLayoutNode.addChild(child);
1929
1713
  }
1930
1714
  }
@@ -1934,8 +1718,6 @@ var RowNode = class _RowNode extends Node {
1934
1718
  /** @internal */
1935
1719
  static attributeDefinitions = _RowNode.createAttributeDefinitions();
1936
1720
  /** @internal */
1937
- windowId;
1938
- /** @internal */
1939
1721
  minHeight;
1940
1722
  /** @internal */
1941
1723
  minWidth;
@@ -1944,9 +1726,8 @@ var RowNode = class _RowNode extends Node {
1944
1726
  /** @internal */
1945
1727
  maxWidth;
1946
1728
  /** @internal */
1947
- constructor(model, windowId, json) {
1729
+ constructor(model, json) {
1948
1730
  super(model);
1949
- this.windowId = windowId;
1950
1731
  this.minHeight = DefaultMin;
1951
1732
  this.minWidth = DefaultMin;
1952
1733
  this.maxHeight = DefaultMax;
@@ -1969,10 +1750,7 @@ var RowNode = class _RowNode extends Node {
1969
1750
  }
1970
1751
  /** @internal */
1971
1752
  getWindowId() {
1972
- return this.windowId;
1973
- }
1974
- setWindowId(windowId) {
1975
- this.windowId = windowId;
1753
+ return Model.MAIN_WINDOW_ID;
1976
1754
  }
1977
1755
  /** @internal */
1978
1756
  setWeight(weight) {
@@ -2099,9 +1877,8 @@ var RowNode = class _RowNode extends Node {
2099
1877
  getMinSize(orientation) {
2100
1878
  if (orientation === Orientation.HORZ) {
2101
1879
  return this.getMinWidth();
2102
- } else {
2103
- return this.getMinHeight();
2104
1880
  }
1881
+ return this.getMinHeight();
2105
1882
  }
2106
1883
  /** @internal */
2107
1884
  getMinWidth() {
@@ -2115,9 +1892,8 @@ var RowNode = class _RowNode extends Node {
2115
1892
  getMaxSize(orientation) {
2116
1893
  if (orientation === Orientation.HORZ) {
2117
1894
  return this.getMaxWidth();
2118
- } else {
2119
- return this.getMaxHeight();
2120
1895
  }
1896
+ return this.getMaxHeight();
2121
1897
  }
2122
1898
  /** @internal */
2123
1899
  getMaxWidth() {
@@ -2194,8 +1970,8 @@ var RowNode = class _RowNode extends Node {
2194
1970
  } else if (child instanceof TabSetNode && child.getChildren().length === 0) {
2195
1971
  if (child.isEnableDeleteWhenEmpty()) {
2196
1972
  this.removeChild(child);
2197
- if (child === this.model.getMaximizedTabset(this.windowId)) {
2198
- this.model.setMaximizedTabset(void 0, this.windowId);
1973
+ if (child === this.model.getMaximizedTabset()) {
1974
+ this.model.setMaximizedTabset(void 0);
2199
1975
  }
2200
1976
  } else {
2201
1977
  i++;
@@ -2204,12 +1980,12 @@ var RowNode = class _RowNode extends Node {
2204
1980
  i++;
2205
1981
  }
2206
1982
  }
2207
- if (this === this.model.getRoot(this.windowId) && this.children.length === 0) {
1983
+ if (this === this.model.getRoot() && this.children.length === 0) {
2208
1984
  const callback = this.model.getOnCreateTabSet();
2209
1985
  const baseAttrs = callback ? callback() : {};
2210
1986
  const attrs = { ...baseAttrs, selected: -1 };
2211
1987
  const child = new TabSetNode(this.model, attrs);
2212
- this.model.setActiveTabset(child, this.windowId);
1988
+ this.model.setActiveTabset(child);
2213
1989
  this.addChild(child);
2214
1990
  }
2215
1991
  }
@@ -2222,9 +1998,6 @@ var RowNode = class _RowNode extends Node {
2222
1998
  const margin = 10;
2223
1999
  const half = 50;
2224
2000
  let dropInfo;
2225
- if (this.getWindowId() !== Model.MAIN_WINDOW_ID && !canDockToWindow(dragNode)) {
2226
- return void 0;
2227
- }
2228
2001
  if (this.model.isEnableEdgeDock() && this.parent === void 0) {
2229
2002
  if (x < this.rect.x + margin && yy > h / 2 - half && yy < h / 2 + half) {
2230
2003
  const dockLocation = DockLocation.LEFT;
@@ -2274,7 +2047,7 @@ var RowNode = class _RowNode extends Node {
2274
2047
  if (dragNode instanceof TabSetNode || dragNode instanceof _RowNode) {
2275
2048
  node = dragNode;
2276
2049
  if (node instanceof _RowNode && node.getOrientation() === this.getOrientation() && (location.getOrientation() === this.getOrientation() || location === DockLocation.CENTER)) {
2277
- node = new _RowNode(this.model, this.windowId, {});
2050
+ node = new _RowNode(this.model, {});
2278
2051
  node.addChild(dragNode);
2279
2052
  }
2280
2053
  } else {
@@ -2302,8 +2075,8 @@ var RowNode = class _RowNode extends Node {
2302
2075
  } else if (horz && dockLocation === DockLocation.RIGHT || !horz && dockLocation === DockLocation.BOTTOM) {
2303
2076
  this.addChild(node);
2304
2077
  } else if (horz && dockLocation === DockLocation.TOP || !horz && dockLocation === DockLocation.LEFT) {
2305
- const vrow = new _RowNode(this.model, this.windowId, {});
2306
- const hrow = new _RowNode(this.model, this.windowId, {});
2078
+ const vrow = new _RowNode(this.model, {});
2079
+ const hrow = new _RowNode(this.model, {});
2307
2080
  hrow.setWeight(75);
2308
2081
  node.setWeight(25);
2309
2082
  for (const child of this.children) {
@@ -2314,8 +2087,8 @@ var RowNode = class _RowNode extends Node {
2314
2087
  vrow.addChild(hrow);
2315
2088
  this.addChild(vrow);
2316
2089
  } else if (horz && dockLocation === DockLocation.BOTTOM || !horz && dockLocation === DockLocation.RIGHT) {
2317
- const vrow = new _RowNode(this.model, this.windowId, {});
2318
- const hrow = new _RowNode(this.model, this.windowId, {});
2090
+ const vrow = new _RowNode(this.model, {});
2091
+ const hrow = new _RowNode(this.model, {});
2319
2092
  hrow.setWeight(75);
2320
2093
  node.setWeight(25);
2321
2094
  for (const child of this.children) {
@@ -2327,7 +2100,7 @@ var RowNode = class _RowNode extends Node {
2327
2100
  this.addChild(vrow);
2328
2101
  }
2329
2102
  if (node instanceof TabSetNode) {
2330
- this.model.setActiveTabset(node, this.windowId);
2103
+ this.model.setActiveTabset(node);
2331
2104
  }
2332
2105
  this.model.tidy();
2333
2106
  }
@@ -2372,93 +2145,6 @@ var RowNode = class _RowNode extends Node {
2372
2145
  }
2373
2146
  };
2374
2147
 
2375
- // src/model/LayoutWindow.ts
2376
- var LayoutWindow = class _LayoutWindow {
2377
- _windowId;
2378
- _layout;
2379
- _rect;
2380
- _window;
2381
- _root;
2382
- _maximizedTabSet;
2383
- _activeTabSet;
2384
- _toScreenRectFunction;
2385
- constructor(windowId, rect) {
2386
- this._windowId = windowId;
2387
- this._rect = rect;
2388
- this._toScreenRectFunction = (r) => r;
2389
- }
2390
- visitNodes(fn) {
2391
- this.root.forEachNode(fn, 0);
2392
- }
2393
- get windowId() {
2394
- return this._windowId;
2395
- }
2396
- get rect() {
2397
- return this._rect;
2398
- }
2399
- get layout() {
2400
- return this._layout;
2401
- }
2402
- get window() {
2403
- return this._window;
2404
- }
2405
- get root() {
2406
- return this._root;
2407
- }
2408
- get maximizedTabSet() {
2409
- return this._maximizedTabSet;
2410
- }
2411
- get activeTabSet() {
2412
- return this._activeTabSet;
2413
- }
2414
- /** @internal */
2415
- set rect(value) {
2416
- this._rect = value;
2417
- }
2418
- /** @internal */
2419
- set layout(value) {
2420
- this._layout = value;
2421
- }
2422
- /** @internal */
2423
- set window(value) {
2424
- this._window = value;
2425
- }
2426
- /** @internal */
2427
- set root(value) {
2428
- this._root = value;
2429
- }
2430
- /** @internal */
2431
- set maximizedTabSet(value) {
2432
- this._maximizedTabSet = value;
2433
- }
2434
- /** @internal */
2435
- set activeTabSet(value) {
2436
- this._activeTabSet = value;
2437
- }
2438
- /** @internal */
2439
- get toScreenRectFunction() {
2440
- return this._toScreenRectFunction;
2441
- }
2442
- /** @internal */
2443
- set toScreenRectFunction(value) {
2444
- this._toScreenRectFunction = value;
2445
- }
2446
- toJson() {
2447
- if (this._window && this._window.screenTop > -1e4) {
2448
- this.rect = new Rect(this._window.screenLeft, this._window.screenTop, this._window.outerWidth, this._window.outerHeight);
2449
- }
2450
- return { layout: this.root.toJson(), rect: this.rect.toJson() };
2451
- }
2452
- static fromJson(windowJson, model, windowId) {
2453
- const count = model.getwindowsMap().size;
2454
- let rect = windowJson.rect ? Rect.fromJson(windowJson.rect) : new Rect(50 + 50 * count, 50 + 50 * count, 600, 400);
2455
- rect = keepOnScreen(rect);
2456
- const layoutWindow = new _LayoutWindow(windowId, rect);
2457
- layoutWindow.root = RowNode.fromJson(windowJson.layout, model, layoutWindow);
2458
- return layoutWindow;
2459
- }
2460
- };
2461
-
2462
2148
  // src/model/Model.ts
2463
2149
  var DefaultMin = 0;
2464
2150
  var DefaultMax = 99999;
@@ -2479,9 +2165,13 @@ var Model = class _Model {
2479
2165
  /** @internal */
2480
2166
  onCreateTabSet;
2481
2167
  /** @internal */
2482
- windows;
2168
+ _root;
2483
2169
  /** @internal */
2484
- rootWindow;
2170
+ _maximizedTabSet;
2171
+ /** @internal */
2172
+ _activeTabSet;
2173
+ /** @internal */
2174
+ _layout;
2485
2175
  /**
2486
2176
  * 'private' constructor. Use the static method Model.fromJson(json) to create a model
2487
2177
  * @internal
@@ -2490,16 +2180,13 @@ var Model = class _Model {
2490
2180
  this.attributes = {};
2491
2181
  this.idMap = /* @__PURE__ */ new Map();
2492
2182
  this.borders = new BorderSet(this);
2493
- this.windows = /* @__PURE__ */ new Map();
2494
- this.rootWindow = new LayoutWindow(_Model.MAIN_WINDOW_ID, Rect.empty());
2495
- this.windows.set(_Model.MAIN_WINDOW_ID, this.rootWindow);
2496
2183
  this.changeListeners = [];
2497
2184
  }
2498
2185
  /**
2499
2186
  * Update the node tree by performing the given action,
2500
2187
  * Actions should be generated via static methods on the Actions class
2501
2188
  * @param action the action to perform
2502
- * @returns added Node for Actions.addNode, windowId for createWindow
2189
+ * @returns added Node for Actions.addNode
2503
2190
  */
2504
2191
  doAction(action) {
2505
2192
  let returnVal = void 0;
@@ -2516,16 +2203,14 @@ var Model = class _Model {
2516
2203
  case Actions.MOVE_NODE: {
2517
2204
  const fromNode = this.idMap.get(action.data.fromNode);
2518
2205
  if (fromNode instanceof TabNode || fromNode instanceof TabSetNode || fromNode instanceof RowNode) {
2519
- if (fromNode === this.getMaximizedTabset(fromNode.getWindowId())) {
2520
- const fromWindow = this.windows.get(fromNode.getWindowId());
2521
- fromWindow.maximizedTabSet = void 0;
2206
+ if (fromNode === this.getMaximizedTabset()) {
2207
+ this._maximizedTabSet = void 0;
2522
2208
  }
2523
2209
  const toNode = this.idMap.get(action.data.toNode);
2524
2210
  if (toNode instanceof TabSetNode || toNode instanceof BorderNode || toNode instanceof RowNode) {
2525
2211
  toNode.drop(fromNode, DockLocation.getByName(action.data.location), action.data.index, action.data.select);
2526
2212
  }
2527
2213
  }
2528
- this.removeEmptyWindows();
2529
2214
  break;
2530
2215
  }
2531
2216
  case Actions.DELETE_TAB: {
@@ -2533,7 +2218,6 @@ var Model = class _Model {
2533
2218
  if (node instanceof TabNode) {
2534
2219
  node.delete();
2535
2220
  }
2536
- this.removeEmptyWindows();
2537
2221
  break;
2538
2222
  }
2539
2223
  case Actions.DELETE_TABSET: {
@@ -2551,77 +2235,6 @@ var Model = class _Model {
2551
2235
  }
2552
2236
  this.tidy();
2553
2237
  }
2554
- this.removeEmptyWindows();
2555
- break;
2556
- }
2557
- case Actions.POPOUT_TABSET: {
2558
- const node = this.idMap.get(action.data.node);
2559
- if (node instanceof TabSetNode) {
2560
- const isMaximized = node.isMaximized();
2561
- const oldLayoutWindow = this.windows.get(node.getWindowId());
2562
- const windowId = randomUUID();
2563
- const layoutWindow = new LayoutWindow(windowId, oldLayoutWindow.toScreenRectFunction(node.getRect()));
2564
- const json = {
2565
- type: "row",
2566
- children: []
2567
- };
2568
- const row = RowNode.fromJson(json, this, layoutWindow);
2569
- layoutWindow.root = row;
2570
- this.windows.set(windowId, layoutWindow);
2571
- row.drop(node, DockLocation.CENTER, 0);
2572
- if (isMaximized) {
2573
- this.rootWindow.maximizedTabSet = void 0;
2574
- }
2575
- }
2576
- this.removeEmptyWindows();
2577
- break;
2578
- }
2579
- case Actions.POPOUT_TAB: {
2580
- const node = this.idMap.get(action.data.node);
2581
- if (node instanceof TabNode) {
2582
- const windowId = randomUUID();
2583
- let r = Rect.empty();
2584
- if (node.getParent() instanceof TabSetNode) {
2585
- r = node.getParent().getRect();
2586
- } else {
2587
- r = node.getParent().getContentRect();
2588
- }
2589
- const oldLayoutWindow = this.windows.get(node.getWindowId());
2590
- const layoutWindow = new LayoutWindow(windowId, oldLayoutWindow.toScreenRectFunction(r));
2591
- const tabsetId = randomUUID();
2592
- const json = {
2593
- type: "row",
2594
- children: [{ type: "tabset", id: tabsetId, children: [] }]
2595
- };
2596
- const row = RowNode.fromJson(json, this, layoutWindow);
2597
- layoutWindow.root = row;
2598
- this.windows.set(windowId, layoutWindow);
2599
- const tabset = this.idMap.get(tabsetId);
2600
- tabset.drop(node, DockLocation.CENTER, 0, true);
2601
- }
2602
- this.removeEmptyWindows();
2603
- break;
2604
- }
2605
- case Actions.CLOSE_WINDOW: {
2606
- const window2 = this.windows.get(action.data.windowId);
2607
- if (window2) {
2608
- this.rootWindow.root?.drop(window2.root, DockLocation.CENTER, -1);
2609
- this.rootWindow.visitNodes((node, _level) => {
2610
- if (node instanceof RowNode) {
2611
- node.setWindowId(_Model.MAIN_WINDOW_ID);
2612
- }
2613
- });
2614
- this.windows.delete(action.data.windowId);
2615
- }
2616
- break;
2617
- }
2618
- case Actions.CREATE_WINDOW: {
2619
- const windowId = randomUUID();
2620
- const layoutWindow = new LayoutWindow(windowId, Rect.fromJson(action.data.rect));
2621
- const row = RowNode.fromJson(action.data.layout, this, layoutWindow);
2622
- layoutWindow.root = row;
2623
- this.windows.set(windowId, layoutWindow);
2624
- returnVal = windowId;
2625
2238
  break;
2626
2239
  }
2627
2240
  case Actions.RENAME_TAB: {
@@ -2633,8 +2246,6 @@ var Model = class _Model {
2633
2246
  }
2634
2247
  case Actions.SELECT_TAB: {
2635
2248
  const tabNode = this.idMap.get(action.data.tabNode);
2636
- const windowId = action.data.windowId ? action.data.windowId : _Model.MAIN_WINDOW_ID;
2637
- const window2 = this.windows.get(windowId);
2638
2249
  if (tabNode instanceof TabNode) {
2639
2250
  const parent = tabNode.getParent();
2640
2251
  const pos = parent.getChildren().indexOf(tabNode);
@@ -2648,20 +2259,18 @@ var Model = class _Model {
2648
2259
  if (parent.getSelected() !== pos) {
2649
2260
  parent.setSelected(pos);
2650
2261
  }
2651
- window2.activeTabSet = parent;
2262
+ this._activeTabSet = parent;
2652
2263
  }
2653
2264
  }
2654
2265
  break;
2655
2266
  }
2656
2267
  case Actions.SET_ACTIVE_TABSET: {
2657
- const windowId = action.data.windowId ? action.data.windowId : _Model.MAIN_WINDOW_ID;
2658
- const window2 = this.windows.get(windowId);
2659
2268
  if (action.data.tabsetNode === void 0) {
2660
- window2.activeTabSet = void 0;
2269
+ this._activeTabSet = void 0;
2661
2270
  } else {
2662
2271
  const tabsetNode = this.idMap.get(action.data.tabsetNode);
2663
2272
  if (tabsetNode instanceof TabSetNode) {
2664
- window2.activeTabSet = tabsetNode;
2273
+ this._activeTabSet = tabsetNode;
2665
2274
  }
2666
2275
  }
2667
2276
  break;
@@ -2683,15 +2292,13 @@ var Model = class _Model {
2683
2292
  break;
2684
2293
  }
2685
2294
  case Actions.MAXIMIZE_TOGGLE: {
2686
- const windowId = action.data.windowId ? action.data.windowId : _Model.MAIN_WINDOW_ID;
2687
- const window2 = this.windows.get(windowId);
2688
2295
  const node = this.idMap.get(action.data.node);
2689
2296
  if (node instanceof TabSetNode) {
2690
- if (node === window2.maximizedTabSet) {
2691
- window2.maximizedTabSet = void 0;
2297
+ if (node === this._maximizedTabSet) {
2298
+ this._maximizedTabSet = void 0;
2692
2299
  } else {
2693
- window2.maximizedTabSet = node;
2694
- window2.activeTabSet = node;
2300
+ this._maximizedTabSet = node;
2301
+ this._activeTabSet = node;
2695
2302
  }
2696
2303
  }
2697
2304
  break;
@@ -2717,26 +2324,24 @@ var Model = class _Model {
2717
2324
  /**
2718
2325
  * Get the currently active tabset node
2719
2326
  */
2720
- getActiveTabset(windowId = _Model.MAIN_WINDOW_ID) {
2721
- const window2 = this.windows.get(windowId);
2722
- if (window2 && window2.activeTabSet && this.getNodeById(window2.activeTabSet.getId())) {
2723
- return window2.activeTabSet;
2724
- } else {
2725
- return void 0;
2327
+ getActiveTabset(_windowId) {
2328
+ if (this._activeTabSet && this.getNodeById(this._activeTabSet.getId())) {
2329
+ return this._activeTabSet;
2726
2330
  }
2331
+ return void 0;
2727
2332
  }
2728
2333
  /**
2729
2334
  * Get the currently maximized tabset node
2730
2335
  */
2731
- getMaximizedTabset(windowId = _Model.MAIN_WINDOW_ID) {
2732
- return this.windows.get(windowId).maximizedTabSet;
2336
+ getMaximizedTabset(_windowId) {
2337
+ return this._maximizedTabSet;
2733
2338
  }
2734
2339
  /**
2735
2340
  * Gets the root RowNode of the model
2736
2341
  * @returns {RowNode}
2737
2342
  */
2738
- getRoot(windowId = _Model.MAIN_WINDOW_ID) {
2739
- return this.windows.get(windowId).root;
2343
+ getRoot(_windowId) {
2344
+ return this._root;
2740
2345
  }
2741
2346
  isRootOrientationVertical() {
2742
2347
  return this.attributes.rootOrientationVertical;
@@ -2751,8 +2356,13 @@ var Model = class _Model {
2751
2356
  getBorderSet() {
2752
2357
  return this.borders;
2753
2358
  }
2754
- getwindowsMap() {
2755
- return this.windows;
2359
+ /** @internal */
2360
+ get layout() {
2361
+ return this._layout;
2362
+ }
2363
+ /** @internal */
2364
+ set layout(value) {
2365
+ this._layout = value;
2756
2366
  }
2757
2367
  /**
2758
2368
  * Visits all the nodes in the model and calls the given function for each
@@ -2760,17 +2370,7 @@ var Model = class _Model {
2760
2370
  */
2761
2371
  visitNodes(fn) {
2762
2372
  this.borders.forEachNode(fn);
2763
- for (const [_, w] of this.windows) {
2764
- w.root.forEachNode(fn, 0);
2765
- }
2766
- }
2767
- visitWindowNodes(windowId, fn) {
2768
- if (this.windows.has(windowId)) {
2769
- if (windowId === _Model.MAIN_WINDOW_ID) {
2770
- this.borders.forEachNode(fn);
2771
- }
2772
- this.windows.get(windowId).visitNodes(fn);
2773
- }
2373
+ this._root.forEachNode(fn, 0);
2774
2374
  }
2775
2375
  /**
2776
2376
  * Gets a node by its id
@@ -2784,13 +2384,12 @@ var Model = class _Model {
2784
2384
  * @param node The top node you want to begin searching from, deafults to the root node
2785
2385
  * @returns The first Tab Set
2786
2386
  */
2787
- getFirstTabSet(node = this.windows.get(_Model.MAIN_WINDOW_ID).root) {
2387
+ getFirstTabSet(node = this._root) {
2788
2388
  const child = node.getChildren()[0];
2789
2389
  if (child instanceof TabSetNode) {
2790
2390
  return child;
2791
- } else {
2792
- return this.getFirstTabSet(child);
2793
2391
  }
2392
+ return this.getFirstTabSet(child);
2794
2393
  }
2795
2394
  /**
2796
2395
  * Loads the model from the given json object
@@ -2803,21 +2402,7 @@ var Model = class _Model {
2803
2402
  if (json.borders) {
2804
2403
  model.borders = BorderSet.fromJson(json.borders, model);
2805
2404
  }
2806
- if (json.popouts) {
2807
- let i = 0;
2808
- const top = 100;
2809
- const left = 100;
2810
- for (const windowId in json.popouts) {
2811
- const windowJson = json.popouts[windowId];
2812
- const layoutWindow = LayoutWindow.fromJson(windowJson, model, windowId);
2813
- model.windows.set(windowId, layoutWindow);
2814
- if (!isOnScreen(layoutWindow.rect)) {
2815
- layoutWindow.rect = new Rect(top + i * 50, left + i * 50, 600, 400);
2816
- i++;
2817
- }
2818
- }
2819
- }
2820
- model.rootWindow.root = RowNode.fromJson(json.layout, model, model.getwindowsMap().get(_Model.MAIN_WINDOW_ID));
2405
+ model._root = RowNode.fromJson(json.layout, model);
2821
2406
  model.tidy();
2822
2407
  return model;
2823
2408
  }
@@ -2831,17 +2416,10 @@ var Model = class _Model {
2831
2416
  this.visitNodes((node) => {
2832
2417
  node.fireEvent("save", {});
2833
2418
  });
2834
- const windows = {};
2835
- for (const [id, window2] of this.windows) {
2836
- if (id !== _Model.MAIN_WINDOW_ID) {
2837
- windows[id] = window2.toJson();
2838
- }
2839
- }
2840
2419
  return {
2841
2420
  global,
2842
2421
  borders: this.borders.toJson(),
2843
- layout: this.rootWindow.root.toJson(),
2844
- popouts: windows
2422
+ layout: this._root.toJson()
2845
2423
  };
2846
2424
  }
2847
2425
  getSplitterSize() {
@@ -2886,46 +2464,12 @@ var Model = class _Model {
2886
2464
  }
2887
2465
  /***********************internal ********************************/
2888
2466
  /** @internal */
2889
- removeEmptyWindows() {
2890
- const emptyWindows = /* @__PURE__ */ new Set();
2891
- for (const [windowId] of this.windows) {
2892
- if (windowId !== _Model.MAIN_WINDOW_ID) {
2893
- let count = 0;
2894
- this.visitWindowNodes(windowId, (node) => {
2895
- if (node instanceof TabNode) {
2896
- count++;
2897
- }
2898
- });
2899
- if (count === 0) {
2900
- emptyWindows.add(windowId);
2901
- }
2902
- }
2903
- }
2904
- for (const windowId of emptyWindows) {
2905
- this.windows.delete(windowId);
2906
- }
2907
- }
2908
- /** @internal */
2909
- setActiveTabset(tabsetNode, windowId) {
2910
- const window2 = this.windows.get(windowId);
2911
- if (window2) {
2912
- if (tabsetNode) {
2913
- window2.activeTabSet = tabsetNode;
2914
- } else {
2915
- window2.activeTabSet = void 0;
2916
- }
2917
- }
2467
+ setActiveTabset(tabsetNode) {
2468
+ this._activeTabSet = tabsetNode;
2918
2469
  }
2919
2470
  /** @internal */
2920
- setMaximizedTabset(tabsetNode, windowId) {
2921
- const window2 = this.windows.get(windowId);
2922
- if (window2) {
2923
- if (tabsetNode) {
2924
- window2.maximizedTabSet = tabsetNode;
2925
- } else {
2926
- window2.maximizedTabSet = void 0;
2927
- }
2928
- }
2471
+ setMaximizedTabset(tabsetNode) {
2472
+ this._maximizedTabSet = tabsetNode;
2929
2473
  }
2930
2474
  /** @internal */
2931
2475
  updateIdMap() {
@@ -2943,18 +2487,16 @@ var Model = class _Model {
2943
2487
  this.idMap.set(id, node);
2944
2488
  }
2945
2489
  /** @internal */
2946
- findDropTargetNode(windowId, dragNode, x, y) {
2947
- let node = this.windows.get(windowId).root.findDropTargetNode(windowId, dragNode, x, y);
2948
- if (node === void 0 && windowId === _Model.MAIN_WINDOW_ID) {
2490
+ findDropTargetNode(_windowId, dragNode, x, y) {
2491
+ let node = this._root.findDropTargetNode(_windowId, dragNode, x, y);
2492
+ if (node === void 0) {
2949
2493
  node = this.borders.findDropTargetNode(dragNode, x, y);
2950
2494
  }
2951
2495
  return node;
2952
2496
  }
2953
2497
  /** @internal */
2954
2498
  tidy() {
2955
- for (const [_, window2] of this.windows) {
2956
- window2.root.tidy();
2957
- }
2499
+ this._root.tidy();
2958
2500
  }
2959
2501
  /** @internal */
2960
2502
  updateAttrs(json) {
@@ -3000,9 +2542,6 @@ var Model = class _Model {
3000
2542
  attributeDefinitions.add("splitterEnableHandle", false).setType(Attribute.BOOLEAN).setDescription(`enable a small centralized handle on all splitters`);
3001
2543
  attributeDefinitions.add("tabEnableClose", true).setType(Attribute.BOOLEAN);
3002
2544
  attributeDefinitions.add("tabCloseType", 1).setType("ICloseType");
3003
- attributeDefinitions.add("tabEnablePopout", false).setType(Attribute.BOOLEAN).setAlias("tabEnableFloat");
3004
- attributeDefinitions.add("tabEnablePopoutIcon", true).setType(Attribute.BOOLEAN);
3005
- attributeDefinitions.add("tabEnablePopoutOverlay", false).setType(Attribute.BOOLEAN);
3006
2545
  attributeDefinitions.add("tabEnableDrag", true).setType(Attribute.BOOLEAN);
3007
2546
  attributeDefinitions.add("tabEnableRename", true).setType(Attribute.BOOLEAN);
3008
2547
  attributeDefinitions.add("tabContentClassName", void 0).setType(Attribute.STRING);
@@ -3259,7 +2798,7 @@ var BorderNode = class _BorderNode extends Node {
3259
2798
  const childY = childRect.y;
3260
2799
  const childHeight = childRect.height;
3261
2800
  let pos = this.tabHeaderRect.x;
3262
- let childCenter = 0;
2801
+ let childCenter;
3263
2802
  for (let i = 0; i < this.children.length; i++) {
3264
2803
  child = this.children[i];
3265
2804
  childRect = child.getTabRect();
@@ -3286,7 +2825,7 @@ var BorderNode = class _BorderNode extends Node {
3286
2825
  const childX = childRect.x;
3287
2826
  const childWidth = childRect.width;
3288
2827
  let pos = this.tabHeaderRect.y;
3289
- let childCenter = 0;
2828
+ let childCenter;
3290
2829
  for (let i = 0; i < this.children.length; i++) {
3291
2830
  child = this.children[i];
3292
2831
  childRect = child.getTabRect();
@@ -3418,6 +2957,99 @@ import * as React3 from "react";
3418
2957
 
3419
2958
  // src/view/Splitter.tsx
3420
2959
  import * as React2 from "react";
2960
+
2961
+ // src/view/Utils.tsx
2962
+ import * as React from "react";
2963
+
2964
+ // src/model/ICloseType.ts
2965
+ var ICloseType = /* @__PURE__ */ ((ICloseType2) => {
2966
+ ICloseType2[ICloseType2["Visible"] = 1] = "Visible";
2967
+ ICloseType2[ICloseType2["Always"] = 2] = "Always";
2968
+ ICloseType2[ICloseType2["Selected"] = 3] = "Selected";
2969
+ return ICloseType2;
2970
+ })(ICloseType || {});
2971
+
2972
+ // src/view/Utils.tsx
2973
+ function isDesktop() {
2974
+ const desktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
2975
+ return desktop;
2976
+ }
2977
+ function getRenderStateEx(layout, node, iconAngle) {
2978
+ let leadingContent = void 0;
2979
+ const titleContent = node.getName();
2980
+ const name = node.getName();
2981
+ if (iconAngle === void 0) {
2982
+ iconAngle = 0;
2983
+ }
2984
+ if (leadingContent === void 0 && node.getIcon() !== void 0) {
2985
+ if (iconAngle !== 0) {
2986
+ leadingContent = /* @__PURE__ */ React.createElement("img", { style: { width: "1em", height: "1em", transform: "rotate(" + iconAngle + "deg)" }, src: node.getIcon(), alt: "leadingContent" });
2987
+ } else {
2988
+ leadingContent = /* @__PURE__ */ React.createElement("img", { style: { width: "1em", height: "1em" }, src: node.getIcon(), alt: "leadingContent" });
2989
+ }
2990
+ }
2991
+ const buttons = [];
2992
+ const renderState = { leading: leadingContent, content: titleContent, name, buttons };
2993
+ layout.customizeTab(node, renderState);
2994
+ node.setRenderedName(renderState.name);
2995
+ return renderState;
2996
+ }
2997
+ function isAuxMouseEvent(event) {
2998
+ let auxEvent = false;
2999
+ if (event.nativeEvent instanceof MouseEvent) {
3000
+ if (event.nativeEvent.button !== 0 || event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) {
3001
+ auxEvent = true;
3002
+ }
3003
+ }
3004
+ return auxEvent;
3005
+ }
3006
+ function enablePointerOnIFrames(enable, currentDocument) {
3007
+ const iframes = [...getElementsByTagName("iframe", currentDocument), ...getElementsByTagName("webview", currentDocument)];
3008
+ for (const iframe of iframes) {
3009
+ iframe.style.pointerEvents = enable ? "auto" : "none";
3010
+ }
3011
+ }
3012
+ function getElementsByTagName(tag, currentDocument) {
3013
+ return [...currentDocument.getElementsByTagName(tag)];
3014
+ }
3015
+ function startDrag(doc, event, drag, dragEnd, dragCancel) {
3016
+ event.preventDefault();
3017
+ const pointerMove = (ev) => {
3018
+ ev.preventDefault();
3019
+ drag(ev.clientX, ev.clientY);
3020
+ };
3021
+ const pointerCancel = (ev) => {
3022
+ ev.preventDefault();
3023
+ dragCancel();
3024
+ };
3025
+ const pointerUp = () => {
3026
+ doc.removeEventListener("pointermove", pointerMove);
3027
+ doc.removeEventListener("pointerup", pointerUp);
3028
+ doc.removeEventListener("pointercancel", pointerCancel);
3029
+ dragEnd();
3030
+ };
3031
+ doc.addEventListener("pointermove", pointerMove);
3032
+ doc.addEventListener("pointerup", pointerUp);
3033
+ doc.addEventListener("pointercancel", pointerCancel);
3034
+ }
3035
+ function isSafari() {
3036
+ const userAgent = navigator.userAgent;
3037
+ return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
3038
+ }
3039
+ function isTabClosable(node, selected) {
3040
+ const closeType = node.getCloseType();
3041
+ if (selected || closeType === 2 /* Always */) {
3042
+ return true;
3043
+ }
3044
+ if (closeType === 1 /* Visible */) {
3045
+ if (window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches) {
3046
+ return true;
3047
+ }
3048
+ }
3049
+ return false;
3050
+ }
3051
+
3052
+ // src/view/Splitter.tsx
3421
3053
  var Splitter = (props) => {
3422
3054
  const { layout, node, index, horizontal } = props;
3423
3055
  const [dragging, setDragging] = React2.useState(false);
@@ -3517,7 +3149,7 @@ var Splitter = (props) => {
3517
3149
  void _realtime;
3518
3150
  const redraw = () => {
3519
3151
  if (outlineDiv.current) {
3520
- let value = 0;
3152
+ let value;
3521
3153
  if (node.getOrientation() === Orientation.VERT) {
3522
3154
  value = outlineDiv.current.offsetTop;
3523
3155
  } else {
@@ -3971,7 +3603,7 @@ var useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {
3971
3603
  }
3972
3604
  };
3973
3605
  const onMouseWheel = (event) => {
3974
- let delta = 0;
3606
+ let delta;
3975
3607
  if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
3976
3608
  delta = -event.deltaX;
3977
3609
  } else {
@@ -4023,13 +3655,6 @@ var BorderTabSet = (props) => {
4023
3655
  layout.doAction(Actions.selectTab(item.node.getId()));
4024
3656
  userControlledLeft.current = false;
4025
3657
  };
4026
- const onPopoutTab = (event) => {
4027
- const selectedTabNode = border.getChildren()[border.getSelected()];
4028
- if (selectedTabNode !== void 0) {
4029
- layout.doAction(Actions.popoutTab(selectedTabNode.getId()));
4030
- }
4031
- event.stopPropagation();
4032
- };
4033
3658
  const cm = layout.getClassName;
4034
3659
  const tabButtons = [];
4035
3660
  const layoutTab = (i) => {
@@ -4103,29 +3728,9 @@ var BorderTabSet = (props) => {
4103
3728
  )
4104
3729
  );
4105
3730
  }
4106
- const selectedIndex = border.getSelected();
4107
- if (selectedIndex !== -1) {
4108
- const selectedTabNode = border.getChildren()[selectedIndex];
4109
- if (selectedTabNode !== void 0 && layout.isSupportsPopout() && selectedTabNode.isEnablePopout()) {
4110
- const popoutTitle = layout.i18nName("Popout selected tab" /* Popout_Tab */);
4111
- buttons.push(
4112
- /* @__PURE__ */ React8.createElement(
4113
- "button",
4114
- {
4115
- key: "popout",
4116
- title: popoutTitle,
4117
- className: cm("flexlayout__border_toolbar_button" /* FLEXLAYOUT__BORDER_TOOLBAR_BUTTON */) + " " + cm("flexlayout__border_toolbar_button-float" /* FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT */),
4118
- onClick: onPopoutTab,
4119
- onPointerDown: onInterceptPointerDown
4120
- },
4121
- typeof icons.popout === "function" ? icons.popout(selectedTabNode) : icons.popout
4122
- )
4123
- );
4124
- }
4125
- }
4126
3731
  const toolbar = /* @__PURE__ */ React8.createElement("div", { key: "toolbar", ref: toolbarRef, className: cm("flexlayout__border_toolbar" /* FLEXLAYOUT__BORDER_TOOLBAR */) + " " + cm("flexlayout__border_toolbar_" /* FLEXLAYOUT__BORDER_TOOLBAR_ */ + border.getLocation().getName()) }, buttons);
4127
- let innerStyle = {};
4128
- let outerStyle = {};
3732
+ let innerStyle;
3733
+ let outerStyle;
4129
3734
  const borderHeight = size - 1;
4130
3735
  if (border.getLocation() === DockLocation.LEFT) {
4131
3736
  innerStyle = { right: "100%", top: position };
@@ -4192,151 +3797,26 @@ var ErrorBoundary = class extends React10.Component {
4192
3797
  }
4193
3798
  };
4194
3799
 
4195
- // src/view/PopoutWindow.tsx
4196
- import * as React11 from "react";
4197
- import { createPortal } from "react-dom";
4198
- var PopoutWindow = (props) => {
4199
- const { title, layout, layoutWindow, url, onCloseWindow, onSetWindow, children } = props;
4200
- const popoutWindow = React11.useRef(null);
4201
- const [content, setContent] = React11.useState(void 0);
4202
- const styleMap = /* @__PURE__ */ new Map();
4203
- React11.useLayoutEffect(() => {
4204
- if (!popoutWindow.current) {
4205
- const windowId = layoutWindow.windowId;
4206
- const rect = layoutWindow.rect;
4207
- popoutWindow.current = window.open(url, windowId, `left=${rect.x},top=${rect.y},width=${rect.width},height=${rect.height}`);
4208
- if (popoutWindow.current) {
4209
- layoutWindow.window = popoutWindow.current;
4210
- onSetWindow(layoutWindow, popoutWindow.current);
4211
- window.addEventListener("beforeunload", () => {
4212
- if (popoutWindow.current) {
4213
- const closedWindow = popoutWindow.current;
4214
- popoutWindow.current = null;
4215
- closedWindow.close();
4216
- }
4217
- });
4218
- popoutWindow.current.addEventListener("load", () => {
4219
- if (popoutWindow.current) {
4220
- popoutWindow.current.focus();
4221
- popoutWindow.current.resizeTo(rect.width, rect.height);
4222
- popoutWindow.current.moveTo(rect.x, rect.y);
4223
- const popoutDocument = popoutWindow.current.document;
4224
- popoutDocument.title = title;
4225
- const popoutContent = popoutDocument.createElement("div");
4226
- popoutContent.className = "flexlayout__floating_window_content" /* FLEXLAYOUT__FLOATING_WINDOW_CONTENT */;
4227
- popoutDocument.body.appendChild(popoutContent);
4228
- void copyStyles(popoutDocument, styleMap).then(() => {
4229
- setContent(popoutContent);
4230
- });
4231
- const observer = new MutationObserver((mutationsList) => handleStyleMutations(mutationsList, popoutDocument, styleMap));
4232
- observer.observe(document.head, { childList: true });
4233
- popoutWindow.current.addEventListener("beforeunload", () => {
4234
- if (popoutWindow.current) {
4235
- onCloseWindow(layoutWindow);
4236
- popoutWindow.current = null;
4237
- observer.disconnect();
4238
- }
4239
- });
4240
- }
4241
- });
4242
- } else {
4243
- console.warn(`Unable to open window ${url}`);
4244
- onCloseWindow(layoutWindow);
4245
- }
4246
- }
4247
- return () => {
4248
- if (!layout.getModel().getwindowsMap().has(layoutWindow.windowId)) {
4249
- popoutWindow.current?.close();
4250
- popoutWindow.current = null;
4251
- }
4252
- };
4253
- }, []);
4254
- if (content !== void 0) {
4255
- return createPortal(children, content);
4256
- } else {
4257
- return null;
4258
- }
4259
- };
4260
- function handleStyleMutations(mutationsList, popoutDocument, styleMap) {
4261
- for (const mutation of mutationsList) {
4262
- if (mutation.type === "childList") {
4263
- for (const addition of mutation.addedNodes) {
4264
- if (addition instanceof HTMLLinkElement || addition instanceof HTMLStyleElement) {
4265
- copyStyle(popoutDocument, addition, styleMap);
4266
- }
4267
- }
4268
- for (const removal of mutation.removedNodes) {
4269
- if (removal instanceof HTMLLinkElement || removal instanceof HTMLStyleElement) {
4270
- const popoutStyle = styleMap.get(removal);
4271
- if (popoutStyle) {
4272
- popoutDocument.head.removeChild(popoutStyle);
4273
- }
4274
- }
4275
- }
4276
- }
4277
- }
4278
- }
4279
- function copyStyles(popoutDoc, styleMap) {
4280
- const promises = [];
4281
- const styleElements = document.querySelectorAll('style, link[rel="stylesheet"]');
4282
- for (const element of styleElements) {
4283
- if (element instanceof HTMLElement) {
4284
- copyStyle(popoutDoc, element, styleMap, promises);
4285
- }
4286
- }
4287
- return Promise.all(promises);
4288
- }
4289
- function copyStyle(popoutDoc, element, styleMap, promises) {
4290
- if (element instanceof HTMLLinkElement) {
4291
- const linkElement = element.cloneNode(true);
4292
- popoutDoc.head.appendChild(linkElement);
4293
- styleMap.set(element, linkElement);
4294
- if (promises) {
4295
- promises.push(
4296
- new Promise((resolve) => {
4297
- linkElement.onload = () => resolve(true);
4298
- })
4299
- );
4300
- }
4301
- } else if (element instanceof HTMLStyleElement) {
4302
- try {
4303
- const styleElement = element.cloneNode(true);
4304
- popoutDoc.head.appendChild(styleElement);
4305
- styleMap.set(element, styleElement);
4306
- } catch {
4307
- }
4308
- }
4309
- }
4310
-
4311
3800
  // src/view/Icons.tsx
4312
- import * as React12 from "react";
3801
+ import * as React11 from "react";
4313
3802
  var style = { width: "1em", height: "1em", display: "flex", alignItems: "center" };
4314
3803
  var CloseIcon = () => {
4315
- return /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24" }, /* @__PURE__ */ React12.createElement("path", { fill: "none", d: "M0 0h24v24H0z" }), /* @__PURE__ */ React12.createElement("path", { stroke: "var(--color-icon)", fill: "var(--color-icon)", d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }));
3804
+ return /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24" }, /* @__PURE__ */ React11.createElement("path", { fill: "none", d: "M0 0h24v24H0z" }), /* @__PURE__ */ React11.createElement("path", { stroke: "var(--color-icon)", fill: "var(--color-icon)", d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }));
4316
3805
  };
4317
3806
  var MaximizeIcon = () => {
4318
- return /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24", fill: "var(--color-icon)" }, /* @__PURE__ */ React12.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React12.createElement("path", { stroke: "var(--color-icon)", d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }));
3807
+ return /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24", fill: "var(--color-icon)" }, /* @__PURE__ */ React11.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React11.createElement("path", { stroke: "var(--color-icon)", d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }));
4319
3808
  };
4320
3809
  var OverflowIcon = () => {
4321
- return /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24", fill: "var(--color-icon)" }, /* @__PURE__ */ React12.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React12.createElement("path", { stroke: "var(--color-icon)", d: "M7 10l5 5 5-5z" }));
3810
+ return /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24", fill: "var(--color-icon)" }, /* @__PURE__ */ React11.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React11.createElement("path", { stroke: "var(--color-icon)", d: "M7 10l5 5 5-5z" }));
4322
3811
  };
4323
3812
  var EdgeIcon = () => {
4324
- return /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style: { display: "block", width: 10, height: 10 }, preserveAspectRatio: "none", viewBox: "0 0 100 100" }, /* @__PURE__ */ React12.createElement("path", { fill: "var(--color-edge-icon)", stroke: "var(--color-edge-icon)", d: "M10 30 L90 30 l-40 40 Z" }));
4325
- };
4326
- var PopoutIcon = () => {
4327
- return (
4328
- // <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 24 24" fill="var(--color-icon)"><path d="M0 0h24v24H0z" fill="none"/><path stroke="var(--color-icon)" d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"/></svg>
4329
- // <svg xmlns="http://www.w3.org/2000/svg" style={style} fill="none" viewBox="0 0 24 24" stroke="var(--color-icon)" stroke-width="2">
4330
- // <path stroke-linecap="round" stroke-linejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
4331
- // </svg>
4332
- /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 20 20", fill: "var(--color-icon)" }, /* @__PURE__ */ React12.createElement("path", { d: "M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z" }), /* @__PURE__ */ React12.createElement("path", { d: "M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z" }))
4333
- );
3813
+ return /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style: { display: "block", width: 10, height: 10 }, preserveAspectRatio: "none", viewBox: "0 0 100 100" }, /* @__PURE__ */ React11.createElement("path", { fill: "var(--color-edge-icon)", stroke: "var(--color-edge-icon)", d: "M10 30 L90 30 l-40 40 Z" }));
4334
3814
  };
4335
3815
  var RestoreIcon = () => {
4336
- return /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24", fill: "var(--color-icon)" }, /* @__PURE__ */ React12.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React12.createElement("path", { stroke: "var(--color-icon)", d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }));
3816
+ return /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24", fill: "var(--color-icon)" }, /* @__PURE__ */ React11.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React11.createElement("path", { stroke: "var(--color-icon)", d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }));
4337
3817
  };
4338
3818
  var AsterickIcon = () => {
4339
- return /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, height: "24px", viewBox: "0 -960 960 960", width: "24px" }, /* @__PURE__ */ React12.createElement(
3819
+ return /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, height: "24px", viewBox: "0 -960 960 960", width: "24px" }, /* @__PURE__ */ React11.createElement(
4340
3820
  "path",
4341
3821
  {
4342
3822
  fill: "var(--color-icon)",
@@ -4347,26 +3827,26 @@ var AsterickIcon = () => {
4347
3827
  };
4348
3828
 
4349
3829
  // src/view/Overlay.tsx
4350
- import * as React13 from "react";
3830
+ import * as React12 from "react";
4351
3831
  var Overlay = (props) => {
4352
3832
  const { layout, show } = props;
4353
- return /* @__PURE__ */ React13.createElement("div", { className: layout.getClassName("flexlayout__layout_overlay" /* FLEXLAYOUT__LAYOUT_OVERLAY */), style: { display: show ? "flex" : "none" } });
3833
+ return /* @__PURE__ */ React12.createElement("div", { className: layout.getClassName("flexlayout__layout_overlay" /* FLEXLAYOUT__LAYOUT_OVERLAY */), style: { display: show ? "flex" : "none" } });
4354
3834
  };
4355
3835
 
4356
3836
  // src/view/Row.tsx
4357
- import * as React16 from "react";
3837
+ import * as React15 from "react";
4358
3838
 
4359
3839
  // src/view/TabSet.tsx
4360
- import * as React15 from "react";
3840
+ import * as React14 from "react";
4361
3841
 
4362
3842
  // src/view/TabButton.tsx
4363
- import * as React14 from "react";
3843
+ import * as React13 from "react";
4364
3844
  var TabButton = (props) => {
4365
3845
  const { layout, node, selected, path } = props;
4366
- const selfRef = React14.useRef(null);
4367
- const contentRef = React14.useRef(null);
3846
+ const selfRef = React13.useRef(null);
3847
+ const contentRef = React13.useRef(null);
4368
3848
  const icons = layout.getIcons();
4369
- React14.useLayoutEffect(() => {
3849
+ React13.useLayoutEffect(() => {
4370
3850
  node.setTabRect(layout.getBoundingClientRect(selfRef.current));
4371
3851
  if (layout.getEditingTab() === node) {
4372
3852
  contentRef.current.select();
@@ -4452,10 +3932,10 @@ var TabButton = (props) => {
4452
3932
  classNames += " " + node.getClassName();
4453
3933
  }
4454
3934
  const renderState = getRenderStateEx(layout, node);
4455
- let content = renderState.content ? /* @__PURE__ */ React14.createElement("div", { className: cm("flexlayout__tab_button_content" /* FLEXLAYOUT__TAB_BUTTON_CONTENT */) }, renderState.content) : null;
4456
- const leading = renderState.leading ? /* @__PURE__ */ React14.createElement("div", { className: cm("flexlayout__tab_button_leading" /* FLEXLAYOUT__TAB_BUTTON_LEADING */) }, renderState.leading) : null;
3935
+ let content = renderState.content ? /* @__PURE__ */ React13.createElement("div", { className: cm("flexlayout__tab_button_content" /* FLEXLAYOUT__TAB_BUTTON_CONTENT */) }, renderState.content) : null;
3936
+ const leading = renderState.leading ? /* @__PURE__ */ React13.createElement("div", { className: cm("flexlayout__tab_button_leading" /* FLEXLAYOUT__TAB_BUTTON_LEADING */) }, renderState.leading) : null;
4457
3937
  if (layout.getEditingTab() === node) {
4458
- content = /* @__PURE__ */ React14.createElement(
3938
+ content = /* @__PURE__ */ React13.createElement(
4459
3939
  "input",
4460
3940
  {
4461
3941
  ref: contentRef,
@@ -4472,7 +3952,7 @@ var TabButton = (props) => {
4472
3952
  if (node.isEnableClose() && !isStretch) {
4473
3953
  const closeTitle = layout.i18nName("Close" /* Close_Tab */);
4474
3954
  renderState.buttons.push(
4475
- /* @__PURE__ */ React14.createElement(
3955
+ /* @__PURE__ */ React13.createElement(
4476
3956
  "button",
4477
3957
  {
4478
3958
  key: "close",
@@ -4493,7 +3973,7 @@ var TabButton = (props) => {
4493
3973
  onClick();
4494
3974
  }
4495
3975
  };
4496
- return /* @__PURE__ */ React14.createElement(
3976
+ return /* @__PURE__ */ React13.createElement(
4497
3977
  "div",
4498
3978
  {
4499
3979
  ref: selfRef,
@@ -4519,18 +3999,18 @@ var TabButton = (props) => {
4519
3999
  };
4520
4000
 
4521
4001
  // src/view/TabSet.tsx
4522
- import { createPortal as createPortal2 } from "react-dom";
4002
+ import { createPortal } from "react-dom";
4523
4003
  var TabSet = (props) => {
4524
4004
  const { node, layout } = props;
4525
- const tabStripRef = React15.useRef(null);
4526
- const tabStripInnerRef = React15.useRef(null);
4527
- const contentRef = React15.useRef(null);
4528
- const buttonBarRef = React15.useRef(null);
4529
- const overflowbuttonRef = React15.useRef(null);
4530
- const stickyButtonsRef = React15.useRef(null);
4005
+ const tabStripRef = React14.useRef(null);
4006
+ const tabStripInnerRef = React14.useRef(null);
4007
+ const contentRef = React14.useRef(null);
4008
+ const buttonBarRef = React14.useRef(null);
4009
+ const overflowbuttonRef = React14.useRef(null);
4010
+ const stickyButtonsRef = React14.useRef(null);
4531
4011
  const icons = layout.getIcons();
4532
- const isFirstRender = React15.useRef(true);
4533
- React15.useEffect(() => {
4012
+ const isFirstRender = React14.useRef(true);
4013
+ React14.useEffect(() => {
4534
4014
  node.setRect(layout.getBoundingClientRect(selfRef.current));
4535
4015
  if (tabStripRef.current) {
4536
4016
  node.setTabStripRect(layout.getBoundingClientRect(tabStripRef.current));
@@ -4576,12 +4056,6 @@ var TabSet = (props) => {
4576
4056
  };
4577
4057
  const onPointerDown = (event) => {
4578
4058
  if (!isAuxMouseEvent(event)) {
4579
- let name = node.getName();
4580
- if (name === void 0) {
4581
- name = "";
4582
- } else {
4583
- name = ": " + name;
4584
- }
4585
4059
  layout.doAction(Actions.setActiveTabset(node.getId(), layout.getWindowId()));
4586
4060
  }
4587
4061
  };
@@ -4610,12 +4084,6 @@ var TabSet = (props) => {
4610
4084
  layout.doAction(Actions.deleteTab(node.getChildren()[0].getId()));
4611
4085
  event.stopPropagation();
4612
4086
  };
4613
- const onPopoutTab = (event) => {
4614
- if (selectedTabNode !== void 0) {
4615
- layout.doAction(Actions.popoutTab(selectedTabNode.getId()));
4616
- }
4617
- event.stopPropagation();
4618
- };
4619
4087
  const onDoubleClick = (_event) => {
4620
4088
  if (node.canMaximize()) {
4621
4089
  layout.maximize(node);
@@ -4625,16 +4093,15 @@ var TabSet = (props) => {
4625
4093
  if (tabStripInnerRef.current !== null && tabStripInnerRef.current.scrollLeft !== 0) {
4626
4094
  tabStripInnerRef.current.scrollLeft = 0;
4627
4095
  }
4628
- const selectedTabNode = node.getSelectedNode();
4629
4096
  const path = node.getPath();
4630
4097
  const tabs = [];
4631
4098
  if (node.isEnableTabStrip()) {
4632
4099
  for (let i = 0; i < node.getChildren().length; i++) {
4633
4100
  const child = node.getChildren()[i];
4634
4101
  const isSelected = node.getSelected() === i;
4635
- tabs.push(/* @__PURE__ */ React15.createElement(TabButton, { layout, node: child, path: path + "/tb" + i, key: child.getId(), selected: isSelected }));
4102
+ tabs.push(/* @__PURE__ */ React14.createElement(TabButton, { layout, node: child, path: path + "/tb" + i, key: child.getId(), selected: isSelected }));
4636
4103
  if (i < node.getChildren().length - 1) {
4637
- tabs.push(/* @__PURE__ */ React15.createElement("div", { key: "divider" + i, className: cm("flexlayout__tabset_tab_divider" /* FLEXLAYOUT__TABSET_TAB_DIVIDER */) }));
4104
+ tabs.push(/* @__PURE__ */ React14.createElement("div", { key: "divider" + i, className: cm("flexlayout__tabset_tab_divider" /* FLEXLAYOUT__TABSET_TAB_DIVIDER */) }));
4638
4105
  }
4639
4106
  }
4640
4107
  }
@@ -4654,7 +4121,7 @@ var TabSet = (props) => {
4654
4121
  buttons = [...stickyButtons, ...buttons];
4655
4122
  } else {
4656
4123
  tabs.push(
4657
- /* @__PURE__ */ React15.createElement(
4124
+ /* @__PURE__ */ React14.createElement(
4658
4125
  "div",
4659
4126
  {
4660
4127
  ref: stickyButtonsRef,
@@ -4677,12 +4144,12 @@ var TabSet = (props) => {
4677
4144
  if (typeof icons.more === "function") {
4678
4145
  overflowContent = icons.more(node, hiddenTabs);
4679
4146
  } else {
4680
- overflowContent = /* @__PURE__ */ React15.createElement(React15.Fragment, null, icons.more, /* @__PURE__ */ React15.createElement("div", { className: cm("flexlayout__tab_button_overflow_count" /* FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT */) }, hiddenTabs.length));
4147
+ overflowContent = /* @__PURE__ */ React14.createElement(React14.Fragment, null, icons.more, /* @__PURE__ */ React14.createElement("div", { className: cm("flexlayout__tab_button_overflow_count" /* FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT */) }, hiddenTabs.length));
4681
4148
  }
4682
4149
  void buttons.splice(
4683
4150
  Math.min(renderState.overflowPosition, buttons.length),
4684
4151
  0,
4685
- /* @__PURE__ */ React15.createElement(
4152
+ /* @__PURE__ */ React14.createElement(
4686
4153
  "button",
4687
4154
  {
4688
4155
  key: "overflowbutton",
@@ -4698,28 +4165,11 @@ var TabSet = (props) => {
4698
4165
  );
4699
4166
  }
4700
4167
  }
4701
- if (selectedTabNode !== void 0 && layout.isSupportsPopout() && selectedTabNode.isEnablePopout() && selectedTabNode.isEnablePopoutIcon()) {
4702
- const popoutTitle = layout.i18nName("Popout selected tab" /* Popout_Tab */);
4703
- buttons.push(
4704
- /* @__PURE__ */ React15.createElement(
4705
- "button",
4706
- {
4707
- key: "popout",
4708
- "data-layout-path": path + "/button/popout",
4709
- title: popoutTitle,
4710
- className: cm("flexlayout__tab_toolbar_button" /* FLEXLAYOUT__TAB_TOOLBAR_BUTTON */) + " " + cm("flexlayout__tab_toolbar_button-float" /* FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT */),
4711
- onClick: onPopoutTab,
4712
- onPointerDown: onInterceptPointerDown
4713
- },
4714
- typeof icons.popout === "function" ? icons.popout(selectedTabNode) : icons.popout
4715
- )
4716
- );
4717
- }
4718
4168
  if (node.canMaximize()) {
4719
4169
  const minTitle = layout.i18nName("Restore tab set" /* Restore */);
4720
4170
  const maxTitle = layout.i18nName("Maximize tab set" /* Maximize */);
4721
4171
  buttons.push(
4722
- /* @__PURE__ */ React15.createElement(
4172
+ /* @__PURE__ */ React14.createElement(
4723
4173
  "button",
4724
4174
  {
4725
4175
  key: "max",
@@ -4736,7 +4186,7 @@ var TabSet = (props) => {
4736
4186
  if (!node.isMaximized() && showClose) {
4737
4187
  const title = isTabStretch ? layout.i18nName("Close" /* Close_Tab */) : layout.i18nName("Close tab set" /* Close_Tabset */);
4738
4188
  buttons.push(
4739
- /* @__PURE__ */ React15.createElement(
4189
+ /* @__PURE__ */ React14.createElement(
4740
4190
  "button",
4741
4191
  {
4742
4192
  key: "close",
@@ -4753,10 +4203,10 @@ var TabSet = (props) => {
4753
4203
  if (node.isActive() && node.isEnableActiveIcon()) {
4754
4204
  const title = layout.i18nName("Active tab set" /* Active_Tabset */);
4755
4205
  buttons.push(
4756
- /* @__PURE__ */ React15.createElement("div", { key: "active", "data-layout-path": path + "/button/active", title, className: cm("flexlayout__tab_toolbar_icon" /* FLEXLAYOUT__TAB_TOOLBAR_ICON */) }, typeof icons.activeTabset === "function" ? icons.activeTabset(node) : icons.activeTabset)
4206
+ /* @__PURE__ */ React14.createElement("div", { key: "active", "data-layout-path": path + "/button/active", title, className: cm("flexlayout__tab_toolbar_icon" /* FLEXLAYOUT__TAB_TOOLBAR_ICON */) }, typeof icons.activeTabset === "function" ? icons.activeTabset(node) : icons.activeTabset)
4757
4207
  );
4758
4208
  }
4759
- const buttonbar = /* @__PURE__ */ React15.createElement(
4209
+ const buttonbar = /* @__PURE__ */ React14.createElement(
4760
4210
  "div",
4761
4211
  {
4762
4212
  key: "buttonbar",
@@ -4789,7 +4239,7 @@ var TabSet = (props) => {
4789
4239
  }
4790
4240
  if (node.isEnableTabWrap()) {
4791
4241
  if (node.isEnableTabStrip()) {
4792
- tabStrip = /* @__PURE__ */ React15.createElement(
4242
+ tabStrip = /* @__PURE__ */ React14.createElement(
4793
4243
  "div",
4794
4244
  {
4795
4245
  className: tabStripClasses,
@@ -4805,13 +4255,13 @@ var TabSet = (props) => {
4805
4255
  onDragStart
4806
4256
  },
4807
4257
  tabs,
4808
- /* @__PURE__ */ React15.createElement("div", { style: { flexGrow: 1 } }),
4258
+ /* @__PURE__ */ React14.createElement("div", { style: { flexGrow: 1 } }),
4809
4259
  buttonbar
4810
4260
  );
4811
4261
  }
4812
4262
  } else {
4813
4263
  if (node.isEnableTabStrip()) {
4814
- tabStrip = /* @__PURE__ */ React15.createElement(
4264
+ tabStrip = /* @__PURE__ */ React14.createElement(
4815
4265
  "div",
4816
4266
  {
4817
4267
  className: tabStripClasses,
@@ -4826,7 +4276,7 @@ var TabSet = (props) => {
4826
4276
  onWheel: onMouseWheel,
4827
4277
  onDragStart
4828
4278
  },
4829
- /* @__PURE__ */ React15.createElement("div", { ref: tabStripInnerRef, className: cm("flexlayout__tabset_tabbar_inner" /* FLEXLAYOUT__TABSET_TABBAR_INNER */) + " " + cm("flexlayout__tabset_tabbar_inner_" /* FLEXLAYOUT__TABSET_TABBAR_INNER_ */ + node.getTabLocation()) }, /* @__PURE__ */ React15.createElement(
4279
+ /* @__PURE__ */ React14.createElement("div", { ref: tabStripInnerRef, className: cm("flexlayout__tabset_tabbar_inner" /* FLEXLAYOUT__TABSET_TABBAR_INNER */) + " " + cm("flexlayout__tabset_tabbar_inner_" /* FLEXLAYOUT__TABSET_TABBAR_INNER_ */ + node.getTabLocation()) }, /* @__PURE__ */ React14.createElement(
4830
4280
  "div",
4831
4281
  {
4832
4282
  style: { left: position, width: isTabStretch ? "100%" : "10000px" },
@@ -4845,11 +4295,11 @@ var TabSet = (props) => {
4845
4295
  emptyTabset = placeHolderCallback(node);
4846
4296
  }
4847
4297
  }
4848
- let content = /* @__PURE__ */ React15.createElement("div", { ref: contentRef, className: cm("flexlayout__tabset_content" /* FLEXLAYOUT__TABSET_CONTENT */) }, emptyTabset);
4298
+ let content = /* @__PURE__ */ React14.createElement("div", { ref: contentRef, className: cm("flexlayout__tabset_content" /* FLEXLAYOUT__TABSET_CONTENT */) }, emptyTabset);
4849
4299
  if (node.getTabLocation() === "top") {
4850
- content = /* @__PURE__ */ React15.createElement(React15.Fragment, null, tabStrip, content);
4300
+ content = /* @__PURE__ */ React14.createElement(React14.Fragment, null, tabStrip, content);
4851
4301
  } else {
4852
- content = /* @__PURE__ */ React15.createElement(React15.Fragment, null, content, tabStrip);
4302
+ content = /* @__PURE__ */ React14.createElement(React14.Fragment, null, content, tabStrip);
4853
4303
  }
4854
4304
  const style2 = {
4855
4305
  flexGrow: Math.max(1, node.getWeight() * 1e3),
@@ -4861,11 +4311,11 @@ var TabSet = (props) => {
4861
4311
  if (node.getModel().getMaximizedTabset(layout.getWindowId()) !== void 0 && !node.isMaximized()) {
4862
4312
  style2.display = "none";
4863
4313
  }
4864
- const tabset = /* @__PURE__ */ React15.createElement("div", { ref: selfRef, className: cm("flexlayout__tabset_container" /* FLEXLAYOUT__TABSET_CONTAINER */), style: style2 }, /* @__PURE__ */ React15.createElement("div", { className: cm("flexlayout__tabset" /* FLEXLAYOUT__TABSET */), "data-layout-path": path }, content));
4314
+ const tabset = /* @__PURE__ */ React14.createElement("div", { ref: selfRef, className: cm("flexlayout__tabset_container" /* FLEXLAYOUT__TABSET_CONTAINER */), style: style2 }, /* @__PURE__ */ React14.createElement("div", { className: cm("flexlayout__tabset" /* FLEXLAYOUT__TABSET */), "data-layout-path": path }, content));
4865
4315
  if (node.isMaximized()) {
4866
4316
  if (layout.getMainElement()) {
4867
- return createPortal2(
4868
- /* @__PURE__ */ React15.createElement(
4317
+ return createPortal(
4318
+ /* @__PURE__ */ React14.createElement(
4869
4319
  "div",
4870
4320
  {
4871
4321
  style: {
@@ -4892,21 +4342,21 @@ var TabSet = (props) => {
4892
4342
  // src/view/Row.tsx
4893
4343
  var Row = (props) => {
4894
4344
  const { layout, node } = props;
4895
- const selfRef = React16.useRef(null);
4345
+ const selfRef = React15.useRef(null);
4896
4346
  const horizontal = node.getOrientation() === Orientation.HORZ;
4897
- React16.useLayoutEffect(() => {
4347
+ React15.useLayoutEffect(() => {
4898
4348
  node.setRect(layout.getBoundingClientRect(selfRef.current));
4899
4349
  });
4900
4350
  const items = [];
4901
4351
  let i = 0;
4902
4352
  for (const child of node.getChildren()) {
4903
4353
  if (i > 0) {
4904
- items.push(/* @__PURE__ */ React16.createElement(Splitter, { key: "splitter" + i, layout, node, index: i, horizontal }));
4354
+ items.push(/* @__PURE__ */ React15.createElement(Splitter, { key: "splitter" + i, layout, node, index: i, horizontal }));
4905
4355
  }
4906
4356
  if (child instanceof RowNode) {
4907
- items.push(/* @__PURE__ */ React16.createElement(Row, { key: child.getId(), layout, node: child }));
4357
+ items.push(/* @__PURE__ */ React15.createElement(Row, { key: child.getId(), layout, node: child }));
4908
4358
  } else if (child instanceof TabSetNode) {
4909
- items.push(/* @__PURE__ */ React16.createElement(TabSet, { key: child.getId(), layout, node: child }));
4359
+ items.push(/* @__PURE__ */ React15.createElement(TabSet, { key: child.getId(), layout, node: child }));
4910
4360
  }
4911
4361
  i++;
4912
4362
  }
@@ -4923,18 +4373,18 @@ var Row = (props) => {
4923
4373
  } else {
4924
4374
  style2.flexDirection = "column";
4925
4375
  }
4926
- return /* @__PURE__ */ React16.createElement("div", { ref: selfRef, className: layout.getClassName("flexlayout__row" /* FLEXLAYOUT__ROW */), style: style2 }, items);
4376
+ return /* @__PURE__ */ React15.createElement("div", { ref: selfRef, className: layout.getClassName("flexlayout__row" /* FLEXLAYOUT__ROW */), style: style2 }, items);
4927
4377
  };
4928
4378
 
4929
4379
  // src/view/Tab.tsx
4930
- import * as React17 from "react";
4380
+ import * as React16 from "react";
4931
4381
  var Tab = (props) => {
4932
4382
  const { layout, selected, node, path } = props;
4933
- const selfRef = React17.useRef(null);
4934
- const firstSelect = React17.useRef(true);
4383
+ const selfRef = React16.useRef(null);
4384
+ const firstSelect = React16.useRef(true);
4935
4385
  const parentNode = node.getParent();
4936
4386
  const rect = parentNode.getContentRect();
4937
- React17.useLayoutEffect(() => {
4387
+ React16.useLayoutEffect(() => {
4938
4388
  const element = node.getMoveableElement();
4939
4389
  selfRef.current.appendChild(element);
4940
4390
  node.setMoveableElement(element);
@@ -4951,7 +4401,7 @@ var Tab = (props) => {
4951
4401
  node.setVisible(false);
4952
4402
  };
4953
4403
  }, []);
4954
- React17.useEffect(() => {
4404
+ React16.useEffect(() => {
4955
4405
  if (node.isSelected()) {
4956
4406
  if (firstSelect.current) {
4957
4407
  node.restoreScrollPosition();
@@ -4959,10 +4409,10 @@ var Tab = (props) => {
4959
4409
  }
4960
4410
  }
4961
4411
  }, [selected]);
4962
- React17.useLayoutEffect(() => {
4412
+ React16.useLayoutEffect(() => {
4963
4413
  node.setRect(rect);
4964
4414
  }, [rect, node]);
4965
- React17.useLayoutEffect(() => {
4415
+ React16.useLayoutEffect(() => {
4966
4416
  node.setVisible(selected);
4967
4417
  }, [selected, node]);
4968
4418
  const onPointerDown = () => {
@@ -4976,14 +4426,7 @@ var Tab = (props) => {
4976
4426
  const cm = layout.getClassName;
4977
4427
  const style2 = {};
4978
4428
  rect.styleWithPosition(style2);
4979
- let overlay = null;
4980
- if (selected) {
4981
- if (document.hidden && node.isEnablePopoutOverlay()) {
4982
- const overlayStyle = {};
4983
- rect.styleWithPosition(overlayStyle);
4984
- overlay = /* @__PURE__ */ React17.createElement("div", { style: overlayStyle, className: cm("flexlayout__tab_overlay" /* FLEXLAYOUT__TAB_OVERLAY */) });
4985
- }
4986
- } else {
4429
+ if (!selected) {
4987
4430
  style2.display = "none";
4988
4431
  }
4989
4432
  if (parentNode instanceof TabSetNode) {
@@ -5003,14 +4446,14 @@ var Tab = (props) => {
5003
4446
  if (node.getContentClassName() !== void 0) {
5004
4447
  className += " " + node.getContentClassName();
5005
4448
  }
5006
- return /* @__PURE__ */ React17.createElement(React17.Fragment, null, overlay, /* @__PURE__ */ React17.createElement("div", { ref: selfRef, style: style2, className, "data-layout-path": path }));
4449
+ return /* @__PURE__ */ React16.createElement("div", { ref: selfRef, style: style2, className, "data-layout-path": path });
5007
4450
  };
5008
4451
 
5009
4452
  // src/view/SizeTracker.tsx
5010
- import * as React18 from "react";
5011
- var SizeTracker = React18.memo(
4453
+ import * as React17 from "react";
4454
+ var SizeTracker = React17.memo(
5012
4455
  ({ children }) => {
5013
- return /* @__PURE__ */ React18.createElement(React18.Fragment, null, children);
4456
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, children);
5014
4457
  },
5015
4458
  (prevProps, nextProps) => {
5016
4459
  return prevProps.rect.equalSize(nextProps.rect) && prevProps.selected === nextProps.selected && prevProps.forceRevision === nextProps.forceRevision && prevProps.tabsRevision === nextProps.tabsRevision;
@@ -5019,7 +4462,7 @@ var SizeTracker = React18.memo(
5019
4462
  SizeTracker.displayName = "SizeTracker";
5020
4463
 
5021
4464
  // src/view/Layout.tsx
5022
- var Layout = class extends React19.Component {
4465
+ var Layout = class extends React18.Component {
5023
4466
  /** @internal */
5024
4467
  selfRef;
5025
4468
  /** @internal */
@@ -5028,7 +4471,7 @@ var Layout = class extends React19.Component {
5028
4471
  /** @internal */
5029
4472
  constructor(props) {
5030
4473
  super(props);
5031
- this.selfRef = React19.createRef();
4474
+ this.selfRef = React18.createRef();
5032
4475
  this.revision = 0;
5033
4476
  }
5034
4477
  /** re-render the layout */
@@ -5088,10 +4531,10 @@ var Layout = class extends React19.Component {
5088
4531
  }
5089
4532
  /** @internal */
5090
4533
  render() {
5091
- return /* @__PURE__ */ React19.createElement(LayoutInternal, { ref: this.selfRef, ...this.props, renderRevision: this.revision++ });
4534
+ return /* @__PURE__ */ React18.createElement(LayoutInternal, { ref: this.selfRef, ...this.props, renderRevision: this.revision++ });
5092
4535
  }
5093
4536
  };
5094
- var LayoutInternal = class _LayoutInternal extends React19.Component {
4537
+ var LayoutInternal = class _LayoutInternal extends React18.Component {
5095
4538
  static dragState = void 0;
5096
4539
  selfRef;
5097
4540
  moveablesRef;
@@ -5103,37 +4546,19 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5103
4546
  dropInfo;
5104
4547
  outlineDiv;
5105
4548
  currentDocument;
5106
- currentWindow;
5107
- supportsPopout;
5108
- popoutURL;
5109
4549
  icons;
5110
4550
  resizeObserver;
5111
4551
  dragEnterCount = 0;
5112
4552
  dragging = false;
5113
- windowId;
5114
- layoutWindow;
5115
- mainLayout;
5116
- isMainWindow;
5117
- isDraggingOverWindow;
5118
- styleObserver;
5119
- popoutWindowName;
5120
4553
  // private renderCount: any;
5121
4554
  constructor(props) {
5122
4555
  super(props);
5123
4556
  this.orderedIds = [];
5124
- this.selfRef = React19.createRef();
5125
- this.moveablesRef = React19.createRef();
5126
- this.mainRef = React19.createRef();
5127
- this.findBorderBarSizeRef = React19.createRef();
5128
- this.supportsPopout = props.supportsPopout !== void 0 ? props.supportsPopout : defaultSupportsPopout;
5129
- this.popoutURL = props.popoutURL ? props.popoutURL : "popout.html";
4557
+ this.selfRef = React18.createRef();
4558
+ this.moveablesRef = React18.createRef();
4559
+ this.mainRef = React18.createRef();
4560
+ this.findBorderBarSizeRef = React18.createRef();
5130
4561
  this.icons = { ...defaultIcons, ...props.icons };
5131
- this.windowId = props.windowId ? props.windowId : Model.MAIN_WINDOW_ID;
5132
- this.mainLayout = this.props.mainLayout ? this.props.mainLayout : this;
5133
- this.isDraggingOverWindow = false;
5134
- this.layoutWindow = this.props.model.getwindowsMap().get(this.windowId);
5135
- this.layoutWindow.layout = this;
5136
- this.popoutWindowName = this.props.popoutWindowName || "Popout Window";
5137
4562
  this.state = {
5138
4563
  rect: Rect.empty(),
5139
4564
  editingTab: void 0,
@@ -5144,14 +4569,11 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5144
4569
  forceRevision: 0,
5145
4570
  showHiddenBorder: DockLocation.CENTER
5146
4571
  };
5147
- this.isMainWindow = this.windowId === Model.MAIN_WINDOW_ID;
5148
4572
  }
5149
4573
  componentDidMount() {
5150
4574
  this.updateRect();
5151
4575
  this.currentDocument = this.selfRef.current.ownerDocument;
5152
- this.currentWindow = this.currentDocument.defaultView;
5153
- this.layoutWindow.window = this.currentWindow;
5154
- this.layoutWindow.toScreenRectFunction = (r) => this.getScreenRect(r);
4576
+ this.props.model.layout = this;
5155
4577
  this.resizeObserver = new ResizeObserver((_entries) => {
5156
4578
  requestAnimationFrame(() => {
5157
4579
  this.updateRect();
@@ -5160,81 +4582,46 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5160
4582
  if (this.selfRef.current) {
5161
4583
  this.resizeObserver.observe(this.selfRef.current);
5162
4584
  }
5163
- if (this.isMainWindow) {
5164
- this.props.model.addChangeListener(this.onModelChange);
5165
- this.updateLayoutMetrics();
5166
- } else {
5167
- this.currentWindow.addEventListener("resize", () => {
5168
- this.updateRect();
5169
- });
5170
- const sourceElement = this.props.mainLayout.getRootDiv();
5171
- const targetElement = this.selfRef.current;
5172
- copyInlineStyles(sourceElement, targetElement);
5173
- this.styleObserver = new MutationObserver(() => {
5174
- const changed = copyInlineStyles(sourceElement, targetElement);
5175
- if (changed) {
5176
- this.redraw("mutation observer");
5177
- }
5178
- });
5179
- this.styleObserver.observe(sourceElement, { attributeFilter: ["style"] });
5180
- }
4585
+ this.props.model.addChangeListener(this.onModelChange);
4586
+ this.updateLayoutMetrics();
5181
4587
  document.addEventListener("visibilitychange", () => {
5182
- for (const [_, layoutWindow] of this.props.model.getwindowsMap()) {
5183
- const layout = layoutWindow.layout;
5184
- if (layout) {
5185
- this.redraw("visibility change");
5186
- }
5187
- }
4588
+ this.redraw("visibility change");
5188
4589
  });
5189
4590
  }
5190
4591
  componentDidUpdate() {
5191
4592
  this.currentDocument = this.selfRef.current.ownerDocument;
5192
- this.currentWindow = this.currentDocument.defaultView;
5193
- if (this.isMainWindow) {
5194
- if (this.props.model !== this.previousModel) {
5195
- if (this.previousModel !== void 0) {
5196
- this.previousModel.removeChangeListener(this.onModelChange);
5197
- }
5198
- this.props.model.getwindowsMap().get(this.windowId).layout = this;
5199
- this.props.model.addChangeListener(this.onModelChange);
5200
- this.layoutWindow = this.props.model.getwindowsMap().get(this.windowId);
5201
- this.layoutWindow.layout = this;
5202
- this.layoutWindow.toScreenRectFunction = (r) => this.getScreenRect(r);
5203
- this.previousModel = this.props.model;
5204
- this.tidyMoveablesMap();
4593
+ if (this.props.model !== this.previousModel) {
4594
+ if (this.previousModel !== void 0) {
4595
+ this.previousModel.removeChangeListener(this.onModelChange);
5205
4596
  }
5206
- this.updateLayoutMetrics();
4597
+ this.props.model.layout = this;
4598
+ this.props.model.addChangeListener(this.onModelChange);
4599
+ this.previousModel = this.props.model;
4600
+ this.tidyMoveablesMap();
5207
4601
  }
4602
+ this.updateLayoutMetrics();
5208
4603
  }
5209
4604
  componentWillUnmount() {
5210
4605
  if (this.selfRef.current) {
5211
4606
  this.resizeObserver?.unobserve(this.selfRef.current);
5212
4607
  }
5213
- this.styleObserver?.disconnect();
5214
4608
  }
5215
4609
  render() {
5216
4610
  if (!this.selfRef.current) {
5217
- return /* @__PURE__ */ React19.createElement("div", { ref: this.selfRef, className: this.getClassName("flexlayout__layout" /* FLEXLAYOUT__LAYOUT */) }, /* @__PURE__ */ React19.createElement("div", { ref: this.moveablesRef, key: "__moveables__", className: this.getClassName("flexlayout__layout_moveables" /* FLEXLAYOUT__LAYOUT_MOVEABLES */) }), this.renderMetricsElements());
4611
+ return /* @__PURE__ */ React18.createElement("div", { ref: this.selfRef, className: this.getClassName("flexlayout__layout" /* FLEXLAYOUT__LAYOUT */) }, /* @__PURE__ */ React18.createElement("div", { ref: this.moveablesRef, key: "__moveables__", className: this.getClassName("flexlayout__layout_moveables" /* FLEXLAYOUT__LAYOUT_MOVEABLES */) }), this.renderMetricsElements());
5218
4612
  }
5219
4613
  const model = this.props.model;
5220
- model.getRoot(this.windowId).calcMinMaxSize();
5221
- model.getRoot(this.windowId).setPaths("");
4614
+ model.getRoot().calcMinMaxSize();
4615
+ model.getRoot().setPaths("");
5222
4616
  model.getBorderSet().setPaths();
5223
4617
  const inner = this.renderLayout();
5224
4618
  const outer = this.renderBorders(inner);
5225
4619
  const tabs = this.renderTabs();
5226
4620
  const reorderedTabs = this.reorderComponents(tabs, this.orderedIds);
5227
- let floatingWindows = null;
5228
- let tabMoveables = null;
5229
- let tabStamps = null;
5230
- let metricElements = null;
5231
- if (this.isMainWindow) {
5232
- floatingWindows = this.renderWindows();
5233
- metricElements = this.renderMetricsElements();
5234
- tabMoveables = this.renderTabMoveables();
5235
- tabStamps = /* @__PURE__ */ React19.createElement("div", { key: "__tabStamps__", className: this.getClassName("flexlayout__layout_tab_stamps" /* FLEXLAYOUT__LAYOUT_TAB_STAMPS */) }, this.renderTabStamps());
5236
- }
5237
- return /* @__PURE__ */ React19.createElement(
4621
+ const metricElements = this.renderMetricsElements();
4622
+ const tabMoveables = this.renderTabMoveables();
4623
+ const tabStamps = /* @__PURE__ */ React18.createElement("div", { key: "__tabStamps__", className: this.getClassName("flexlayout__layout_tab_stamps" /* FLEXLAYOUT__LAYOUT_TAB_STAMPS */) }, this.renderTabStamps());
4624
+ return /* @__PURE__ */ React18.createElement(
5238
4625
  "div",
5239
4626
  {
5240
4627
  ref: this.selfRef,
@@ -5244,133 +4631,102 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5244
4631
  onDragOver: this.onDragOver,
5245
4632
  onDrop: this.onDrop
5246
4633
  },
5247
- /* @__PURE__ */ React19.createElement("div", { ref: this.moveablesRef, key: "__moveables__", className: this.getClassName("flexlayout__layout_moveables" /* FLEXLAYOUT__LAYOUT_MOVEABLES */) }),
4634
+ /* @__PURE__ */ React18.createElement("div", { ref: this.moveablesRef, key: "__moveables__", className: this.getClassName("flexlayout__layout_moveables" /* FLEXLAYOUT__LAYOUT_MOVEABLES */) }),
5248
4635
  metricElements,
5249
- /* @__PURE__ */ React19.createElement(Overlay, { key: "__overlay__", layout: this, show: this.state.showOverlay }),
4636
+ /* @__PURE__ */ React18.createElement(Overlay, { key: "__overlay__", layout: this, show: this.state.showOverlay }),
5250
4637
  outer,
5251
4638
  reorderedTabs,
5252
4639
  tabMoveables,
5253
4640
  tabStamps,
5254
- this.state.portal,
5255
- floatingWindows
4641
+ this.state.portal
5256
4642
  );
5257
4643
  }
5258
4644
  renderBorders(inner) {
5259
4645
  const classMain = this.getClassName("flexlayout__layout_main" /* FLEXLAYOUT__LAYOUT_MAIN */);
5260
4646
  const borders = this.props.model.getBorderSet().getBorderMap();
5261
- if (this.isMainWindow && borders.size > 0) {
5262
- inner = /* @__PURE__ */ React19.createElement("div", { className: classMain, ref: this.mainRef }, inner);
4647
+ if (borders.size > 0) {
4648
+ inner = /* @__PURE__ */ React18.createElement("div", { className: classMain, ref: this.mainRef }, inner);
5263
4649
  const borderSetComponents = /* @__PURE__ */ new Map();
5264
4650
  const borderSetContentComponents = /* @__PURE__ */ new Map();
5265
4651
  for (const [_, location] of DockLocation.values) {
5266
4652
  const border = borders.get(location);
5267
4653
  const showBorder = border && (!border.isAutoHide() || border.isAutoHide() && (border.getChildren().length > 0 || this.state.showHiddenBorder === location));
5268
4654
  if (showBorder) {
5269
- borderSetComponents.set(location, /* @__PURE__ */ React19.createElement(BorderTabSet, { layout: this, border, size: this.state.calculatedBorderBarSize }));
5270
- borderSetContentComponents.set(location, /* @__PURE__ */ React19.createElement(BorderTab, { layout: this, border, show: border.getSelected() !== -1 }));
4655
+ borderSetComponents.set(location, /* @__PURE__ */ React18.createElement(BorderTabSet, { layout: this, border, size: this.state.calculatedBorderBarSize }));
4656
+ borderSetContentComponents.set(location, /* @__PURE__ */ React18.createElement(BorderTab, { layout: this, border, show: border.getSelected() !== -1 }));
5271
4657
  }
5272
4658
  }
5273
4659
  const classBorderOuter = this.getClassName("flexlayout__layout_border_container" /* FLEXLAYOUT__LAYOUT_BORDER_CONTAINER */);
5274
4660
  const classBorderInner = this.getClassName("flexlayout__layout_border_container_inner" /* FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER */);
5275
4661
  if (this.props.model.getBorderSet().getLayoutHorizontal()) {
5276
- const innerWithBorderTabs = /* @__PURE__ */ React19.createElement("div", { className: classBorderInner, style: { flexDirection: "column" } }, borderSetContentComponents.get(DockLocation.TOP), /* @__PURE__ */ React19.createElement("div", { className: classBorderInner, style: { flexDirection: "row" } }, borderSetContentComponents.get(DockLocation.LEFT), inner, borderSetContentComponents.get(DockLocation.RIGHT)), borderSetContentComponents.get(DockLocation.BOTTOM));
5277
- return /* @__PURE__ */ React19.createElement("div", { className: classBorderOuter, style: { flexDirection: "column" } }, borderSetComponents.get(DockLocation.TOP), /* @__PURE__ */ React19.createElement("div", { className: classBorderInner, style: { flexDirection: "row" } }, borderSetComponents.get(DockLocation.LEFT), innerWithBorderTabs, borderSetComponents.get(DockLocation.RIGHT)), borderSetComponents.get(DockLocation.BOTTOM));
5278
- } else {
5279
- const innerWithBorderTabs = /* @__PURE__ */ React19.createElement("div", { className: classBorderInner, style: { flexDirection: "row" } }, borderSetContentComponents.get(DockLocation.LEFT), /* @__PURE__ */ React19.createElement("div", { className: classBorderInner, style: { flexDirection: "column" } }, borderSetContentComponents.get(DockLocation.TOP), inner, borderSetContentComponents.get(DockLocation.BOTTOM)), borderSetContentComponents.get(DockLocation.RIGHT));
5280
- return /* @__PURE__ */ React19.createElement("div", { className: classBorderOuter, style: { flexDirection: "row" } }, borderSetComponents.get(DockLocation.LEFT), /* @__PURE__ */ React19.createElement("div", { className: classBorderInner, style: { flexDirection: "column" } }, borderSetComponents.get(DockLocation.TOP), innerWithBorderTabs, borderSetComponents.get(DockLocation.BOTTOM)), borderSetComponents.get(DockLocation.RIGHT));
4662
+ const innerWithBorderTabs2 = /* @__PURE__ */ React18.createElement("div", { className: classBorderInner, style: { flexDirection: "column" } }, borderSetContentComponents.get(DockLocation.TOP), /* @__PURE__ */ React18.createElement("div", { className: classBorderInner, style: { flexDirection: "row" } }, borderSetContentComponents.get(DockLocation.LEFT), inner, borderSetContentComponents.get(DockLocation.RIGHT)), borderSetContentComponents.get(DockLocation.BOTTOM));
4663
+ return /* @__PURE__ */ React18.createElement("div", { className: classBorderOuter, style: { flexDirection: "column" } }, borderSetComponents.get(DockLocation.TOP), /* @__PURE__ */ React18.createElement("div", { className: classBorderInner, style: { flexDirection: "row" } }, borderSetComponents.get(DockLocation.LEFT), innerWithBorderTabs2, borderSetComponents.get(DockLocation.RIGHT)), borderSetComponents.get(DockLocation.BOTTOM));
5281
4664
  }
5282
- } else {
5283
- return /* @__PURE__ */ React19.createElement("div", { className: classMain, ref: this.mainRef, style: { position: "absolute", top: 0, left: 0, bottom: 0, right: 0, display: "flex" } }, inner);
4665
+ const innerWithBorderTabs = /* @__PURE__ */ React18.createElement("div", { className: classBorderInner, style: { flexDirection: "row" } }, borderSetContentComponents.get(DockLocation.LEFT), /* @__PURE__ */ React18.createElement("div", { className: classBorderInner, style: { flexDirection: "column" } }, borderSetContentComponents.get(DockLocation.TOP), inner, borderSetContentComponents.get(DockLocation.BOTTOM)), borderSetContentComponents.get(DockLocation.RIGHT));
4666
+ return /* @__PURE__ */ React18.createElement("div", { className: classBorderOuter, style: { flexDirection: "row" } }, borderSetComponents.get(DockLocation.LEFT), /* @__PURE__ */ React18.createElement("div", { className: classBorderInner, style: { flexDirection: "column" } }, borderSetComponents.get(DockLocation.TOP), innerWithBorderTabs, borderSetComponents.get(DockLocation.BOTTOM)), borderSetComponents.get(DockLocation.RIGHT));
5284
4667
  }
4668
+ return /* @__PURE__ */ React18.createElement("div", { className: classMain, ref: this.mainRef, style: { position: "absolute", top: 0, left: 0, bottom: 0, right: 0, display: "flex" } }, inner);
5285
4669
  }
5286
4670
  renderLayout() {
5287
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(Row, { key: "__row__", layout: this, node: this.props.model.getRoot(this.windowId) }), this.renderEdgeIndicators());
4671
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(Row, { key: "__row__", layout: this, node: this.props.model.getRoot() }), this.renderEdgeIndicators());
5288
4672
  }
5289
4673
  renderEdgeIndicators() {
5290
4674
  const edges = [];
5291
4675
  const arrowIcon = this.icons.edgeArrow;
5292
4676
  if (this.state.showEdges) {
5293
- const r = this.props.model.getRoot(this.windowId).getRect();
4677
+ const r = this.props.model.getRoot().getRect();
5294
4678
  const length = edgeRectLength;
5295
4679
  const width = edgeRectWidth;
5296
4680
  const offset = edgeRectLength / 2;
5297
4681
  const className = this.getClassName("flexlayout__edge_rect" /* FLEXLAYOUT__EDGE_RECT */);
5298
4682
  const radius = 50;
5299
4683
  edges.push(
5300
- /* @__PURE__ */ React19.createElement(
4684
+ /* @__PURE__ */ React18.createElement(
5301
4685
  "div",
5302
4686
  {
5303
4687
  key: "North",
5304
4688
  style: { top: 0, left: r.width / 2 - offset, width: length, height: width, borderBottomLeftRadius: radius, borderBottomRightRadius: radius },
5305
4689
  className: className + " " + this.getClassName("flexlayout__edge_rect_top" /* FLEXLAYOUT__EDGE_RECT_TOP */)
5306
4690
  },
5307
- /* @__PURE__ */ React19.createElement("div", { style: { transform: "rotate(180deg)" } }, arrowIcon)
4691
+ /* @__PURE__ */ React18.createElement("div", { style: { transform: "rotate(180deg)" } }, arrowIcon)
5308
4692
  )
5309
4693
  );
5310
4694
  edges.push(
5311
- /* @__PURE__ */ React19.createElement(
4695
+ /* @__PURE__ */ React18.createElement(
5312
4696
  "div",
5313
4697
  {
5314
4698
  key: "West",
5315
4699
  style: { top: r.height / 2 - offset, left: 0, width, height: length, borderTopRightRadius: radius, borderBottomRightRadius: radius },
5316
4700
  className: className + " " + this.getClassName("flexlayout__edge_rect_left" /* FLEXLAYOUT__EDGE_RECT_LEFT */)
5317
4701
  },
5318
- /* @__PURE__ */ React19.createElement("div", { style: { transform: "rotate(90deg)" } }, arrowIcon)
4702
+ /* @__PURE__ */ React18.createElement("div", { style: { transform: "rotate(90deg)" } }, arrowIcon)
5319
4703
  )
5320
4704
  );
5321
4705
  edges.push(
5322
- /* @__PURE__ */ React19.createElement(
4706
+ /* @__PURE__ */ React18.createElement(
5323
4707
  "div",
5324
4708
  {
5325
4709
  key: "South",
5326
4710
  style: { top: r.height - width, left: r.width / 2 - offset, width: length, height: width, borderTopLeftRadius: radius, borderTopRightRadius: radius },
5327
4711
  className: className + " " + this.getClassName("flexlayout__edge_rect_bottom" /* FLEXLAYOUT__EDGE_RECT_BOTTOM */)
5328
4712
  },
5329
- /* @__PURE__ */ React19.createElement("div", null, arrowIcon)
4713
+ /* @__PURE__ */ React18.createElement("div", null, arrowIcon)
5330
4714
  )
5331
4715
  );
5332
4716
  edges.push(
5333
- /* @__PURE__ */ React19.createElement(
4717
+ /* @__PURE__ */ React18.createElement(
5334
4718
  "div",
5335
4719
  {
5336
4720
  key: "East",
5337
4721
  style: { top: r.height / 2 - offset, left: r.width - width, width, height: length, borderTopLeftRadius: radius, borderBottomLeftRadius: radius },
5338
4722
  className: className + " " + this.getClassName("flexlayout__edge_rect_right" /* FLEXLAYOUT__EDGE_RECT_RIGHT */)
5339
4723
  },
5340
- /* @__PURE__ */ React19.createElement("div", { style: { transform: "rotate(-90deg)" } }, arrowIcon)
4724
+ /* @__PURE__ */ React18.createElement("div", { style: { transform: "rotate(-90deg)" } }, arrowIcon)
5341
4725
  )
5342
4726
  );
5343
4727
  }
5344
4728
  return edges;
5345
4729
  }
5346
- renderWindows() {
5347
- const floatingWindows = [];
5348
- if (this.supportsPopout) {
5349
- const windows = this.props.model.getwindowsMap();
5350
- let i = 1;
5351
- for (const [windowId, layoutWindow] of windows) {
5352
- if (windowId !== Model.MAIN_WINDOW_ID) {
5353
- floatingWindows.push(
5354
- /* @__PURE__ */ React19.createElement(
5355
- PopoutWindow,
5356
- {
5357
- key: windowId,
5358
- layout: this,
5359
- title: this.popoutWindowName + " " + i,
5360
- layoutWindow,
5361
- url: this.popoutURL + "?id=" + windowId,
5362
- onSetWindow: this.onSetWindow,
5363
- onCloseWindow: this.onCloseWindow
5364
- },
5365
- /* @__PURE__ */ React19.createElement(_LayoutInternal, { ...this.props, windowId, mainLayout: this })
5366
- )
5367
- );
5368
- i++;
5369
- }
5370
- }
5371
- }
5372
- return floatingWindows;
5373
- }
5374
4730
  renderTabMoveables() {
5375
4731
  const tabMoveables = [];
5376
4732
  this.props.model.visitNodes((node) => {
@@ -5382,10 +4738,10 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5382
4738
  const rect = child.getParent().getContentRect();
5383
4739
  const renderTab = child.isRendered() || (selected || !child.isEnableRenderOnDemand()) && rect.width > 0 && rect.height > 0;
5384
4740
  if (renderTab) {
5385
- const key = child.getId() + (child.isEnableWindowReMount() ? child.getWindowId() : "");
4741
+ const key = child.getId();
5386
4742
  tabMoveables.push(
5387
- createPortal3(
5388
- /* @__PURE__ */ React19.createElement(SizeTracker, { rect, selected: child.isSelected(), forceRevision: this.state.forceRevision, tabsRevision: this.props.renderRevision, key }, /* @__PURE__ */ React19.createElement(ErrorBoundary, { message: this.i18nName("Error rendering component" /* Error_rendering_component */) }, this.props.factory(child))),
4743
+ createPortal2(
4744
+ /* @__PURE__ */ React18.createElement(SizeTracker, { rect, selected: child.isSelected(), forceRevision: this.state.forceRevision, tabsRevision: this.props.renderRevision, key }, /* @__PURE__ */ React18.createElement(ErrorBoundary, { message: this.i18nName("Error rendering component" /* Error_rendering_component */) }, this.props.factory(child))),
5389
4745
  element,
5390
4746
  key
5391
4747
  )
@@ -5401,33 +4757,28 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5401
4757
  this.props.model.visitNodes((node) => {
5402
4758
  if (node instanceof TabNode) {
5403
4759
  const child = node;
5404
- tabStamps.push(/* @__PURE__ */ React19.createElement(DragContainer, { key: child.getId(), layout: this, node: child }));
4760
+ tabStamps.push(/* @__PURE__ */ React18.createElement(DragContainer, { key: child.getId(), layout: this, node: child }));
5405
4761
  }
5406
4762
  });
5407
4763
  return tabStamps;
5408
4764
  }
5409
4765
  renderTabs() {
5410
4766
  const tabs = /* @__PURE__ */ new Map();
5411
- this.props.model.visitWindowNodes(this.windowId, (node) => {
4767
+ this.props.model.visitNodes((node) => {
5412
4768
  if (node instanceof TabNode) {
5413
4769
  const child = node;
5414
4770
  const selected = child.isSelected();
5415
4771
  const path = child.getPath();
5416
4772
  const renderTab = child.isRendered() || selected || !child.isEnableRenderOnDemand();
5417
4773
  if (renderTab) {
5418
- tabs.set(
5419
- child.getId(),
5420
- // <SizeTracker rect={rect} forceRevision={this.state.forceRevision} key={key}>
5421
- /* @__PURE__ */ React19.createElement(Tab, { key: child.getId(), layout: this, path, node: child, selected })
5422
- // </SizeTracker>
5423
- );
4774
+ tabs.set(child.getId(), /* @__PURE__ */ React18.createElement(Tab, { key: child.getId(), layout: this, path, node: child, selected }));
5424
4775
  }
5425
4776
  }
5426
4777
  });
5427
4778
  return tabs;
5428
4779
  }
5429
4780
  renderMetricsElements() {
5430
- return /* @__PURE__ */ React19.createElement("div", { key: "findBorderBarSize", ref: this.findBorderBarSizeRef, className: this.getClassName("flexlayout__border_sizer" /* FLEXLAYOUT__BORDER_SIZER */) }, "FindBorderBarSize");
4781
+ return /* @__PURE__ */ React18.createElement("div", { key: "findBorderBarSize", ref: this.findBorderBarSizeRef, className: this.getClassName("flexlayout__border_sizer" /* FLEXLAYOUT__BORDER_SIZER */) }, "FindBorderBarSize");
5431
4782
  }
5432
4783
  checkForBorderToShow(x, y) {
5433
4784
  const r = this.getBoundingClientRect(this.mainRef.current);
@@ -5481,7 +4832,6 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5481
4832
  reorderComponents(components, ids) {
5482
4833
  const nextIds = [];
5483
4834
  const nextIdsSet = /* @__PURE__ */ new Set();
5484
- let reordered = [];
5485
4835
  for (const id of ids) {
5486
4836
  if (components.get(id)) {
5487
4837
  nextIds.push(id);
@@ -5494,7 +4844,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5494
4844
  ids.push(id);
5495
4845
  }
5496
4846
  }
5497
- reordered = ids.map((id) => {
4847
+ const reordered = ids.map((id) => {
5498
4848
  return components.get(id);
5499
4849
  });
5500
4850
  return reordered;
@@ -5506,12 +4856,12 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5506
4856
  }
5507
4857
  };
5508
4858
  redraw(_type) {
5509
- this.mainLayout.setState((state, _props) => {
4859
+ this.setState((state, _props) => {
5510
4860
  return { forceRevision: state.forceRevision + 1 };
5511
4861
  });
5512
4862
  }
5513
4863
  redrawInternal(_type) {
5514
- this.mainLayout.setState((state, _props) => {
4864
+ this.setState((state, _props) => {
5515
4865
  return { layoutRevision: state.layoutRevision + 1 };
5516
4866
  });
5517
4867
  }
@@ -5522,17 +4872,13 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5522
4872
  return this.props.model.doAction(outcome);
5523
4873
  }
5524
4874
  return void 0;
5525
- } else {
5526
- return this.props.model.doAction(action);
5527
4875
  }
4876
+ return this.props.model.doAction(action);
5528
4877
  }
5529
4878
  updateRect = () => {
5530
4879
  const rect = this.getDomRect();
5531
4880
  if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {
5532
4881
  this.setState({ rect });
5533
- if (this.windowId !== Model.MAIN_WINDOW_ID) {
5534
- this.redrawInternal("rect updated");
5535
- }
5536
4882
  }
5537
4883
  };
5538
4884
  getBoundingClientRect(div) {
@@ -5556,14 +4902,13 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5556
4902
  return moveableElement;
5557
4903
  }
5558
4904
  getMainLayout() {
5559
- return this.mainLayout;
4905
+ return this;
5560
4906
  }
5561
4907
  getClassName = (defaultClassName) => {
5562
4908
  if (this.props.classNameMapper === void 0) {
5563
4909
  return defaultClassName;
5564
- } else {
5565
- return this.props.classNameMapper(defaultClassName);
5566
4910
  }
4911
+ return this.props.classNameMapper(defaultClassName);
5567
4912
  };
5568
4913
  getCurrentDocument() {
5569
4914
  return this.currentDocument;
@@ -5571,12 +4916,11 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5571
4916
  getDomRect() {
5572
4917
  if (this.selfRef.current) {
5573
4918
  return Rect.fromDomRect(this.selfRef.current.getBoundingClientRect());
5574
- } else {
5575
- return Rect.empty();
5576
4919
  }
4920
+ return Rect.empty();
5577
4921
  }
5578
4922
  getWindowId() {
5579
- return this.windowId;
4923
+ return Model.MAIN_WINDOW_ID;
5580
4924
  }
5581
4925
  getRootDiv() {
5582
4926
  return this.selfRef.current;
@@ -5587,15 +4931,9 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5587
4931
  getFactory() {
5588
4932
  return this.props.factory;
5589
4933
  }
5590
- isSupportsPopout() {
5591
- return this.supportsPopout;
5592
- }
5593
4934
  isRealtimeResize() {
5594
4935
  return this.props.realtimeResize ?? false;
5595
4936
  }
5596
- getPopoutURL() {
5597
- return this.popoutURL;
5598
- }
5599
4937
  setEditingTab(tabNode) {
5600
4938
  this.setState({ editingTab: tabNode });
5601
4939
  }
@@ -5605,22 +4943,6 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5605
4943
  getModel() {
5606
4944
  return this.props.model;
5607
4945
  }
5608
- onCloseWindow = (windowLayout) => {
5609
- this.doAction(Actions.closeWindow(windowLayout.windowId));
5610
- };
5611
- onSetWindow = (_windowLayout, _window) => {
5612
- };
5613
- getScreenRect(inRect) {
5614
- const rect = inRect.clone();
5615
- const layoutRect = this.getDomRect();
5616
- const navHeight = 60;
5617
- const navWidth = 2;
5618
- rect.x = this.currentWindow.screenX + this.currentWindow.scrollX + navWidth / 2 + layoutRect.x + rect.x;
5619
- rect.y = this.currentWindow.screenY + this.currentWindow.scrollY + (navHeight - navWidth / 2) + layoutRect.y + rect.y;
5620
- rect.height += navHeight;
5621
- rect.width += navWidth;
5622
- return rect;
5623
- }
5624
4946
  addTabToTabSet(tabsetId, json) {
5625
4947
  const tabsetNode = this.props.model.getNodeById(tabsetId);
5626
4948
  if (tabsetNode !== void 0) {
@@ -5630,7 +4952,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5630
4952
  return void 0;
5631
4953
  }
5632
4954
  addTabToActiveTabSet(json) {
5633
- const tabsetNode = this.props.model.getActiveTabset(this.windowId);
4955
+ const tabsetNode = this.props.model.getActiveTabset();
5634
4956
  if (tabsetNode !== void 0) {
5635
4957
  const node = this.doAction(Actions.addNode(json, tabsetNode.getId(), DockLocation.CENTER, -1));
5636
4958
  return node;
@@ -5638,7 +4960,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5638
4960
  return void 0;
5639
4961
  }
5640
4962
  showControlInPortal = (control, element) => {
5641
- const portal = createPortal3(control, element);
4963
+ const portal = createPortal2(control, element);
5642
4964
  this.setState({ portal });
5643
4965
  };
5644
4966
  hideControlInPortal = () => {
@@ -5693,13 +5015,13 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5693
5015
  // *************************** Start Drag Drop *************************************
5694
5016
  addTabWithDragAndDrop(_event, json, onDrop) {
5695
5017
  const tempNode = TabNode.fromJson(json, this.props.model, false);
5696
- _LayoutInternal.dragState = new DragState(this.mainLayout, "add" /* Add */, tempNode, json, onDrop);
5018
+ _LayoutInternal.dragState = new DragState(this, "add" /* Add */, tempNode, json, onDrop);
5697
5019
  }
5698
5020
  moveTabWithDragAndDrop(event, node) {
5699
5021
  this.setDragNode(event, node);
5700
5022
  }
5701
5023
  setDragNode = (event, node) => {
5702
- _LayoutInternal.dragState = new DragState(this.mainLayout, "internal" /* Internal */, node, void 0, void 0);
5024
+ _LayoutInternal.dragState = new DragState(this, "internal" /* Internal */, node, void 0, void 0);
5703
5025
  event.dataTransfer.setData("text/plain", "--flexlayout--");
5704
5026
  event.dataTransfer.effectAllowed = "copyMove";
5705
5027
  event.dataTransfer.dropEffect = "move";
@@ -5731,7 +5053,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5731
5053
  const y = isInVerticalBorder ? 10 : offsetY;
5732
5054
  let rendered = false;
5733
5055
  if (this.props.onRenderDragRect) {
5734
- const content = /* @__PURE__ */ React19.createElement(TabButtonStamp, { key: node.getId(), layout: this, node });
5056
+ const content = /* @__PURE__ */ React18.createElement(TabButtonStamp, { key: node.getId(), layout: this, node });
5735
5057
  const dragComponent = this.props.onRenderDragRect(content, node, void 0);
5736
5058
  if (dragComponent) {
5737
5059
  this.setDragComponent(event, dragComponent, x, y);
@@ -5740,7 +5062,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5740
5062
  }
5741
5063
  if (!rendered) {
5742
5064
  if (isSafari()) {
5743
- this.setDragComponent(event, /* @__PURE__ */ React19.createElement(TabButtonStamp, { node, layout: this }), x, y);
5065
+ this.setDragComponent(event, /* @__PURE__ */ React18.createElement(TabButtonStamp, { node, layout: this }), x, y);
5744
5066
  } else {
5745
5067
  event.dataTransfer.setDragImage(node.getTabStamp(), x, y);
5746
5068
  }
@@ -5748,7 +5070,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5748
5070
  }
5749
5071
  };
5750
5072
  setDragComponent(event, component, x, y) {
5751
- const dragElement = /* @__PURE__ */ React19.createElement("div", { style: { position: "unset" }, className: this.getClassName("flexlayout__layout" /* FLEXLAYOUT__LAYOUT */) + " " + this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */) }, component);
5073
+ const dragElement = /* @__PURE__ */ React18.createElement("div", { style: { position: "unset" }, className: this.getClassName("flexlayout__layout" /* FLEXLAYOUT__LAYOUT */) + " " + this.getClassName("flexlayout__drag_rect" /* FLEXLAYOUT__DRAG_RECT */) }, component);
5752
5074
  const tempDiv = this.currentDocument.createElement("div");
5753
5075
  tempDiv.setAttribute("data-layout-path", "/drag-rectangle");
5754
5076
  tempDiv.style.position = "absolute";
@@ -5761,21 +5083,6 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5761
5083
  this.currentDocument.body.removeChild(tempDiv);
5762
5084
  }, 0);
5763
5085
  }
5764
- setDraggingOverWindow(overWindow) {
5765
- if (this.isDraggingOverWindow !== overWindow) {
5766
- if (this.outlineDiv) {
5767
- this.outlineDiv.style.visibility = overWindow ? "hidden" : "visible";
5768
- }
5769
- if (overWindow) {
5770
- this.setState({ showEdges: false });
5771
- } else {
5772
- if (this.props.model.getMaximizedTabset(this.windowId) === void 0) {
5773
- this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
5774
- }
5775
- }
5776
- this.isDraggingOverWindow = overWindow;
5777
- }
5778
- }
5779
5086
  onDragEnterRaw = (event) => {
5780
5087
  this.dragEnterCount++;
5781
5088
  if (this.dragEnterCount === 1) {
@@ -5802,12 +5109,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5802
5109
  };
5803
5110
  clearDragMain() {
5804
5111
  _LayoutInternal.dragState = void 0;
5805
- if (this.windowId === Model.MAIN_WINDOW_ID) {
5806
- this.isDraggingOverWindow = false;
5807
- }
5808
- for (const [, layoutWindow] of this.props.model.getwindowsMap()) {
5809
- layoutWindow.layout.clearDragLocal();
5810
- }
5112
+ this.clearDragLocal();
5811
5113
  }
5812
5114
  clearDragLocal() {
5813
5115
  this.setState({ showEdges: false });
@@ -5825,14 +5127,11 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5825
5127
  const externalDrag = this.props.onExternalDrag(event);
5826
5128
  if (externalDrag) {
5827
5129
  const tempNode = TabNode.fromJson(externalDrag.json, this.props.model, false);
5828
- _LayoutInternal.dragState = new DragState(this.mainLayout, "external" /* External */, tempNode, externalDrag.json, externalDrag.onDrop);
5130
+ _LayoutInternal.dragState = new DragState(this, "external" /* External */, tempNode, externalDrag.json, externalDrag.onDrop);
5829
5131
  }
5830
5132
  }
5831
5133
  if (_LayoutInternal.dragState) {
5832
- if (this.windowId !== Model.MAIN_WINDOW_ID && _LayoutInternal.dragState.mainLayout === this.mainLayout) {
5833
- _LayoutInternal.dragState.mainLayout.setDraggingOverWindow(true);
5834
- }
5835
- if (_LayoutInternal.dragState.mainLayout !== this.mainLayout) {
5134
+ if (_LayoutInternal.dragState.mainLayout !== this) {
5836
5135
  return;
5837
5136
  }
5838
5137
  event.preventDefault();
@@ -5847,7 +5146,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5847
5146
  this.dragging = true;
5848
5147
  this.showOverlay(true);
5849
5148
  this.props.onDragStateChange?.(true);
5850
- if (!this.isDraggingOverWindow && this.props.model.getMaximizedTabset(this.windowId) === void 0) {
5149
+ if (this.props.model.getMaximizedTabset() === void 0) {
5851
5150
  this.setState({ showEdges: this.props.model.isEnableEdgeDock() });
5852
5151
  }
5853
5152
  const clientRect = this.selfRef.current.getBoundingClientRect();
@@ -5856,7 +5155,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5856
5155
  }
5857
5156
  };
5858
5157
  onDragOver = (event) => {
5859
- if (this.dragging && !this.isDraggingOverWindow) {
5158
+ if (this.dragging) {
5860
5159
  event.preventDefault();
5861
5160
  const clientRect = this.selfRef.current?.getBoundingClientRect();
5862
5161
  const pos = {
@@ -5864,7 +5163,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5864
5163
  y: event.clientY - (clientRect?.top ?? 0)
5865
5164
  };
5866
5165
  this.checkForBorderToShow(pos.x, pos.y);
5867
- const dropInfo = this.props.model.findDropTargetNode(this.windowId, _LayoutInternal.dragState.dragNode, pos.x, pos.y);
5166
+ const dropInfo = this.props.model.findDropTargetNode(Model.MAIN_WINDOW_ID, _LayoutInternal.dragState.dragNode, pos.x, pos.y);
5868
5167
  if (dropInfo) {
5869
5168
  this.dropInfo = dropInfo;
5870
5169
  if (this.outlineDiv) {
@@ -5877,9 +5176,6 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5877
5176
  };
5878
5177
  onDragLeave = (_event) => {
5879
5178
  if (this.dragging) {
5880
- if (this.windowId !== Model.MAIN_WINDOW_ID) {
5881
- _LayoutInternal.dragState.mainLayout.setDraggingOverWindow(false);
5882
- }
5883
5179
  this.clearDragLocal();
5884
5180
  }
5885
5181
  };
@@ -5897,7 +5193,7 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5897
5193
  this.doAction(Actions.moveNode(dragState.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));
5898
5194
  }
5899
5195
  }
5900
- this.mainLayout.clearDragMain();
5196
+ this.clearDragMain();
5901
5197
  }
5902
5198
  this.dragEnterCount = 0;
5903
5199
  };
@@ -5905,16 +5201,14 @@ var LayoutInternal = class _LayoutInternal extends React19.Component {
5905
5201
  };
5906
5202
  var FlexLayoutVersion = "0.8.1";
5907
5203
  var defaultIcons = {
5908
- close: /* @__PURE__ */ React19.createElement(CloseIcon, null),
5909
- closeTabset: /* @__PURE__ */ React19.createElement(CloseIcon, null),
5910
- popout: /* @__PURE__ */ React19.createElement(PopoutIcon, null),
5911
- maximize: /* @__PURE__ */ React19.createElement(MaximizeIcon, null),
5912
- restore: /* @__PURE__ */ React19.createElement(RestoreIcon, null),
5913
- more: /* @__PURE__ */ React19.createElement(OverflowIcon, null),
5914
- edgeArrow: /* @__PURE__ */ React19.createElement(EdgeIcon, null),
5915
- activeTabset: /* @__PURE__ */ React19.createElement(AsterickIcon, null)
5204
+ close: /* @__PURE__ */ React18.createElement(CloseIcon, null),
5205
+ closeTabset: /* @__PURE__ */ React18.createElement(CloseIcon, null),
5206
+ maximize: /* @__PURE__ */ React18.createElement(MaximizeIcon, null),
5207
+ restore: /* @__PURE__ */ React18.createElement(RestoreIcon, null),
5208
+ more: /* @__PURE__ */ React18.createElement(OverflowIcon, null),
5209
+ edgeArrow: /* @__PURE__ */ React18.createElement(EdgeIcon, null),
5210
+ activeTabset: /* @__PURE__ */ React18.createElement(AsterickIcon, null)
5916
5211
  };
5917
- var defaultSupportsPopout = isDesktop();
5918
5212
  var edgeRectLength = 100;
5919
5213
  var edgeRectWidth = 10;
5920
5214
  var DragState = class {
@@ -5933,8 +5227,8 @@ var DragState = class {
5933
5227
  };
5934
5228
 
5935
5229
  // src/view/OptimizedLayout.tsx
5936
- import * as React20 from "react";
5937
- import { memo as memo2, useCallback, useEffect as useEffect6, useLayoutEffect as useLayoutEffect9, useMemo, useRef as useRef12, useState as useState4 } from "react";
5230
+ import * as React19 from "react";
5231
+ import { memo as memo2, useCallback, useEffect as useEffect6, useLayoutEffect as useLayoutEffect8, useMemo, useRef as useRef11, useState as useState3 } from "react";
5938
5232
  function createTabInfo(node) {
5939
5233
  const parent = node.getParent();
5940
5234
  const contentRect = parent?.getContentRect() ?? Rect.empty();
@@ -5992,10 +5286,10 @@ var TabPanel = memo2(function TabPanel2({
5992
5286
  isMaximized,
5993
5287
  hasMaximizedTabset
5994
5288
  }) {
5995
- const selfRef = useRef12(null);
5289
+ const selfRef = useRef11(null);
5996
5290
  const hasValidDimensions = rect.width > 0 && rect.height > 0;
5997
5291
  const content = useMemo(() => renderTab(node), [renderTab, node]);
5998
- useLayoutEffect9(() => {
5292
+ useLayoutEffect8(() => {
5999
5293
  const element = selfRef.current;
6000
5294
  if (!element) return;
6001
5295
  const onPointerDown = () => {
@@ -6020,7 +5314,7 @@ var TabPanel = memo2(function TabPanel2({
6020
5314
  isHidden = true;
6021
5315
  }
6022
5316
  }
6023
- return /* @__PURE__ */ React20.createElement(
5317
+ return /* @__PURE__ */ React19.createElement(
6024
5318
  "div",
6025
5319
  {
6026
5320
  ref: selfRef,
@@ -6056,10 +5350,10 @@ function TabContainer({
6056
5350
  const maximizedTabset = model.getMaximizedTabset(Model.MAIN_WINDOW_ID);
6057
5351
  const hasMaximizedTabset = maximizedTabset !== void 0;
6058
5352
  const containerStyle = hasMaximizedTabset ? { zIndex: 10 } : {};
6059
- return /* @__PURE__ */ React20.createElement("div", { className: "flexlayout__optimized_layout_tab_container", "data-layout-path": "/tab-container", style: containerStyle }, Array.from(tabs.entries()).map(([nodeId, tabInfo]) => {
5353
+ return /* @__PURE__ */ React19.createElement("div", { className: "flexlayout__optimized_layout_tab_container", "data-layout-path": "/tab-container", style: containerStyle }, Array.from(tabs.entries()).map(([nodeId, tabInfo]) => {
6060
5354
  const parent = tabInfo.node.getParent();
6061
5355
  const isMaximized = parent instanceof TabSetNode && parent.isMaximized();
6062
- return /* @__PURE__ */ React20.createElement(
5356
+ return /* @__PURE__ */ React19.createElement(
6063
5357
  TabPanel,
6064
5358
  {
6065
5359
  key: nodeId,
@@ -6079,9 +5373,9 @@ function TabContainer({
6079
5373
  }));
6080
5374
  }
6081
5375
  function OptimizedLayout({ model, renderTab, classNameMapper, onDragStateChange, onModelChange: userOnModelChange, ...layoutProps }) {
6082
- const [isDragging, setIsDragging] = useState4(false);
6083
- const [tabs, setTabs] = useState4(() => /* @__PURE__ */ new Map());
6084
- const [maximizedTabsetId, setMaximizedTabsetId] = useState4(() => model.getMaximizedTabset(Model.MAIN_WINDOW_ID)?.getId());
5376
+ const [isDragging, setIsDragging] = useState3(false);
5377
+ const [tabs, setTabs] = useState3(() => /* @__PURE__ */ new Map());
5378
+ const [maximizedTabsetId, setMaximizedTabsetId] = useState3(() => model.getMaximizedTabset(Model.MAIN_WINDOW_ID)?.getId());
6085
5379
  const syncTabsWithModel = useCallback(
6086
5380
  (prevTabs) => {
6087
5381
  const modelTabNodes = /* @__PURE__ */ new Map();
@@ -6183,11 +5477,11 @@ function OptimizedLayout({ model, renderTab, classNameMapper, onDragStateChange,
6183
5477
  );
6184
5478
  const factory = useCallback(
6185
5479
  (node) => {
6186
- return /* @__PURE__ */ React20.createElement(TabRef, { key: node.getId(), node, selected: node.isSelected(), onTabMount: handleTabMount, onRectChange: handleRectChange, onVisibilityChange: handleVisibilityChange });
5480
+ return /* @__PURE__ */ React19.createElement(TabRef, { key: node.getId(), node, selected: node.isSelected(), onTabMount: handleTabMount, onRectChange: handleRectChange, onVisibilityChange: handleVisibilityChange });
6187
5481
  },
6188
5482
  [handleTabMount, handleRectChange, handleVisibilityChange]
6189
5483
  );
6190
- return /* @__PURE__ */ React20.createElement("div", { className: "flexlayout__optimized_layout" }, /* @__PURE__ */ React20.createElement(Layout, { model, factory, classNameMapper, onDragStateChange: handleDragStateChange, onModelChange: handleModelChange, ...layoutProps }), /* @__PURE__ */ React20.createElement(TabContainer, { tabs, renderTab, isDragging, classNameMapper, model, maximizedTabsetId }));
5484
+ return /* @__PURE__ */ React19.createElement("div", { className: "flexlayout__optimized_layout" }, /* @__PURE__ */ React19.createElement(Layout, { model, factory, classNameMapper, onDragStateChange: handleDragStateChange, onModelChange: handleModelChange, ...layoutProps }), /* @__PURE__ */ React19.createElement(TabContainer, { tabs, renderTab, isDragging, classNameMapper, model, maximizedTabsetId }));
6191
5485
  }
6192
5486
 
6193
5487
  // src/model/walk.ts
@@ -6246,7 +5540,6 @@ export {
6246
5540
  ICloseType,
6247
5541
  Layout,
6248
5542
  LayoutInternal,
6249
- LayoutWindow,
6250
5543
  Model,
6251
5544
  Node,
6252
5545
  OptimizedLayout,