@byeolnaerim/flex-layout 0.0.9 → 0.0.12

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 (132) hide show
  1. package/dist/flex-layout/components/FlexLayout.cjs +1 -110
  2. package/dist/flex-layout/components/FlexLayout.d.ts +2 -1
  3. package/dist/flex-layout/components/FlexLayout.js +1 -85
  4. package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -262
  5. package/dist/flex-layout/components/FlexLayoutContainer.d.ts +1 -1
  6. package/dist/flex-layout/components/FlexLayoutContainer.js +1 -232
  7. package/dist/flex-layout/components/FlexLayoutDynamicHeight.cjs +1 -0
  8. package/dist/flex-layout/components/FlexLayoutDynamicHeight.d.ts +6 -0
  9. package/dist/flex-layout/components/FlexLayoutDynamicHeight.js +1 -0
  10. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -68
  11. package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -44
  12. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -246
  13. package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -216
  14. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1252
  15. package/dist/flex-layout/components/FlexLayoutSplitScreen.d.ts +14 -1
  16. package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1236
  17. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -532
  18. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -509
  19. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -55
  20. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
  21. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -63
  22. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -33
  23. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -53
  24. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -23
  25. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -133
  26. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -107
  27. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -245
  28. package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -229
  29. package/dist/flex-layout/components/index.cjs +1 -57
  30. package/dist/flex-layout/components/index.d.ts +1 -0
  31. package/dist/flex-layout/components/index.js +1 -17
  32. package/dist/flex-layout/hooks/index.cjs +1 -25
  33. package/dist/flex-layout/hooks/index.js +1 -3
  34. package/dist/flex-layout/hooks/useDrag.cjs +1 -289
  35. package/dist/flex-layout/hooks/useDrag.d.ts +15 -0
  36. package/dist/flex-layout/hooks/useDrag.js +1 -258
  37. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -139
  38. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -118
  39. package/dist/flex-layout/hooks/useListPaging.cjs +1 -212
  40. package/dist/flex-layout/hooks/useListPaging.js +1 -191
  41. package/dist/flex-layout/hooks/useSizes.cjs +1 -126
  42. package/dist/flex-layout/hooks/useSizes.d.ts +6 -3
  43. package/dist/flex-layout/hooks/useSizes.js +1 -101
  44. package/dist/flex-layout/index.cjs +1 -31
  45. package/dist/flex-layout/index.js +1 -6
  46. package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -49
  47. package/dist/flex-layout/providers/FlexLayoutContext.js +1 -24
  48. package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -276
  49. package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
  50. package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -263
  51. package/dist/flex-layout/providers/index.cjs +1 -23
  52. package/dist/flex-layout/providers/index.js +1 -2
  53. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -257
  54. package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -206
  55. package/dist/flex-layout/store/index.cjs +1 -23
  56. package/dist/flex-layout/store/index.js +1 -2
  57. package/dist/flex-layout/styles/FlexLayout.module.css +499 -416
  58. package/dist/flex-layout/styles/sentinelStyle.module.css +11 -0
  59. package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -17
  60. package/dist/flex-layout/types/FlexDirectionTypes.js +0 -1
  61. package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -17
  62. package/dist/flex-layout/types/FlexLayoutTypes.d.ts +38 -2
  63. package/dist/flex-layout/types/FlexLayoutTypes.js +0 -1
  64. package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -245
  65. package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -211
  66. package/dist/flex-layout/utils/index.cjs +1 -23
  67. package/dist/flex-layout/utils/index.js +1 -2
  68. package/dist/index.cjs +1 -23
  69. package/dist/index.js +1 -2
  70. package/dist/types/css.d.cjs +0 -1
  71. package/dist/types/css.d.js +0 -1
  72. package/package.json +116 -113
  73. package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
  74. package/dist/flex-layout/components/FlexLayout.js.map +0 -1
  75. package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
  76. package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
  77. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs.map +0 -1
  78. package/dist/flex-layout/components/FlexLayoutIFramePane.js.map +0 -1
  79. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
  80. package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
  81. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
  82. package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
  83. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
  84. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
  85. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
  86. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
  87. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
  88. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
  89. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
  90. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
  91. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
  92. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
  93. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
  94. package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
  95. package/dist/flex-layout/components/index.cjs.map +0 -1
  96. package/dist/flex-layout/components/index.js.map +0 -1
  97. package/dist/flex-layout/hooks/index.cjs.map +0 -1
  98. package/dist/flex-layout/hooks/index.js.map +0 -1
  99. package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
  100. package/dist/flex-layout/hooks/useDrag.js.map +0 -1
  101. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
  102. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
  103. package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
  104. package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
  105. package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
  106. package/dist/flex-layout/hooks/useSizes.js.map +0 -1
  107. package/dist/flex-layout/index.cjs.map +0 -1
  108. package/dist/flex-layout/index.js.map +0 -1
  109. package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
  110. package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
  111. package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
  112. package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
  113. package/dist/flex-layout/providers/index.cjs.map +0 -1
  114. package/dist/flex-layout/providers/index.js.map +0 -1
  115. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
  116. package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
  117. package/dist/flex-layout/store/index.cjs.map +0 -1
  118. package/dist/flex-layout/store/index.js.map +0 -1
  119. package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
  120. package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
  121. package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
  122. package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
  123. package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
  124. package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
  125. package/dist/flex-layout/utils/index.cjs.map +0 -1
  126. package/dist/flex-layout/utils/index.js.map +0 -1
  127. package/dist/index.cjs.map +0 -1
  128. package/dist/index.js.map +0 -1
  129. package/dist/metafile-cjs.json +0 -1
  130. package/dist/metafile-esm.json +0 -1
  131. package/dist/types/css.d.cjs.map +0 -1
  132. package/dist/types/css.d.js.map +0 -1
@@ -1,509 +1 @@
1
- "use client";
2
- import { Fragment, jsx } from "react/jsx-runtime";
3
- import {
4
- useEffect,
5
- useRef,
6
- useState
7
- } from "react";
8
- import {
9
- dragStateSubject,
10
- useDragEvents
11
- } from "../hooks/useDrag";
12
- import styles from "../styles/FlexLayout.module.css";
13
- import { isDocumentOut } from "../utils/FlexLayoutUtils";
14
- import { FlexLayoutIFramePane } from "./FlexLayoutIFramePane";
15
- const MAX_STEP = 18;
16
- function shouldAllowViewportScroll(x, y) {
17
- const w = window.innerWidth;
18
- const h = window.innerHeight;
19
- const marginX = w * 0.15;
20
- const marginY = h * 0.15;
21
- return x < marginX || // 왼쪽 15 %
22
- x > w - marginX || // 오른쪽 15 %
23
- y < marginY || // 상단 15 %
24
- y > h - marginY;
25
- }
26
- function edgeVelocity(x, y) {
27
- const w = window.innerWidth, h = window.innerHeight;
28
- const mx = w * 0.15, my = h * 0.15;
29
- let vx = 0;
30
- if (x < mx)
31
- vx = -((mx - x) / mx) * MAX_STEP;
32
- else if (x > w - mx)
33
- vx = (x - (w - mx)) / mx * MAX_STEP;
34
- let vy = 0;
35
- if (y < my)
36
- vy = -((my - y) / my) * MAX_STEP;
37
- else if (y > h - my)
38
- vy = (y - (h - my)) / my * MAX_STEP;
39
- return { vx, vy };
40
- }
41
- function calcVelocity(dx, dy, x, y) {
42
- const w = window.innerWidth, h = window.innerHeight;
43
- const marginX = w * 0.15, marginY = h * 0.15;
44
- const multX = x < marginX ? 1 + (marginX - x) / marginX * 3 : x > w - marginX ? 1 + (x - (w - marginX)) / marginX * 3 : 1;
45
- const multY = y < marginY ? 1 + (marginY - y) / marginY * 3 : y > h - marginY ? 1 + (y - (h - marginY)) / marginY * 3 : 1;
46
- return { vx: -dx * multX, vy: -dy * multY };
47
- }
48
- function createScreenKey() {
49
- const c = globalThis.crypto;
50
- if (c?.randomUUID) return c.randomUUID();
51
- if (c?.getRandomValues) {
52
- return Array.from(
53
- c.getRandomValues(new Uint32Array(16)),
54
- (e) => e.toString(32).padStart(2, "0")
55
- ).join("");
56
- }
57
- return `${Date.now().toString(32)}-${Math.random().toString(32).slice(2)}`;
58
- }
59
- function getFallbackElement(targetComponent, url) {
60
- if (targetComponent) return targetComponent;
61
- if (url) return /* @__PURE__ */ jsx(FlexLayoutIFramePane, { url });
62
- return void 0;
63
- }
64
- function titleFromUrl(url) {
65
- if (!url) return void 0;
66
- try {
67
- const u = new URL(url);
68
- return u.hostname;
69
- } catch {
70
- return url;
71
- }
72
- }
73
- function FlexLayoutSplitScreenDragBox({
74
- onMouseDown,
75
- onTouchStart,
76
- dropEndCallback,
77
- style,
78
- navigationTitle,
79
- targetComponent,
80
- containerName,
81
- children,
82
- className,
83
- dropDocumentOutsideOption,
84
- screenKey: _screenKey,
85
- isBlockingActiveInput = false,
86
- customData = {},
87
- scrollTargetRef,
88
- ...props
89
- }) {
90
- const [screenKey, setScreenKey] = useState();
91
- useEffect(() => {
92
- if (!_screenKey) setScreenKey(createScreenKey());
93
- else setScreenKey(_screenKey);
94
- }, [_screenKey]);
95
- const scrollRAF = useRef(null);
96
- const velocity = useRef({ vx: 0, vy: 0 });
97
- const ref = useRef(null);
98
- const clonedNodeRef = useRef(null);
99
- const clonedWidth = useRef(null);
100
- const clonedHeight = useRef(null);
101
- const hrefUrlRef = useRef("");
102
- const rafId = useRef(null);
103
- const pending = useRef(null);
104
- const lastPointRef = useRef({ x: 0, y: 0 });
105
- const escCanceledRef = useRef(false);
106
- const emitDragState = (v) => {
107
- pending.current = v;
108
- if (rafId.current != null) return;
109
- rafId.current = requestAnimationFrame(() => {
110
- if (pending.current) dragStateSubject.next(pending.current);
111
- pending.current = null;
112
- rafId.current = null;
113
- });
114
- };
115
- useEffect(() => {
116
- return () => {
117
- if (rafId.current != null) cancelAnimationFrame(rafId.current);
118
- };
119
- }, []);
120
- const { handleStart, handleMove, handleEnd } = useDragEvents({
121
- isBlockingActiveInput
122
- });
123
- const handleMoveWrapper = (event) => {
124
- let allowScrollEdge = false;
125
- let x = 0;
126
- let y = 0;
127
- if (event.type === "touchmove") {
128
- const t = event.touches[0];
129
- x = t.clientX;
130
- y = t.clientY;
131
- } else {
132
- const m = event;
133
- x = m.clientX;
134
- y = m.clientY;
135
- }
136
- const { vx, vy } = edgeVelocity(x, y);
137
- const inEdge = vx !== 0 || vy !== 0;
138
- allowScrollEdge = shouldAllowViewportScroll(x, y);
139
- if (clonedNodeRef.current?.isConnected && !inEdge) {
140
- event.preventDefault();
141
- if (scrollRAF.current) {
142
- cancelAnimationFrame(scrollRAF.current);
143
- scrollRAF.current = null;
144
- }
145
- }
146
- if (clonedNodeRef.current?.isConnected && inEdge) {
147
- event.preventDefault();
148
- velocity.current = { vx, vy };
149
- if (!scrollRAF.current) {
150
- const step = () => {
151
- const target = scrollTargetRef?.current ?? document.scrollingElement;
152
- if (target?.scrollBy) {
153
- target.scrollBy(
154
- velocity.current.vx,
155
- velocity.current.vy
156
- );
157
- } else {
158
- window.scrollBy(
159
- velocity.current.vx,
160
- velocity.current.vy
161
- );
162
- }
163
- if (velocity.current.vx === 0 && velocity.current.vy === 0) {
164
- scrollRAF.current = null;
165
- return;
166
- }
167
- scrollRAF.current = requestAnimationFrame(step);
168
- };
169
- scrollRAF.current = requestAnimationFrame(step);
170
- }
171
- }
172
- if (event.type !== "touchmove") {
173
- event.preventDefault();
174
- }
175
- handleMove({
176
- event,
177
- notDragCallback: ({ x: x2, y: y2 }) => {
178
- if (clonedNodeRef.current) clonedNodeRef.current.remove();
179
- },
180
- dragStartCallback: ({ x: x2, y: y2 }) => {
181
- if (!clonedNodeRef.current) return;
182
- navigator.vibrate(100);
183
- clonedNodeRef.current.style.transform = `translate3d(${x2 - (clonedWidth.current || 0) / 2}px, ${y2 - (clonedHeight.current || 0) / 2}px, 0)`;
184
- },
185
- moveingCallback: ({ x: x2, y: y2 }) => {
186
- lastPointRef.current = { x: x2, y: y2 };
187
- if (clonedNodeRef.current?.isConnected) {
188
- clonedNodeRef.current.style.transform = `translate3d(${x2 - (clonedWidth.current || 0) / 2}px, ${y2 - (clonedHeight.current || 0) / 2}px, 0)`;
189
- }
190
- emitDragState({
191
- isDragging: true,
192
- isDrop: false,
193
- navigationTitle: navigationTitle ?? titleFromUrl(dropDocumentOutsideOption?.openUrl),
194
- children: getFallbackElement(
195
- targetComponent,
196
- dropDocumentOutsideOption?.openUrl
197
- ),
198
- x: x2,
199
- y: y2,
200
- containerName,
201
- dropDocumentOutsideOption,
202
- customData
203
- });
204
- }
205
- });
206
- };
207
- const handleEndWrapper = (event) => {
208
- if (scrollRAF.current !== null) {
209
- cancelAnimationFrame(scrollRAF.current);
210
- scrollRAF.current = null;
211
- }
212
- velocity.current = { vx: 0, vy: 0 };
213
- if (event.type === "blur" || event.type === "touchcancel" || event.type === "pointercancel") {
214
- if (clonedNodeRef.current) clonedNodeRef.current.remove();
215
- }
216
- handleEnd({
217
- event,
218
- dragEndCallback: ({ x, y }) => {
219
- if (escCanceledRef.current) {
220
- escCanceledRef.current = false;
221
- if (clonedNodeRef.current) clonedNodeRef.current.remove();
222
- emitDragState({
223
- isDragging: false,
224
- isDrop: false,
225
- navigationTitle: navigationTitle ?? titleFromUrl(dropDocumentOutsideOption?.openUrl),
226
- children: getFallbackElement(
227
- targetComponent,
228
- dropDocumentOutsideOption?.openUrl
229
- ),
230
- x,
231
- y,
232
- containerName,
233
- dropDocumentOutsideOption,
234
- customData
235
- });
236
- return;
237
- }
238
- const href = hrefUrlRef.current;
239
- if (clonedNodeRef.current) clonedNodeRef.current.remove();
240
- if (dropDocumentOutsideOption && isDocumentOut({ x, y })) {
241
- if (dropDocumentOutsideOption.isNewTap || !dropDocumentOutsideOption.widthRatio && !dropDocumentOutsideOption.heightRatio) {
242
- window.open(href, "_blank");
243
- } else {
244
- const width = window.innerWidth * (dropDocumentOutsideOption.widthRatio || 1);
245
- const height = window.innerHeight * (dropDocumentOutsideOption.heightRatio || 1);
246
- window.open(
247
- href,
248
- "_blank",
249
- `width=${width},height=${height},left=${window.screenLeft - x * -1 - width},top=${window.screenTop + y}`
250
- );
251
- }
252
- }
253
- emitDragState({
254
- isDragging: false,
255
- isDrop: true,
256
- navigationTitle: navigationTitle ?? titleFromUrl(dropDocumentOutsideOption?.openUrl),
257
- children: getFallbackElement(
258
- targetComponent,
259
- dropDocumentOutsideOption?.openUrl
260
- ),
261
- x,
262
- y,
263
- containerName,
264
- dropDocumentOutsideOption,
265
- dropEndCallback,
266
- screenKey,
267
- customData
268
- });
269
- }
270
- });
271
- };
272
- useEffect(() => {
273
- if (ref.current) {
274
- const clone = ref.current.cloneNode(true);
275
- const originRect = ref.current.getBoundingClientRect();
276
- clone.style.width = originRect.width + "px";
277
- clone.style.height = originRect.height + "px";
278
- clone.style.opacity = "0.3";
279
- clone.style.backdropFilter = "blur(6px)";
280
- clonedWidth.current = originRect.width;
281
- clonedHeight.current = originRect.height;
282
- if (dropDocumentOutsideOption?.openUrl) {
283
- hrefUrlRef.current = dropDocumentOutsideOption.openUrl;
284
- const href = document.createElement("span");
285
- href.textContent = hrefUrlRef.current;
286
- clone.prepend(href);
287
- }
288
- const title = document.createElement("span");
289
- title.textContent = navigationTitle ?? titleFromUrl(dropDocumentOutsideOption?.openUrl) ?? "";
290
- clone.prepend(title);
291
- clone.style.position = "fixed";
292
- clone.style.left = "0px";
293
- clone.style.top = "0px";
294
- clone.style.margin = "0px";
295
- clone.style.willChange = "transform";
296
- clone.style.transform = "translate3d(-9999px, -9999px, 0)";
297
- clone.style.pointerEvents = "none";
298
- clonedNodeRef.current = clone;
299
- clonedNodeRef.current.classList.add(
300
- styles["flex-split-screen-drag-box-clone"]
301
- );
302
- }
303
- }, []);
304
- useEffect(() => {
305
- const moveEvents = [
306
- "mousemove",
307
- "touchmove"
308
- ];
309
- const endEvents = [
310
- "mouseup",
311
- "touchend",
312
- "touchcancel",
313
- // 터치 제스처 시스템 인터럽트
314
- "pointerup",
315
- // 범용 포인터 이벤트
316
- "pointercancel",
317
- "blur"
318
- // 윈도우 포커스 아웃 (Alt+Tab 등)
319
- ];
320
- moveEvents.forEach((eventName) => {
321
- window.addEventListener(eventName, handleMoveWrapper, {
322
- passive: false
323
- });
324
- });
325
- endEvents.forEach((eventName) => {
326
- window.addEventListener(eventName, handleEndWrapper);
327
- });
328
- return () => {
329
- moveEvents.forEach((eventName) => {
330
- window.removeEventListener(eventName, handleMoveWrapper);
331
- });
332
- endEvents.forEach((eventName) => {
333
- window.removeEventListener(eventName, handleEndWrapper);
334
- });
335
- };
336
- }, [
337
- customData,
338
- targetComponent,
339
- dropDocumentOutsideOption,
340
- screenKey,
341
- isBlockingActiveInput,
342
- containerName,
343
- navigationTitle,
344
- dropEndCallback
345
- ]);
346
- useEffect(() => {
347
- const el = ref.current;
348
- if (!el) return;
349
- const onCtx = (e) => e.preventDefault();
350
- el.addEventListener("contextmenu", onCtx);
351
- return () => {
352
- el.removeEventListener("contextmenu", onCtx);
353
- };
354
- }, []);
355
- useEffect(() => {
356
- return () => {
357
- if (scrollRAF.current !== null) {
358
- cancelAnimationFrame(scrollRAF.current);
359
- scrollRAF.current = null;
360
- }
361
- velocity.current = { vx: 0, vy: 0 };
362
- clonedNodeRef.current?.remove();
363
- };
364
- }, []);
365
- useEffect(() => {
366
- const onKeyDown = (e) => {
367
- if (e.key !== "Escape") return;
368
- if (!clonedNodeRef.current?.isConnected) return;
369
- e.preventDefault();
370
- e.stopPropagation();
371
- escCanceledRef.current = true;
372
- if (scrollRAF.current !== null) {
373
- cancelAnimationFrame(scrollRAF.current);
374
- scrollRAF.current = null;
375
- }
376
- velocity.current = { vx: 0, vy: 0 };
377
- clonedNodeRef.current?.remove();
378
- handleEnd({
379
- event: new Event("pointercancel"),
380
- dragEndCallback: () => {
381
- }
382
- });
383
- const { x, y } = lastPointRef.current;
384
- emitDragState({
385
- isDragging: false,
386
- isDrop: false,
387
- navigationTitle: navigationTitle ?? titleFromUrl(dropDocumentOutsideOption?.openUrl),
388
- children: getFallbackElement(
389
- targetComponent,
390
- dropDocumentOutsideOption?.openUrl
391
- ),
392
- x,
393
- y,
394
- containerName,
395
- dropDocumentOutsideOption,
396
- customData
397
- });
398
- };
399
- window.addEventListener("keydown", onKeyDown, true);
400
- return () => window.removeEventListener("keydown", onKeyDown, true);
401
- }, [
402
- handleEnd,
403
- containerName,
404
- navigationTitle,
405
- dropDocumentOutsideOption,
406
- targetComponent,
407
- customData
408
- ]);
409
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
410
- "div",
411
- {
412
- className: `${className || ""} ${styles["flex-split-screen-drag-box"]}`,
413
- ref,
414
- onContextMenu: (e) => e.preventDefault(),
415
- onMouseDown: (ev) => {
416
- if (onMouseDown) {
417
- Promise.resolve().then(() => onMouseDown(ev));
418
- }
419
- handleStart({
420
- event: ev,
421
- dragStartCallback: ({ x, y }) => {
422
- lastPointRef.current = { x, y };
423
- if (clonedNodeRef.current) {
424
- document.body.appendChild(
425
- clonedNodeRef.current
426
- );
427
- if (ref.current) {
428
- const originRect = ref.current.getBoundingClientRect();
429
- clonedNodeRef.current.style.width = originRect.width + "px";
430
- clonedNodeRef.current.style.height = originRect.height + "px";
431
- clonedWidth.current = originRect.width;
432
- clonedHeight.current = originRect.height;
433
- }
434
- }
435
- if (clonedNodeRef.current?.isConnected) {
436
- navigator.vibrate(100);
437
- clonedNodeRef.current.style.transform = `translate3d(${x - (clonedWidth.current || 0) / 2}px, ${y - (clonedHeight.current || 0) / 2}px, 0)`;
438
- }
439
- emitDragState({
440
- isDragging: true,
441
- isDrop: false,
442
- navigationTitle: navigationTitle ?? titleFromUrl(
443
- dropDocumentOutsideOption?.openUrl
444
- ),
445
- children: getFallbackElement(
446
- targetComponent,
447
- dropDocumentOutsideOption?.openUrl
448
- ),
449
- x,
450
- y,
451
- containerName,
452
- dropDocumentOutsideOption,
453
- customData
454
- });
455
- }
456
- });
457
- },
458
- onTouchStart: (ev) => {
459
- if (onTouchStart) {
460
- Promise.resolve().then(() => onTouchStart(ev));
461
- }
462
- handleStart({
463
- event: ev,
464
- dragStartCallback: ({ x, y }) => {
465
- if (clonedNodeRef.current) {
466
- document.body.appendChild(
467
- clonedNodeRef.current
468
- );
469
- if (ref.current) {
470
- const originRect = ref.current.getBoundingClientRect();
471
- clonedNodeRef.current.style.width = originRect.width + "px";
472
- clonedNodeRef.current.style.height = originRect.height + "px";
473
- clonedWidth.current = originRect.width;
474
- clonedHeight.current = originRect.height;
475
- }
476
- }
477
- if (clonedNodeRef.current?.isConnected) {
478
- navigator.vibrate(100);
479
- clonedNodeRef.current.style.transform = `translate3d(${x - (clonedWidth.current || 0) / 2}px, ${y - (clonedHeight.current || 0) / 2}px, 0)`;
480
- }
481
- emitDragState({
482
- isDragging: true,
483
- isDrop: false,
484
- navigationTitle: navigationTitle ?? titleFromUrl(
485
- dropDocumentOutsideOption?.openUrl
486
- ),
487
- children: getFallbackElement(
488
- targetComponent,
489
- dropDocumentOutsideOption?.openUrl
490
- ),
491
- x,
492
- y,
493
- containerName,
494
- dropDocumentOutsideOption,
495
- customData
496
- });
497
- }
498
- });
499
- },
500
- style: { ...style },
501
- ...props,
502
- children
503
- }
504
- ) });
505
- }
506
- export {
507
- FlexLayoutSplitScreenDragBox as default
508
- };
509
- //# sourceMappingURL=FlexLayoutSplitScreenDragBox.js.map
1
+ "use client";import{Fragment as ce,jsx as W}from"react/jsx-runtime";import{useEffect as S,useRef as m,useState as J}from"react";import{dragStateSubject as Q,useDragEvents as Z}from"../hooks/useDrag";import N from"../styles/FlexLayout.module.css";import{isDocumentOut as O}from"../utils/FlexLayoutUtils";import{FlexLayoutIFramePane as ee}from"./FlexLayoutIFramePane";const F=18;function re(c,s){const d=window.innerWidth,g=window.innerHeight,i=d*.15,o=g*.15;return c<i||c>d-i||s<o||s>g-o}function ne(c,s){const d=window.innerWidth,g=window.innerHeight,i=d*.15,o=g*.15;let a=0;c<i?a=-((i-c)/i)*F:c>d-i&&(a=(c-(d-i))/i*F);let v=0;return s<o?v=-((o-s)/o)*F:s>g-o&&(v=(s-(g-o))/o*F),{vx:a,vy:v}}function pe(c,s,d,g){const i=window.innerWidth,o=window.innerHeight,a=i*.15,v=o*.15,H=d<a?1+(a-d)/a*3:d>i-a?1+(d-(i-a))/a*3:1,r=g<v?1+(v-g)/v*3:g>o-v?1+(g-(o-v))/v*3:1;return{vx:-c*H,vy:-s*r}}function te(){const c=globalThis.crypto;return c?.randomUUID?c.randomUUID():c?.getRandomValues?Array.from(c.getRandomValues(new Uint32Array(16)),s=>s.toString(32).padStart(2,"0")).join(""):`${Date.now().toString(32)}-${Math.random().toString(32).slice(2)}`}function T(c,s){if(c)return c;if(s)return W(ee,{url:s})}function R(c){if(c)try{return new URL(c).hostname}catch{return c}}function le({onMouseDown:c,onTouchStart:s,dropEndCallback:d,style:g,navigationTitle:i,targetComponent:o,containerName:a,children:v,className:H,dropDocumentOutsideOption:r,screenKey:k,isBlockingActiveInput:X=!1,customData:E={},scrollTargetRef:_,...z}){const[K,V]=J();S(()=>{V(k||te())},[k]);const f=m(null),w=m({vx:0,vy:0}),y=m(null),n=m(null),b=m(null),x=m(null),$=m(""),U=m(null),C=m(null),D=m({x:0,y:0}),P=m(!1),L=e=>{C.current=e,U.current==null&&(U.current=requestAnimationFrame(()=>{C.current&&Q.next(C.current),C.current=null,U.current=null}))};S(()=>()=>{U.current!=null&&cancelAnimationFrame(U.current)},[]);const{handleStart:Y,handleMove:G,handleEnd:B}=Z({isBlockingActiveInput:X}),I=e=>{let l=!1,t=0,u=0;if(e.type==="touchmove"){const h=e.touches[0];t=h.clientX,u=h.clientY}else{const h=e;t=h.clientX,u=h.clientY}const{vx:M,vy:A}=ne(t,u),q=M!==0||A!==0;if(l=re(t,u),n.current?.isConnected&&!q&&(e.preventDefault(),f.current&&(cancelAnimationFrame(f.current),f.current=null)),n.current?.isConnected&&q&&(e.preventDefault(),w.current={vx:M,vy:A},!f.current)){const h=()=>{const p=_?.current??document.scrollingElement;if(p?.scrollBy?p.scrollBy(w.current.vx,w.current.vy):window.scrollBy(w.current.vx,w.current.vy),w.current.vx===0&&w.current.vy===0){f.current=null;return}f.current=requestAnimationFrame(h)};f.current=requestAnimationFrame(h)}e.type!=="touchmove"&&e.preventDefault(),G({event:e,notDragCallback:({x:h,y:p})=>{n.current&&n.current.remove()},dragStartCallback:({x:h,y:p})=>{n.current&&(navigator.vibrate(100),n.current.style.transform=`translate3d(${h-(b.current||0)/2}px, ${p-(x.current||0)/2}px, 0)`)},moveingCallback:({x:h,y:p})=>{D.current={x:h,y:p},n.current?.isConnected&&(n.current.style.transform=`translate3d(${h-(b.current||0)/2}px, ${p-(x.current||0)/2}px, 0)`),L({isDragging:!0,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:h,y:p,containerName:a,dropDocumentOutsideOption:r,customData:E})}})},j=e=>{f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),w.current={vx:0,vy:0},(e.type==="blur"||e.type==="touchcancel"||e.type==="pointercancel")&&n.current&&n.current.remove(),B({event:e,dragEndCallback:({x:l,y:t})=>{if(P.current){P.current=!1,n.current&&n.current.remove(),L({isDragging:!1,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,customData:E});return}const u=$.current;if(n.current&&n.current.remove(),r&&O({x:l,y:t}))if(r.isNewTap||!r.widthRatio&&!r.heightRatio)window.open(u,"_blank");else{const M=window.innerWidth*(r.widthRatio||1),A=window.innerHeight*(r.heightRatio||1);window.open(u,"_blank",`width=${M},height=${A},left=${window.screenLeft-l*-1-M},top=${window.screenTop+t}`)}L({isDragging:!1,isDrop:!0,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,dropEndCallback:d,screenKey:K,customData:E})}})};return S(()=>{if(y.current){const e=y.current.cloneNode(!0),l=y.current.getBoundingClientRect();if(e.style.width=l.width+"px",e.style.height=l.height+"px",e.style.opacity="0.3",e.style.backdropFilter="blur(6px)",b.current=l.width,x.current=l.height,r?.openUrl){$.current=r.openUrl;const u=document.createElement("span");u.textContent=$.current,e.prepend(u)}const t=document.createElement("span");t.textContent=i??R(r?.openUrl)??"",e.prepend(t),e.style.position="fixed",e.style.left="0px",e.style.top="0px",e.style.margin="0px",e.style.willChange="transform",e.style.transform="translate3d(-9999px, -9999px, 0)",e.style.pointerEvents="none",n.current=e,n.current.classList.add(N["flex-split-screen-drag-box-clone"])}},[]),S(()=>{const e=["mousemove","touchmove"],l=["mouseup","touchend","touchcancel","pointerup","pointercancel","blur"];return e.forEach(t=>{window.addEventListener(t,I,{passive:!1})}),l.forEach(t=>{window.addEventListener(t,j)}),()=>{e.forEach(t=>{window.removeEventListener(t,I)}),l.forEach(t=>{window.removeEventListener(t,j)})}},[E,o,r,K,X,a,i,d]),S(()=>{const e=y.current;if(!e)return;const l=t=>t.preventDefault();return e.addEventListener("contextmenu",l),()=>{e.removeEventListener("contextmenu",l)}},[]),S(()=>()=>{f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),w.current={vx:0,vy:0},n.current?.remove()},[]),S(()=>{const e=l=>{if(l.key!=="Escape"||!n.current?.isConnected)return;l.preventDefault(),l.stopPropagation(),P.current=!0,f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),w.current={vx:0,vy:0},n.current?.remove(),B({event:new Event("pointercancel"),dragEndCallback:()=>{}});const{x:t,y:u}=D.current;L({isDragging:!1,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:t,y:u,containerName:a,dropDocumentOutsideOption:r,customData:E})};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[B,a,i,r,o,E]),W(ce,{children:W("div",{className:`${H||""} ${N["flex-split-screen-drag-box"]}`,ref:y,onContextMenu:e=>e.preventDefault(),onMouseDown:e=>{c&&Promise.resolve().then(()=>c(e)),Y({event:e,dragStartCallback:({x:l,y:t})=>{if(D.current={x:l,y:t},n.current&&(document.body.appendChild(n.current),y.current)){const u=y.current.getBoundingClientRect();n.current.style.width=u.width+"px",n.current.style.height=u.height+"px",b.current=u.width,x.current=u.height}n.current?.isConnected&&(navigator.vibrate(100),n.current.style.transform=`translate3d(${l-(b.current||0)/2}px, ${t-(x.current||0)/2}px, 0)`),L({isDragging:!0,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,customData:E})}})},onTouchStart:e=>{s&&Promise.resolve().then(()=>s(e)),Y({event:e,dragStartCallback:({x:l,y:t})=>{if(n.current&&(document.body.appendChild(n.current),y.current)){const u=y.current.getBoundingClientRect();n.current.style.width=u.width+"px",n.current.style.height=u.height+"px",b.current=u.width,x.current=u.height}n.current?.isConnected&&(navigator.vibrate(100),n.current.style.transform=`translate3d(${l-(b.current||0)/2}px, ${t-(x.current||0)/2}px, 0)`),L({isDragging:!0,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,customData:E})}})},style:{...g},...z,children:v})})}export{le as default};
@@ -1,55 +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 FlexLayoutSplitScreenDragBoxContainer_exports = {};
31
- __export(FlexLayoutSplitScreenDragBoxContainer_exports, {
32
- default: () => FlexLayoutSplitScreenDragBoxContainer
33
- });
34
- module.exports = __toCommonJS(FlexLayoutSplitScreenDragBoxContainer_exports);
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_FlexLayout = __toESM(require("../styles/FlexLayout.module.css"), 1);
37
- var import_FlexLayoutSplitScreenScrollBox = __toESM(require("./FlexLayoutSplitScreenScrollBox"), 1);
38
- function FlexLayoutSplitScreenDragBoxContainer({
39
- className,
40
- children,
41
- layoutName,
42
- ...props
43
- }) {
44
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
- import_FlexLayoutSplitScreenScrollBox.default,
46
- {
47
- keyName: layoutName,
48
- className: `${import_FlexLayout.default["flex-split-screen-drag-box-title-container"]} ${className && className !== "" && className || ""}`,
49
- direction: "x",
50
- ...props,
51
- children
52
- }
53
- );
54
- }
55
- //# sourceMappingURL=FlexLayoutSplitScreenDragBoxContainer.cjs.map
1
+ "use strict";"use client";var u=Object.create;var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var m=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of y(t))!f.call(e,o)&&o!==r&&n(e,o,{get:()=>t[o],enumerable:!(i=s(t,o))||i.enumerable});return e};var a=(e,t,r)=>(r=e!=null?u(L(e)):{},l(t||!e||!e.__esModule?n(r,"default",{value:e,enumerable:!0}):r,e)),g=e=>l(n({},"__esModule",{value:!0}),e);var B={};m(B,{default:()=>S});module.exports=g(B);var c=require("react/jsx-runtime"),x=a(require("../styles/FlexLayout.module.css"),1),p=a(require("./FlexLayoutSplitScreenScrollBox"),1);function S({className:e,children:t,layoutName:r,...i}){return(0,c.jsx)(p.default,{keyName:r,className:`${x.default["flex-split-screen-drag-box-title-container"]} ${e&&e!==""&&e||""}`,direction:"x",...i,children:t})}
@@ -1,25 +1 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import styles from "../styles/FlexLayout.module.css";
4
- import FlexLayoutSplitScreenScrollBox from "./FlexLayoutSplitScreenScrollBox";
5
- function FlexLayoutSplitScreenDragBoxContainer({
6
- className,
7
- children,
8
- layoutName,
9
- ...props
10
- }) {
11
- return /* @__PURE__ */ jsx(
12
- FlexLayoutSplitScreenScrollBox,
13
- {
14
- keyName: layoutName,
15
- className: `${styles["flex-split-screen-drag-box-title-container"]} ${className && className !== "" && className || ""}`,
16
- direction: "x",
17
- ...props,
18
- children
19
- }
20
- );
21
- }
22
- export {
23
- FlexLayoutSplitScreenDragBoxContainer as default
24
- };
25
- //# sourceMappingURL=FlexLayoutSplitScreenDragBoxContainer.js.map
1
+ "use client";import{jsx as a}from"react/jsx-runtime";import i from"../styles/FlexLayout.module.css";import n from"./FlexLayoutSplitScreenScrollBox";function l({className:e,children:t,layoutName:r,...o}){return a(n,{keyName:r,className:`${i["flex-split-screen-drag-box-title-container"]} ${e&&e!==""&&e||""}`,direction:"x",...o,children:t})}export{l as default};
@@ -1,63 +1 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var FlexLayoutSplitScreenDragBoxItem_exports = {};
30
- __export(FlexLayoutSplitScreenDragBoxItem_exports, {
31
- default: () => FlexLayoutSplitScreenDragBoxItem
32
- });
33
- module.exports = __toCommonJS(FlexLayoutSplitScreenDragBoxItem_exports);
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var import_react = require("react");
36
- var import_useDrag = require("../hooks/useDrag");
37
- var import_FlexLayout = __toESM(require("../styles/FlexLayout.module.css"), 1);
38
- function FlexLayoutSplitScreenDragBoxItem({
39
- children,
40
- onClose,
41
- isActive,
42
- ...props
43
- }) {
44
- (0, import_react.useEffect)(() => {
45
- import_useDrag.allSplitScreenCount.next(import_useDrag.allSplitScreenCount.value + 1);
46
- return () => {
47
- if (import_useDrag.allSplitScreenCount.value <= 1) return;
48
- import_useDrag.allSplitScreenCount.next(import_useDrag.allSplitScreenCount.value - 1);
49
- };
50
- }, []);
51
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
52
- "div",
53
- {
54
- className: `${import_FlexLayout.default["flex-split-screen-drag-box-title-item"]} ${isActive ? import_FlexLayout.default["active"] : ""}`,
55
- ...props,
56
- children: [
57
- children,
58
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: (ev) => onClose(ev), children: "X" })
59
- ]
60
- }
61
- );
62
- }
63
- //# sourceMappingURL=FlexLayoutSplitScreenDragBoxItem.cjs.map
1
+ "use strict";var x=Object.create;var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var y=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},p=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of S(t))!v.call(e,r)&&r!==o&&i(e,r,{get:()=>t[r],enumerable:!(n=s(t,r))||n.enumerable});return e};var d=(e,t,o)=>(o=e!=null?x(f(e)):{},p(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),g=e=>p(i({},"__esModule",{value:!0}),e);var B={};y(B,{default:()=>m});module.exports=g(B);var a=require("react/jsx-runtime"),c=require("react"),l=require("../hooks/useDrag"),u=d(require("../styles/FlexLayout.module.css"),1);function m({children:e,onClose:t,isActive:o,...n}){return(0,c.useEffect)(()=>(l.allSplitScreenCount.next(l.allSplitScreenCount.value+1),()=>{l.allSplitScreenCount.value<=1||l.allSplitScreenCount.next(l.allSplitScreenCount.value-1)}),[]),(0,a.jsxs)("div",{className:`${u.default["flex-split-screen-drag-box-title-item"]} ${o?u.default.active:""}`,...n,children:[e,(0,a.jsx)("button",{type:"button",onClick:r=>t(r),children:"X"})]})}