@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.
- package/dist/flex-layout/components/FlexLayout.cjs +1 -110
- package/dist/flex-layout/components/FlexLayout.js +1 -85
- package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -262
- package/dist/flex-layout/components/FlexLayoutContainer.js +1 -232
- 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.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.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.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 +473 -416
- 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.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,229 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState
|
|
7
|
-
} from "react";
|
|
8
|
-
function clamp(n, min, max) {
|
|
9
|
-
return Math.max(min, Math.min(max, n));
|
|
10
|
-
}
|
|
11
|
-
function pickDefaultScrollRoot() {
|
|
12
|
-
if (typeof document === "undefined") return null;
|
|
13
|
-
let el = document.body;
|
|
14
|
-
while (el && el !== document.documentElement && el !== document.body) {
|
|
15
|
-
const style = getComputedStyle(el);
|
|
16
|
-
const oy = style.overflowY;
|
|
17
|
-
const ox = style.overflowX;
|
|
18
|
-
const scrollable = oy === "auto" || oy === "scroll" || ox === "auto" || ox === "scroll";
|
|
19
|
-
if (scrollable) return el;
|
|
20
|
-
el = el.parentElement;
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
function isVerticalScroll(root) {
|
|
25
|
-
if (typeof window == "undefined") return true;
|
|
26
|
-
if (!root) {
|
|
27
|
-
return document.documentElement.scrollHeight > window.innerHeight + 1;
|
|
28
|
-
}
|
|
29
|
-
const el = root;
|
|
30
|
-
return el.scrollHeight > el.clientHeight + 1;
|
|
31
|
-
}
|
|
32
|
-
const dpr = typeof window != "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
33
|
-
function quantizeToDevicePixel(n) {
|
|
34
|
-
return Math.round(n * dpr) / dpr;
|
|
35
|
-
}
|
|
36
|
-
const FlexLayoutStickyBox = ({
|
|
37
|
-
edge = "auto",
|
|
38
|
-
offset = 16,
|
|
39
|
-
scrollRoot = null,
|
|
40
|
-
debug = false,
|
|
41
|
-
children,
|
|
42
|
-
style,
|
|
43
|
-
className,
|
|
44
|
-
transitionDurationMs = 200,
|
|
45
|
-
onTranslateChange = () => {
|
|
46
|
-
},
|
|
47
|
-
...rest
|
|
48
|
-
}) => {
|
|
49
|
-
const offsetRef = useRef(offset);
|
|
50
|
-
const rootRef = useRef(null);
|
|
51
|
-
const contentRef = useRef(null);
|
|
52
|
-
const mutatingRef = useRef(false);
|
|
53
|
-
const lastOffsetRef = useRef(0);
|
|
54
|
-
const [resolvedEdge, setResolvedEdge] = useState("top");
|
|
55
|
-
const rafId = useRef(null);
|
|
56
|
-
const [contentDynamicStyle, setContentDynamicStyle] = useState({});
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
setContentDynamicStyle({
|
|
59
|
-
willChange: "transform",
|
|
60
|
-
transition: `transform ${transitionDurationMs}ms linear`
|
|
61
|
-
});
|
|
62
|
-
}, [transitionDurationMs]);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
offsetRef.current = offset;
|
|
65
|
-
scheduleUpdate();
|
|
66
|
-
}, [offset]);
|
|
67
|
-
const [ioRoot, setIoRoot] = useState(null);
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
const root = scrollRoot ?? pickDefaultScrollRoot();
|
|
70
|
-
setResolvedEdge(
|
|
71
|
-
edge === "auto" ? isVerticalScroll(root) ? "top" : "left" : edge
|
|
72
|
-
);
|
|
73
|
-
setIoRoot(root);
|
|
74
|
-
}, [edge, scrollRoot]);
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (edge !== "auto") {
|
|
77
|
-
setResolvedEdge(edge);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const vertical = isVerticalScroll(ioRoot);
|
|
81
|
-
setResolvedEdge(vertical ? "top" : "left");
|
|
82
|
-
}, [edge, ioRoot]);
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
}, []);
|
|
85
|
-
const scheduleUpdate = () => {
|
|
86
|
-
if (rafId.current != null) return;
|
|
87
|
-
rafId.current = requestAnimationFrame(() => {
|
|
88
|
-
rafId.current = null;
|
|
89
|
-
doUpdate();
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
const doUpdate = () => {
|
|
93
|
-
if (mutatingRef.current) return;
|
|
94
|
-
mutatingRef.current = true;
|
|
95
|
-
const rootEl = rootRef.current;
|
|
96
|
-
const contentEl = contentRef.current;
|
|
97
|
-
if (!rootEl || !contentEl) {
|
|
98
|
-
mutatingRef.current = false;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const parentEl = rootEl.parentElement;
|
|
102
|
-
if (!parentEl) {
|
|
103
|
-
mutatingRef.current = false;
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const rootBounds = ioRoot && "getBoundingClientRect" in ioRoot ? ioRoot.getBoundingClientRect() : new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
107
|
-
const parentRect = parentEl.getBoundingClientRect();
|
|
108
|
-
const contentRect = contentEl.getBoundingClientRect();
|
|
109
|
-
let newOffset = 0;
|
|
110
|
-
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
111
|
-
const maxTranslate = Math.max(
|
|
112
|
-
0,
|
|
113
|
-
parentRect.height - contentRect.height
|
|
114
|
-
);
|
|
115
|
-
let desiredTop = 0;
|
|
116
|
-
if (resolvedEdge === "top") {
|
|
117
|
-
desiredTop = rootBounds.top + offsetRef.current - parentRect.top;
|
|
118
|
-
} else {
|
|
119
|
-
const targetBottomFromParentTop = Math.min(
|
|
120
|
-
parentRect.bottom,
|
|
121
|
-
rootBounds.bottom - offsetRef.current
|
|
122
|
-
) - parentRect.top;
|
|
123
|
-
desiredTop = targetBottomFromParentTop - contentRect.height;
|
|
124
|
-
}
|
|
125
|
-
newOffset = clamp(desiredTop, 0, maxTranslate);
|
|
126
|
-
} else {
|
|
127
|
-
const maxTranslate = Math.max(
|
|
128
|
-
0,
|
|
129
|
-
parentRect.width - contentRect.width
|
|
130
|
-
);
|
|
131
|
-
let desiredLeft = 0;
|
|
132
|
-
if (resolvedEdge === "left") {
|
|
133
|
-
desiredLeft = rootBounds.left + offsetRef.current - parentRect.left;
|
|
134
|
-
} else {
|
|
135
|
-
const targetRightFromParentLeft = Math.min(
|
|
136
|
-
parentRect.right,
|
|
137
|
-
rootBounds.right - offsetRef.current
|
|
138
|
-
) - parentRect.left;
|
|
139
|
-
desiredLeft = targetRightFromParentLeft - contentRect.width;
|
|
140
|
-
}
|
|
141
|
-
newOffset = clamp(desiredLeft, 0, maxTranslate);
|
|
142
|
-
}
|
|
143
|
-
const nextOffset = quantizeToDevicePixel(newOffset);
|
|
144
|
-
if (Math.abs(lastOffsetRef.current - nextOffset) > 0.5) {
|
|
145
|
-
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
146
|
-
contentEl.style.transform = `translateY(${nextOffset}px)`;
|
|
147
|
-
} else {
|
|
148
|
-
contentEl.style.transform = `translateX(${nextOffset}px)`;
|
|
149
|
-
}
|
|
150
|
-
lastOffsetRef.current = nextOffset;
|
|
151
|
-
onTranslateChange(nextOffset, rootRef, contentRef);
|
|
152
|
-
}
|
|
153
|
-
if (debug) {
|
|
154
|
-
rootEl.style.outline = "1px dashed rgba(0,0,0,.2)";
|
|
155
|
-
contentEl.style.outline = "1px solid rgba(0,128,255,.35)";
|
|
156
|
-
}
|
|
157
|
-
queueMicrotask(() => {
|
|
158
|
-
mutatingRef.current = false;
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
useEffect(() => {
|
|
162
|
-
if (typeof window == "undefined") return;
|
|
163
|
-
const rootEl = rootRef.current;
|
|
164
|
-
if (!rootEl) return;
|
|
165
|
-
const parentEl = rootEl.parentElement;
|
|
166
|
-
console.log(parentEl);
|
|
167
|
-
if (!parentEl) return;
|
|
168
|
-
const targets = [parentEl];
|
|
169
|
-
const observerCallback = () => {
|
|
170
|
-
if (!mutatingRef.current) scheduleUpdate();
|
|
171
|
-
};
|
|
172
|
-
const io = new IntersectionObserver(observerCallback, {
|
|
173
|
-
root: ioRoot instanceof Element ? ioRoot : null,
|
|
174
|
-
threshold: 0,
|
|
175
|
-
rootMargin: "1px"
|
|
176
|
-
});
|
|
177
|
-
const ro = new ResizeObserver(observerCallback);
|
|
178
|
-
targets.forEach((t) => io.observe(t));
|
|
179
|
-
ro.observe(parentEl);
|
|
180
|
-
if (contentRef.current) {
|
|
181
|
-
ro.observe(contentRef.current);
|
|
182
|
-
}
|
|
183
|
-
const scrollTarget = ioRoot || window;
|
|
184
|
-
scrollTarget.addEventListener("scroll", scheduleUpdate, {
|
|
185
|
-
passive: true
|
|
186
|
-
});
|
|
187
|
-
window.addEventListener("resize", scheduleUpdate);
|
|
188
|
-
scheduleUpdate();
|
|
189
|
-
return () => {
|
|
190
|
-
io.disconnect();
|
|
191
|
-
ro.disconnect();
|
|
192
|
-
scrollTarget.removeEventListener("scroll", scheduleUpdate);
|
|
193
|
-
window.removeEventListener("resize", scheduleUpdate);
|
|
194
|
-
if (rafId.current != null) {
|
|
195
|
-
cancelAnimationFrame(rafId.current);
|
|
196
|
-
rafId.current = null;
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
}, [ioRoot, resolvedEdge, offset, debug]);
|
|
200
|
-
return /* @__PURE__ */ jsx(
|
|
201
|
-
"div",
|
|
202
|
-
{
|
|
203
|
-
ref: rootRef,
|
|
204
|
-
className,
|
|
205
|
-
style: {
|
|
206
|
-
display: "block",
|
|
207
|
-
minWidth: 0,
|
|
208
|
-
minHeight: 0,
|
|
209
|
-
height: "100%",
|
|
210
|
-
// 부모 높이를 채우도록 설정
|
|
211
|
-
...style
|
|
212
|
-
},
|
|
213
|
-
...rest,
|
|
214
|
-
children: /* @__PURE__ */ jsx(
|
|
215
|
-
"div",
|
|
216
|
-
{
|
|
217
|
-
ref: contentRef,
|
|
218
|
-
style: contentDynamicStyle,
|
|
219
|
-
children
|
|
220
|
-
}
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
};
|
|
225
|
-
var FlexLayoutStickyBox_default = FlexLayoutStickyBox;
|
|
226
|
-
export {
|
|
227
|
-
FlexLayoutStickyBox_default as default
|
|
228
|
-
};
|
|
229
|
-
//# sourceMappingURL=FlexLayoutStickyBox.js.map
|
|
1
|
+
"use client";import{jsx as D}from"react/jsx-runtime";import{useEffect as g,useRef as b,useState as L}from"react";function C(e,t,c){return Math.max(t,Math.min(c,e))}function j(){if(typeof document>"u")return null;let e=document.body;for(;e&&e!==document.documentElement&&e!==document.body;){const t=getComputedStyle(e),c=t.overflowY,E=t.overflowX;if(c==="auto"||c==="scroll"||E==="auto"||E==="scroll")return e;e=e.parentElement}return null}function F(e){if(typeof window>"u")return!0;if(!e)return document.documentElement.scrollHeight>window.innerHeight+1;const t=e;return t.scrollHeight>t.clientHeight+1}const B=typeof window<"u"&&window.devicePixelRatio||1;function U(e){return Math.round(e*B)/B}const W=({edge:e="auto",offset:t=16,scrollRoot:c=null,debug:E=!1,children:T,style:P,className:O,transitionDurationMs:S=200,onTranslateChange:k=()=>{},...z})=>{const v=b(t),R=b(null),w=b(null),m=b(!1),H=b(0),[s,x]=L("top"),p=b(null),[A,q]=L({});g(()=>{q({willChange:"transform",transition:`transform ${S}ms linear`})},[S]),g(()=>{v.current=t,u()},[t]);const[l,I]=L(null);g(()=>{const n=c??j();x(e==="auto"?F(n)?"top":"left":e),I(n)},[e,c]),g(()=>{if(e!=="auto"){x(e);return}const n=F(l);x(n?"top":"left")},[e,l]),g(()=>{},[]);const u=()=>{p.current==null&&(p.current=requestAnimationFrame(()=>{p.current=null,N()}))},N=()=>{if(m.current)return;m.current=!0;const n=R.current,r=w.current;if(!n||!r){m.current=!1;return}const y=n.parentElement;if(!y){m.current=!1;return}const a=l&&"getBoundingClientRect"in l?l.getBoundingClientRect():new DOMRect(0,0,window.innerWidth,window.innerHeight),o=y.getBoundingClientRect(),i=r.getBoundingClientRect();let h=0;if(s==="top"||s==="bottom"){const M=Math.max(0,o.height-i.height);let d=0;s==="top"?d=a.top+v.current-o.top:d=Math.min(o.bottom,a.bottom-v.current)-o.top-i.height,h=C(d,0,M)}else{const M=Math.max(0,o.width-i.width);let d=0;s==="left"?d=a.left+v.current-o.left:d=Math.min(o.right,a.right-v.current)-o.left-i.width,h=C(d,0,M)}const f=U(h);Math.abs(H.current-f)>.5&&(s==="top"||s==="bottom"?r.style.transform=`translateY(${f}px)`:r.style.transform=`translateX(${f}px)`,H.current=f,k(f,R,w)),E&&(n.style.outline="1px dashed rgba(0,0,0,.2)",r.style.outline="1px solid rgba(0,128,255,.35)"),queueMicrotask(()=>{m.current=!1})};return g(()=>{if(typeof window>"u")return;const n=R.current;if(!n)return;const r=n.parentElement;if(console.log(r),!r)return;const y=[r],a=()=>{m.current||u()},o=new IntersectionObserver(a,{root:l instanceof Element?l:null,threshold:0,rootMargin:"1px"}),i=new ResizeObserver(a);y.forEach(f=>o.observe(f)),i.observe(r),w.current&&i.observe(w.current);const h=l||window;return h.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),u(),()=>{o.disconnect(),i.disconnect(),h.removeEventListener("scroll",u),window.removeEventListener("resize",u),p.current!=null&&(cancelAnimationFrame(p.current),p.current=null)}},[l,s,t,E]),D("div",{ref:R,className:O,style:{display:"block",minWidth:0,minHeight:0,height:"100%",...P},...z,children:D("div",{ref:w,style:A,children:T})})};var Q=W;export{Q as default};
|
|
@@ -1,57 +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 components_exports = {};
|
|
30
|
-
__export(components_exports, {
|
|
31
|
-
FlexLayout: () => import_FlexLayout.default,
|
|
32
|
-
FlexLayoutContainer: () => import_FlexLayoutContainer.default,
|
|
33
|
-
FlexLayoutResizePanel: () => import_FlexLayoutResizePanel.default,
|
|
34
|
-
FlexLayoutSplitScreen: () => import_FlexLayoutSplitScreen.default,
|
|
35
|
-
FlexLayoutSplitScreenDragBox: () => import_FlexLayoutSplitScreenDragBox.default,
|
|
36
|
-
FlexLayoutSplitScreenScrollBox: () => import_FlexLayoutSplitScreenScrollBox.default,
|
|
37
|
-
FlexLayoutStickyBox: () => import_FlexLayoutStickyBox.default
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(components_exports);
|
|
40
|
-
var import_FlexLayout = __toESM(require("./FlexLayout"), 1);
|
|
41
|
-
var import_FlexLayoutContainer = __toESM(require("./FlexLayoutContainer"), 1);
|
|
42
|
-
var import_FlexLayoutResizePanel = __toESM(require("./FlexLayoutResizePanel"), 1);
|
|
43
|
-
var import_FlexLayoutSplitScreen = __toESM(require("./FlexLayoutSplitScreen"), 1);
|
|
44
|
-
var import_FlexLayoutSplitScreenDragBox = __toESM(require("./FlexLayoutSplitScreenDragBox"), 1);
|
|
45
|
-
var import_FlexLayoutSplitScreenScrollBox = __toESM(require("./FlexLayoutSplitScreenScrollBox"), 1);
|
|
46
|
-
var import_FlexLayoutStickyBox = __toESM(require("./FlexLayoutStickyBox"), 1);
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
FlexLayout,
|
|
50
|
-
FlexLayoutContainer,
|
|
51
|
-
FlexLayoutResizePanel,
|
|
52
|
-
FlexLayoutSplitScreen,
|
|
53
|
-
FlexLayoutSplitScreenDragBox,
|
|
54
|
-
FlexLayoutSplitScreenScrollBox,
|
|
55
|
-
FlexLayoutStickyBox
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var F=Object.create;var r=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var n=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var B=(e,o)=>{for(var t in o)r(e,t,{get:o[t],enumerable:!0})},f=(e,o,t,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of i(o))!c.call(e,l)&&l!==t&&r(e,l,{get:()=>o[l],enumerable:!(x=L(o,l))||x.enumerable});return e};var a=(e,o,t)=>(t=e!=null?F(n(e)):{},f(o||!e||!e.__esModule?r(t,"default",{value:e,enumerable:!0}):t,e)),g=e=>f(r({},"__esModule",{value:!0}),e);var k={};B(k,{FlexLayout:()=>u.default,FlexLayoutContainer:()=>p.default,FlexLayoutResizePanel:()=>s.default,FlexLayoutSplitScreen:()=>y.default,FlexLayoutSplitScreenDragBox:()=>S.default,FlexLayoutSplitScreenScrollBox:()=>d.default,FlexLayoutStickyBox:()=>m.default});module.exports=g(k);var u=a(require("./FlexLayout"),1),p=a(require("./FlexLayoutContainer"),1),s=a(require("./FlexLayoutResizePanel"),1),y=a(require("./FlexLayoutSplitScreen"),1),S=a(require("./FlexLayoutSplitScreenDragBox"),1),d=a(require("./FlexLayoutSplitScreenScrollBox"),1),m=a(require("./FlexLayoutStickyBox"),1);0&&(module.exports={FlexLayout,FlexLayoutContainer,FlexLayoutResizePanel,FlexLayoutSplitScreen,FlexLayoutSplitScreenDragBox,FlexLayoutSplitScreenScrollBox,FlexLayoutStickyBox});
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { default as default3 } from "./FlexLayoutContainer";
|
|
3
|
-
import { default as default4 } from "./FlexLayoutResizePanel";
|
|
4
|
-
import { default as default5 } from "./FlexLayoutSplitScreen";
|
|
5
|
-
import { default as default6 } from "./FlexLayoutSplitScreenDragBox";
|
|
6
|
-
import { default as default7 } from "./FlexLayoutSplitScreenScrollBox";
|
|
7
|
-
import { default as default8 } from "./FlexLayoutStickyBox";
|
|
8
|
-
export {
|
|
9
|
-
default2 as FlexLayout,
|
|
10
|
-
default3 as FlexLayoutContainer,
|
|
11
|
-
default4 as FlexLayoutResizePanel,
|
|
12
|
-
default5 as FlexLayoutSplitScreen,
|
|
13
|
-
default6 as FlexLayoutSplitScreenDragBox,
|
|
14
|
-
default7 as FlexLayoutSplitScreenScrollBox,
|
|
15
|
-
default8 as FlexLayoutStickyBox
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{default as t}from"./FlexLayout";import{default as l}from"./FlexLayoutContainer";import{default as x}from"./FlexLayoutResizePanel";import{default as u}from"./FlexLayoutSplitScreen";import{default as s}from"./FlexLayoutSplitScreenDragBox";import{default as S}from"./FlexLayoutSplitScreenScrollBox";import{default as m}from"./FlexLayoutStickyBox";export{t as FlexLayout,l as FlexLayoutContainer,x as FlexLayoutResizePanel,u as FlexLayoutSplitScreen,s as FlexLayoutSplitScreenDragBox,S as FlexLayoutSplitScreenScrollBox,m as FlexLayoutStickyBox};
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var hooks_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(hooks_exports);
|
|
18
|
-
__reExport(hooks_exports, require("./useDrag"), module.exports);
|
|
19
|
-
__reExport(hooks_exports, require("./useListPaging"), module.exports);
|
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
-
0 && (module.exports = {
|
|
22
|
-
...require("./useDrag"),
|
|
23
|
-
...require("./useListPaging")
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var t=(r,o,p,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let m of c(o))!d.call(r,m)&&m!==p&&a(r,m,{get:()=>o[m],enumerable:!(x=b(o,m))||x.enumerable});return r},f=(r,o,p)=>(t(r,o,"default"),p&&t(p,o,"default"));var g=r=>t(a({},"__esModule",{value:!0}),r);var e={};module.exports=g(e);f(e,require("./useDrag"),module.exports);f(e,require("./useListPaging"),module.exports);0&&(module.exports={...require("./useDrag"),...require("./useListPaging")});
|
|
@@ -1,289 +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 useDrag_exports = {};
|
|
30
|
-
__export(useDrag_exports, {
|
|
31
|
-
allSplitScreenCount: () => allSplitScreenCount,
|
|
32
|
-
dragState: () => dragState,
|
|
33
|
-
dragStateSubject: () => dragStateSubject,
|
|
34
|
-
dropMovementEventSubject: () => dropMovementEventSubject,
|
|
35
|
-
folderEventSubject: () => folderEventSubject,
|
|
36
|
-
isResizingSubject: () => isResizingSubject,
|
|
37
|
-
setFolderEvent: () => setFolderEvent,
|
|
38
|
-
useDragCapture: () => useDragCapture,
|
|
39
|
-
useDragEvents: () => useDragEvents,
|
|
40
|
-
useFolderEvent: () => useFolderEvent
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(useDrag_exports);
|
|
43
|
-
var import_fast_deep_equal = __toESM(require("fast-deep-equal"), 1);
|
|
44
|
-
var import_react = require("react");
|
|
45
|
-
var import_rxjs = require("rxjs");
|
|
46
|
-
var import_FlexLayoutUtils = require("../utils/FlexLayoutUtils");
|
|
47
|
-
const dragStateSubject = new import_rxjs.Subject();
|
|
48
|
-
const dragState = dragStateSubject;
|
|
49
|
-
const isResizingSubject = new import_rxjs.BehaviorSubject(false);
|
|
50
|
-
const filterChildren = (obj) => {
|
|
51
|
-
const { children, ...rest } = obj || {};
|
|
52
|
-
return rest;
|
|
53
|
-
};
|
|
54
|
-
const useDragCapture = (targetRef) => {
|
|
55
|
-
const [state, setState] = (0, import_react.useState)(null);
|
|
56
|
-
(0, import_react.useEffect)(() => {
|
|
57
|
-
const subscription = dragStateSubject.pipe(
|
|
58
|
-
(0, import_rxjs.auditTime)(0, import_rxjs.animationFrameScheduler),
|
|
59
|
-
(0, import_rxjs.map)((value) => {
|
|
60
|
-
if (!targetRef || !targetRef.current) return null;
|
|
61
|
-
const { x, y } = value;
|
|
62
|
-
const rect = targetRef.current.getBoundingClientRect();
|
|
63
|
-
const {
|
|
64
|
-
width,
|
|
65
|
-
height,
|
|
66
|
-
x: rectX,
|
|
67
|
-
y: rectY,
|
|
68
|
-
right,
|
|
69
|
-
bottom
|
|
70
|
-
} = rect;
|
|
71
|
-
let isOver = false;
|
|
72
|
-
if (x < rectX || x > right || y < rectY || y > bottom) {
|
|
73
|
-
isOver = true;
|
|
74
|
-
}
|
|
75
|
-
const leftBoundary = rectX + width * 0.2;
|
|
76
|
-
const rightBoundary = right - width * 0.2;
|
|
77
|
-
const topBoundary = rectY + height * 0.2;
|
|
78
|
-
const bottomBoundary = bottom - height * 0.2;
|
|
79
|
-
let position = "centerBoundary";
|
|
80
|
-
if (x < leftBoundary) {
|
|
81
|
-
position = "leftBoundary";
|
|
82
|
-
} else if (x > rightBoundary) {
|
|
83
|
-
position = "rightBoundary";
|
|
84
|
-
} else if (y < topBoundary) {
|
|
85
|
-
position = "topBoundary";
|
|
86
|
-
} else if (y > bottomBoundary) {
|
|
87
|
-
position = "bottomBoundary";
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
positionName: position,
|
|
91
|
-
isOver,
|
|
92
|
-
...value
|
|
93
|
-
};
|
|
94
|
-
}),
|
|
95
|
-
(0, import_rxjs.distinctUntilChanged)((prev, curr) => {
|
|
96
|
-
const { children: prevChildren, ..._prev } = prev || {};
|
|
97
|
-
const { children: currChildren, ..._curr } = curr || {};
|
|
98
|
-
return (0, import_fast_deep_equal.default)(filterChildren(_prev), filterChildren(_curr));
|
|
99
|
-
})
|
|
100
|
-
).subscribe({
|
|
101
|
-
next: setState,
|
|
102
|
-
error: (err) => console.error(err)
|
|
103
|
-
});
|
|
104
|
-
return () => subscription.unsubscribe();
|
|
105
|
-
}, [targetRef]);
|
|
106
|
-
return state;
|
|
107
|
-
};
|
|
108
|
-
const dropMovementEventSubject = new import_rxjs.Subject();
|
|
109
|
-
const allSplitScreenCount = new import_rxjs.BehaviorSubject(0);
|
|
110
|
-
const useDragEvents = ({
|
|
111
|
-
isBlockingActiveInput = false
|
|
112
|
-
}) => {
|
|
113
|
-
const dragResumeTimer = (0, import_react.useRef)(null);
|
|
114
|
-
const dragStartDelayTimer = (0, import_react.useRef)(
|
|
115
|
-
null
|
|
116
|
-
);
|
|
117
|
-
const scrollThreshold = 10;
|
|
118
|
-
const isScrolling = (0, import_react.useRef)(false);
|
|
119
|
-
const isPending = (0, import_react.useRef)(false);
|
|
120
|
-
const isMouseDown = (0, import_react.useRef)(false);
|
|
121
|
-
const isDragging = (0, import_react.useRef)(false);
|
|
122
|
-
const touchStartX = (0, import_react.useRef)(0);
|
|
123
|
-
const touchStartY = (0, import_react.useRef)(0);
|
|
124
|
-
(0, import_react.useEffect)(() => {
|
|
125
|
-
return () => {
|
|
126
|
-
if (dragResumeTimer.current) {
|
|
127
|
-
clearTimeout(dragResumeTimer.current);
|
|
128
|
-
dragResumeTimer.current = null;
|
|
129
|
-
}
|
|
130
|
-
if (dragStartDelayTimer.current) {
|
|
131
|
-
clearTimeout(dragStartDelayTimer.current);
|
|
132
|
-
dragStartDelayTimer.current = null;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}, []);
|
|
136
|
-
const handleStart = (0, import_react.useCallback)(
|
|
137
|
-
({
|
|
138
|
-
event: _event,
|
|
139
|
-
dragStartCallback
|
|
140
|
-
}) => {
|
|
141
|
-
const event = _event instanceof Event ? _event : _event.nativeEvent;
|
|
142
|
-
if (dragResumeTimer.current) {
|
|
143
|
-
clearTimeout(dragResumeTimer.current);
|
|
144
|
-
dragResumeTimer.current = null;
|
|
145
|
-
}
|
|
146
|
-
if (dragStartDelayTimer.current) {
|
|
147
|
-
clearTimeout(dragStartDelayTimer.current);
|
|
148
|
-
dragStartDelayTimer.current = null;
|
|
149
|
-
}
|
|
150
|
-
if (event.target.contentEditable === "true" || isBlockingActiveInput && document.activeElement === event.target) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (event.cancelable && !(event instanceof globalThis.TouchEvent)) {
|
|
154
|
-
event.preventDefault();
|
|
155
|
-
}
|
|
156
|
-
isPending.current = true;
|
|
157
|
-
isMouseDown.current = true;
|
|
158
|
-
isScrolling.current = false;
|
|
159
|
-
const xy = (0, import_FlexLayoutUtils.getClientXy)(event);
|
|
160
|
-
if (!xy) return;
|
|
161
|
-
touchStartX.current = xy.clientX;
|
|
162
|
-
touchStartY.current = xy.clientY;
|
|
163
|
-
if (event.type.toLowerCase().startsWith("touch") || event instanceof globalThis.TouchEvent) {
|
|
164
|
-
isPending.current = false;
|
|
165
|
-
isDragging.current = true;
|
|
166
|
-
dragStartCallback({ x: xy.clientX, y: xy.clientY });
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
dragStartDelayTimer.current = setTimeout(() => {
|
|
170
|
-
if (!isPending.current || isScrolling.current) return;
|
|
171
|
-
isPending.current = false;
|
|
172
|
-
isDragging.current = true;
|
|
173
|
-
const xy2 = (0, import_FlexLayoutUtils.getClientXy)(event);
|
|
174
|
-
if (!xy2) return;
|
|
175
|
-
const { clientX, clientY } = xy2;
|
|
176
|
-
dragStartCallback({ x: clientX, y: clientY });
|
|
177
|
-
}, 300);
|
|
178
|
-
},
|
|
179
|
-
[isBlockingActiveInput]
|
|
180
|
-
);
|
|
181
|
-
const handleMove = (0, import_react.useCallback)(
|
|
182
|
-
({
|
|
183
|
-
event: _event,
|
|
184
|
-
notDragCallback,
|
|
185
|
-
dragStartCallback,
|
|
186
|
-
moveingCallback
|
|
187
|
-
}) => {
|
|
188
|
-
if (!isMouseDown.current) return;
|
|
189
|
-
const event = _event instanceof Event ? _event : _event.nativeEvent;
|
|
190
|
-
const xy = (0, import_FlexLayoutUtils.getClientXy)(event);
|
|
191
|
-
if (!xy) return;
|
|
192
|
-
const { clientX, clientY } = xy;
|
|
193
|
-
const deltaX = Math.abs(clientX - touchStartX.current);
|
|
194
|
-
const deltaY = Math.abs(clientY - touchStartY.current);
|
|
195
|
-
if (isPending.current && (event.type.toLowerCase().startsWith("touch") || event instanceof globalThis.TouchEvent) && (deltaX > scrollThreshold || deltaY > scrollThreshold)) {
|
|
196
|
-
if (dragStartDelayTimer.current) {
|
|
197
|
-
clearTimeout(dragStartDelayTimer.current);
|
|
198
|
-
dragStartDelayTimer.current = null;
|
|
199
|
-
}
|
|
200
|
-
isScrolling.current = true;
|
|
201
|
-
isPending.current = false;
|
|
202
|
-
isDragging.current = false;
|
|
203
|
-
if (notDragCallback)
|
|
204
|
-
notDragCallback({ x: clientX, y: clientY });
|
|
205
|
-
if (dragResumeTimer.current) {
|
|
206
|
-
clearTimeout(dragResumeTimer.current);
|
|
207
|
-
dragResumeTimer.current = null;
|
|
208
|
-
}
|
|
209
|
-
dragResumeTimer.current = setTimeout(() => {
|
|
210
|
-
if (!isMouseDown.current) return;
|
|
211
|
-
touchStartX.current = clientX;
|
|
212
|
-
touchStartY.current = clientY;
|
|
213
|
-
isPending.current = true;
|
|
214
|
-
isScrolling.current = false;
|
|
215
|
-
handleStart({ event: _event, dragStartCallback });
|
|
216
|
-
}, 400);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (!isDragging.current || isPending.current) return;
|
|
220
|
-
moveingCallback({ x: clientX, y: clientY });
|
|
221
|
-
},
|
|
222
|
-
[isBlockingActiveInput]
|
|
223
|
-
);
|
|
224
|
-
const handleEnd = (0, import_react.useCallback)(
|
|
225
|
-
({
|
|
226
|
-
event: _event,
|
|
227
|
-
dragEndCallback
|
|
228
|
-
}) => {
|
|
229
|
-
isScrolling.current = false;
|
|
230
|
-
isMouseDown.current = false;
|
|
231
|
-
if (isPending.current) {
|
|
232
|
-
isPending.current = false;
|
|
233
|
-
if (dragStartDelayTimer.current) {
|
|
234
|
-
clearTimeout(dragStartDelayTimer.current);
|
|
235
|
-
dragStartDelayTimer.current = null;
|
|
236
|
-
}
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
const event = _event instanceof Event ? _event : _event.nativeEvent;
|
|
240
|
-
if (!isDragging.current) return;
|
|
241
|
-
isDragging.current = false;
|
|
242
|
-
const xy = (0, import_FlexLayoutUtils.getClientXy)(event);
|
|
243
|
-
if (!xy) return;
|
|
244
|
-
const { clientX, clientY } = xy;
|
|
245
|
-
dragEndCallback({ x: clientX, y: clientY });
|
|
246
|
-
},
|
|
247
|
-
[isBlockingActiveInput]
|
|
248
|
-
);
|
|
249
|
-
return {
|
|
250
|
-
handleStart,
|
|
251
|
-
handleMove,
|
|
252
|
-
handleEnd
|
|
253
|
-
};
|
|
254
|
-
};
|
|
255
|
-
const folderEventSubject = new import_rxjs.Subject();
|
|
256
|
-
const setFolderEvent = (newValue) => {
|
|
257
|
-
folderEventSubject.next(newValue);
|
|
258
|
-
};
|
|
259
|
-
const useFolderEvent = () => {
|
|
260
|
-
const [folderEvent, setFolderEvent2] = (0, import_react.useState)(
|
|
261
|
-
null
|
|
262
|
-
);
|
|
263
|
-
(0, import_react.useEffect)(() => {
|
|
264
|
-
const subscription = folderEventSubject.subscribe((e) => {
|
|
265
|
-
if (!e) return;
|
|
266
|
-
setFolderEvent2(e);
|
|
267
|
-
});
|
|
268
|
-
return () => {
|
|
269
|
-
if (subscription) {
|
|
270
|
-
subscription.unsubscribe();
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
}, []);
|
|
274
|
-
return { folderEvent };
|
|
275
|
-
};
|
|
276
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
277
|
-
0 && (module.exports = {
|
|
278
|
-
allSplitScreenCount,
|
|
279
|
-
dragState,
|
|
280
|
-
dragStateSubject,
|
|
281
|
-
dropMovementEventSubject,
|
|
282
|
-
folderEventSubject,
|
|
283
|
-
isResizingSubject,
|
|
284
|
-
setFolderEvent,
|
|
285
|
-
useDragCapture,
|
|
286
|
-
useDragEvents,
|
|
287
|
-
useFolderEvent
|
|
288
|
-
});
|
|
289
|
-
//# sourceMappingURL=useDrag.cjs.map
|
|
1
|
+
"use strict";var j=Object.create;var S=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var L=(e,n)=>{for(var t in n)S(e,t,{get:n[t],enumerable:!0})},O=(e,n,t,m)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of F(n))!P.call(e,o)&&o!==t&&S(e,o,{get:()=>n[o],enumerable:!(m=X(n,o))||m.enumerable});return e};var z=(e,n,t)=>(t=e!=null?j(Y(e)):{},O(n||!e||!e.__esModule?S(t,"default",{value:e,enumerable:!0}):t,e)),k=e=>O(S({},"__esModule",{value:!0}),e);var Q={};L(Q,{allSplitScreenCount:()=>U,dragState:()=>H,dragStateSubject:()=>C,dropMovementEventSubject:()=>q,folderEventSubject:()=>N,isResizingSubject:()=>I,resizeDragSubject:()=>K,setFolderEvent:()=>G,useDragCapture:()=>W,useDragEvents:()=>V,useFolderEvent:()=>J});module.exports=k(Q);var B=z(require("fast-deep-equal"),1),r=require("react"),c=require("rxjs"),x=require("../utils/FlexLayoutUtils");const C=new c.Subject,H=C,I=new c.BehaviorSubject(!1),K=new c.Subject,R=e=>{const{children:n,...t}=e||{};return t},W=e=>{const[n,t]=(0,r.useState)(null);return(0,r.useEffect)(()=>{const m=C.pipe((0,c.auditTime)(0,c.animationFrameScheduler),(0,c.map)(o=>{if(!e||!e.current)return null;const{x:u,y:p}=o,d=e.current.getBoundingClientRect(),{width:v,height:b,x:E,y:T,right:h,bottom:i}=d;let f=!1;(u<E||u>h||p<T||p>i)&&(f=!0);const a=E+v*.2,s=h-v*.2,y=T+b*.2,g=i-b*.2;let l="centerBoundary";return u<a?l="leftBoundary":u>s?l="rightBoundary":p<y?l="topBoundary":p>g&&(l="bottomBoundary"),{positionName:l,isOver:f,...o}}),(0,c.distinctUntilChanged)((o,u)=>{const{children:p,...d}=o||{},{children:v,...b}=u||{};return(0,B.default)(R(d),R(b))})).subscribe({next:t,error:o=>console.error(o)});return()=>m.unsubscribe()},[e]),n},q=new c.Subject,U=new c.BehaviorSubject(0),V=({isBlockingActiveInput:e=!1})=>{const n=(0,r.useRef)(null),t=(0,r.useRef)(null),m=10,o=(0,r.useRef)(!1),u=(0,r.useRef)(!1),p=(0,r.useRef)(!1),d=(0,r.useRef)(!1),v=(0,r.useRef)(0),b=(0,r.useRef)(0);(0,r.useEffect)(()=>()=>{n.current&&(clearTimeout(n.current),n.current=null),t.current&&(clearTimeout(t.current),t.current=null)},[]);const E=(0,r.useCallback)(({event:i,dragStartCallback:f})=>{const a=i instanceof Event?i:i.nativeEvent;if(n.current&&(clearTimeout(n.current),n.current=null),t.current&&(clearTimeout(t.current),t.current=null),a.target.contentEditable==="true"||e&&document.activeElement===a.target)return;a.cancelable&&!(a instanceof globalThis.TouchEvent)&&a.preventDefault(),u.current=!0,p.current=!0,o.current=!1;const s=(0,x.getClientXy)(a);if(s){if(v.current=s.clientX,b.current=s.clientY,a.type.toLowerCase().startsWith("touch")||a instanceof globalThis.TouchEvent){u.current=!1,d.current=!0,f({x:s.clientX,y:s.clientY});return}t.current=setTimeout(()=>{if(!u.current||o.current)return;u.current=!1,d.current=!0;const y=(0,x.getClientXy)(a);if(!y)return;const{clientX:g,clientY:l}=y;f({x:g,y:l})},300)}},[e]),T=(0,r.useCallback)(({event:i,notDragCallback:f,dragStartCallback:a,moveingCallback:s})=>{if(!p.current)return;const y=i instanceof Event?i:i.nativeEvent,g=(0,x.getClientXy)(y);if(!g)return;const{clientX:l,clientY:D}=g,M=Math.abs(l-v.current),w=Math.abs(D-b.current);if(u.current&&(y.type.toLowerCase().startsWith("touch")||y instanceof globalThis.TouchEvent)&&(M>m||w>m)){t.current&&(clearTimeout(t.current),t.current=null),o.current=!0,u.current=!1,d.current=!1,f&&f({x:l,y:D}),n.current&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{p.current&&(v.current=l,b.current=D,u.current=!0,o.current=!1,E({event:i,dragStartCallback:a}))},400);return}!d.current||u.current||s({x:l,y:D})},[e]),h=(0,r.useCallback)(({event:i,dragEndCallback:f})=>{if(o.current=!1,p.current=!1,u.current){u.current=!1,t.current&&(clearTimeout(t.current),t.current=null);return}const a=i instanceof Event?i:i.nativeEvent;if(!d.current)return;d.current=!1;const s=(0,x.getClientXy)(a);if(!s)return;const{clientX:y,clientY:g}=s;f({x:y,y:g})},[e]);return{handleStart:E,handleMove:T,handleEnd:h}},N=new c.Subject,G=e=>{N.next(e)},J=()=>{const[e,n]=(0,r.useState)(null);return(0,r.useEffect)(()=>{const t=N.subscribe(m=>{m&&n(m)});return()=>{t&&t.unsubscribe()}},[]),{folderEvent:e}};0&&(module.exports={allSplitScreenCount,dragState,dragStateSubject,dropMovementEventSubject,folderEventSubject,isResizingSubject,resizeDragSubject,setFolderEvent,useDragCapture,useDragEvents,useFolderEvent});
|
|
@@ -23,12 +23,27 @@ export interface DragStateResultType extends DragStateType {
|
|
|
23
23
|
positionName: PositionName;
|
|
24
24
|
isOver: boolean;
|
|
25
25
|
}
|
|
26
|
+
export type ResizeDragEvent = {
|
|
27
|
+
type: "START";
|
|
28
|
+
sessionId: string;
|
|
29
|
+
targets: string[];
|
|
30
|
+
cursor?: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: "MOVE";
|
|
33
|
+
sessionId: string;
|
|
34
|
+
movementX: number;
|
|
35
|
+
movementY: number;
|
|
36
|
+
} | {
|
|
37
|
+
type: "END";
|
|
38
|
+
sessionId: string;
|
|
39
|
+
};
|
|
26
40
|
export declare const dragStateSubject: Subject<DragStateType>;
|
|
27
41
|
/**
|
|
28
42
|
* @deprecated Use `dragStateSubject` instead. This alias will be removed in a future release.
|
|
29
43
|
*/
|
|
30
44
|
export declare const dragState: Subject<DragStateType>;
|
|
31
45
|
export declare const isResizingSubject: BehaviorSubject<boolean>;
|
|
46
|
+
export declare const resizeDragSubject: Subject<ResizeDragEvent>;
|
|
32
47
|
export declare const useDragCapture: (targetRef: RefObject<HTMLElement | null>) => DragStateResultType | null;
|
|
33
48
|
export interface DropTargetComponent {
|
|
34
49
|
containerName: string;
|