@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,33 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { allSplitScreenCount } from "../hooks/useDrag";
|
|
4
|
-
import styles from "../styles/FlexLayout.module.css";
|
|
5
|
-
function FlexLayoutSplitScreenDragBoxItem({
|
|
6
|
-
children,
|
|
7
|
-
onClose,
|
|
8
|
-
isActive,
|
|
9
|
-
...props
|
|
10
|
-
}) {
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
allSplitScreenCount.next(allSplitScreenCount.value + 1);
|
|
13
|
-
return () => {
|
|
14
|
-
if (allSplitScreenCount.value <= 1) return;
|
|
15
|
-
allSplitScreenCount.next(allSplitScreenCount.value - 1);
|
|
16
|
-
};
|
|
17
|
-
}, []);
|
|
18
|
-
return /* @__PURE__ */ jsxs(
|
|
19
|
-
"div",
|
|
20
|
-
{
|
|
21
|
-
className: `${styles["flex-split-screen-drag-box-title-item"]} ${isActive ? styles["active"] : ""}`,
|
|
22
|
-
...props,
|
|
23
|
-
children: [
|
|
24
|
-
children,
|
|
25
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: (ev) => onClose(ev), children: "X" })
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
FlexLayoutSplitScreenDragBoxItem as default
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxItem.js.map
|
|
1
|
+
import{jsx as p,jsxs as c}from"react/jsx-runtime";import{useEffect as a}from"react";import{allSplitScreenCount as e}from"../hooks/useDrag";import t from"../styles/FlexLayout.module.css";function u({children:o,onClose:r,isActive:l,...n}){return a(()=>(e.next(e.value+1),()=>{e.value<=1||e.next(e.value-1)}),[]),c("div",{className:`${t["flex-split-screen-drag-box-title-item"]} ${l?t.active:""}`,...n,children:[o,p("button",{type:"button",onClick:i=>r(i),children:"X"})]})}export{u as default};
|
|
@@ -1,53 +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 FlexLayoutSplitScreenDragBoxTitleMore_exports = {};
|
|
30
|
-
__export(FlexLayoutSplitScreenDragBoxTitleMore_exports, {
|
|
31
|
-
default: () => FlexLayoutSplitScreenDragBoxTitleMore
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(FlexLayoutSplitScreenDragBoxTitleMore_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var import_FlexLayout = __toESM(require("../styles/FlexLayout.module.css"), 1);
|
|
36
|
-
function FlexLayoutSplitScreenDragBoxTitleMore({
|
|
37
|
-
className,
|
|
38
|
-
...props
|
|
39
|
-
}) {
|
|
40
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
41
|
-
"button",
|
|
42
|
-
{
|
|
43
|
-
...props,
|
|
44
|
-
className: `${import_FlexLayout.default["flex-split-screen-drag-box-title-more"]} ${className || ""}`,
|
|
45
|
-
children: [
|
|
46
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "." }),
|
|
47
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "." }),
|
|
48
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "." })
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxTitleMore.cjs.map
|
|
1
|
+
"use strict";var u=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c(e))!f.call(t,n)&&n!==r&&l(t,n,{get:()=>e[n],enumerable:!(a=x(e,n))||a.enumerable});return t};var M=(t,e,r)=>(r=t!=null?u(m(t)):{},p(e||!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>p(l({},"__esModule",{value:!0}),t);var T={};L(T,{default:()=>i});module.exports=S(T);var o=require("react/jsx-runtime"),s=M(require("../styles/FlexLayout.module.css"),1);function i({className:t,...e}){return(0,o.jsxs)("button",{...e,className:`${s.default["flex-split-screen-drag-box-title-more"]} ${t||""}`,children:[(0,o.jsx)("span",{children:"."}),(0,o.jsx)("span",{children:"."}),(0,o.jsx)("span",{children:"."})]})}
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styles from "../styles/FlexLayout.module.css";
|
|
3
|
-
function FlexLayoutSplitScreenDragBoxTitleMore({
|
|
4
|
-
className,
|
|
5
|
-
...props
|
|
6
|
-
}) {
|
|
7
|
-
return /* @__PURE__ */ jsxs(
|
|
8
|
-
"button",
|
|
9
|
-
{
|
|
10
|
-
...props,
|
|
11
|
-
className: `${styles["flex-split-screen-drag-box-title-more"]} ${className || ""}`,
|
|
12
|
-
children: [
|
|
13
|
-
/* @__PURE__ */ jsx("span", { children: "." }),
|
|
14
|
-
/* @__PURE__ */ jsx("span", { children: "." }),
|
|
15
|
-
/* @__PURE__ */ jsx("span", { children: "." })
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
FlexLayoutSplitScreenDragBoxTitleMore as default
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxTitleMore.js.map
|
|
1
|
+
import{jsx as t,jsxs as l}from"react/jsx-runtime";import o from"../styles/FlexLayout.module.css";function n({className:e,...r}){return l("button",{...r,className:`${o["flex-split-screen-drag-box-title-more"]} ${e||""}`,children:[t("span",{children:"."}),t("span",{children:"."}),t("span",{children:"."})]})}export{n as default};
|
|
@@ -1,133 +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 FlexLayoutSplitScreenScrollBox_exports = {};
|
|
31
|
-
__export(FlexLayoutSplitScreenScrollBox_exports, {
|
|
32
|
-
default: () => FlexLayoutSplitScreenScrollBox_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(FlexLayoutSplitScreenScrollBox_exports);
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react = require("react");
|
|
37
|
-
var import_rxjs = require("rxjs");
|
|
38
|
-
var import_operators = require("rxjs/operators");
|
|
39
|
-
var import_FlexLayoutContainerStore = require("../store/FlexLayoutContainerStore");
|
|
40
|
-
var import_listScroll = __toESM(require("../styles/listScroll.module.css"), 1);
|
|
41
|
-
const FlexLayoutSplitScreenScrollBox = ({
|
|
42
|
-
className,
|
|
43
|
-
children,
|
|
44
|
-
keyName,
|
|
45
|
-
direction,
|
|
46
|
-
isDefaultScrollStyle = false,
|
|
47
|
-
...props
|
|
48
|
-
}) => {
|
|
49
|
-
const scrollRef = (0, import_react.useRef)(null);
|
|
50
|
-
const [isMouseDown, setIsMouseDown] = (0, import_react.useState)(false);
|
|
51
|
-
const scrollEventSubject = (0, import_react.useRef)(new import_rxjs.Subject());
|
|
52
|
-
(0, import_react.useEffect)(() => {
|
|
53
|
-
const mouseUpSubscribe = (0, import_rxjs.fromEvent)(
|
|
54
|
-
window,
|
|
55
|
-
"mouseup"
|
|
56
|
-
).subscribe(() => {
|
|
57
|
-
setIsMouseDown(false);
|
|
58
|
-
});
|
|
59
|
-
const scrollEventSubscribe = scrollEventSubject.current.pipe((0, import_operators.throttleTime)(70)).subscribe((position) => {
|
|
60
|
-
(0, import_FlexLayoutContainerStore.setScrollPosition)(keyName, position);
|
|
61
|
-
});
|
|
62
|
-
const scrollSubscribe = (0, import_FlexLayoutContainerStore.getScrollPosition)(keyName).pipe((0, import_operators.take)(1)).subscribe((position) => {
|
|
63
|
-
if (scrollRef.current && position) {
|
|
64
|
-
scrollRef.current.scrollLeft = position.x;
|
|
65
|
-
scrollRef.current.scrollTop = position.y;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return () => {
|
|
69
|
-
(0, import_FlexLayoutContainerStore.removeScrollPosition)(keyName);
|
|
70
|
-
mouseUpSubscribe.unsubscribe();
|
|
71
|
-
scrollSubscribe.unsubscribe();
|
|
72
|
-
scrollEventSubscribe.unsubscribe();
|
|
73
|
-
};
|
|
74
|
-
}, [keyName]);
|
|
75
|
-
(0, import_react.useEffect)(() => {
|
|
76
|
-
if (!scrollRef.current) return;
|
|
77
|
-
let animationFrameId = null;
|
|
78
|
-
const handleWheel = (event) => {
|
|
79
|
-
if (!scrollRef.current || direction !== "x") return;
|
|
80
|
-
if (scrollRef.current.matches(":hover")) {
|
|
81
|
-
event.preventDefault();
|
|
82
|
-
const { deltaY } = event;
|
|
83
|
-
const newScrollLeft = scrollRef.current.scrollLeft + deltaY;
|
|
84
|
-
if (animationFrameId) {
|
|
85
|
-
cancelAnimationFrame(animationFrameId);
|
|
86
|
-
}
|
|
87
|
-
animationFrameId = requestAnimationFrame(() => {
|
|
88
|
-
scrollRef.current.scrollLeft = newScrollLeft;
|
|
89
|
-
scrollEventSubject.current.next({
|
|
90
|
-
x: newScrollLeft,
|
|
91
|
-
y: scrollRef.current.scrollTop
|
|
92
|
-
});
|
|
93
|
-
animationFrameId = null;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
scrollRef.current.addEventListener("wheel", handleWheel, {
|
|
98
|
-
passive: false
|
|
99
|
-
});
|
|
100
|
-
return () => {
|
|
101
|
-
scrollRef.current?.removeEventListener("wheel", handleWheel);
|
|
102
|
-
};
|
|
103
|
-
}, []);
|
|
104
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
-
"div",
|
|
106
|
-
{
|
|
107
|
-
ref: scrollRef,
|
|
108
|
-
onMouseUp: () => setIsMouseDown(false),
|
|
109
|
-
onMouseDown: () => setIsMouseDown(true),
|
|
110
|
-
onMouseMove: (event) => {
|
|
111
|
-
if (!scrollRef.current || !isMouseDown || direction !== "x")
|
|
112
|
-
return;
|
|
113
|
-
scrollRef.current.scrollLeft += event.movementX * -1;
|
|
114
|
-
scrollEventSubject.current.next({
|
|
115
|
-
x: scrollRef.current.scrollLeft,
|
|
116
|
-
y: scrollRef.current.scrollTop
|
|
117
|
-
});
|
|
118
|
-
},
|
|
119
|
-
onScroll: () => {
|
|
120
|
-
if (!scrollRef.current) return;
|
|
121
|
-
scrollEventSubject.current.next({
|
|
122
|
-
x: scrollRef.current.scrollLeft,
|
|
123
|
-
y: scrollRef.current.scrollTop
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
className: `${className || ""} ${isDefaultScrollStyle ? import_listScroll.default["default-scroll"] : import_listScroll.default["list-scroll"]} ${direction ? import_listScroll.default[direction] : ""}`,
|
|
127
|
-
...props,
|
|
128
|
-
children
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
var FlexLayoutSplitScreenScrollBox_default = (0, import_react.memo)(FlexLayoutSplitScreenScrollBox);
|
|
133
|
-
//# sourceMappingURL=FlexLayoutSplitScreenScrollBox.cjs.map
|
|
1
|
+
"use strict";"use client";var F=Object.create;var S=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var D=(r,t)=>{for(var l in t)S(r,l,{get:t[l],enumerable:!0})},M=(r,t,l,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of h(t))!P.call(r,c)&&c!==l&&S(r,c,{get:()=>t[c],enumerable:!(s=T(t,c))||s.enumerable});return r};var A=(r,t,l)=>(l=r!=null?F(y(r)):{},M(t||!r||!r.__esModule?S(l,"default",{value:r,enumerable:!0}):l,r)),B=r=>M(S({},"__esModule",{value:!0}),r);var $={};D($,{default:()=>g});module.exports=B($);var E=require("react/jsx-runtime"),o=require("react"),p=require("rxjs"),x=require("rxjs/operators"),i=require("../store/FlexLayoutContainerStore"),b=A(require("../styles/listScroll.module.css"),1);const H=({className:r,children:t,keyName:l,direction:s,isDefaultScrollStyle:c=!1,...d})=>{const e=(0,o.useRef)(null),[w,v]=(0,o.useState)(!1),f=(0,o.useRef)(new p.Subject);return(0,o.useEffect)(()=>{const n=(0,p.fromEvent)(window,"mouseup").subscribe(()=>{v(!1)}),a=f.current.pipe((0,x.throttleTime)(70)).subscribe(u=>{(0,i.setScrollPosition)(l,u)}),m=(0,i.getScrollPosition)(l).pipe((0,x.take)(1)).subscribe(u=>{e.current&&u&&(e.current.scrollLeft=u.x,e.current.scrollTop=u.y)});return()=>{(0,i.removeScrollPosition)(l),n.unsubscribe(),m.unsubscribe(),a.unsubscribe()}},[l]),(0,o.useEffect)(()=>{if(!e.current)return;let n=null;const a=m=>{if(!(!e.current||s!=="x")&&e.current.matches(":hover")){m.preventDefault();const{deltaY:u}=m,L=e.current.scrollLeft+u;n&&cancelAnimationFrame(n),n=requestAnimationFrame(()=>{e.current.scrollLeft=L,f.current.next({x:L,y:e.current.scrollTop}),n=null})}};return e.current.addEventListener("wheel",a,{passive:!1}),()=>{e.current?.removeEventListener("wheel",a)}},[]),(0,E.jsx)("div",{ref:e,onMouseUp:()=>v(!1),onMouseDown:()=>v(!0),onMouseMove:n=>{!e.current||!w||s!=="x"||(e.current.scrollLeft+=n.movementX*-1,f.current.next({x:e.current.scrollLeft,y:e.current.scrollTop}))},onScroll:()=>{e.current&&f.current.next({x:e.current.scrollLeft,y:e.current.scrollTop})},className:`${r||""} ${c?b.default["default-scroll"]:b.default["list-scroll"]} ${s?b.default[s]:""}`,...d,children:t})};var g=(0,o.memo)(H);
|
|
@@ -1,107 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { memo, useEffect, useRef, useState } from "react";
|
|
4
|
-
import { fromEvent, Subject } from "rxjs";
|
|
5
|
-
import { take, throttleTime } from "rxjs/operators";
|
|
6
|
-
import {
|
|
7
|
-
getScrollPosition,
|
|
8
|
-
removeScrollPosition,
|
|
9
|
-
setScrollPosition
|
|
10
|
-
} from "../store/FlexLayoutContainerStore";
|
|
11
|
-
import listScroll from "../styles/listScroll.module.css";
|
|
12
|
-
const FlexLayoutSplitScreenScrollBox = ({
|
|
13
|
-
className,
|
|
14
|
-
children,
|
|
15
|
-
keyName,
|
|
16
|
-
direction,
|
|
17
|
-
isDefaultScrollStyle = false,
|
|
18
|
-
...props
|
|
19
|
-
}) => {
|
|
20
|
-
const scrollRef = useRef(null);
|
|
21
|
-
const [isMouseDown, setIsMouseDown] = useState(false);
|
|
22
|
-
const scrollEventSubject = useRef(new Subject());
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const mouseUpSubscribe = fromEvent(
|
|
25
|
-
window,
|
|
26
|
-
"mouseup"
|
|
27
|
-
).subscribe(() => {
|
|
28
|
-
setIsMouseDown(false);
|
|
29
|
-
});
|
|
30
|
-
const scrollEventSubscribe = scrollEventSubject.current.pipe(throttleTime(70)).subscribe((position) => {
|
|
31
|
-
setScrollPosition(keyName, position);
|
|
32
|
-
});
|
|
33
|
-
const scrollSubscribe = getScrollPosition(keyName).pipe(take(1)).subscribe((position) => {
|
|
34
|
-
if (scrollRef.current && position) {
|
|
35
|
-
scrollRef.current.scrollLeft = position.x;
|
|
36
|
-
scrollRef.current.scrollTop = position.y;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return () => {
|
|
40
|
-
removeScrollPosition(keyName);
|
|
41
|
-
mouseUpSubscribe.unsubscribe();
|
|
42
|
-
scrollSubscribe.unsubscribe();
|
|
43
|
-
scrollEventSubscribe.unsubscribe();
|
|
44
|
-
};
|
|
45
|
-
}, [keyName]);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!scrollRef.current) return;
|
|
48
|
-
let animationFrameId = null;
|
|
49
|
-
const handleWheel = (event) => {
|
|
50
|
-
if (!scrollRef.current || direction !== "x") return;
|
|
51
|
-
if (scrollRef.current.matches(":hover")) {
|
|
52
|
-
event.preventDefault();
|
|
53
|
-
const { deltaY } = event;
|
|
54
|
-
const newScrollLeft = scrollRef.current.scrollLeft + deltaY;
|
|
55
|
-
if (animationFrameId) {
|
|
56
|
-
cancelAnimationFrame(animationFrameId);
|
|
57
|
-
}
|
|
58
|
-
animationFrameId = requestAnimationFrame(() => {
|
|
59
|
-
scrollRef.current.scrollLeft = newScrollLeft;
|
|
60
|
-
scrollEventSubject.current.next({
|
|
61
|
-
x: newScrollLeft,
|
|
62
|
-
y: scrollRef.current.scrollTop
|
|
63
|
-
});
|
|
64
|
-
animationFrameId = null;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
scrollRef.current.addEventListener("wheel", handleWheel, {
|
|
69
|
-
passive: false
|
|
70
|
-
});
|
|
71
|
-
return () => {
|
|
72
|
-
scrollRef.current?.removeEventListener("wheel", handleWheel);
|
|
73
|
-
};
|
|
74
|
-
}, []);
|
|
75
|
-
return /* @__PURE__ */ jsx(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
ref: scrollRef,
|
|
79
|
-
onMouseUp: () => setIsMouseDown(false),
|
|
80
|
-
onMouseDown: () => setIsMouseDown(true),
|
|
81
|
-
onMouseMove: (event) => {
|
|
82
|
-
if (!scrollRef.current || !isMouseDown || direction !== "x")
|
|
83
|
-
return;
|
|
84
|
-
scrollRef.current.scrollLeft += event.movementX * -1;
|
|
85
|
-
scrollEventSubject.current.next({
|
|
86
|
-
x: scrollRef.current.scrollLeft,
|
|
87
|
-
y: scrollRef.current.scrollTop
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
onScroll: () => {
|
|
91
|
-
if (!scrollRef.current) return;
|
|
92
|
-
scrollEventSubject.current.next({
|
|
93
|
-
x: scrollRef.current.scrollLeft,
|
|
94
|
-
y: scrollRef.current.scrollTop
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
className: `${className || ""} ${isDefaultScrollStyle ? listScroll["default-scroll"] : listScroll["list-scroll"]} ${direction ? listScroll[direction] : ""}`,
|
|
98
|
-
...props,
|
|
99
|
-
children
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
var FlexLayoutSplitScreenScrollBox_default = memo(FlexLayoutSplitScreenScrollBox);
|
|
104
|
-
export {
|
|
105
|
-
FlexLayoutSplitScreenScrollBox_default as default
|
|
106
|
-
};
|
|
107
|
-
//# sourceMappingURL=FlexLayoutSplitScreenScrollBox.js.map
|
|
1
|
+
"use client";import{jsx as D}from"react/jsx-runtime";import{memo as L,useEffect as a,useRef as m,useState as M}from"react";import{fromEvent as E,Subject as d}from"rxjs";import{take as w,throttleTime as F}from"rxjs/operators";import{getScrollPosition as T,removeScrollPosition as h,setScrollPosition as y}from"../store/FlexLayoutContainerStore";import i from"../styles/listScroll.module.css";const P=({className:S,children:b,keyName:l,direction:o,isDefaultScrollStyle:p=!1,...x})=>{const e=m(null),[v,u]=M(!1),n=m(new d);return a(()=>{const r=E(window,"mouseup").subscribe(()=>{u(!1)}),s=n.current.pipe(F(70)).subscribe(t=>{y(l,t)}),c=T(l).pipe(w(1)).subscribe(t=>{e.current&&t&&(e.current.scrollLeft=t.x,e.current.scrollTop=t.y)});return()=>{h(l),r.unsubscribe(),c.unsubscribe(),s.unsubscribe()}},[l]),a(()=>{if(!e.current)return;let r=null;const s=c=>{if(!(!e.current||o!=="x")&&e.current.matches(":hover")){c.preventDefault();const{deltaY:t}=c,f=e.current.scrollLeft+t;r&&cancelAnimationFrame(r),r=requestAnimationFrame(()=>{e.current.scrollLeft=f,n.current.next({x:f,y:e.current.scrollTop}),r=null})}};return e.current.addEventListener("wheel",s,{passive:!1}),()=>{e.current?.removeEventListener("wheel",s)}},[]),D("div",{ref:e,onMouseUp:()=>u(!1),onMouseDown:()=>u(!0),onMouseMove:r=>{!e.current||!v||o!=="x"||(e.current.scrollLeft+=r.movementX*-1,n.current.next({x:e.current.scrollLeft,y:e.current.scrollTop}))},onScroll:()=>{e.current&&n.current.next({x:e.current.scrollLeft,y:e.current.scrollTop})},className:`${S||""} ${p?i["default-scroll"]:i["list-scroll"]} ${o?i[o]:""}`,...x,children:b})};var U=L(P);export{U as default};
|
|
@@ -1,245 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var FlexLayoutStickyBox_exports = {};
|
|
21
|
-
__export(FlexLayoutStickyBox_exports, {
|
|
22
|
-
default: () => FlexLayoutStickyBox_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(FlexLayoutStickyBox_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
function clamp(n, min, max) {
|
|
28
|
-
return Math.max(min, Math.min(max, n));
|
|
29
|
-
}
|
|
30
|
-
function pickDefaultScrollRoot() {
|
|
31
|
-
if (typeof document === "undefined") return null;
|
|
32
|
-
let el = document.body;
|
|
33
|
-
while (el && el !== document.documentElement && el !== document.body) {
|
|
34
|
-
const style = getComputedStyle(el);
|
|
35
|
-
const oy = style.overflowY;
|
|
36
|
-
const ox = style.overflowX;
|
|
37
|
-
const scrollable = oy === "auto" || oy === "scroll" || ox === "auto" || ox === "scroll";
|
|
38
|
-
if (scrollable) return el;
|
|
39
|
-
el = el.parentElement;
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
function isVerticalScroll(root) {
|
|
44
|
-
if (typeof window == "undefined") return true;
|
|
45
|
-
if (!root) {
|
|
46
|
-
return document.documentElement.scrollHeight > window.innerHeight + 1;
|
|
47
|
-
}
|
|
48
|
-
const el = root;
|
|
49
|
-
return el.scrollHeight > el.clientHeight + 1;
|
|
50
|
-
}
|
|
51
|
-
const dpr = typeof window != "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
52
|
-
function quantizeToDevicePixel(n) {
|
|
53
|
-
return Math.round(n * dpr) / dpr;
|
|
54
|
-
}
|
|
55
|
-
const FlexLayoutStickyBox = ({
|
|
56
|
-
edge = "auto",
|
|
57
|
-
offset = 16,
|
|
58
|
-
scrollRoot = null,
|
|
59
|
-
debug = false,
|
|
60
|
-
children,
|
|
61
|
-
style,
|
|
62
|
-
className,
|
|
63
|
-
transitionDurationMs = 200,
|
|
64
|
-
onTranslateChange = () => {
|
|
65
|
-
},
|
|
66
|
-
...rest
|
|
67
|
-
}) => {
|
|
68
|
-
const offsetRef = (0, import_react.useRef)(offset);
|
|
69
|
-
const rootRef = (0, import_react.useRef)(null);
|
|
70
|
-
const contentRef = (0, import_react.useRef)(null);
|
|
71
|
-
const mutatingRef = (0, import_react.useRef)(false);
|
|
72
|
-
const lastOffsetRef = (0, import_react.useRef)(0);
|
|
73
|
-
const [resolvedEdge, setResolvedEdge] = (0, import_react.useState)("top");
|
|
74
|
-
const rafId = (0, import_react.useRef)(null);
|
|
75
|
-
const [contentDynamicStyle, setContentDynamicStyle] = (0, import_react.useState)({});
|
|
76
|
-
(0, import_react.useEffect)(() => {
|
|
77
|
-
setContentDynamicStyle({
|
|
78
|
-
willChange: "transform",
|
|
79
|
-
transition: `transform ${transitionDurationMs}ms linear`
|
|
80
|
-
});
|
|
81
|
-
}, [transitionDurationMs]);
|
|
82
|
-
(0, import_react.useEffect)(() => {
|
|
83
|
-
offsetRef.current = offset;
|
|
84
|
-
scheduleUpdate();
|
|
85
|
-
}, [offset]);
|
|
86
|
-
const [ioRoot, setIoRoot] = (0, import_react.useState)(null);
|
|
87
|
-
(0, import_react.useEffect)(() => {
|
|
88
|
-
const root = scrollRoot ?? pickDefaultScrollRoot();
|
|
89
|
-
setResolvedEdge(
|
|
90
|
-
edge === "auto" ? isVerticalScroll(root) ? "top" : "left" : edge
|
|
91
|
-
);
|
|
92
|
-
setIoRoot(root);
|
|
93
|
-
}, [edge, scrollRoot]);
|
|
94
|
-
(0, import_react.useEffect)(() => {
|
|
95
|
-
if (edge !== "auto") {
|
|
96
|
-
setResolvedEdge(edge);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const vertical = isVerticalScroll(ioRoot);
|
|
100
|
-
setResolvedEdge(vertical ? "top" : "left");
|
|
101
|
-
}, [edge, ioRoot]);
|
|
102
|
-
(0, import_react.useEffect)(() => {
|
|
103
|
-
}, []);
|
|
104
|
-
const scheduleUpdate = () => {
|
|
105
|
-
if (rafId.current != null) return;
|
|
106
|
-
rafId.current = requestAnimationFrame(() => {
|
|
107
|
-
rafId.current = null;
|
|
108
|
-
doUpdate();
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
const doUpdate = () => {
|
|
112
|
-
if (mutatingRef.current) return;
|
|
113
|
-
mutatingRef.current = true;
|
|
114
|
-
const rootEl = rootRef.current;
|
|
115
|
-
const contentEl = contentRef.current;
|
|
116
|
-
if (!rootEl || !contentEl) {
|
|
117
|
-
mutatingRef.current = false;
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const parentEl = rootEl.parentElement;
|
|
121
|
-
if (!parentEl) {
|
|
122
|
-
mutatingRef.current = false;
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const rootBounds = ioRoot && "getBoundingClientRect" in ioRoot ? ioRoot.getBoundingClientRect() : new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
126
|
-
const parentRect = parentEl.getBoundingClientRect();
|
|
127
|
-
const contentRect = contentEl.getBoundingClientRect();
|
|
128
|
-
let newOffset = 0;
|
|
129
|
-
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
130
|
-
const maxTranslate = Math.max(
|
|
131
|
-
0,
|
|
132
|
-
parentRect.height - contentRect.height
|
|
133
|
-
);
|
|
134
|
-
let desiredTop = 0;
|
|
135
|
-
if (resolvedEdge === "top") {
|
|
136
|
-
desiredTop = rootBounds.top + offsetRef.current - parentRect.top;
|
|
137
|
-
} else {
|
|
138
|
-
const targetBottomFromParentTop = Math.min(
|
|
139
|
-
parentRect.bottom,
|
|
140
|
-
rootBounds.bottom - offsetRef.current
|
|
141
|
-
) - parentRect.top;
|
|
142
|
-
desiredTop = targetBottomFromParentTop - contentRect.height;
|
|
143
|
-
}
|
|
144
|
-
newOffset = clamp(desiredTop, 0, maxTranslate);
|
|
145
|
-
} else {
|
|
146
|
-
const maxTranslate = Math.max(
|
|
147
|
-
0,
|
|
148
|
-
parentRect.width - contentRect.width
|
|
149
|
-
);
|
|
150
|
-
let desiredLeft = 0;
|
|
151
|
-
if (resolvedEdge === "left") {
|
|
152
|
-
desiredLeft = rootBounds.left + offsetRef.current - parentRect.left;
|
|
153
|
-
} else {
|
|
154
|
-
const targetRightFromParentLeft = Math.min(
|
|
155
|
-
parentRect.right,
|
|
156
|
-
rootBounds.right - offsetRef.current
|
|
157
|
-
) - parentRect.left;
|
|
158
|
-
desiredLeft = targetRightFromParentLeft - contentRect.width;
|
|
159
|
-
}
|
|
160
|
-
newOffset = clamp(desiredLeft, 0, maxTranslate);
|
|
161
|
-
}
|
|
162
|
-
const nextOffset = quantizeToDevicePixel(newOffset);
|
|
163
|
-
if (Math.abs(lastOffsetRef.current - nextOffset) > 0.5) {
|
|
164
|
-
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
165
|
-
contentEl.style.transform = `translateY(${nextOffset}px)`;
|
|
166
|
-
} else {
|
|
167
|
-
contentEl.style.transform = `translateX(${nextOffset}px)`;
|
|
168
|
-
}
|
|
169
|
-
lastOffsetRef.current = nextOffset;
|
|
170
|
-
onTranslateChange(nextOffset, rootRef, contentRef);
|
|
171
|
-
}
|
|
172
|
-
if (debug) {
|
|
173
|
-
rootEl.style.outline = "1px dashed rgba(0,0,0,.2)";
|
|
174
|
-
contentEl.style.outline = "1px solid rgba(0,128,255,.35)";
|
|
175
|
-
}
|
|
176
|
-
queueMicrotask(() => {
|
|
177
|
-
mutatingRef.current = false;
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
(0, import_react.useEffect)(() => {
|
|
181
|
-
if (typeof window == "undefined") return;
|
|
182
|
-
const rootEl = rootRef.current;
|
|
183
|
-
if (!rootEl) return;
|
|
184
|
-
const parentEl = rootEl.parentElement;
|
|
185
|
-
console.log(parentEl);
|
|
186
|
-
if (!parentEl) return;
|
|
187
|
-
const targets = [parentEl];
|
|
188
|
-
const observerCallback = () => {
|
|
189
|
-
if (!mutatingRef.current) scheduleUpdate();
|
|
190
|
-
};
|
|
191
|
-
const io = new IntersectionObserver(observerCallback, {
|
|
192
|
-
root: ioRoot instanceof Element ? ioRoot : null,
|
|
193
|
-
threshold: 0,
|
|
194
|
-
rootMargin: "1px"
|
|
195
|
-
});
|
|
196
|
-
const ro = new ResizeObserver(observerCallback);
|
|
197
|
-
targets.forEach((t) => io.observe(t));
|
|
198
|
-
ro.observe(parentEl);
|
|
199
|
-
if (contentRef.current) {
|
|
200
|
-
ro.observe(contentRef.current);
|
|
201
|
-
}
|
|
202
|
-
const scrollTarget = ioRoot || window;
|
|
203
|
-
scrollTarget.addEventListener("scroll", scheduleUpdate, {
|
|
204
|
-
passive: true
|
|
205
|
-
});
|
|
206
|
-
window.addEventListener("resize", scheduleUpdate);
|
|
207
|
-
scheduleUpdate();
|
|
208
|
-
return () => {
|
|
209
|
-
io.disconnect();
|
|
210
|
-
ro.disconnect();
|
|
211
|
-
scrollTarget.removeEventListener("scroll", scheduleUpdate);
|
|
212
|
-
window.removeEventListener("resize", scheduleUpdate);
|
|
213
|
-
if (rafId.current != null) {
|
|
214
|
-
cancelAnimationFrame(rafId.current);
|
|
215
|
-
rafId.current = null;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
}, [ioRoot, resolvedEdge, offset, debug]);
|
|
219
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
220
|
-
"div",
|
|
221
|
-
{
|
|
222
|
-
ref: rootRef,
|
|
223
|
-
className,
|
|
224
|
-
style: {
|
|
225
|
-
display: "block",
|
|
226
|
-
minWidth: 0,
|
|
227
|
-
minHeight: 0,
|
|
228
|
-
height: "100%",
|
|
229
|
-
// 부모 높이를 채우도록 설정
|
|
230
|
-
...style
|
|
231
|
-
},
|
|
232
|
-
...rest,
|
|
233
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
234
|
-
"div",
|
|
235
|
-
{
|
|
236
|
-
ref: contentRef,
|
|
237
|
-
style: contentDynamicStyle,
|
|
238
|
-
children
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
);
|
|
243
|
-
};
|
|
244
|
-
var FlexLayoutStickyBox_default = FlexLayoutStickyBox;
|
|
245
|
-
//# sourceMappingURL=FlexLayoutStickyBox.cjs.map
|
|
1
|
+
"use strict";"use client";var L=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var W=(e,t)=>{for(var o in t)L(e,o,{get:t[o],enumerable:!0})},X=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of j(t))!U.call(e,u)&&u!==o&&L(e,u,{get:()=>t[u],enumerable:!(s=$(t,u))||s.enumerable});return e};var Y=e=>X(L({},"__esModule",{value:!0}),e);var Q={};W(Q,{default:()=>K});module.exports=Y(Q);var T=require("react/jsx-runtime"),n=require("react");function C(e,t,o){return Math.max(t,Math.min(o,e))}function V(){if(typeof document>"u")return null;let e=document.body;for(;e&&e!==document.documentElement&&e!==document.body;){const t=getComputedStyle(e),o=t.overflowY,s=t.overflowX;if(o==="auto"||o==="scroll"||s==="auto"||s==="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 G(e){return Math.round(e*B)/B}const J=({edge:e="auto",offset:t=16,scrollRoot:o=null,debug:s=!1,children:u,style:D,className:P,transitionDurationMs:S=200,onTranslateChange:O=()=>{},...k})=>{const v=(0,n.useRef)(t),R=(0,n.useRef)(null),w=(0,n.useRef)(null),g=(0,n.useRef)(!1),H=(0,n.useRef)(0),[f,x]=(0,n.useState)("top"),b=(0,n.useRef)(null),[z,A]=(0,n.useState)({});(0,n.useEffect)(()=>{A({willChange:"transform",transition:`transform ${S}ms linear`})},[S]),(0,n.useEffect)(()=>{v.current=t,d()},[t]);const[i,q]=(0,n.useState)(null);(0,n.useEffect)(()=>{const r=o??V();x(e==="auto"?F(r)?"top":"left":e),q(r)},[e,o]),(0,n.useEffect)(()=>{if(e!=="auto"){x(e);return}const r=F(i);x(r?"top":"left")},[e,i]),(0,n.useEffect)(()=>{},[]);const d=()=>{b.current==null&&(b.current=requestAnimationFrame(()=>{b.current=null,I()}))},I=()=>{if(g.current)return;g.current=!0;const r=R.current,c=w.current;if(!r||!c){g.current=!1;return}const y=r.parentElement;if(!y){g.current=!1;return}const m=i&&"getBoundingClientRect"in i?i.getBoundingClientRect():new DOMRect(0,0,window.innerWidth,window.innerHeight),l=y.getBoundingClientRect(),a=c.getBoundingClientRect();let E=0;if(f==="top"||f==="bottom"){const M=Math.max(0,l.height-a.height);let h=0;f==="top"?h=m.top+v.current-l.top:h=Math.min(l.bottom,m.bottom-v.current)-l.top-a.height,E=C(h,0,M)}else{const M=Math.max(0,l.width-a.width);let h=0;f==="left"?h=m.left+v.current-l.left:h=Math.min(l.right,m.right-v.current)-l.left-a.width,E=C(h,0,M)}const p=G(E);Math.abs(H.current-p)>.5&&(f==="top"||f==="bottom"?c.style.transform=`translateY(${p}px)`:c.style.transform=`translateX(${p}px)`,H.current=p,O(p,R,w)),s&&(r.style.outline="1px dashed rgba(0,0,0,.2)",c.style.outline="1px solid rgba(0,128,255,.35)"),queueMicrotask(()=>{g.current=!1})};return(0,n.useEffect)(()=>{if(typeof window>"u")return;const r=R.current;if(!r)return;const c=r.parentElement;if(!c)return;const y=[c],m=()=>{g.current||d()},l=new IntersectionObserver(m,{root:i instanceof Element?i:null,threshold:0,rootMargin:"1px"}),a=new ResizeObserver(m);y.forEach(p=>l.observe(p)),a.observe(c),w.current&&a.observe(w.current);const E=i||window;return E.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),d(),()=>{l.disconnect(),a.disconnect(),E.removeEventListener("scroll",d),window.removeEventListener("resize",d),b.current!=null&&(cancelAnimationFrame(b.current),b.current=null)}},[i,f,t,s]),(0,T.jsx)("div",{ref:R,className:P,style:{display:"block",minWidth:0,minHeight:0,height:"100%",...D},...k,children:(0,T.jsx)("div",{ref:w,style:z,children:u})})};var K=J;
|