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