@byeolnaerim/flex-layout 0.0.9 → 0.0.10

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 (122) hide show
  1. package/dist/flex-layout/components/FlexLayout.cjs +1 -110
  2. package/dist/flex-layout/components/FlexLayout.js +1 -85
  3. package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -262
  4. package/dist/flex-layout/components/FlexLayoutContainer.js +1 -232
  5. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -68
  6. package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -44
  7. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -246
  8. package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -216
  9. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1252
  10. package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1236
  11. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -532
  12. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -509
  13. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -55
  14. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
  15. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -63
  16. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -33
  17. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -53
  18. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -23
  19. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -133
  20. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -107
  21. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -245
  22. package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -229
  23. package/dist/flex-layout/components/index.cjs +1 -57
  24. package/dist/flex-layout/components/index.js +1 -17
  25. package/dist/flex-layout/hooks/index.cjs +1 -25
  26. package/dist/flex-layout/hooks/index.js +1 -3
  27. package/dist/flex-layout/hooks/useDrag.cjs +1 -289
  28. package/dist/flex-layout/hooks/useDrag.d.ts +15 -0
  29. package/dist/flex-layout/hooks/useDrag.js +1 -258
  30. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -139
  31. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -118
  32. package/dist/flex-layout/hooks/useListPaging.cjs +1 -212
  33. package/dist/flex-layout/hooks/useListPaging.js +1 -191
  34. package/dist/flex-layout/hooks/useSizes.cjs +1 -126
  35. package/dist/flex-layout/hooks/useSizes.js +1 -101
  36. package/dist/flex-layout/index.cjs +1 -31
  37. package/dist/flex-layout/index.js +1 -6
  38. package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -49
  39. package/dist/flex-layout/providers/FlexLayoutContext.js +1 -24
  40. package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -276
  41. package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
  42. package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -263
  43. package/dist/flex-layout/providers/index.cjs +1 -23
  44. package/dist/flex-layout/providers/index.js +1 -2
  45. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -257
  46. package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -206
  47. package/dist/flex-layout/store/index.cjs +1 -23
  48. package/dist/flex-layout/store/index.js +1 -2
  49. package/dist/flex-layout/styles/FlexLayout.module.css +473 -416
  50. package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -17
  51. package/dist/flex-layout/types/FlexDirectionTypes.js +0 -1
  52. package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -17
  53. package/dist/flex-layout/types/FlexLayoutTypes.js +0 -1
  54. package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -245
  55. package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -211
  56. package/dist/flex-layout/utils/index.cjs +1 -23
  57. package/dist/flex-layout/utils/index.js +1 -2
  58. package/dist/index.cjs +1 -23
  59. package/dist/index.js +1 -2
  60. package/dist/types/css.d.cjs +0 -1
  61. package/dist/types/css.d.js +0 -1
  62. package/package.json +116 -113
  63. package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
  64. package/dist/flex-layout/components/FlexLayout.js.map +0 -1
  65. package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
  66. package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
  67. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs.map +0 -1
  68. package/dist/flex-layout/components/FlexLayoutIFramePane.js.map +0 -1
  69. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
  70. package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
  71. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
  72. package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
  73. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
  74. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
  75. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
  76. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
  77. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
  78. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
  79. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
  80. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
  81. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
  82. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
  83. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
  84. package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
  85. package/dist/flex-layout/components/index.cjs.map +0 -1
  86. package/dist/flex-layout/components/index.js.map +0 -1
  87. package/dist/flex-layout/hooks/index.cjs.map +0 -1
  88. package/dist/flex-layout/hooks/index.js.map +0 -1
  89. package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
  90. package/dist/flex-layout/hooks/useDrag.js.map +0 -1
  91. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
  92. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
  93. package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
  94. package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
  95. package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
  96. package/dist/flex-layout/hooks/useSizes.js.map +0 -1
  97. package/dist/flex-layout/index.cjs.map +0 -1
  98. package/dist/flex-layout/index.js.map +0 -1
  99. package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
  100. package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
  101. package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
  102. package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
  103. package/dist/flex-layout/providers/index.cjs.map +0 -1
  104. package/dist/flex-layout/providers/index.js.map +0 -1
  105. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
  106. package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
  107. package/dist/flex-layout/store/index.cjs.map +0 -1
  108. package/dist/flex-layout/store/index.js.map +0 -1
  109. package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
  110. package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
  111. package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
  112. package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
  113. package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
  114. package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
  115. package/dist/flex-layout/utils/index.cjs.map +0 -1
  116. package/dist/flex-layout/utils/index.js.map +0 -1
  117. package/dist/index.cjs.map +0 -1
  118. package/dist/index.js.map +0 -1
  119. package/dist/metafile-cjs.json +0 -1
  120. package/dist/metafile-esm.json +0 -1
  121. package/dist/types/css.d.cjs.map +0 -1
  122. package/dist/types/css.d.js.map +0 -1
@@ -1,232 +1 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useRef, useState } from "react";
4
- import { useSize } from "../hooks/useSizes";
5
- import { useFlexLayoutContext } from "../providers/FlexLayoutContext";
6
- import { setContainerRef } from "../store/FlexLayoutContainerStore";
7
- import styles from "../styles/FlexLayout.module.css";
8
- import { getGrow, mathGrow, mathWeight } from "../utils/FlexLayoutUtils";
9
- import FlexLayoutResizePanel from "./FlexLayoutResizePanel";
10
- function FlexLayoutContainer({
11
- isFitContent,
12
- isFitResize,
13
- // fitContent,
14
- // containerCount,
15
- // layoutName,
16
- containerName,
17
- grow: initialGrow,
18
- prevGrow: initialPrevGrow,
19
- isInitialResizable,
20
- isResizePanel,
21
- children,
22
- className,
23
- panelMode
24
- }) {
25
- const {
26
- direction,
27
- panelMovementMode,
28
- panelClassName,
29
- layoutName,
30
- fitContent,
31
- containerCount
32
- } = useFlexLayoutContext();
33
- const { ref, size } = (
34
- // isFitContent && fitContent
35
- //?
36
- useSize(fitContent)
37
- );
38
- const flexContainerNodeRef = useRef(null);
39
- const isUserResizingRef = useRef(false);
40
- const handleResizingChange = useCallback((v) => {
41
- isUserResizingRef.current = v;
42
- }, []);
43
- const flexContainerRef = useCallback(
44
- (node) => {
45
- flexContainerNodeRef.current = node;
46
- if (node) {
47
- setContainerRef(
48
- layoutName,
49
- containerName,
50
- flexContainerNodeRef
51
- );
52
- } else {
53
- setContainerRef(layoutName, containerName, null);
54
- }
55
- },
56
- [layoutName, containerName]
57
- );
58
- const [growState, setGrowState] = useState(initialGrow);
59
- useEffect(() => {
60
- setGrowState(initialGrow);
61
- }, [initialGrow]);
62
- const [prevGrowState, setPrevGrowState] = useState(
63
- initialPrevGrow
64
- );
65
- const [isFirstLoad, setIsFirstLoad] = useState(true);
66
- useEffect(() => {
67
- if (typeof window == "undefined" || flexContainerNodeRef.current === null)
68
- return;
69
- const storedGrow = sessionStorage.getItem(containerName);
70
- if (storedGrow !== null) {
71
- const parsed = parseFloat(storedGrow);
72
- if (!isNaN(parsed)) {
73
- flexContainerNodeRef.current.style.flex = `${parsed} 1 0%`;
74
- setGrowState(parsed);
75
- }
76
- }
77
- }, [containerName]);
78
- useEffect(() => {
79
- if (!flexContainerNodeRef.current) return;
80
- const targetNode = flexContainerNodeRef.current;
81
- const observer = new MutationObserver((mutations) => {
82
- for (const mutation of mutations) {
83
- if (mutation.type === "attributes" && mutation.attributeName === "style" && targetNode.style.flex) {
84
- const flexValue = targetNode.style.flex;
85
- const parsedGrow = parseFloat(flexValue.split(" ")[0]);
86
- if (!isNaN(parsedGrow)) {
87
- setGrowState(parsedGrow);
88
- }
89
- }
90
- }
91
- });
92
- observer.observe(targetNode, {
93
- attributes: true,
94
- attributeFilter: ["style"],
95
- attributeOldValue: true
96
- });
97
- return () => {
98
- observer.disconnect();
99
- };
100
- }, [containerName]);
101
- useEffect(() => {
102
- if (!flexContainerNodeRef.current || !ref || !ref.current || !size || !fitContent || // getGrow(flexContainerNodeRef.current) == 0 ||
103
- isUserResizingRef.current)
104
- return;
105
- requestAnimationFrame(() => {
106
- if (!flexContainerNodeRef.current) return;
107
- const sizeName = `${fitContent.charAt(0).toUpperCase() + fitContent.substring(1)}`;
108
- const parentSize = flexContainerNodeRef.current.parentElement && flexContainerNodeRef.current.parentElement["client" + sizeName] || 0;
109
- if (isFitContent) {
110
- flexContainerNodeRef.current.style["max" + sizeName] = size + "px";
111
- }
112
- if (!isFitResize && isFirstLoad) {
113
- setIsFirstLoad(false);
114
- return;
115
- }
116
- if (getGrow(flexContainerNodeRef.current) != 0 && isFitResize) {
117
- const newGrow = mathGrow(size, parentSize, containerCount);
118
- setPrevGrowState(growState);
119
- setGrowState(newGrow);
120
- }
121
- });
122
- }, [size, containerCount, isFitResize, children]);
123
- useEffect(() => {
124
- if (!flexContainerNodeRef.current) return;
125
- let notGrowList = [];
126
- let containerList = [
127
- ...flexContainerNodeRef.current.parentElement?.children || []
128
- ].filter((e) => e.hasAttribute("data-container_name"));
129
- let remainingGrow = containerList.reduce((t, e, i) => {
130
- let item = e;
131
- if (item.classList.contains(styles["flex-resize-panel"])) return t;
132
- if (e.hasAttribute("data-grow") == false || e.getAttribute("data-is_resize") === "true") {
133
- notGrowList.push(item);
134
- return t;
135
- }
136
- let grow = parseFloat(item.dataset.grow || "");
137
- item.style.flex = `${grow} 1 0%`;
138
- t -= grow;
139
- return t;
140
- }, containerList.length);
141
- if (notGrowList.length != 0) {
142
- let resizeWeight = mathWeight(notGrowList.length, remainingGrow);
143
- notGrowList.forEach((e) => {
144
- e.dataset.grow = resizeWeight.toString();
145
- e.style.flex = `${resizeWeight} 1 0%`;
146
- });
147
- }
148
- }, []);
149
- useEffect(() => {
150
- if (!flexContainerNodeRef.current || !isFitContent || !fitContent || !size || getGrow(flexContainerNodeRef.current) == 0)
151
- return;
152
- const parent = flexContainerNodeRef.current.parentElement;
153
- if (!parent) return;
154
- const sizeName = fitContent.charAt(0).toUpperCase() + fitContent.substring(1);
155
- const parentSize = parent["client" + sizeName] || 0;
156
- if (!parentSize || containerCount <= 0) return;
157
- const nextGrowRaw = mathGrow(size, parentSize, containerCount);
158
- const nextGrow = Math.min(containerCount, Math.max(0, nextGrowRaw));
159
- const currentGrow = getGrow(flexContainerNodeRef.current);
160
- if (Math.abs(nextGrow - currentGrow) < 1e-3) return;
161
- setPrevGrowState(currentGrow);
162
- setGrowState(nextGrow);
163
- const containers = [...parent.children || []].filter((el) => {
164
- const item = el;
165
- return item.hasAttribute("data-container_name") && !item.classList.contains(styles["flex-resize-panel"]);
166
- });
167
- const siblings = containers.filter(
168
- (el) => el !== flexContainerNodeRef.current
169
- );
170
- const adjustable = siblings.filter((el) => el.style.flex !== "0 1 0%");
171
- const remaining = containerCount - nextGrow;
172
- if (remaining <= 0 || adjustable.length === 0) return;
173
- const oldSum = adjustable.reduce((sum, el) => sum + getGrow(el), 0);
174
- if (oldSum <= 0) {
175
- const each = remaining / adjustable.length;
176
- adjustable.forEach((el) => {
177
- el.dataset.grow = each.toString();
178
- el.style.flex = `${each} 1 0%`;
179
- });
180
- } else {
181
- adjustable.forEach((el) => {
182
- const g = getGrow(el);
183
- const scaled = remaining * (g / oldSum);
184
- el.dataset.grow = scaled.toString();
185
- el.style.flex = `${scaled} 1 0%`;
186
- });
187
- }
188
- }, [size, isFitContent, fitContent, containerCount]);
189
- return /* @__PURE__ */ jsxs(Fragment, { children: [
190
- /* @__PURE__ */ jsx(
191
- "div",
192
- {
193
- id: containerName,
194
- "data-container_name": containerName,
195
- ref: flexContainerRef,
196
- className: `${styles["flex-container"]} ${className && className !== "" ? className : ""}`,
197
- ...growState !== void 0 ? { ["data-grow"]: growState } : {},
198
- ...prevGrowState != void 0 ? { ["data-prev_grow"]: prevGrowState } : {},
199
- "data-is_resize": isInitialResizable,
200
- "data-is_resize_panel": isResizePanel,
201
- style: growState !== void 0 && {
202
- flex: `${growState} 1 0%`
203
- } || {},
204
- children: isFitContent && /* @__PURE__ */ jsx(
205
- "div",
206
- {
207
- className: `${styles["flex-content-fit-wrapper"]}`,
208
- ref,
209
- children
210
- }
211
- ) || children
212
- }
213
- ),
214
- isResizePanel && /* @__PURE__ */ jsx(
215
- FlexLayoutResizePanel,
216
- {
217
- containerName,
218
- layoutName,
219
- direction,
220
- containerCount,
221
- panelMode,
222
- panelClassName,
223
- panelMovementMode,
224
- onResizingChange: handleResizingChange
225
- }
226
- )
227
- ] });
228
- }
229
- export {
230
- FlexLayoutContainer as default
231
- };
232
- //# sourceMappingURL=FlexLayoutContainer.js.map
1
+ "use client";import{Fragment as re,jsx as A,jsxs as ne}from"react/jsx-runtime";import{useCallback as W,useEffect as m,useRef as P,useState as $}from"react";import{useSize as X}from"../hooks/useSizes";import{useFlexLayoutContext as Y}from"../providers/FlexLayoutContext";import{setContainerRef as U}from"../store/FlexLayoutContainerStore";import L from"../styles/FlexLayout.module.css";import{getGrow as w,mathGrow as D,mathWeight as Z}from"../utils/FlexLayoutUtils";import ee from"./FlexLayoutResizePanel";function te({isFitContent:b,isFitResize:M,containerName:o,grow:v,prevGrow:I,isInitialResizable:O,isResizePanel:_,children:E,className:C,panelMode:V}){const{direction:k,panelMovementMode:q,panelClassName:j,layoutName:y,fitContent:l,containerCount:u}=Y(),{ref:z,size:f}=X(l),t=P(null),S=P(!1),B=W(e=>{S.current=e},[]),J=W(e=>{t.current=e,e?U(y,o,t):U(y,o,null)},[y,o]),[p,g]=$(v);m(()=>{g(v)},[v]);const[F,R]=$(I),[K,Q]=$(!0);return m(()=>{if(typeof window>"u"||t.current===null)return;const e=sessionStorage.getItem(o);if(e!==null){const s=parseFloat(e);isNaN(s)||(t.current.style.flex=`${s} 1 0%`,g(s))}},[o]),m(()=>{if(!t.current)return;const e=t.current,s=new MutationObserver(c=>{for(const r of c)if(r.type==="attributes"&&r.attributeName==="style"&&e.style.flex){const a=e.style.flex,d=parseFloat(a.split(" ")[0]);isNaN(d)||g(d)}});return s.observe(e,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0}),()=>{s.disconnect()}},[o]),m(()=>{!t.current||!z||!z.current||!f||!l||S.current||requestAnimationFrame(()=>{if(!t.current)return;const e=`${l.charAt(0).toUpperCase()+l.substring(1)}`,s=t.current.parentElement&&t.current.parentElement["client"+e]||0;if(b&&(t.current.style["max"+e]=f+"px"),!M&&K){Q(!1);return}if(w(t.current)!=0&&M){const c=D(f,s,u);R(p),g(c)}})},[f,u,M,E]),m(()=>{if(!t.current)return;let e=[],s=[...t.current.parentElement?.children||[]].filter(r=>r.hasAttribute("data-container_name")),c=s.reduce((r,a,d)=>{let h=a;if(h.classList.contains(L["flex-resize-panel"]))return r;if(a.hasAttribute("data-grow")==!1||a.getAttribute("data-is_resize")==="true")return e.push(h),r;let G=parseFloat(h.dataset.grow||"");return h.style.flex=`${G} 1 0%`,r-=G,r},s.length);if(e.length!=0){let r=Z(e.length,c);e.forEach(a=>{a.dataset.grow=r.toString(),a.style.flex=`${r} 1 0%`})}},[]),m(()=>{if(!t.current||!b||!l||!f||w(t.current)==0||S.current)return;const e=t.current.parentElement;if(!e)return;const s=l.charAt(0).toUpperCase()+l.substring(1),c=e["client"+s]||0;if(!c||u<=0)return;const r=D(f,c,u),a=Math.min(u,Math.max(0,r)),d=w(t.current);if(Math.abs(a-d)<.001)return;R(d),g(a);const x=[...e.children||[]].filter(n=>{const i=n;return i.hasAttribute("data-container_name")&&!i.classList.contains(L["flex-resize-panel"])}).filter(n=>n!==t.current).filter(n=>n.style.flex!=="0 1 0%"),H=u-a;if(H<=0||x.length===0)return;const T=x.reduce((n,i)=>n+w(i),0);if(T<=0){const n=H/x.length;x.forEach(i=>{i.dataset.grow=n.toString(),i.style.flex=`${n} 1 0%`})}else x.forEach(n=>{const i=w(n),N=H*(i/T);n.dataset.grow=N.toString(),n.style.flex=`${N} 1 0%`})},[f,b,l,u]),ne(re,{children:[A("div",{id:o,"data-container_name":o,ref:J,className:`${L["flex-container"]} ${C&&C!==""?C:""}`,...p!==void 0?{"data-grow":p}:{},...F!=null?{"data-prev_grow":F}:{},"data-is_resize":O,"data-is_resize_panel":_,style:p!==void 0&&{flex:`${p} 1 0%`}||{},children:b&&A("div",{className:`${L["flex-content-fit-wrapper"]}`,ref:z,children:E})||E}),_&&A(ee,{containerName:o,layoutName:y,direction:k,containerCount:u,panelMode:V,panelClassName:j,panelMovementMode:q,onResizingChange:B})]})}export{te as default};
@@ -1,68 +1 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var FlexLayoutIFramePane_exports = {};
21
- __export(FlexLayoutIFramePane_exports, {
22
- FlexLayoutIFramePane: () => FlexLayoutIFramePane
23
- });
24
- module.exports = __toCommonJS(FlexLayoutIFramePane_exports);
25
- var import_jsx_runtime = require("react/jsx-runtime");
26
- var import_react = require("react");
27
- var import_rxjs = require("rxjs");
28
- var import_hooks = require("../hooks");
29
- function FlexLayoutIFramePane({
30
- url,
31
- screenKey
32
- }) {
33
- const [blockPointer, setBlockPointer] = (0, import_react.useState)(false);
34
- (0, import_react.useEffect)(() => {
35
- const draggingSubject = import_hooks.dragStateSubject.pipe(
36
- (0, import_rxjs.map)((s) => !!s?.isDragging),
37
- (0, import_rxjs.startWith)(false),
38
- (0, import_rxjs.distinctUntilChanged)()
39
- );
40
- const sub = (0, import_rxjs.combineLatest)([draggingSubject, import_hooks.isResizingSubject]).pipe(
41
- (0, import_rxjs.map)(([dragging, resizing]) => dragging || resizing),
42
- (0, import_rxjs.distinctUntilChanged)()
43
- ).subscribe(setBlockPointer);
44
- return () => sub.unsubscribe();
45
- }, []);
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
- "iframe",
48
- {
49
- src: url,
50
- style: {
51
- width: "100%",
52
- height: "100%",
53
- border: 0,
54
- //리사이즈 및 드래깅 중 ifram이 이벤트 못먹게 방지
55
- pointerEvents: blockPointer ? "none" : "auto"
56
- },
57
- sandbox: "allow-same-origin allow-scripts allow-forms allow-popups",
58
- referrerPolicy: "no-referrer",
59
- loading: "lazy"
60
- },
61
- screenKey
62
- );
63
- }
64
- // Annotate the CommonJS export names for ESM import in node:
65
- 0 && (module.exports = {
66
- FlexLayoutIFramePane
67
- });
68
- //# sourceMappingURL=FlexLayoutIFramePane.cjs.map
1
+ "use strict";"use client";var c=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f(e))!m.call(t,i)&&i!==o&&c(t,i,{get:()=>e[i],enumerable:!(s=b(e,i))||s.enumerable});return t};var h=t=>y(c({},"__esModule",{value:!0}),t);var S={};d(S,{FlexLayoutIFramePane:()=>w});module.exports=h(S);var u=require("react/jsx-runtime"),n=require("react"),r=require("rxjs"),a=require("../hooks");function w({url:t,screenKey:e}){const[o,s]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{const i=a.dragStateSubject.pipe((0,r.map)(l=>!!l?.isDragging),(0,r.startWith)(!1),(0,r.distinctUntilChanged)()),g=(0,r.combineLatest)([i,a.isResizingSubject]).pipe((0,r.map)(([l,p])=>l||p),(0,r.distinctUntilChanged)()).subscribe(s);return()=>g.unsubscribe()},[]),(0,u.jsx)("iframe",{src:t,style:{width:"100%",height:"100%",border:0,pointerEvents:o?"none":"auto"},sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",referrerPolicy:"no-referrer",loading:"lazy"},e)}0&&(module.exports={FlexLayoutIFramePane});
@@ -1,44 +1 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useEffect, useState } from "react";
4
- import { combineLatest, distinctUntilChanged, map, startWith } from "rxjs";
5
- import { dragStateSubject, isResizingSubject } from "../hooks";
6
- function FlexLayoutIFramePane({
7
- url,
8
- screenKey
9
- }) {
10
- const [blockPointer, setBlockPointer] = useState(false);
11
- useEffect(() => {
12
- const draggingSubject = dragStateSubject.pipe(
13
- map((s) => !!s?.isDragging),
14
- startWith(false),
15
- distinctUntilChanged()
16
- );
17
- const sub = combineLatest([draggingSubject, isResizingSubject]).pipe(
18
- map(([dragging, resizing]) => dragging || resizing),
19
- distinctUntilChanged()
20
- ).subscribe(setBlockPointer);
21
- return () => sub.unsubscribe();
22
- }, []);
23
- return /* @__PURE__ */ jsx(
24
- "iframe",
25
- {
26
- src: url,
27
- style: {
28
- width: "100%",
29
- height: "100%",
30
- border: 0,
31
- //리사이즈 및 드래깅 중 ifram이 이벤트 못먹게 방지
32
- pointerEvents: blockPointer ? "none" : "auto"
33
- },
34
- sandbox: "allow-same-origin allow-scripts allow-forms allow-popups",
35
- referrerPolicy: "no-referrer",
36
- loading: "lazy"
37
- },
38
- screenKey
39
- );
40
- }
41
- export {
42
- FlexLayoutIFramePane
43
- };
44
- //# sourceMappingURL=FlexLayoutIFramePane.js.map
1
+ "use client";import{jsx as d}from"react/jsx-runtime";import{useEffect as u,useState as g}from"react";import{combineLatest as p,distinctUntilChanged as r,map as t,startWith as b}from"rxjs";import{dragStateSubject as f,isResizingSubject as m}from"../hooks";function S({url:i,screenKey:o}){const[s,n]=g(!1);return u(()=>{const a=f.pipe(t(e=>!!e?.isDragging),b(!1),r()),l=p([a,m]).pipe(t(([e,c])=>e||c),r()).subscribe(n);return()=>l.unsubscribe()},[]),d("iframe",{src:i,style:{width:"100%",height:"100%",border:0,pointerEvents:s?"none":"auto"},sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",referrerPolicy:"no-referrer",loading:"lazy"},o)}export{S as FlexLayoutIFramePane};
@@ -1,246 +1 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var FlexLayoutResizePanel_exports = {};
31
- __export(FlexLayoutResizePanel_exports, {
32
- default: () => FlexLayoutResizePanel
33
- });
34
- module.exports = __toCommonJS(FlexLayoutResizePanel_exports);
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_react = require("react");
37
- var import_hooks = require("../hooks");
38
- var import_FlexLayoutContainerStore = require("../store/FlexLayoutContainerStore");
39
- var import_FlexLayout = __toESM(require("../styles/FlexLayout.module.css"), 1);
40
- var import_FlexLayoutUtils = require("../utils/FlexLayoutUtils");
41
- const flexDirectionModel = {
42
- row: {
43
- xy: "x",
44
- targetDirection: "left",
45
- nextDirection: "right",
46
- sizeName: "width",
47
- resizeCursor: "ew-resize"
48
- },
49
- column: {
50
- xy: "y",
51
- targetDirection: "top",
52
- nextDirection: "bottom",
53
- sizeName: "height",
54
- resizeCursor: "ns-resize"
55
- }
56
- };
57
- function FlexLayoutResizePanel({
58
- direction,
59
- containerCount,
60
- panelMode = "default",
61
- containerName,
62
- layoutName,
63
- panelClassName,
64
- panelMovementMode,
65
- onResizingChange
66
- }) {
67
- const directionRef = (0, import_react.useRef)(direction);
68
- const movementModeRef = (0, import_react.useRef)(panelMovementMode);
69
- (0, import_react.useEffect)(() => {
70
- directionRef.current = direction;
71
- }, [direction]);
72
- (0, import_react.useEffect)(() => {
73
- movementModeRef.current = panelMovementMode;
74
- }, [panelMovementMode]);
75
- const isResizePanelClickRef = (0, import_react.useRef)(false);
76
- const prevTouchEventRef = (0, import_react.useRef)(null);
77
- const parentSizeRef = (0, import_react.useRef)(0);
78
- const totalMovementRef = (0, import_react.useRef)(0);
79
- const containerCountRef = (0, import_react.useRef)(containerCount);
80
- const panelRef = (0, import_react.useRef)(null);
81
- (0, import_react.useEffect)(() => {
82
- return () => {
83
- import_hooks.isResizingSubject.next(false);
84
- document.body.style.cursor = "";
85
- };
86
- }, []);
87
- (0, import_react.useEffect)(() => {
88
- containerCountRef.current = containerCount;
89
- }, [containerCount]);
90
- const panelMouseDownEvent = (event) => {
91
- if (!panelRef.current || !panelRef.current.parentElement) return;
92
- isResizePanelClickRef.current = true;
93
- onResizingChange?.(true);
94
- containerCountRef.current = [
95
- ...panelRef.current.parentElement.children
96
- ].filter((e) => e.hasAttribute("data-container_name")).length;
97
- const sizeName = flexDirectionModel[direction].sizeName;
98
- parentSizeRef.current = panelRef.current.parentElement.getBoundingClientRect()[sizeName];
99
- prevTouchEventRef.current = null;
100
- totalMovementRef.current = 0;
101
- import_hooks.isResizingSubject.next(true);
102
- if (!parentSizeRef.current) return;
103
- document.body.style.cursor = flexDirectionModel[direction].resizeCursor;
104
- };
105
- const panelMouseUpEvent = () => {
106
- isResizePanelClickRef.current = false;
107
- onResizingChange?.(false);
108
- parentSizeRef.current = 0;
109
- totalMovementRef.current = 0;
110
- prevTouchEventRef.current = null;
111
- import_hooks.isResizingSubject.next(false);
112
- document.body.style.cursor = "";
113
- };
114
- function moveMouseFlex(originTarget, resizePanel, moveEvent, dir, mode) {
115
- const model = flexDirectionModel[dir];
116
- const movement = moveEvent["movement" + model.xy.toUpperCase()];
117
- totalMovementRef.current += movement;
118
- const minSizeName = "min-" + model.sizeName;
119
- const maxSizeName = "max-" + model.sizeName;
120
- let targetElement = (0, import_FlexLayoutUtils.findNotCloseFlexContent)(
121
- originTarget,
122
- "previousElementSibling"
123
- );
124
- if (panelMovementMode === "divorce" && totalMovementRef.current > 0 || panelMovementMode === "bulldozer" && movement > 0 || !targetElement)
125
- targetElement = originTarget;
126
- let nextElement = (0, import_FlexLayoutUtils.findNotCloseFlexContent)(
127
- resizePanel.nextElementSibling,
128
- "nextElementSibling"
129
- );
130
- if (panelMovementMode === "divorce" && totalMovementRef.current < 0 || panelMovementMode === "bulldozer" && movement < 0 || !nextElement)
131
- nextElement = resizePanel.nextElementSibling;
132
- if (!targetElement || !nextElement) return;
133
- const targetRect = targetElement.getBoundingClientRect();
134
- const targetStyle = window.getComputedStyle(targetElement);
135
- const targetMinSize = parseFloat(targetStyle.getPropertyValue(minSizeName)) || 0;
136
- const targetMaxSize = parseFloat(targetStyle.getPropertyValue(maxSizeName)) || 0;
137
- const nextRect = nextElement.getBoundingClientRect();
138
- const nextStyle = window.getComputedStyle(nextElement);
139
- const nextMinSize = parseFloat(nextStyle.getPropertyValue(minSizeName)) || 0;
140
- const nextMaxSize = parseFloat(nextStyle.getPropertyValue(maxSizeName)) || 0;
141
- let targetSize = targetRect[model.sizeName] + movement;
142
- let nextElementSize = nextRect[model.sizeName] - movement;
143
- if (targetMaxSize > 0 && targetSize > targetMaxSize) {
144
- return;
145
- }
146
- if (nextMaxSize > 0 && nextElementSize > nextMaxSize) {
147
- return;
148
- }
149
- if ((0, import_FlexLayoutUtils.isOverMove)(targetSize, targetMinSize)) {
150
- targetSize = 0;
151
- nextElementSize = nextRect[model.sizeName];
152
- } else if ((0, import_FlexLayoutUtils.isOverMove)(nextElementSize, nextMinSize)) {
153
- nextElementSize = 0;
154
- targetSize = targetRect[model.sizeName];
155
- }
156
- const targetFlexGrow = targetSize / (parentSizeRef.current - 1) * containerCountRef.current;
157
- const nextElementFlexGrow = nextElementSize / (parentSizeRef.current - 1) * containerCountRef.current;
158
- if (!(targetElement instanceof HTMLElement)) return;
159
- if (!(nextElement instanceof HTMLElement)) return;
160
- targetElement.style.flex = `${targetFlexGrow} 1 0%`;
161
- nextElement.style.flex = `${nextElementFlexGrow} 1 0%`;
162
- }
163
- (0, import_react.useEffect)(() => {
164
- const addGlobalMoveEvent = (event) => {
165
- if (!isResizePanelClickRef.current || !panelRef.current) {
166
- return;
167
- }
168
- event.preventDefault();
169
- const dir = directionRef.current;
170
- const mode = movementModeRef.current;
171
- const targetElement = panelRef.current.previousElementSibling;
172
- const targetPanel = panelRef.current;
173
- if (!targetElement || !targetPanel) return;
174
- let move = { movementX: 0, movementY: 0 };
175
- if (window.TouchEvent && event instanceof window.TouchEvent) {
176
- const prev = prevTouchEventRef.current;
177
- if (!prev) {
178
- prevTouchEventRef.current = event;
179
- return;
180
- }
181
- move.movementX = (prev.touches[0].pageX - event.touches[0].pageX) * -1;
182
- move.movementY = (prev.touches[0].pageY - event.touches[0].pageY) * -1;
183
- prevTouchEventRef.current = event;
184
- } else {
185
- move.movementX = event.movementX;
186
- move.movementY = event.movementY;
187
- }
188
- moveMouseFlex(targetElement, targetPanel, move, dir, mode);
189
- };
190
- ["mousemove", "touchmove"].forEach((eventName) => {
191
- window.addEventListener(eventName, addGlobalMoveEvent, {
192
- passive: false
193
- });
194
- });
195
- [
196
- "mouseup",
197
- "touchend",
198
- "touchcancel",
199
- // 터치 제스처 시스템 인터럽트
200
- "pointerup",
201
- // 범용 포인터 이벤트
202
- "pointercancel",
203
- "blur"
204
- // 윈도우 포커스 아웃 (Alt+Tab 등)
205
- ].forEach((eventName) => {
206
- window.addEventListener(eventName, panelMouseUpEvent);
207
- });
208
- return () => {
209
- ["mousemove", "touchmove"].forEach((eventName) => {
210
- window.removeEventListener(eventName, addGlobalMoveEvent);
211
- });
212
- [
213
- "mouseup",
214
- "touchend",
215
- "touchcancel",
216
- // 터치 제스처 시스템 인터럽트
217
- "pointerup",
218
- // 범용 포인터 이벤트
219
- "pointercancel",
220
- "blur"
221
- // 윈도우 포커스 아웃 (Alt+Tab 등)
222
- ].forEach((eventName) => {
223
- window.removeEventListener(eventName, panelMouseUpEvent);
224
- });
225
- };
226
- }, []);
227
- (0, import_react.useEffect)(() => {
228
- if (!panelRef.current) return;
229
- (0, import_FlexLayoutContainerStore.setResizePanelRef)(layoutName, containerName, panelRef);
230
- return () => {
231
- (0, import_FlexLayoutContainerStore.setResizePanelRef)(layoutName, containerName, null);
232
- };
233
- }, [containerName, layoutName]);
234
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
235
- "div",
236
- {
237
- id: containerName + "_resize_panel",
238
- className: `${import_FlexLayout.default["flex-resize-panel"]} ${import_FlexLayout.default[panelMode]} ${panelClassName && panelClassName !== "" ? panelClassName : ""}`,
239
- ref: panelRef,
240
- onMouseDown: panelMouseDownEvent,
241
- onTouchStart: panelMouseDownEvent,
242
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_FlexLayout.default.hover })
243
- }
244
- );
245
- }
246
- //# sourceMappingURL=FlexLayoutResizePanel.cjs.map
1
+ "use strict";"use client";var fe=Object.create;var G=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var Ee=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},te=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of pe(t))!ge.call(e,c)&&c!==n&&G(e,c,{get:()=>t[c],enumerable:!(r=de(t,c))||r.enumerable});return e};var ve=(e,t,n)=>(n=e!=null?fe(he(e)):{},te(t||!e||!e.__esModule?G(n,"default",{value:e,enumerable:!0}):n,e)),Me=e=>te(G({},"__esModule",{value:!0}),e);var xe={};Ee(xe,{default:()=>oe});module.exports=Me(xe);var J=require("react/jsx-runtime"),u=require("react"),T=require("../hooks"),K=require("../store/FlexLayoutContainerStore"),C=ve(require("../styles/FlexLayout.module.css"),1),L=require("../utils/FlexLayoutUtils");const j={row:{xy:"x",targetDirection:"left",nextDirection:"right",sizeName:"width",resizeCursor:"ew-resize"},column:{xy:"y",targetDirection:"top",nextDirection:"bottom",sizeName:"height",resizeCursor:"ns-resize"}},h=4,ne=(e,t,n,r)=>{const c=new Map,l=(a,g)=>{const s=document.elementsFromPoint(a,g);for(const m of s){const M=m.closest?.(`.${C.default["flex-resize-panel"]}`);if(!M)continue;const f=M.dataset.resize_panel_key;f&&(c.has(f)||c.set(f,{el:M,key:f,dir:M.dataset.direction}))}};if([[0,0],[-h,0],[h,0],[0,-h],[0,h],[-h,-h],[h,-h],[-h,h],[h,h]].forEach(([a,g])=>l(e+a,t+g)),n&&r){const a=n.getBoundingClientRect(),g=r==="row"?a.width:r==="column"?a.height:1,s=Math.max(1,Math.ceil(g/2)),m=Math.ceil(h+g*2),p=Math.max(h,Math.ceil(g*2)),M=Array.from(new Set([1,Math.floor(p/2),Math.max(1,p-1)]));if(r==="row")for(let f=-m;f<=m;f+=s)for(const b of M)l(a.left-b,t+f),l(a.right+b,t+f);else if(r==="column")for(let f=-m;f<=m;f+=s)for(const b of M)l(e+f,a.top-b),l(e+f,a.bottom+b)}if(r){const g=[...c.values()].filter(s=>s.dir&&s.dir!==r);for(const s of g){const m=s.el.getBoundingClientRect(),p=s.dir==="row"?m.width:s.dir==="column"?m.height:1,M=Math.max(1,Math.ceil(p/2)),f=Math.ceil(h+p*2),b=Math.max(h,Math.ceil(p*2)),F=Array.from(new Set([1,Math.floor(b/2),Math.max(1,b-1)]));if(r==="column"&&s.dir==="row")for(let y=-f;y<=f;y+=M)for(const o of F)l(m.left-o,t+y),l(m.right+o,t+y);else if(r==="row"&&s.dir==="column")for(let y=-f;y<=f;y+=M)for(const o of F)l(e+y,m.top-o),l(e+y,m.bottom+o)}}return[...c.values()]},D=(e,t)=>{if(!e||e==="auto")return null;if(e.endsWith("px")){const r=parseFloat(e);return Number.isFinite(r)?r:null}if(e.endsWith("%")){const r=parseFloat(e);return Number.isFinite(r)?t*r/100:null}const n=parseFloat(e);return Number.isFinite(n)?n:null},ye=(e,t,n)=>e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom,be=e=>{const t=e.getBoundingClientRect(),n=getComputedStyle(e,"::after");if(!n||n.content==="none"||n.content==="normal"||n.display==="none"||n.visibility==="hidden")return null;const r=D(n.width,t.width),c=D(n.height,t.height);if(!r||!c)return null;const l=D(n.left,t.width),a=D(n.right,t.width),g=D(n.top,t.height),s=D(n.bottom,t.height);let m=t.left;l!==null?m=t.left+l:a!==null&&(m=t.right-a-r);let p=t.top;return g!==null?p=t.top+g:s!==null&&(p=t.bottom-s-c),{left:m,top:p,right:m+r,bottom:p+c}},re=(e,t,n,r,c)=>{const l=n.getBoundingClientRect(),a=be(n);if(a&&ye(e,t,a))return!1;const g=r==="row"?l.width:r==="column"?l.height:1,s=Math.max(c,Math.ceil(g));return r==="row"?e>=l.left-s&&e<=l.right+s:r==="column"?t>=l.top-s&&t<=l.bottom+s:!0};function oe({direction:e,containerCount:t,panelMode:n="default",containerName:r,layoutName:c,panelClassName:l,panelMovementMode:a,onResizingChange:g}){const s=(0,u.useRef)(e),m=(0,u.useRef)(a),p=(0,u.useMemo)(()=>`${c}::${r}`,[c,r]);(0,u.useEffect)(()=>{s.current=e},[e]),(0,u.useEffect)(()=>{m.current=a},[a]);const M=(0,u.useRef)(!1),f=(0,u.useRef)(null),b=(0,u.useRef)(0),F=(0,u.useRef)(0),y=(0,u.useRef)(t),o=(0,u.useRef)(null),B=(0,u.useRef)(null),k=(0,u.useRef)(null);(0,u.useEffect)(()=>()=>{T.isResizingSubject.next(!1),document.body.style.cursor="",k.current?.()},[]),(0,u.useEffect)(()=>{y.current=t},[t]);const se=()=>{if(!o.current||!o.current.parentElement)return;M.current=!0,g?.(!0),y.current=[...o.current.parentElement.children].filter(i=>i.hasAttribute("data-container_name")).length;const d=j[e].sizeName;b.current=o.current.parentElement.getBoundingClientRect()[d],f.current=null,F.current=0,T.isResizingSubject.next(!0)},ie=()=>{M.current=!1,g?.(!1),b.current=0,F.current=0,B.current=null,T.isResizingSubject.next(!1),document.body.style.cursor="",O()};function le(d,i,x,z,S){const E=j[z],H=x["movement"+E.xy.toUpperCase()];F.current+=H;const A="min-"+E.sizeName,X="max-"+E.sizeName;let R=(0,L.findNotCloseFlexContent)(d,"previousElementSibling");(S==="divorce"&&F.current>0||S==="bulldozer"&&H>0||!R)&&(R=d);let w=(0,L.findNotCloseFlexContent)(i.nextElementSibling,"nextElementSibling");if((S==="divorce"&&F.current<0||S==="bulldozer"&&H<0||!w)&&(w=i.nextElementSibling),!R||!w)return;const N=R.getBoundingClientRect(),$=window.getComputedStyle(R),Y=parseFloat($.getPropertyValue(A))||0,v=parseFloat($.getPropertyValue(X))||0,P=w.getBoundingClientRect(),I=window.getComputedStyle(w),W=parseFloat(I.getPropertyValue(A))||0,ee=parseFloat(I.getPropertyValue(X))||0;let _=N[E.sizeName]+H,V=P[E.sizeName]-H;if(v>0&&_>v||ee>0&&V>ee)return;(0,L.isOverMove)(_,Y)?(_=0,V=P[E.sizeName]):(0,L.isOverMove)(V,W)&&(V=0,_=N[E.sizeName]);const ae=_/(b.current-1)*y.current,me=V/(b.current-1)*y.current;R instanceof HTMLElement&&w instanceof HTMLElement&&(R.style.flex=`${ae} 1 0%`,w.style.flex=`${me} 1 0%`)}(0,u.useEffect)(()=>{const d=T.resizeDragSubject.subscribe(i=>{if(i.type==="START"){if(!i.targets.includes(p))return;B.current=i.sessionId,se(),i.cursor&&(document.body.style.cursor=i.cursor);return}if(i.type==="MOVE"){if(B.current!==i.sessionId||!M.current||!o.current)return;const x=s.current,z=m.current,S=o.current.previousElementSibling,E=o.current;if(!S||!E)return;le(S,E,{movementX:i.movementX,movementY:i.movementY},x,z);return}if(i.type==="END"){if(B.current!==i.sessionId)return;ie()}});return()=>d.unsubscribe()},[p]);const Q=d=>{if(!o.current)return;d.preventDefault?.();const i=d.nativeEvent,x=(0,L.getClientXy)(i);if(!x)return;const z=s.current,S=re(x.clientX,x.clientY,o.current,z,h),E=S?ne(x.clientX,x.clientY,o.current,z):[{el:o.current,key:p,dir:z}],H=new Set([p]);E.forEach(v=>H.add(v.key));const A=[...H],X=S&&A.length>=2?"move":j[z].resizeCursor,R=`${Date.now()}_${Math.random().toString(16).slice(2)}`;T.resizeDragSubject.next({type:"START",sessionId:R,targets:A,cursor:X}),k.current?.();let w=x.clientX,N=x.clientY;const $=v=>{v.preventDefault?.();const P=(0,L.getClientXy)(v);if(!P)return;const I=P.clientX-w,W=P.clientY-N;w=P.clientX,N=P.clientY,T.resizeDragSubject.next({type:"MOVE",sessionId:R,movementX:I,movementY:W})},Y=()=>{k.current?.(),k.current=null,T.resizeDragSubject.next({type:"END",sessionId:R})};["mousemove","touchmove"].forEach(v=>{window.addEventListener(v,$,{passive:!1})}),["mouseup","touchend","touchcancel","pointerup","pointercancel","blur"].forEach(v=>window.addEventListener(v,Y)),k.current=()=>{["mousemove","touchmove"].forEach(v=>window.removeEventListener(v,$)),["mouseup","touchend","touchcancel","pointerup","pointercancel","blur"].forEach(v=>window.removeEventListener(v,Y))}};(0,u.useEffect)(()=>{if(o.current)return(0,K.setResizePanelRef)(c,r,o),()=>{(0,K.setResizePanelRef)(c,r,null)}},[r,c]);const q=(0,u.useRef)([]),U=(0,u.useRef)(null),O=()=>{for(const d of q.current)d.querySelector(`.${C.default.hover}`)?.removeAttribute("data-is_hover");q.current=[]},ce=d=>{O();for(const i of d)i.querySelector(`.${C.default.hover}`)?.setAttribute("data-is_hover","");q.current=d},Z=d=>{o.current&&(U.current&&cancelAnimationFrame(U.current),U.current=requestAnimationFrame(()=>{const i=s.current;if(!re(d.clientX,d.clientY,o.current,i,h)){o.current.style.cursor="",O();return}const S=ne(d.clientX,d.clientY,o.current,i).filter(E=>E.dir&&E.dir!==i).map(E=>E.el);o.current.style.cursor=S.length>0?"move":"",ce(S)}))},ue=()=>{o.current&&(o.current.style.cursor="",O())};return(0,J.jsx)("div",{id:r+"_resize_panel","data-resize_panel_key":p,"data-direction":e,className:`${C.default["flex-resize-panel"]} ${C.default[n]} ${l&&l!==""?l:""}`,ref:o,onMouseDown:Q,onTouchStart:Q,onMouseMove:Z,onMouseEnter:Z,onMouseLeave:ue,children:(0,J.jsx)("div",{className:C.default.hover,"aria-hidden":!0})})}