flexlayout-react 0.9.0 → 0.9.2

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 (50) hide show
  1. package/README.md +5 -5
  2. package/dist/index.js +442 -400
  3. package/package.json +23 -22
  4. package/style/_base.scss +8 -3
  5. package/style/_themes.scss +0 -1
  6. package/style/alpha_dark.css +6 -3
  7. package/style/alpha_dark.css.map +1 -1
  8. package/style/alpha_light.css +6 -3
  9. package/style/alpha_light.css.map +1 -1
  10. package/style/alpha_rounded.css +6 -4
  11. package/style/alpha_rounded.css.map +1 -1
  12. package/style/combined.css +6 -4
  13. package/style/combined.css.map +1 -1
  14. package/style/dark.css +6 -3
  15. package/style/dark.css.map +1 -1
  16. package/style/gray.css +6 -3
  17. package/style/gray.css.map +1 -1
  18. package/style/light.css +6 -3
  19. package/style/light.css.map +1 -1
  20. package/style/rounded.css +6 -3
  21. package/style/rounded.css.map +1 -1
  22. package/style/underline.css +6 -3
  23. package/style/underline.css.map +1 -1
  24. package/types/model/IJsonModel.d.ts +2 -2
  25. package/types/model/Model.d.ts +1 -1
  26. package/types/model/TabNode.d.ts +8 -5
  27. package/types/view/BorderButton.d.ts +2 -1
  28. package/types/view/BorderTab.d.ts +2 -1
  29. package/types/view/BorderTabSet.d.ts +2 -1
  30. package/types/view/CSSClassNames.d.ts +2 -1
  31. package/types/view/{DragContainer.d.ts → DragTabButton.d.ts} +2 -2
  32. package/types/view/ErrorBoundary.d.ts +1 -1
  33. package/types/view/FloatWindow.d.ts +2 -1
  34. package/types/view/I18nLabel.d.ts +1 -1
  35. package/types/view/Icons.d.ts +11 -11
  36. package/types/view/Layout.d.ts +17 -15
  37. package/types/view/Overlay.d.ts +1 -1
  38. package/types/view/Row.d.ts +2 -1
  39. package/types/view/Splitter.d.ts +2 -1
  40. package/types/view/Tab.d.ts +2 -1
  41. package/types/view/TabButton.d.ts +2 -1
  42. package/types/view/TabButtonStamp.d.ts +1 -1
  43. package/types/view/TabContentRenderer.d.ts +1 -1
  44. package/types/view/TabLayout.d.ts +1 -1
  45. package/types/view/TabSet.d.ts +2 -1
  46. package/types/view/Utils.d.ts +9 -1
  47. package/types/view/layout/BorderContainer.d.ts +1 -1
  48. package/types/view/layout/EdgeIndicators.d.ts +2 -1
  49. package/types/view/layout/FloatingWindowContainer.d.ts +2 -1
  50. package/types/view/layout/LayoutInternal.d.ts +9 -13
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * flexlayout-react
3
- * @version 0.9.0
3
+ * @version 0.9.2
4
4
  */
5
5
  import * as React from "react";
6
6
  import { useEffect, useImperativeHandle, useRef } from "react";
@@ -279,7 +279,8 @@ var CLASSES = /* @__PURE__ */ function(CLASSES) {
279
279
  CLASSES["FLEXLAYOUT__FLOAT_WINDOW_CONTENT"] = "flexlayout__float_window_content";
280
280
  CLASSES["FLEXLAYOUT__FLOATING_WINDOW_CONTENT"] = "flexlayout__floating_window_content";
281
281
  CLASSES["FLEXLAYOUT__LAYOUT"] = "flexlayout__layout";
282
- CLASSES["FLEXLAYOUT__LAYOUT_MOVEABLES"] = "flexlayout__layout_moveables";
282
+ CLASSES["FLEXLAYOUT__LAYOUT_METRICS"] = "flexlayout__layout_metrics";
283
+ CLASSES["FLEXLAYOUT__LAYOUT_MOVEABLES_HOME"] = "flexlayout__layout_moveables_home";
283
284
  CLASSES["FLEXLAYOUT__LAYOUT_OVERLAY"] = "flexlayout__layout_overlay";
284
285
  CLASSES["FLEXLAYOUT__LAYOUT_TAB_STAMPS"] = "flexlayout__layout_tab_stamps";
285
286
  CLASSES["FLEXLAYOUT__LAYOUT_MAIN"] = "flexlayout__layout_main";
@@ -953,19 +954,20 @@ var TabNode = class TabNode extends Node {
953
954
  return new TabNode(model, json, addToModel);
954
955
  }
955
956
  tabRect = Rect.empty();
956
- moveableElement;
957
957
  renderedName;
958
958
  extra;
959
959
  visible;
960
960
  rendered;
961
+ moveableElement;
962
+ tabStamp;
961
963
  scrollTop;
962
964
  scrollLeft;
963
- tabStamp;
964
965
  /** @internal */
965
966
  constructor(model, json, addToModel = true) {
966
967
  super(model);
967
968
  this.extra = {};
968
- this.moveableElement = null;
969
+ this.moveableElement = document.createElement("div");
970
+ this.moveableElement.className = CLASSES.FLEXLAYOUT__TAB_MOVEABLE;
969
971
  this.tabStamp = null;
970
972
  this.rendered = false;
971
973
  this.visible = false;
@@ -1159,7 +1161,10 @@ var TabNode = class TabNode extends Node {
1159
1161
  getMoveableElement() {
1160
1162
  return this.moveableElement;
1161
1163
  }
1162
- /** @internal */
1164
+ /**
1165
+ * @internal
1166
+ * This method is exposed to allow the workaround for issue: #524
1167
+ */
1163
1168
  setMoveableElement(element) {
1164
1169
  this.moveableElement = element;
1165
1170
  }
@@ -1227,7 +1232,7 @@ var TabNode = class TabNode extends Node {
1227
1232
  attributeDefinitions.addInherited("contentClassName", "tabContentClassName").setType(Attribute.STRING).setDescription(`class applied to tab content`);
1228
1233
  attributeDefinitions.addInherited("icon", "tabIcon").setType(Attribute.STRING).setDescription(`the tab icon`);
1229
1234
  attributeDefinitions.addInherited("enableRenderOnDemand", "tabEnableRenderOnDemand").setType(Attribute.BOOLEAN).setDescription(`whether to avoid rendering component until tab is visible`);
1230
- attributeDefinitions.addInherited("enablePopout", "tabEnablePopout").setType(Attribute.BOOLEAN).setAlias("enableFloat").setDescription(`enable popout (in popout capable browser)`);
1235
+ attributeDefinitions.addInherited("enablePopout", "tabEnablePopout").setType(Attribute.BOOLEAN).setAlias("enableFloat").setDescription(`enable window popout (in popout capable browser), to show an icon in the tabset header also set the enablePopoutIcon attribute`);
1231
1236
  attributeDefinitions.addInherited("enablePopoutIcon", "tabEnablePopoutIcon").setType(Attribute.BOOLEAN).setDescription(`whether to show the popout icon in the tabset header if this tab enables popouts`);
1232
1237
  attributeDefinitions.addInherited("enablePopoutFloatIcon", "tabEnablePopoutFloatIcon").setType(Attribute.BOOLEAN).setDescription(`whether to show the popout float icon in the tabset header if this tab enables floating popouts`);
1233
1238
  attributeDefinitions.addInherited("enablePopoutOverlay", "tabEnablePopoutOverlay").setType(Attribute.BOOLEAN).setDescription(`if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
@@ -1353,6 +1358,16 @@ function isSafari() {
1353
1358
  const userAgent = navigator.userAgent;
1354
1359
  return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
1355
1360
  }
1361
+ function getPageMetrics() {
1362
+ return {
1363
+ scrollTop: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,
1364
+ scrollLeft: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
1365
+ fullHeight: Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight),
1366
+ fullWidth: Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth),
1367
+ viewportHeight: window.innerHeight || document.documentElement.clientHeight,
1368
+ viewportWidth: window.innerWidth || document.documentElement.clientWidth
1369
+ };
1370
+ }
1356
1371
  //#endregion
1357
1372
  //#region src/model/RowNode.ts
1358
1373
  var RowNode = class RowNode extends Node {
@@ -2155,7 +2170,7 @@ function adjustSelectedIndex(parent, removedIndex) {
2155
2170
  }
2156
2171
  }
2157
2172
  function randomUUID() {
2158
- return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
2173
+ return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (c ^ crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
2159
2174
  }
2160
2175
  //#endregion
2161
2176
  //#region src/model/BorderNode.ts
@@ -2667,7 +2682,7 @@ var Model = class Model {
2667
2682
  * Update the node tree by performing the given action,
2668
2683
  * Actions should be generated via static methods on the Actions class
2669
2684
  * @param action the action to perform
2670
- * @returns added Node for Actions.addNode, layoutId for createPopout
2685
+ * @returns added Node for Actions.addTab, layoutId for createPopout
2671
2686
  */
2672
2687
  doAction(action) {
2673
2688
  let returnVal = void 0;
@@ -3332,7 +3347,7 @@ var I18nLabel = /* @__PURE__ */ function(I18nLabel) {
3332
3347
  I18nLabel["Close_Tabset"] = "Close tab set";
3333
3348
  I18nLabel["Active_Tabset"] = "Active tab set";
3334
3349
  I18nLabel["Move_Tabset"] = "Move tab set";
3335
- I18nLabel["Move_Tabs"] = "Move tabs(?)";
3350
+ I18nLabel["Move_Tabs"] = "Move tabs (?)";
3336
3351
  I18nLabel["Maximize"] = "Maximize tab set";
3337
3352
  I18nLabel["Restore"] = "Restore tab set";
3338
3353
  I18nLabel["Popout_Tab"] = "Popout selected tab";
@@ -3609,51 +3624,62 @@ var useTabOverflow = (controller, node, orientation, tabStripRef, miniScrollRef,
3609
3624
  const hiddenTabsRef = React.useRef([]);
3610
3625
  const thumbInternalPos = React.useRef(0);
3611
3626
  const repositioningRef = React.useRef(false);
3612
- hiddenTabsRef.current = hiddenTabs;
3613
3627
  React.useLayoutEffect(() => {
3614
- if (tabStripRef.current) setScrollPosition(0);
3615
- }, [node.getId()]);
3616
- React.useLayoutEffect(() => {
3617
- userControlledPositionRef.current = false;
3618
- }, [
3619
- node.getSelectedNode(),
3620
- node.getRect().width,
3621
- node.getRect().height
3622
- ]);
3623
- React.useLayoutEffect(() => {
3624
- checkForOverflow();
3625
- if (userControlledPositionRef.current === false) scrollIntoView();
3626
- updateScrollMetrics();
3627
- updateHiddenTabs();
3628
+ hiddenTabsRef.current = hiddenTabs;
3628
3629
  });
3629
- React.useEffect(() => {
3630
- selfRef.current?.addEventListener("wheel", onWheel, { passive: false });
3631
- return () => {
3632
- selfRef.current?.removeEventListener("wheel", onWheel);
3633
- };
3634
- }, [selfRef.current]);
3635
- const onWheel = (event) => {
3636
- event.preventDefault();
3637
- };
3638
- function scrollIntoView() {
3639
- const selectedTabNode = node.getSelectedNode();
3640
- if (selectedTabNode && tabStripRef.current) {
3641
- const stripRect = controller.getBoundingClientRect(tabStripRef.current);
3642
- const selectedRect = selectedTabNode.getTabRect();
3643
- let shift = getNear(stripRect) - getNear(selectedRect);
3644
- if (shift > 0 || getSize(selectedRect) > getSize(stripRect)) {
3645
- setScrollPosition(getScrollPosition(tabStripRef.current) - shift);
3646
- repositioningRef.current = true;
3647
- } else {
3648
- shift = getFar(selectedRect) - getFar(stripRect);
3649
- if (shift > 0) {
3650
- setScrollPosition(getScrollPosition(tabStripRef.current) + shift);
3651
- repositioningRef.current = true;
3630
+ const setScrollPosition = React.useCallback((p) => {
3631
+ if (orientation === Orientation.HORZ) tabStripRef.current.scrollLeft = p;
3632
+ else tabStripRef.current.scrollTop = p;
3633
+ }, [orientation, tabStripRef]);
3634
+ const getScrollPosition = React.useCallback((elm) => {
3635
+ if (orientation === Orientation.HORZ) return elm.scrollLeft;
3636
+ else return elm.scrollTop;
3637
+ }, [orientation]);
3638
+ const getElementSize = React.useCallback((elm) => {
3639
+ if (orientation === Orientation.HORZ) return elm.clientWidth;
3640
+ else return elm.clientHeight;
3641
+ }, [orientation]);
3642
+ const getScrollSize = React.useCallback((elm) => {
3643
+ if (orientation === Orientation.HORZ) return elm.scrollWidth;
3644
+ else return elm.scrollHeight;
3645
+ }, [orientation]);
3646
+ const getSize = React.useCallback((rect) => {
3647
+ if (orientation === Orientation.HORZ) return rect.width;
3648
+ else return rect.height;
3649
+ }, [orientation]);
3650
+ const getNear = React.useCallback((rect) => {
3651
+ if (orientation === Orientation.HORZ) return rect.x;
3652
+ else return rect.y;
3653
+ }, [orientation]);
3654
+ const getFar = React.useCallback((rect) => {
3655
+ if (orientation === Orientation.HORZ) return rect.right;
3656
+ else return rect.bottom;
3657
+ }, [orientation]);
3658
+ const findHiddenTabs = React.useCallback(() => {
3659
+ const hidden = [];
3660
+ if (tabStripRef.current) {
3661
+ const strip = tabStripRef.current;
3662
+ const stripRect = strip.getBoundingClientRect();
3663
+ const visibleNear = getNear(stripRect) - 1;
3664
+ const visibleFar = getFar(stripRect) + 1;
3665
+ const tabContainer = strip.firstElementChild;
3666
+ let i = 0;
3667
+ Array.from(tabContainer.children).forEach((child) => {
3668
+ const tabRect = child.getBoundingClientRect();
3669
+ if (child.classList.contains(tabClassName)) {
3670
+ if (getNear(tabRect) < visibleNear || getFar(tabRect) > visibleFar) hidden.push(i);
3671
+ i++;
3652
3672
  }
3653
- }
3673
+ });
3654
3674
  }
3655
- }
3656
- const updateScrollMetrics = () => {
3675
+ return hidden;
3676
+ }, [
3677
+ tabClassName,
3678
+ tabStripRef,
3679
+ getNear,
3680
+ getFar
3681
+ ]);
3682
+ const updateScrollMetrics = React.useCallback(() => {
3657
3683
  if (tabStripRef.current && miniScrollRef.current) {
3658
3684
  const t = tabStripRef.current;
3659
3685
  const s = miniScrollRef.current;
@@ -3680,31 +3706,71 @@ var useTabOverflow = (controller, node, orientation, tabStripRef, miniScrollRef,
3680
3706
  if (orientation === Orientation.HORZ) s.style.bottom = "0px";
3681
3707
  else s.style.right = "0px";
3682
3708
  }
3683
- };
3684
- const updateHiddenTabs = () => {
3685
- const showHidden = findHiddenTabs().length > 0;
3709
+ }, [
3710
+ orientation,
3711
+ tabStripRef,
3712
+ miniScrollRef,
3713
+ getElementSize,
3714
+ getScrollSize,
3715
+ getScrollPosition
3716
+ ]);
3717
+ const updateHiddenTabs = React.useCallback((isInitial = false) => {
3718
+ const newHiddenTabs = findHiddenTabs();
3719
+ const showHidden = newHiddenTabs.length > 0;
3686
3720
  if (showHidden !== isShowHiddenTabs) setShowHiddenTabs(showHidden);
3687
- if (updateHiddenTabsTimerRef.current === void 0) updateHiddenTabsTimerRef.current = setTimeout(() => {
3688
- const newHiddenTabs = findHiddenTabs();
3689
- if (!arraysEqual(newHiddenTabs, hiddenTabsRef.current)) setHiddenTabs(newHiddenTabs);
3721
+ if (isInitial) setHiddenTabs(newHiddenTabs);
3722
+ else if (updateHiddenTabsTimerRef.current === void 0) updateHiddenTabsTimerRef.current = setTimeout(() => {
3723
+ const currentHiddenTabs = findHiddenTabs();
3724
+ if (!arraysEqual(currentHiddenTabs, hiddenTabsRef.current)) setHiddenTabs(currentHiddenTabs);
3690
3725
  updateHiddenTabsTimerRef.current = void 0;
3691
3726
  }, 100);
3692
- };
3693
- const onScroll = () => {
3727
+ }, [findHiddenTabs, isShowHiddenTabs]);
3728
+ const scrollIntoView = React.useCallback(() => {
3729
+ const selectedTabNode = node.getSelectedNode();
3730
+ if (selectedTabNode && tabStripRef.current) {
3731
+ const stripRect = controller.getBoundingClientRect(tabStripRef.current);
3732
+ const selectedRect = selectedTabNode.getTabRect();
3733
+ let shift = getNear(stripRect) - getNear(selectedRect);
3734
+ if (shift > 0 || getSize(selectedRect) > getSize(stripRect)) {
3735
+ setScrollPosition(getScrollPosition(tabStripRef.current) - shift);
3736
+ repositioningRef.current = true;
3737
+ } else {
3738
+ shift = getFar(selectedRect) - getFar(stripRect);
3739
+ if (shift > 0) {
3740
+ setScrollPosition(getScrollPosition(tabStripRef.current) + shift);
3741
+ repositioningRef.current = true;
3742
+ }
3743
+ }
3744
+ }
3745
+ }, [
3746
+ node,
3747
+ controller,
3748
+ tabStripRef,
3749
+ getNear,
3750
+ getFar,
3751
+ getSize,
3752
+ getScrollPosition,
3753
+ setScrollPosition
3754
+ ]);
3755
+ const checkForOverflow = React.useCallback(() => {
3756
+ if (tabStripRef.current) {
3757
+ const tabContainer = tabStripRef.current.firstElementChild;
3758
+ const offset = isDockStickyButtons ? 10 : 0;
3759
+ const dock = getElementSize(tabContainer) + offset > getElementSize(tabStripRef.current);
3760
+ if (dock !== isDockStickyButtons) setDockStickyButtons(dock);
3761
+ }
3762
+ }, [
3763
+ tabStripRef,
3764
+ isDockStickyButtons,
3765
+ getElementSize
3766
+ ]);
3767
+ const onScroll = React.useCallback(() => {
3694
3768
  if (!repositioningRef.current) userControlledPositionRef.current = true;
3695
3769
  repositioningRef.current = false;
3696
3770
  updateScrollMetrics();
3697
3771
  updateHiddenTabs();
3698
- };
3699
- const onScrollPointerDown = (event) => {
3700
- event.stopPropagation();
3701
- miniScrollRef.current.setPointerCapture(event.pointerId);
3702
- const r = miniScrollRef.current.getBoundingClientRect();
3703
- if (orientation === Orientation.HORZ) thumbInternalPos.current = event.clientX - r.x;
3704
- else thumbInternalPos.current = event.clientY - r.y;
3705
- startDrag(event.currentTarget.ownerDocument, event, onDragMove, onDragEnd, onDragCancel);
3706
- };
3707
- const onDragMove = (x, y) => {
3772
+ }, [updateScrollMetrics, updateHiddenTabs]);
3773
+ const onDragMove = React.useCallback((x, y) => {
3708
3774
  if (tabStripRef.current && miniScrollRef.current) {
3709
3775
  const t = tabStripRef.current;
3710
3776
  const s = miniScrollRef.current;
@@ -3718,37 +3784,31 @@ var useTabOverflow = (controller, node, orientation, tabStripRef, miniScrollRef,
3718
3784
  thumb = Math.max(0, Math.min(scrollSize - thumbSize, thumb));
3719
3785
  if (size > 0) setScrollPosition(thumb * scrollSize / size);
3720
3786
  }
3721
- };
3722
- const onDragEnd = () => {};
3723
- const onDragCancel = () => {};
3724
- const checkForOverflow = () => {
3725
- if (tabStripRef.current) {
3726
- const tabContainer = tabStripRef.current.firstElementChild;
3727
- const offset = isDockStickyButtons ? 10 : 0;
3728
- const dock = getElementSize(tabContainer) + offset > getElementSize(tabStripRef.current);
3729
- if (dock !== isDockStickyButtons) setDockStickyButtons(dock);
3730
- }
3731
- };
3732
- const findHiddenTabs = () => {
3733
- const hidden = [];
3734
- if (tabStripRef.current) {
3735
- const strip = tabStripRef.current;
3736
- const stripRect = strip.getBoundingClientRect();
3737
- const visibleNear = getNear(stripRect) - 1;
3738
- const visibleFar = getFar(stripRect) + 1;
3739
- const tabContainer = strip.firstElementChild;
3740
- let i = 0;
3741
- Array.from(tabContainer.children).forEach((child) => {
3742
- const tabRect = child.getBoundingClientRect();
3743
- if (child.classList.contains(tabClassName)) {
3744
- if (getNear(tabRect) < visibleNear || getFar(tabRect) > visibleFar) hidden.push(i);
3745
- i++;
3746
- }
3747
- });
3748
- }
3749
- return hidden;
3750
- };
3751
- const onMouseWheel = (event) => {
3787
+ }, [
3788
+ tabStripRef,
3789
+ miniScrollRef,
3790
+ orientation,
3791
+ getElementSize,
3792
+ getScrollSize,
3793
+ setScrollPosition
3794
+ ]);
3795
+ const onDragEnd = React.useCallback(() => {}, []);
3796
+ const onDragCancel = React.useCallback(() => {}, []);
3797
+ const onScrollPointerDown = React.useCallback((event) => {
3798
+ event.stopPropagation();
3799
+ miniScrollRef.current.setPointerCapture(event.pointerId);
3800
+ const r = miniScrollRef.current.getBoundingClientRect();
3801
+ if (orientation === Orientation.HORZ) thumbInternalPos.current = event.clientX - r.x;
3802
+ else thumbInternalPos.current = event.clientY - r.y;
3803
+ startDrag(event.currentTarget.ownerDocument, event, onDragMove, onDragEnd, onDragCancel);
3804
+ }, [
3805
+ miniScrollRef,
3806
+ orientation,
3807
+ onDragMove,
3808
+ onDragEnd,
3809
+ onDragCancel
3810
+ ]);
3811
+ const onMouseWheel = React.useCallback((event) => {
3752
3812
  if (tabStripRef.current) {
3753
3813
  if (node.getChildren().length === 0) return;
3754
3814
  let delta;
@@ -3761,35 +3821,60 @@ var useTabOverflow = (controller, node, orientation, tabStripRef, miniScrollRef,
3761
3821
  event.stopPropagation();
3762
3822
  }
3763
3823
  }
3764
- };
3765
- const getNear = (rect) => {
3766
- if (orientation === Orientation.HORZ) return rect.x;
3767
- else return rect.y;
3768
- };
3769
- const getFar = (rect) => {
3770
- if (orientation === Orientation.HORZ) return rect.right;
3771
- else return rect.bottom;
3772
- };
3773
- const getElementSize = (elm) => {
3774
- if (orientation === Orientation.HORZ) return elm.clientWidth;
3775
- else return elm.clientHeight;
3776
- };
3777
- const getSize = (rect) => {
3778
- if (orientation === Orientation.HORZ) return rect.width;
3779
- else return rect.height;
3780
- };
3781
- const getScrollSize = (elm) => {
3782
- if (orientation === Orientation.HORZ) return elm.scrollWidth;
3783
- else return elm.scrollHeight;
3784
- };
3785
- const setScrollPosition = (p) => {
3786
- if (orientation === Orientation.HORZ) tabStripRef.current.scrollLeft = p;
3787
- else tabStripRef.current.scrollTop = p;
3788
- };
3789
- const getScrollPosition = (elm) => {
3790
- if (orientation === Orientation.HORZ) return elm.scrollLeft;
3791
- else return elm.scrollTop;
3792
- };
3824
+ }, [
3825
+ node,
3826
+ tabStripRef,
3827
+ getScrollPosition,
3828
+ getScrollSize,
3829
+ getElementSize,
3830
+ setScrollPosition
3831
+ ]);
3832
+ const onWheel = React.useCallback((event) => {
3833
+ event.preventDefault();
3834
+ }, []);
3835
+ const nodeId = node.getId();
3836
+ const selectedNode = node.getSelectedNode();
3837
+ const rectWidth = node.getRect().width;
3838
+ const rectHeight = node.getRect().height;
3839
+ React.useLayoutEffect(() => {
3840
+ if (tabStripRef.current) setScrollPosition(0);
3841
+ }, [
3842
+ nodeId,
3843
+ tabStripRef,
3844
+ setScrollPosition
3845
+ ]);
3846
+ React.useLayoutEffect(() => {
3847
+ userControlledPositionRef.current = false;
3848
+ }, [
3849
+ selectedNode,
3850
+ rectWidth,
3851
+ rectHeight
3852
+ ]);
3853
+ React.useLayoutEffect(() => {
3854
+ checkForOverflow();
3855
+ if (userControlledPositionRef.current === false) scrollIntoView();
3856
+ updateScrollMetrics();
3857
+ updateHiddenTabs(true);
3858
+ requestAnimationFrame(() => {
3859
+ updateHiddenTabs();
3860
+ });
3861
+ }, [
3862
+ checkForOverflow,
3863
+ scrollIntoView,
3864
+ updateScrollMetrics,
3865
+ updateHiddenTabs,
3866
+ rectWidth,
3867
+ rectHeight,
3868
+ orientation,
3869
+ selectedNode
3870
+ ]);
3871
+ React.useEffect(() => {
3872
+ const strip = selfRef.current;
3873
+ strip?.addEventListener("wheel", onWheel, { passive: false });
3874
+ return () => {
3875
+ strip?.removeEventListener("wheel", onWheel);
3876
+ };
3877
+ }, [onWheel]);
3793
3878
  return {
3794
3879
  selfRef,
3795
3880
  userControlledPositionRef,
@@ -3809,6 +3894,7 @@ function arraysEqual(arr1, arr2) {
3809
3894
  /** @internal */
3810
3895
  var TabSet = (props) => {
3811
3896
  const { tabsetNode, controller } = props;
3897
+ const selfRef = React.useRef(null);
3812
3898
  const tabStripRef = React.useRef(null);
3813
3899
  const miniScrollRef = React.useRef(null);
3814
3900
  const tabStripInnerRef = React.useRef(null);
@@ -3817,16 +3903,18 @@ var TabSet = (props) => {
3817
3903
  const overflowbuttonRef = React.useRef(null);
3818
3904
  const stickyButtonsRef = React.useRef(null);
3819
3905
  const icons = controller.getIcons();
3906
+ const { userControlledPositionRef, onScroll, onScrollPointerDown, hiddenTabs, onMouseWheel, isDockStickyButtons, isShowHiddenTabs } = useTabOverflow(controller, tabsetNode, Orientation.HORZ, tabStripInnerRef, miniScrollRef, controller.getClassName(CLASSES.FLEXLAYOUT__TAB_BUTTON));
3820
3907
  React.useLayoutEffect(() => {
3821
- tabsetNode.setRect(controller.getBoundingClientRect(selfRef.current));
3908
+ if (selfRef.current) tabsetNode.setRect(controller.getBoundingClientRect(selfRef.current));
3822
3909
  if (tabStripRef.current) tabsetNode.setTabStripRect(controller.getBoundingClientRect(tabStripRef.current));
3823
- const newContentRect = controller.getBoundingClientRect(contentRef.current);
3824
- if (!tabsetNode.getContentRect().equalsWhenRounded(newContentRect) && !isNaN(newContentRect.x)) {
3825
- tabsetNode.setContentRect(newContentRect);
3826
- controller.setReLayout(true);
3910
+ if (contentRef.current) {
3911
+ const newContentRect = controller.getBoundingClientRect(contentRef.current);
3912
+ if (!tabsetNode.getContentRect().equalsWhenRounded(newContentRect) && !isNaN(newContentRect.x)) {
3913
+ tabsetNode.setContentRect(newContentRect);
3914
+ controller.setReLayout(true);
3915
+ }
3827
3916
  }
3828
3917
  });
3829
- const { selfRef, userControlledPositionRef, onScroll, onScrollPointerDown, hiddenTabs, onMouseWheel, isDockStickyButtons, isShowHiddenTabs } = useTabOverflow(controller, tabsetNode, Orientation.HORZ, tabStripInnerRef, miniScrollRef, controller.getClassName(CLASSES.FLEXLAYOUT__TAB_BUTTON));
3830
3918
  const onOverflowClick = (event) => {
3831
3919
  const callback = controller.getShowOverflowMenu();
3832
3920
  const items = hiddenTabs.map((h) => {
@@ -3995,7 +4083,7 @@ var TabSet = (props) => {
3995
4083
  children: typeof icons.popoutFloat === "function" ? icons.popoutFloat(selectedTabNode) : icons.popoutFloat
3996
4084
  }, "popout-float"));
3997
4085
  }
3998
- if (controller.isSupportsPopout() && selectedTabNode.isAllowedInWindow() && selectedTabNode.isEnablePopout()) {
4086
+ if (controller.isSupportsPopout() && selectedTabNode.isAllowedInWindow() && selectedTabNode.isEnablePopoutIcon()) {
3999
4087
  const popoutTitle = controller.i18nName(I18nLabel.Popout_Tab);
4000
4088
  buttons.push(/* @__PURE__ */ jsx("button", {
4001
4089
  "data-layout-path": path + "/button/popout",
@@ -4205,18 +4293,20 @@ var Splitter = (props) => {
4205
4293
  sum: 0,
4206
4294
  startPosition: 0
4207
4295
  });
4296
+ const onTouchStart = React.useCallback((event) => {
4297
+ event.preventDefault();
4298
+ event.stopImmediatePropagation();
4299
+ }, []);
4208
4300
  React.useEffect(() => {
4209
- selfRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4210
- extendedRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4301
+ const self = selfRef.current;
4302
+ const extended = extendedRef.current;
4303
+ self?.addEventListener("touchstart", onTouchStart, { passive: false });
4304
+ extended?.addEventListener("touchstart", onTouchStart, { passive: false });
4211
4305
  return () => {
4212
- selfRef.current?.removeEventListener("touchstart", onTouchStart);
4213
- extendedRef.current?.removeEventListener("touchstart", onTouchStart);
4306
+ self?.removeEventListener("touchstart", onTouchStart);
4307
+ extended?.removeEventListener("touchstart", onTouchStart);
4214
4308
  };
4215
- }, []);
4216
- const onTouchStart = (event) => {
4217
- event.preventDefault();
4218
- event.stopImmediatePropagation();
4219
- };
4309
+ }, [onTouchStart]);
4220
4310
  const onPointerDown = (event) => {
4221
4311
  event.stopPropagation();
4222
4312
  if (node instanceof RowNode) initalSizes.current = node.getSplitterInitials(index);
@@ -4356,27 +4446,36 @@ var Tab = (props) => {
4356
4446
  const { controller, selected, tabNode } = props;
4357
4447
  const selfRef = React.useRef(null);
4358
4448
  const firstSelect = React.useRef(true);
4449
+ const onPointerDown = React.useCallback(() => {
4450
+ const parent = tabNode.getParent();
4451
+ if (parent instanceof TabSetNode) {
4452
+ if (!parent.isActive()) controller.doAction(Actions.setActiveTabset(parent.getId(), controller.getLayoutId()));
4453
+ }
4454
+ }, [tabNode, controller]);
4359
4455
  const parentNode = tabNode.getParent();
4360
4456
  const rect = parentNode.getContentRect();
4361
4457
  React.useLayoutEffect(() => {
4458
+ const element = tabNode.getMoveableElement();
4459
+ selfRef.current.appendChild(element);
4362
4460
  const handleScroll = () => {
4363
4461
  tabNode.saveScrollPosition();
4364
4462
  };
4365
- const element = tabNode.getMoveableElement();
4366
- if (element) {
4367
- selfRef.current.appendChild(element);
4368
- element.addEventListener("scroll", handleScroll);
4369
- }
4370
- selfRef.current.addEventListener("pointerdown", onPointerDown);
4463
+ element.addEventListener("scroll", handleScroll);
4464
+ const self = selfRef.current;
4465
+ if (self) self.addEventListener("pointerdown", onPointerDown);
4371
4466
  return () => {
4372
- if (selfRef.current) selfRef.current.removeEventListener("pointerdown", onPointerDown);
4373
- if (element) {
4374
- if (!tabNode.isEnableWindowReMount()) controller.getMainController()?.getMoveablesDiv()?.appendChild(element);
4375
- element.removeEventListener("scroll", handleScroll);
4467
+ if (self) self.removeEventListener("pointerdown", onPointerDown);
4468
+ if (controller.getModel().getNodeById(tabNode.getId())) {
4469
+ if (!tabNode.isEnableWindowReMount()) controller.getMainController()?.getMoveablesHome()?.appendChild(element);
4376
4470
  }
4471
+ element.removeEventListener("scroll", handleScroll);
4377
4472
  tabNode.setVisible(false);
4378
4473
  };
4379
- }, [tabNode.getMoveableElement()]);
4474
+ }, [
4475
+ tabNode,
4476
+ controller,
4477
+ onPointerDown
4478
+ ]);
4380
4479
  React.useEffect(() => {
4381
4480
  if (tabNode.isSelected()) {
4382
4481
  if (firstSelect.current) {
@@ -4385,12 +4484,6 @@ var Tab = (props) => {
4385
4484
  }
4386
4485
  }
4387
4486
  });
4388
- const onPointerDown = () => {
4389
- const parent = tabNode.getParent();
4390
- if (parent instanceof TabSetNode) {
4391
- if (!parent.isActive()) controller.doAction(Actions.setActiveTabset(parent.getId(), controller.getLayoutId()));
4392
- }
4393
- };
4394
4487
  tabNode.setRect(rect);
4395
4488
  const cm = controller.getClassName;
4396
4489
  const style = {};
@@ -4510,17 +4603,18 @@ var DragDropManager = class DragDropManager {
4510
4603
  }
4511
4604
  addTabWithDragAndDrop(event, json, onDrop) {
4512
4605
  const tempNode = TabNode.fromJson(json, this._controller.getModel(), false);
4513
- DragDropManager.dragState = new DragState(this._controller.getMainController(), DragSource.Add, tempNode, json, onDrop);
4606
+ DragDropManager.dragState = new DragState(this._controller.getMainController(), "add", tempNode, json, onDrop);
4514
4607
  }
4515
4608
  moveTabWithDragAndDrop(event, node) {
4516
4609
  this.setDragNode(event, node);
4517
4610
  }
4518
4611
  setDragNode = (event, node) => {
4519
- DragDropManager.dragState = new DragState(this._controller.getMainController(), DragSource.Internal, node, void 0, void 0);
4612
+ DragDropManager.dragState = new DragState(this._controller.getMainController(), "internal", node, void 0, void 0);
4520
4613
  event.dataTransfer.setData("text/plain", "--flexlayout--");
4521
4614
  event.dataTransfer.effectAllowed = "copyMove";
4522
4615
  event.dataTransfer.dropEffect = "move";
4523
4616
  this._dragEnterCount = 0;
4617
+ this._controller.getModel().sortLayouts();
4524
4618
  if (node instanceof TabSetNode) {
4525
4619
  let rendered = false;
4526
4620
  let content = this._controller.i18nName(I18nLabel.Move_Tabset);
@@ -4569,7 +4663,6 @@ var DragDropManager = class DragDropManager {
4569
4663
  className: this._controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT) + " " + this._controller.getClassName(CLASSES.FLEXLAYOUT__DRAG_RECT),
4570
4664
  children: component
4571
4665
  });
4572
- this._controller.getModel().sortLayouts();
4573
4666
  const currentDocument = this._controller.getCurrentDocument();
4574
4667
  const tempDiv = currentDocument.createElement("div");
4575
4668
  tempDiv.setAttribute("data-layout-path", "/drag-rectangle");
@@ -4585,15 +4678,24 @@ var DragDropManager = class DragDropManager {
4585
4678
  }
4586
4679
  updateActive(event) {
4587
4680
  const layouts = Array.from(this._controller.getModel().getLayouts().values());
4588
- let foundActive = false;
4681
+ let found = void 0;
4682
+ let foundTab = void 0;
4589
4683
  for (let i = layouts.length - 1; i >= 0; i--) {
4590
- const manager = layouts[i].getController()?.getDragDropManager();
4591
- if (manager) {
4592
- const newActive = !foundActive && manager.getDragEnterCount() > 0;
4593
- if (newActive) foundActive = true;
4594
- manager.setActive(newActive, event);
4684
+ const layout = layouts[i];
4685
+ const dragDropManager = layout.getController()?.getDragDropManager();
4686
+ if (dragDropManager) {
4687
+ if (dragDropManager.getDragEnterCount() > 0) {
4688
+ if (layout.getType() === "tab") foundTab = layout;
4689
+ else if (!found && !foundTab) found = layout;
4690
+ }
4595
4691
  }
4596
4692
  }
4693
+ if (foundTab) {
4694
+ const parentLayout = findParentLayout(foundTab);
4695
+ if (found === parentLayout || !found) found = foundTab;
4696
+ }
4697
+ if (found) found.getController().getDragDropManager().setActive(true, event);
4698
+ for (const layout of layouts) if (layout !== found) layout.getController()?.getDragDropManager().setActive(false, event);
4597
4699
  }
4598
4700
  setActive(active, event) {
4599
4701
  if (this._active !== active) {
@@ -4632,7 +4734,7 @@ var DragDropManager = class DragDropManager {
4632
4734
  const externalDrag = this._controller.getProps().onExternalDrag(event);
4633
4735
  if (externalDrag) {
4634
4736
  const tempNode = TabNode.fromJson(externalDrag.json, this._controller.getModel(), false);
4635
- DragDropManager.dragState = new DragState(this._controller.getMainController(), DragSource.External, tempNode, externalDrag.json, externalDrag.onDrop);
4737
+ DragDropManager.dragState = new DragState(this._controller.getMainController(), "external", tempNode, externalDrag.json, externalDrag.onDrop);
4636
4738
  }
4637
4739
  }
4638
4740
  if (this._mainController !== DragDropManager.dragState?.mainLayoutController) return;
@@ -4640,7 +4742,8 @@ var DragDropManager = class DragDropManager {
4640
4742
  event.preventDefault();
4641
4743
  this._dropInfo = void 0;
4642
4744
  const rootdiv = this._controller.getRootDiv();
4643
- this._outlineDiv = this._controller.getCurrentDocument().createElement("div");
4745
+ const currentDocument = this._controller.getCurrentDocument();
4746
+ this._outlineDiv = currentDocument.createElement("div");
4644
4747
  this._outlineDiv.className = this._controller.getClassName(CLASSES.FLEXLAYOUT__OUTLINE_RECT);
4645
4748
  this._outlineDiv.style.visibility = "hidden";
4646
4749
  const speed = this._controller.getTabDragSpeed();
@@ -4695,7 +4798,7 @@ var DragDropManager = class DragDropManager {
4695
4798
  const dragState = DragDropManager.dragState;
4696
4799
  if (this._dropInfo) {
4697
4800
  if (dragState.dragJson !== void 0) {
4698
- const newNode = this._controller.doAction(Actions.addNode(dragState.dragJson, this._dropInfo.node.getId(), this._dropInfo.location, this._dropInfo.index));
4801
+ const newNode = this._controller.doAction(Actions.addTab(dragState.dragJson, this._dropInfo.node.getId(), this._dropInfo.location, this._dropInfo.index));
4699
4802
  if (dragState.fnNewNodeDropped !== void 0) dragState.fnNewNodeDropped(newNode, event);
4700
4803
  } else if (dragState.dragNode !== void 0) this._controller.doAction(Actions.moveNode(dragState.dragNode.getId(), this._dropInfo.node.getId(), this._dropInfo.location, this._dropInfo.index));
4701
4804
  }
@@ -4711,12 +4814,6 @@ var DragDropManager = class DragDropManager {
4711
4814
  return this._dragging;
4712
4815
  }
4713
4816
  };
4714
- var DragSource = /* @__PURE__ */ function(DragSource) {
4715
- DragSource["Internal"] = "internal";
4716
- DragSource["External"] = "external";
4717
- DragSource["Add"] = "add";
4718
- return DragSource;
4719
- }({});
4720
4817
  var DragState = class {
4721
4818
  mainLayoutController;
4722
4819
  dragSource;
@@ -4810,8 +4907,14 @@ var PopoutWindow = (props) => {
4810
4907
  const { title, controller, layout, url, onCloseLayout, onSetWindow: onSetLayout, children } = props;
4811
4908
  const popoutWindow = React.useRef(null);
4812
4909
  const [content, setContent] = React.useState(void 0);
4813
- const [firstRender, setFirstRender] = React.useState(true);
4814
- const styleMap = /* @__PURE__ */ new Map();
4910
+ const styleMap = React.useMemo(() => /* @__PURE__ */ new Map(), []);
4911
+ const initializedRef = React.useRef(false);
4912
+ React.useLayoutEffect(() => {
4913
+ if (!initializedRef.current && content) {
4914
+ initializedRef.current = true;
4915
+ controller.redrawLayout();
4916
+ }
4917
+ }, [content, controller]);
4815
4918
  React.useLayoutEffect(() => {
4816
4919
  if (!popoutWindow.current) {
4817
4920
  const layoutId = layout.getLayoutId();
@@ -4856,22 +4959,10 @@ var PopoutWindow = (props) => {
4856
4959
  }
4857
4960
  }
4858
4961
  return () => {
4859
- if (!controller.getModel().getLayouts().has(layout.getLayoutId())) {
4860
- popoutWindow.current?.close();
4861
- popoutWindow.current = null;
4862
- }
4962
+ popoutWindow.current?.close();
4963
+ popoutWindow.current = null;
4863
4964
  };
4864
4965
  }, []);
4865
- React.useEffect(() => {
4866
- if (content !== void 0 && firstRender) {
4867
- controller.redrawLayout();
4868
- setFirstRender(false);
4869
- }
4870
- }, [
4871
- content,
4872
- firstRender,
4873
- controller
4874
- ]);
4875
4966
  if (content !== void 0) return createPortal(children, content);
4876
4967
  else return null;
4877
4968
  };
@@ -4908,17 +4999,6 @@ function copyStyle(popoutDoc, element, styleMap, promises) {
4908
4999
  }
4909
5000
  //#endregion
4910
5001
  //#region src/view/FloatWindow.tsx
4911
- var FloatWindowResizeDirection = /* @__PURE__ */ function(FloatWindowResizeDirection) {
4912
- FloatWindowResizeDirection["North"] = "n";
4913
- FloatWindowResizeDirection["South"] = "s";
4914
- FloatWindowResizeDirection["East"] = "e";
4915
- FloatWindowResizeDirection["West"] = "w";
4916
- FloatWindowResizeDirection["NorthWest"] = "nw";
4917
- FloatWindowResizeDirection["NorthEast"] = "ne";
4918
- FloatWindowResizeDirection["SouthWest"] = "sw";
4919
- FloatWindowResizeDirection["SouthEast"] = "se";
4920
- return FloatWindowResizeDirection;
4921
- }(FloatWindowResizeDirection || {});
4922
5002
  var RESIZE_ZINDEX = 10;
4923
5003
  var RESIZE_MARGIN = -4;
4924
5004
  var RESIZE_EDGE_SIZE = 8;
@@ -4942,32 +5022,56 @@ var FloatWindow = (props) => {
4942
5022
  const wRef = React.useRef(null);
4943
5023
  const nwRef = React.useRef(null);
4944
5024
  const moveToFrontRef = React.useRef(false);
5025
+ const clampToDoc = React.useCallback((rect) => {
5026
+ const layoutRect = Rect.fromDomRect(controller.getRootDiv().getBoundingClientRect());
5027
+ let boundaryRect;
5028
+ if (controller.getProps().constrainFloatPanels) boundaryRect = new Rect(0, 0, layoutRect.width, layoutRect.height);
5029
+ else {
5030
+ const page = getPageMetrics();
5031
+ const width = Math.max(page.fullWidth, window.innerWidth);
5032
+ const height = Math.max(page.fullHeight, window.innerHeight);
5033
+ boundaryRect = new Rect(-layoutRect.x, -layoutRect.y, width, height);
5034
+ }
5035
+ const clamped = rect.clone();
5036
+ clamped.clamp(boundaryRect);
5037
+ return clamped;
5038
+ }, [controller]);
5039
+ const onTouchStart = React.useCallback((event) => {
5040
+ event.preventDefault();
5041
+ event.stopImmediatePropagation();
5042
+ }, []);
4945
5043
  React.useEffect(() => {
4946
- headerRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4947
- nRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4948
- neRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4949
- eRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4950
- seRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4951
- sRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4952
- swRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4953
- wRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
4954
- nwRef.current?.addEventListener("touchstart", onTouchStart, { passive: false });
5044
+ const elements = [
5045
+ headerRef,
5046
+ nRef,
5047
+ neRef,
5048
+ eRef,
5049
+ seRef,
5050
+ sRef,
5051
+ swRef,
5052
+ wRef,
5053
+ nwRef
5054
+ ].map((r) => r.current).filter((el) => el !== null);
5055
+ elements.forEach((el) => el.addEventListener("touchstart", onTouchStart, { passive: false }));
4955
5056
  return () => {
4956
- headerRef.current?.removeEventListener("touchstart", onTouchStart);
4957
- nRef.current?.removeEventListener("touchstart", onTouchStart);
4958
- neRef.current?.removeEventListener("touchstart", onTouchStart);
4959
- eRef.current?.removeEventListener("touchstart", onTouchStart);
4960
- seRef.current?.removeEventListener("touchstart", onTouchStart);
4961
- sRef.current?.removeEventListener("touchstart", onTouchStart);
4962
- swRef.current?.removeEventListener("touchstart", onTouchStart);
4963
- wRef.current?.removeEventListener("touchstart", onTouchStart);
4964
- nwRef.current?.removeEventListener("touchstart", onTouchStart);
5057
+ elements.forEach((el) => el.removeEventListener("touchstart", onTouchStart));
4965
5058
  };
4966
- }, []);
4967
- const onTouchStart = (event) => {
4968
- event.preventDefault();
4969
- event.stopImmediatePropagation();
4970
- };
5059
+ }, [onTouchStart]);
5060
+ const initializedRef = React.useRef(false);
5061
+ React.useLayoutEffect(() => {
5062
+ if (!initializedRef.current) {
5063
+ initializedRef.current = true;
5064
+ const clamped = clampToDoc(rect);
5065
+ if (!clamped.equals(rect)) {
5066
+ setRect(clamped);
5067
+ layout.setRect(clamped);
5068
+ }
5069
+ }
5070
+ }, [
5071
+ clampToDoc,
5072
+ rect,
5073
+ layout
5074
+ ]);
4971
5075
  React.useEffect(() => {
4972
5076
  const onPointerDown = () => {
4973
5077
  const layouts = [...controller.getModel().getLayouts()];
@@ -4992,28 +5096,22 @@ var FloatWindow = (props) => {
4992
5096
  current.removeEventListener("pointerup", onPointerUp);
4993
5097
  }
4994
5098
  };
4995
- }, [controller, layout.getLayoutId()]);
5099
+ }, [controller, layout]);
4996
5100
  const onPointerDownHeader = (e) => {
4997
5101
  e.stopPropagation();
4998
5102
  const offset = {
4999
5103
  x: e.clientX - rect.x,
5000
5104
  y: e.clientY - rect.y
5001
5105
  };
5002
- const rootDiv = controller.getRootDiv();
5003
- const rootRect = rootDiv ? rootDiv.getBoundingClientRect() : {
5004
- width: window.innerWidth,
5005
- height: window.innerHeight
5006
- };
5007
5106
  startDrag(document, e, (x, y) => {
5008
5107
  controller.showOverlayOnAllWindows(true);
5009
5108
  if (moveToFrontRef.current) {
5010
5109
  controller.moveWindowToFront(layout.getLayoutId());
5011
5110
  moveToFrontRef.current = false;
5012
5111
  }
5013
- const newRect = new Rect(x - offset.x, y - offset.y, rect.width, rect.height);
5014
- newRect.clamp(new Rect(0, 0, rootRect.width, rootRect.height));
5015
- setRect(newRect);
5016
- layout.setRect(newRect);
5112
+ const clamped = clampToDoc(new Rect(x - offset.x, y - offset.y, rect.width, rect.height));
5113
+ setRect(clamped);
5114
+ layout.setRect(clamped);
5017
5115
  }, () => {
5018
5116
  controller.redrawLayout();
5019
5117
  controller.showOverlayOnAllWindows(false);
@@ -5025,11 +5123,6 @@ var FloatWindow = (props) => {
5025
5123
  x: e.clientX,
5026
5124
  y: e.clientY
5027
5125
  };
5028
- const rootDiv = controller.getRootDiv();
5029
- const rootRect = rootDiv ? rootDiv.getBoundingClientRect() : {
5030
- width: window.innerWidth,
5031
- height: window.innerHeight
5032
- };
5033
5126
  startDrag(document, e, (x, y) => {
5034
5127
  controller.showOverlayOnAllWindows(true);
5035
5128
  const dx = x - startPos.x;
@@ -5048,41 +5141,15 @@ var FloatWindow = (props) => {
5048
5141
  newW -= dx;
5049
5142
  }
5050
5143
  if (direction.includes("e")) newW += dx;
5051
- if (newW < MIN_WIDTH) {
5052
- if (direction.includes("w")) newX = startRect.x + startRect.width - MIN_WIDTH;
5053
- newW = MIN_WIDTH;
5054
- }
5055
- if (newH < MIN_HEIGHT) {
5056
- if (direction.includes("n")) newY = startRect.y + startRect.height - MIN_HEIGHT;
5057
- newH = MIN_HEIGHT;
5058
- }
5059
- if (newX < 0) {
5060
- newW += newX;
5061
- newX = 0;
5062
- }
5063
- if (newY < 0) {
5064
- newH += newY;
5065
- newY = 0;
5066
- }
5067
- if (newX + newW > rootRect.width) newW = rootRect.width - newX;
5068
- if (newY + newH > rootRect.height) newH = rootRect.height - newY;
5069
- if (newW < MIN_WIDTH) newW = MIN_WIDTH;
5070
- if (newH < MIN_HEIGHT) newH = MIN_HEIGHT;
5071
- const newRect = new Rect(newX, newY, newW, newH);
5072
- setRect(newRect);
5073
- layout.setRect(newRect);
5144
+ const clamped = clampToDoc(new Rect(newX, newY, Math.max(MIN_WIDTH, newW), Math.max(MIN_HEIGHT, newH)));
5145
+ setRect(clamped);
5146
+ layout.setRect(clamped);
5074
5147
  }, () => {
5075
5148
  controller.redrawLayout();
5076
5149
  controller.showOverlayOnAllWindows(false);
5077
5150
  }, () => {});
5078
5151
  e.stopPropagation();
5079
5152
  };
5080
- const rootDiv = controller.getRootDiv();
5081
- const rootRect = rootDiv ? rootDiv.getBoundingClientRect() : {
5082
- width: window.innerWidth,
5083
- height: window.innerHeight
5084
- };
5085
- rect.clamp(new Rect(0, 0, rootRect.width, rootRect.height));
5086
5153
  return /* @__PURE__ */ jsxs("div", {
5087
5154
  ref: selfRef,
5088
5155
  className: cm(CLASSES.FLEXLAYOUT__FLOAT_WINDOW),
@@ -5136,7 +5203,7 @@ var FloatWindow = (props) => {
5136
5203
  height: RESIZE_EDGE_SIZE,
5137
5204
  cursor: "ns-resize"
5138
5205
  },
5139
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.North)
5206
+ onPointerDown: (e) => onPointerDownResize(e, "n")
5140
5207
  }),
5141
5208
  /* @__PURE__ */ jsx("div", {
5142
5209
  ref: sRef,
@@ -5149,7 +5216,7 @@ var FloatWindow = (props) => {
5149
5216
  height: RESIZE_EDGE_SIZE,
5150
5217
  cursor: "ns-resize"
5151
5218
  },
5152
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.South)
5219
+ onPointerDown: (e) => onPointerDownResize(e, "s")
5153
5220
  }),
5154
5221
  /* @__PURE__ */ jsx("div", {
5155
5222
  ref: eRef,
@@ -5162,7 +5229,7 @@ var FloatWindow = (props) => {
5162
5229
  width: RESIZE_EDGE_SIZE,
5163
5230
  cursor: "ew-resize"
5164
5231
  },
5165
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.East)
5232
+ onPointerDown: (e) => onPointerDownResize(e, "e")
5166
5233
  }),
5167
5234
  /* @__PURE__ */ jsx("div", {
5168
5235
  ref: wRef,
@@ -5175,7 +5242,7 @@ var FloatWindow = (props) => {
5175
5242
  width: RESIZE_EDGE_SIZE,
5176
5243
  cursor: "ew-resize"
5177
5244
  },
5178
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.West)
5245
+ onPointerDown: (e) => onPointerDownResize(e, "w")
5179
5246
  }),
5180
5247
  /* @__PURE__ */ jsx("div", {
5181
5248
  ref: nwRef,
@@ -5188,7 +5255,7 @@ var FloatWindow = (props) => {
5188
5255
  height: RESIZE_CORNER_SIZE,
5189
5256
  cursor: "nwse-resize"
5190
5257
  },
5191
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.NorthWest)
5258
+ onPointerDown: (e) => onPointerDownResize(e, "nw")
5192
5259
  }),
5193
5260
  /* @__PURE__ */ jsx("div", {
5194
5261
  ref: neRef,
@@ -5201,7 +5268,7 @@ var FloatWindow = (props) => {
5201
5268
  height: RESIZE_CORNER_SIZE,
5202
5269
  cursor: "nesw-resize"
5203
5270
  },
5204
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.NorthEast)
5271
+ onPointerDown: (e) => onPointerDownResize(e, "ne")
5205
5272
  }),
5206
5273
  /* @__PURE__ */ jsx("div", {
5207
5274
  ref: swRef,
@@ -5214,7 +5281,7 @@ var FloatWindow = (props) => {
5214
5281
  height: RESIZE_CORNER_SIZE,
5215
5282
  cursor: "nesw-resize"
5216
5283
  },
5217
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.SouthWest)
5284
+ onPointerDown: (e) => onPointerDownResize(e, "sw")
5218
5285
  }),
5219
5286
  /* @__PURE__ */ jsx("div", {
5220
5287
  ref: seRef,
@@ -5227,7 +5294,7 @@ var FloatWindow = (props) => {
5227
5294
  height: RESIZE_SE_CORNER_SIZE,
5228
5295
  cursor: "nwse-resize"
5229
5296
  },
5230
- onPointerDown: (e) => onPointerDownResize(e, FloatWindowResizeDirection.SouthEast)
5297
+ onPointerDown: (e) => onPointerDownResize(e, "se")
5231
5298
  })
5232
5299
  ]
5233
5300
  });
@@ -5238,6 +5305,7 @@ var FloatingWindowContainer = ({ controller }) => {
5238
5305
  const floatingLayouts = [];
5239
5306
  const layouts = controller.getModel().getLayouts();
5240
5307
  let windowPopoutId = 0;
5308
+ let floatPopoutZIndex = 2e3;
5241
5309
  for (const [layoutId, layout] of layouts) if (!layout.isMainLayout()) {
5242
5310
  if (layout.getType() === "window" && controller.isSupportsPopout()) {
5243
5311
  floatingLayouts.push(/* @__PURE__ */ jsx(PopoutWindow, {
@@ -5257,16 +5325,20 @@ var FloatingWindowContainer = ({ controller }) => {
5257
5325
  })
5258
5326
  }, layoutId));
5259
5327
  windowPopoutId++;
5260
- } else if (layout.getType() === "float") floatingLayouts.push(/* @__PURE__ */ jsx(FloatWindow, {
5261
- controller,
5262
- layout,
5263
- onCloseLayout: controller.onCloseLayout,
5264
- children: /* @__PURE__ */ jsx(LayoutInternal, {
5265
- ...controller.getProps(),
5266
- layoutId,
5267
- mainLayoutController: controller
5268
- })
5269
- }, layoutId + "float"));
5328
+ } else if (layout.getType() === "float") {
5329
+ floatingLayouts.push(/* @__PURE__ */ jsx(FloatWindow, {
5330
+ controller,
5331
+ layout,
5332
+ zIndex: floatPopoutZIndex,
5333
+ onCloseLayout: controller.onCloseLayout,
5334
+ children: /* @__PURE__ */ jsx(LayoutInternal, {
5335
+ ...controller.getProps(),
5336
+ layoutId,
5337
+ mainLayoutController: controller
5338
+ })
5339
+ }, layoutId + "float"));
5340
+ floatPopoutZIndex++;
5341
+ }
5270
5342
  }
5271
5343
  return /* @__PURE__ */ jsx(Fragment, { children: floatingLayouts });
5272
5344
  };
@@ -5396,16 +5468,17 @@ var BorderButton = (props) => {
5396
5468
  /** @internal */
5397
5469
  var BorderTabSet = (props) => {
5398
5470
  const { borderNode, controller, size } = props;
5471
+ const selfRef = React.useRef(null);
5399
5472
  const toolbarRef = React.useRef(null);
5400
5473
  const miniScrollRef = React.useRef(null);
5401
5474
  const overflowbuttonRef = React.useRef(null);
5402
5475
  const stickyButtonsRef = React.useRef(null);
5403
5476
  const tabStripInnerRef = React.useRef(null);
5404
5477
  const icons = controller.getIcons();
5478
+ const { userControlledPositionRef, onScroll, onScrollPointerDown, hiddenTabs, onMouseWheel, isDockStickyButtons, isShowHiddenTabs } = useTabOverflow(controller, borderNode, Orientation.flip(borderNode.getOrientation()), tabStripInnerRef, miniScrollRef, controller.getClassName(CLASSES.FLEXLAYOUT__BORDER_BUTTON));
5405
5479
  React.useLayoutEffect(() => {
5406
- borderNode.setTabHeaderRect(controller.getBoundingClientRect(selfRef.current));
5480
+ if (selfRef.current) borderNode.setTabHeaderRect(controller.getBoundingClientRect(selfRef.current));
5407
5481
  });
5408
- const { selfRef, userControlledPositionRef, onScroll, onScrollPointerDown, hiddenTabs, onMouseWheel, isDockStickyButtons, isShowHiddenTabs } = useTabOverflow(controller, borderNode, Orientation.flip(borderNode.getOrientation()), tabStripInnerRef, miniScrollRef, controller.getClassName(CLASSES.FLEXLAYOUT__BORDER_BUTTON));
5409
5482
  const onAuxMouseClick = (event) => {
5410
5483
  if (isAuxMouseEvent(event)) controller.auxMouseClick(borderNode, event);
5411
5484
  };
@@ -5787,15 +5860,15 @@ var BorderContainer = ({ controller, inner }) => {
5787
5860
  });
5788
5861
  };
5789
5862
  //#endregion
5790
- //#region src/view/DragContainer.tsx
5863
+ //#region src/view/DragTabButton.tsx
5791
5864
  /** @internal */
5792
- var DragContainer = React.memo((props) => {
5793
- DragContainer.displayName = "DragContainer";
5865
+ var DragTabButton = React.memo((props) => {
5866
+ DragTabButton.displayName = "DragTabButton";
5794
5867
  const { controller, tabNode } = props;
5795
5868
  const selfRef = React.useRef(null);
5796
5869
  React.useEffect(() => {
5797
5870
  tabNode.setTabStamp(selfRef.current);
5798
- }, [tabNode, selfRef.current]);
5871
+ }, [tabNode]);
5799
5872
  const cm = controller.getClassName;
5800
5873
  return /* @__PURE__ */ jsx("div", {
5801
5874
  ref: selfRef,
@@ -5820,10 +5893,10 @@ var LayoutInternal = React.forwardRef((props, ref) => {
5820
5893
  showEdges: false,
5821
5894
  showOverlay: false,
5822
5895
  calculatedBorderBarSize: 29,
5896
+ calculatedSplitterSize: 8,
5823
5897
  layoutRedrawRevision: 0,
5824
5898
  fullRedrawRevision: 0,
5825
- showHiddenBorder: DockLocation.CENTER,
5826
- splitterSize: 8
5899
+ showHiddenBorder: DockLocation.CENTER
5827
5900
  });
5828
5901
  const setState = React.useCallback((update) => {
5829
5902
  setStateRaw((prev) => ({
@@ -5832,16 +5905,18 @@ var LayoutInternal = React.forwardRef((props, ref) => {
5832
5905
  }));
5833
5906
  }, [props]);
5834
5907
  const layoutRef = React.useRef(null);
5835
- const moveablesRef = React.useRef(null);
5908
+ const moveablesHomeRef = React.useRef(null);
5836
5909
  const findBorderBarSizeRef = React.useRef(null);
5910
+ const findSplitterSizeRef = React.useRef(null);
5837
5911
  const mainRef = React.useRef(null);
5838
5912
  const controller = React.useMemo(() => new LayoutController(props, state, setState), []);
5839
5913
  controller.setProps(props);
5840
5914
  controller.setStateRaw(state);
5841
5915
  controller.setSetState(setState);
5842
5916
  controller.setLayoutRef(layoutRef);
5843
- controller.setMoveablesRef(moveablesRef);
5917
+ controller.setMoveablesHomeRef(moveablesHomeRef);
5844
5918
  controller.setFindBorderBarSizeRef(findBorderBarSizeRef);
5919
+ controller.setFindSplitterSizeRef(findSplitterSizeRef);
5845
5920
  controller.setMainRef(mainRef);
5846
5921
  React.useImperativeHandle(ref, () => controller, [controller]);
5847
5922
  React.useLayoutEffect(() => {
@@ -5904,61 +5979,57 @@ var LayoutInternal = React.forwardRef((props, ref) => {
5904
5979
  controller.setLayout(layout);
5905
5980
  if (controller.isMainLayout()) {
5906
5981
  currentModel.addChangeListener(controller.onModelChange);
5907
- const updateFromCSSVars = () => {
5908
- const size = parseInt(getComputedStyle(layoutRef.current).getPropertyValue("--splitter-size"));
5909
- if (Number.isFinite(size)) {
5910
- props.model.setSplitterSize(size);
5911
- if (state.splitterSize !== size) setState({ splitterSize: size });
5912
- }
5913
- };
5914
- updateFromCSSVars();
5915
- const cssVarUpdater = setInterval(updateFromCSSVars, 1e3);
5916
5982
  return () => {
5917
5983
  currentModel.removeChangeListener(controller.onModelChange);
5918
- clearInterval(cssVarUpdater);
5919
- controller.tidyMoveablesMap();
5920
5984
  };
5921
5985
  }
5922
5986
  }, [props.model, controller]);
5923
- if (!layoutRef.current) return /* @__PURE__ */ jsxs("div", {
5924
- ref: layoutRef,
5925
- className: controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT),
5987
+ const metrics = /* @__PURE__ */ jsxs("div", {
5988
+ className: controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT_METRICS),
5926
5989
  children: [/* @__PURE__ */ jsx("div", {
5927
- ref: moveablesRef,
5928
- className: controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT_MOVEABLES)
5929
- }, "__moveables__"), /* @__PURE__ */ jsx("div", {
5930
5990
  ref: findBorderBarSizeRef,
5931
5991
  className: controller.getClassName(CLASSES.FLEXLAYOUT__BORDER_SIZER),
5932
5992
  children: "FindBorderBarSize"
5933
- }, "findBorderBarSize")]
5993
+ }, "findBorderBarSize"), /* @__PURE__ */ jsx("div", {
5994
+ ref: findSplitterSizeRef,
5995
+ className: controller.getClassName(CLASSES.FLEXLAYOUT__SPLITTER_ + "horz")
5996
+ }, "findSplitterSize")]
5997
+ });
5998
+ if (!layoutRef.current) return /* @__PURE__ */ jsx("div", {
5999
+ ref: layoutRef,
6000
+ className: controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT),
6001
+ children: metrics
5934
6002
  });
5935
6003
  const model = props.model;
5936
6004
  const layoutId = controller.getLayoutId();
5937
6005
  model.getRootRow(layoutId).calcMinMaxSize();
5938
6006
  model.getRootRow(layoutId).setPaths("");
5939
- if (controller.isMainLayout()) {
5940
- model.getBorderSet().setPaths();
5941
- controller.createMoveableDivs();
5942
- }
6007
+ if (controller.isMainLayout()) model.getBorderSet().setPaths();
6008
+ const overlay = /* @__PURE__ */ jsx(Overlay, {
6009
+ controller,
6010
+ show: state.showOverlay
6011
+ }, "__overlay__");
5943
6012
  const outer = /* @__PURE__ */ jsx(BorderContainer, {
5944
6013
  controller,
5945
6014
  inner: controller.renderLayout()
5946
6015
  });
5947
6016
  const tabs = controller.renderTabContainers();
5948
6017
  const reorderedTabs = controller.reorderComponents(tabs, controller.getOrderedTabIds());
5949
- let metricElements = null;
5950
6018
  let floatingWindows = null;
5951
6019
  let reorderedTabContents = null;
5952
- let tabStamps = null;
6020
+ let dragTabButtons = null;
6021
+ let moveablesHome = null;
5953
6022
  if (controller.isMainLayout()) {
5954
- metricElements = controller.renderMetricsElements();
5955
6023
  floatingWindows = /* @__PURE__ */ jsx(FloatingWindowContainer, { controller });
5956
- const tabContents = controller.renderTabContents();
5957
- reorderedTabContents = controller.reorderComponents(tabContents, controller.getOrderedTabMoveableIds());
5958
- tabStamps = /* @__PURE__ */ jsx("div", {
6024
+ reorderedTabContents = controller.reorderComponents(controller.renderTabContents(), controller.getOrderedTabMoveableIds());
6025
+ dragTabButtons = /* @__PURE__ */ jsx("div", {
5959
6026
  className: controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT_TAB_STAMPS),
5960
- children: controller.renderTabStamps()
5961
- }, "__tabStamps__");
6027
+ children: controller.renderDragTabButtons()
6028
+ }, "__dragTabButtons__");
6029
+ moveablesHome = /* @__PURE__ */ jsx("div", {
6030
+ ref: moveablesHomeRef,
6031
+ className: controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT_MOVEABLES_HOME)
6032
+ }, "__moveables_home__");
5962
6033
  }
5963
6034
  return /* @__PURE__ */ jsxs("div", {
5964
6035
  ref: layoutRef,
@@ -5968,21 +6039,15 @@ var LayoutInternal = React.forwardRef((props, ref) => {
5968
6039
  onDragOver: controller.getDragDropManager().onDragOver,
5969
6040
  onDrop: controller.getDragDropManager().onDrop,
5970
6041
  children: [
5971
- /* @__PURE__ */ jsx("div", {
5972
- ref: moveablesRef,
5973
- className: controller.getClassName(CLASSES.FLEXLAYOUT__LAYOUT_MOVEABLES)
5974
- }, "__moveables__"),
5975
- metricElements,
5976
- /* @__PURE__ */ jsx(Overlay, {
5977
- controller,
5978
- show: state.showOverlay
5979
- }, "__overlay__"),
6042
+ metrics,
6043
+ moveablesHome,
6044
+ overlay,
5980
6045
  outer,
5981
6046
  reorderedTabs,
5982
6047
  reorderedTabContents,
5983
6048
  state.portal,
5984
6049
  floatingWindows,
5985
- tabStamps
6050
+ dragTabButtons
5986
6051
  ]
5987
6052
  });
5988
6053
  });
@@ -5993,12 +6058,12 @@ var LayoutController = class LayoutController {
5993
6058
  _state;
5994
6059
  _setState;
5995
6060
  _layoutRef;
5996
- _moveablesRef;
6061
+ _moveablesHomeRef;
5997
6062
  _findBorderBarSizeRef;
6063
+ _findSplitterSizeRef;
5998
6064
  _mainRef;
5999
6065
  _orderedTabIds;
6000
6066
  _orderedTabMoveableIds;
6001
- _moveableElementMap = /* @__PURE__ */ new Map();
6002
6067
  _currentDocument;
6003
6068
  _currentWindow;
6004
6069
  _supportsPopout;
@@ -6084,58 +6149,19 @@ var LayoutController = class LayoutController {
6084
6149
  });
6085
6150
  return tabContents;
6086
6151
  }
6087
- renderMetricsElements() {
6088
- return /* @__PURE__ */ jsx("div", {
6089
- ref: this._findBorderBarSizeRef,
6090
- className: this.getClassName(CLASSES.FLEXLAYOUT__BORDER_SIZER),
6091
- children: "FindBorderBarSize"
6092
- }, "findBorderBarSize");
6093
- }
6094
- renderTabStamps() {
6095
- const tabStamps = [];
6152
+ renderDragTabButtons() {
6153
+ const dragTabButtons = [];
6096
6154
  this._props.model.visitNodes((node) => {
6097
6155
  if (node instanceof TabNode) {
6098
6156
  const child = node;
6099
- tabStamps.push(/* @__PURE__ */ jsx(DragContainer, {
6157
+ dragTabButtons.push(/* @__PURE__ */ jsx(DragTabButton, {
6100
6158
  controller: this,
6101
6159
  tabNode: child,
6102
6160
  dragging: Utils_dragging
6103
6161
  }, child.getId()));
6104
6162
  }
6105
6163
  });
6106
- return tabStamps;
6107
- }
6108
- createMoveableDivs() {
6109
- this._props.model.visitNodes((node) => {
6110
- if (node instanceof TabNode) {
6111
- const tabNode = node;
6112
- const element = this.getMoveableElement(tabNode.getId());
6113
- tabNode.setMoveableElement(element);
6114
- }
6115
- });
6116
- }
6117
- getMoveablesDiv() {
6118
- return this._moveablesRef.current;
6119
- }
6120
- getMoveableElement(id) {
6121
- let moveableElement = this._moveableElementMap.get(id);
6122
- if (moveableElement === void 0) {
6123
- moveableElement = document.createElement("div");
6124
- this._moveablesRef.current.appendChild(moveableElement);
6125
- moveableElement.className = CLASSES.FLEXLAYOUT__TAB_MOVEABLE;
6126
- this._moveableElementMap.set(id, moveableElement);
6127
- }
6128
- return moveableElement;
6129
- }
6130
- tidyMoveablesMap() {
6131
- const tabs = /* @__PURE__ */ new Map();
6132
- this._props.model.visitNodes((node, _) => {
6133
- if (node instanceof TabNode) tabs.set(node.getId(), node);
6134
- });
6135
- for (const [nodeId, element] of this._moveableElementMap) if (!tabs.has(nodeId)) {
6136
- element.remove();
6137
- this._moveableElementMap.delete(nodeId);
6138
- }
6164
+ return dragTabButtons;
6139
6165
  }
6140
6166
  redrawLayout() {
6141
6167
  this._mainController?.setState((state) => {
@@ -6208,7 +6234,14 @@ var LayoutController = class LayoutController {
6208
6234
  updateLayoutMetrics = () => {
6209
6235
  if (this._findBorderBarSizeRef.current) {
6210
6236
  const borderBarSize = this._findBorderBarSizeRef.current.getBoundingClientRect().height;
6211
- if (borderBarSize !== this._state.calculatedBorderBarSize) this.setState({ calculatedBorderBarSize: borderBarSize });
6237
+ if (Math.abs(borderBarSize - this._state.calculatedBorderBarSize) > .5) this.setState({ calculatedBorderBarSize: borderBarSize });
6238
+ }
6239
+ if (this._findSplitterSizeRef.current) {
6240
+ const splitterBarSize = this._findSplitterSizeRef.current.getBoundingClientRect().width;
6241
+ if (Math.abs(splitterBarSize - this._state.calculatedSplitterSize) > .5) {
6242
+ this._props.model.setSplitterSize(splitterBarSize);
6243
+ this.setState({ calculatedSplitterSize: splitterBarSize });
6244
+ }
6212
6245
  }
6213
6246
  };
6214
6247
  addTabWithDragAndDrop(event, json, onDrop) {
@@ -6220,6 +6253,9 @@ var LayoutController = class LayoutController {
6220
6253
  setDragComponent(event, component, x, y) {
6221
6254
  this._dragDropManager.setDragComponent(event, component, x, y);
6222
6255
  }
6256
+ getMoveablesHome() {
6257
+ return this._moveablesHomeRef.current;
6258
+ }
6223
6259
  getProps() {
6224
6260
  return this._props;
6225
6261
  }
@@ -6244,11 +6280,8 @@ var LayoutController = class LayoutController {
6244
6280
  setLayoutRef(value) {
6245
6281
  this._layoutRef = value;
6246
6282
  }
6247
- getMoveablesRef() {
6248
- return this._moveablesRef;
6249
- }
6250
- setMoveablesRef(value) {
6251
- this._moveablesRef = value;
6283
+ setMoveablesHomeRef(value) {
6284
+ this._moveablesHomeRef = value;
6252
6285
  }
6253
6286
  getFindBorderBarSizeRef() {
6254
6287
  return this._findBorderBarSizeRef;
@@ -6256,6 +6289,12 @@ var LayoutController = class LayoutController {
6256
6289
  setFindBorderBarSizeRef(value) {
6257
6290
  this._findBorderBarSizeRef = value;
6258
6291
  }
6292
+ getFindSplitterSizeRef() {
6293
+ return this._findBorderBarSizeRef;
6294
+ }
6295
+ setFindSplitterSizeRef(value) {
6296
+ this._findSplitterSizeRef = value;
6297
+ }
6259
6298
  getMainRef() {
6260
6299
  return this._mainRef;
6261
6300
  }
@@ -6325,9 +6364,6 @@ var LayoutController = class LayoutController {
6325
6364
  if (layoutRect) return Rect.getBoundingClientRect(div).relativeTo(layoutRect);
6326
6365
  return Rect.empty();
6327
6366
  }
6328
- getMoveableContainer() {
6329
- return this._moveablesRef.current;
6330
- }
6331
6367
  getClassName = (defaultClassName) => {
6332
6368
  if (this._props.classNameMapper === void 0) return defaultClassName;
6333
6369
  else return this._props.classNameMapper(defaultClassName);
@@ -6391,11 +6427,11 @@ var LayoutController = class LayoutController {
6391
6427
  this.doAction(Actions.movePopoutToFront(layoutId));
6392
6428
  }
6393
6429
  addTabToTabSet(tabsetId, json) {
6394
- if (this._props.model.getNodeById(tabsetId) !== void 0) return this.doAction(Actions.addNode(json, tabsetId, DockLocation.CENTER, -1));
6430
+ if (this._props.model.getNodeById(tabsetId) !== void 0) return this.doAction(Actions.addTab(json, tabsetId, DockLocation.CENTER, -1));
6395
6431
  }
6396
6432
  addTabToActiveTabSet(json) {
6397
6433
  const tabsetNode = this._props.model.getActiveTabset(this._layoutId);
6398
- if (tabsetNode !== void 0) return this.doAction(Actions.addNode(json, tabsetNode.getId(), DockLocation.CENTER, -1));
6434
+ if (tabsetNode !== void 0) return this.doAction(Actions.addTab(json, tabsetNode.getId(), DockLocation.CENTER, -1));
6399
6435
  }
6400
6436
  showControlInPortal = (control, element) => {
6401
6437
  const portal = createPortal(control, element);
@@ -6462,6 +6498,12 @@ var defaultSupportsPopout = isDesktop();
6462
6498
  var Layout = React.forwardRef((props, ref) => {
6463
6499
  const controllerRef = useRef(null);
6464
6500
  const renderRevision = useRef(0);
6501
+ const lastModel = useRef(props.model);
6502
+ const key = useRef(0);
6503
+ if (lastModel.current !== props.model) {
6504
+ key.current++;
6505
+ lastModel.current = props.model;
6506
+ }
6465
6507
  Layout.displayName = "Layout";
6466
6508
  useImperativeHandle(ref, () => ({
6467
6509
  redraw: () => {
@@ -6490,9 +6532,9 @@ var Layout = React.forwardRef((props, ref) => {
6490
6532
  ref: controllerRef,
6491
6533
  ...props,
6492
6534
  parentRedrawRevision: renderRevision.current++
6493
- });
6535
+ }, key.current);
6494
6536
  });
6495
- var FlexLayoutVersion = "0.9.0";
6537
+ var FlexLayoutVersion = "0.9.2";
6496
6538
  //#endregion
6497
6539
  //#region src/view/TabLayout.tsx
6498
6540
  /**