@byeolnaerim/flex-layout 0.0.9 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/flex-layout/components/FlexLayout.cjs +1 -110
  2. package/dist/flex-layout/components/FlexLayout.d.ts +2 -1
  3. package/dist/flex-layout/components/FlexLayout.js +1 -85
  4. package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -262
  5. package/dist/flex-layout/components/FlexLayoutContainer.d.ts +1 -1
  6. package/dist/flex-layout/components/FlexLayoutContainer.js +1 -232
  7. package/dist/flex-layout/components/FlexLayoutDynamicHeight.cjs +1 -0
  8. package/dist/flex-layout/components/FlexLayoutDynamicHeight.d.ts +6 -0
  9. package/dist/flex-layout/components/FlexLayoutDynamicHeight.js +1 -0
  10. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -68
  11. package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -44
  12. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -246
  13. package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -216
  14. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1252
  15. package/dist/flex-layout/components/FlexLayoutSplitScreen.d.ts +14 -1
  16. package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1236
  17. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -532
  18. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -509
  19. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -55
  20. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
  21. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -63
  22. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -33
  23. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -53
  24. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -23
  25. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -133
  26. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -107
  27. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -245
  28. package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -229
  29. package/dist/flex-layout/components/index.cjs +1 -57
  30. package/dist/flex-layout/components/index.d.ts +1 -0
  31. package/dist/flex-layout/components/index.js +1 -17
  32. package/dist/flex-layout/hooks/index.cjs +1 -25
  33. package/dist/flex-layout/hooks/index.js +1 -3
  34. package/dist/flex-layout/hooks/useDrag.cjs +1 -289
  35. package/dist/flex-layout/hooks/useDrag.d.ts +15 -0
  36. package/dist/flex-layout/hooks/useDrag.js +1 -258
  37. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -139
  38. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -118
  39. package/dist/flex-layout/hooks/useListPaging.cjs +1 -212
  40. package/dist/flex-layout/hooks/useListPaging.js +1 -191
  41. package/dist/flex-layout/hooks/useSizes.cjs +1 -126
  42. package/dist/flex-layout/hooks/useSizes.d.ts +6 -3
  43. package/dist/flex-layout/hooks/useSizes.js +1 -101
  44. package/dist/flex-layout/index.cjs +1 -31
  45. package/dist/flex-layout/index.js +1 -6
  46. package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -49
  47. package/dist/flex-layout/providers/FlexLayoutContext.js +1 -24
  48. package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -276
  49. package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
  50. package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -263
  51. package/dist/flex-layout/providers/index.cjs +1 -23
  52. package/dist/flex-layout/providers/index.js +1 -2
  53. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -257
  54. package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -206
  55. package/dist/flex-layout/store/index.cjs +1 -23
  56. package/dist/flex-layout/store/index.js +1 -2
  57. package/dist/flex-layout/styles/FlexLayout.module.css +499 -416
  58. package/dist/flex-layout/styles/sentinelStyle.module.css +11 -0
  59. package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -17
  60. package/dist/flex-layout/types/FlexDirectionTypes.js +0 -1
  61. package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -17
  62. package/dist/flex-layout/types/FlexLayoutTypes.d.ts +38 -2
  63. package/dist/flex-layout/types/FlexLayoutTypes.js +0 -1
  64. package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -245
  65. package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -211
  66. package/dist/flex-layout/utils/index.cjs +1 -23
  67. package/dist/flex-layout/utils/index.js +1 -2
  68. package/dist/index.cjs +1 -23
  69. package/dist/index.js +1 -2
  70. package/dist/types/css.d.cjs +0 -1
  71. package/dist/types/css.d.js +0 -1
  72. package/package.json +116 -113
  73. package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
  74. package/dist/flex-layout/components/FlexLayout.js.map +0 -1
  75. package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
  76. package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
  77. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs.map +0 -1
  78. package/dist/flex-layout/components/FlexLayoutIFramePane.js.map +0 -1
  79. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
  80. package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
  81. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
  82. package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
  83. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
  84. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
  85. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
  86. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
  87. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
  88. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
  89. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
  90. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
  91. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
  92. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
  93. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
  94. package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
  95. package/dist/flex-layout/components/index.cjs.map +0 -1
  96. package/dist/flex-layout/components/index.js.map +0 -1
  97. package/dist/flex-layout/hooks/index.cjs.map +0 -1
  98. package/dist/flex-layout/hooks/index.js.map +0 -1
  99. package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
  100. package/dist/flex-layout/hooks/useDrag.js.map +0 -1
  101. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
  102. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
  103. package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
  104. package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
  105. package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
  106. package/dist/flex-layout/hooks/useSizes.js.map +0 -1
  107. package/dist/flex-layout/index.cjs.map +0 -1
  108. package/dist/flex-layout/index.js.map +0 -1
  109. package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
  110. package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
  111. package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
  112. package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
  113. package/dist/flex-layout/providers/index.cjs.map +0 -1
  114. package/dist/flex-layout/providers/index.js.map +0 -1
  115. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
  116. package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
  117. package/dist/flex-layout/store/index.cjs.map +0 -1
  118. package/dist/flex-layout/store/index.js.map +0 -1
  119. package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
  120. package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
  121. package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
  122. package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
  123. package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
  124. package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
  125. package/dist/flex-layout/utils/index.cjs.map +0 -1
  126. package/dist/flex-layout/utils/index.js.map +0 -1
  127. package/dist/index.cjs.map +0 -1
  128. package/dist/index.js.map +0 -1
  129. package/dist/metafile-cjs.json +0 -1
  130. package/dist/metafile-esm.json +0 -1
  131. package/dist/types/css.d.cjs.map +0 -1
  132. package/dist/types/css.d.js.map +0 -1
@@ -1,110 +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 FlexLayout_exports = {};
31
- __export(FlexLayout_exports, {
32
- default: () => FlexLayout
33
- });
34
- module.exports = __toCommonJS(FlexLayout_exports);
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_react = require("react");
37
- var import_FlexLayoutHooks = require("../providers/FlexLayoutHooks");
38
- var import_FlexLayout = __toESM(require("../styles/FlexLayout.module.css"), 1);
39
- var import_FlexLayoutContext = require("../providers/FlexLayoutContext");
40
- const withFlexLayout = (layoutName, fitContent, containerCount) => (WrappedComponent) => {
41
- if (WrappedComponent.type === import_react.Fragment || WrappedComponent.type === "div" || WrappedComponent.type === "span") {
42
- return WrappedComponent;
43
- }
44
- return (0, import_react.cloneElement)(WrappedComponent, {
45
- layoutName,
46
- fitContent,
47
- containerCount
48
- });
49
- };
50
- function FlexLayout({
51
- layoutName,
52
- direction,
53
- children,
54
- ref,
55
- className,
56
- panelClassName,
57
- panelMovementMode = "divorce",
58
- ...props
59
- }) {
60
- const containerCount = import_react.Children.count(children);
61
- const fitContent = direction === "row" ? "width" : "height";
62
- const isFragmentElement = (node) => (0, import_react.isValidElement)(node) && node.type === import_react.Fragment;
63
- const nodes = import_react.Children.toArray(children).flatMap(
64
- (node) => isFragmentElement(node) ? import_react.Children.toArray(node.props.children) : [node]
65
- );
66
- const flattenedChildren = nodes.filter(
67
- import_react.isValidElement
68
- );
69
- if (flattenedChildren.length === 0) {
70
- return null;
71
- }
72
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
- import_FlexLayoutContext.FlexLayoutProvider,
74
- {
75
- value: {
76
- layoutName,
77
- direction,
78
- panelMovementMode,
79
- panelClassName,
80
- containerCount,
81
- fitContent
82
- },
83
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
- "div",
85
- {
86
- className: `${import_FlexLayout.default["flex-layout"]} ${className && className !== "" ? className : ""}`,
87
- ...ref ? { ref } : {},
88
- ...props,
89
- "data-layout_name": layoutName,
90
- "data-direction": direction,
91
- children: flattenedChildren.map((child, index) => {
92
- if (!child || !(0, import_react.isValidElement)(child)) return null;
93
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
94
- child,
95
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
- import_FlexLayoutHooks.ContainerOpenCloseProvider,
97
- {
98
- layoutName,
99
- containerName: child.props.containerName,
100
- sizeName: fitContent
101
- }
102
- )
103
- ] }, index);
104
- })
105
- }
106
- )
107
- }
108
- ) });
109
- }
110
- //# sourceMappingURL=FlexLayout.cjs.map
1
+ "use strict";"use client";var T=Object.create;var m=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var k=(o,t)=>{for(var r in t)m(o,r,{get:t[r],enumerable:!0})},F=(o,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of H(t))!N.call(o,l)&&l!==r&&m(o,l,{get:()=>t[l],enumerable:!(i=D(t,l))||i.enumerable});return o};var A=(o,t,r)=>(r=o!=null?T(M(o)):{},F(t||!o||!o.__esModule?m(r,"default",{value:o,enumerable:!0}):r,o)),O=o=>F(m({},"__esModule",{value:!0}),o);var b={};k(b,{default:()=>$});module.exports=O(b);var a=require("react/jsx-runtime"),e=require("react"),C=require("../providers/FlexLayoutHooks"),L=A(require("../styles/FlexLayout.module.css"),1),v=require("../providers/FlexLayoutContext");const V=(0,e.forwardRef)(function({layoutName:t,direction:r,children:i,className:l,panelClassName:c,panelMovementMode:p="divorce",scrollMode:x,...E},u){const y=e.Children.count(i),s=r==="row"?"width":"height",g=(0,e.useRef)(null),d=(0,e.useCallback)(n=>{if(g.current=n,typeof u=="function"){u(n);return}u&&(u.current=n)},[u]),P=n=>(0,e.isValidElement)(n)&&n.type===e.Fragment,f=e.Children.toArray(i).flatMap(n=>P(n)?e.Children.toArray(n.props.children):[n]).filter(e.isValidElement),R=(0,e.useMemo)(()=>({layoutName:t,direction:r,panelMovementMode:p,panelClassName:c,containerCount:y,fitContent:s}),[t,r,p,c,y,s]);return f.length===0?null:(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(v.FlexLayoutProvider,{value:R,children:(0,a.jsx)("div",{ref:d,className:`${L.default["flex-layout"]} ${l&&l!==""?l:""}`,...E,"data-scroll-mode":x,"data-layout_name":t,"data-direction":r,children:f.map((n,h)=>!n||!(0,e.isValidElement)(n)?null:(0,a.jsxs)(e.Fragment,{children:[n,(0,a.jsx)(C.ContainerOpenCloseProvider,{layoutName:t,containerName:n.props.containerName,sizeName:s})]},n.props.containerName??h))})})})});var $=V;
@@ -1,2 +1,3 @@
1
1
  import { FlexLayoutProps } from "../types/FlexLayoutTypes";
2
- export default function FlexLayout({ layoutName, direction, children, ref, className, panelClassName, panelMovementMode, ...props }: FlexLayoutProps): import("react/jsx-runtime").JSX.Element | null;
2
+ declare const FlexLayout: import("react").ForwardRefExoticComponent<FlexLayoutProps & import("react").RefAttributes<HTMLDivElement>>;
3
+ export default FlexLayout;
@@ -1,85 +1 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import {
4
- Children,
5
- cloneElement,
6
- Fragment as Fragment2,
7
- isValidElement
8
- } from "react";
9
- import { ContainerOpenCloseProvider } from "../providers/FlexLayoutHooks";
10
- import styles from "../styles/FlexLayout.module.css";
11
- import { FlexLayoutProvider } from "../providers/FlexLayoutContext";
12
- const withFlexLayout = (layoutName, fitContent, containerCount) => (WrappedComponent) => {
13
- if (WrappedComponent.type === Fragment2 || WrappedComponent.type === "div" || WrappedComponent.type === "span") {
14
- return WrappedComponent;
15
- }
16
- return cloneElement(WrappedComponent, {
17
- layoutName,
18
- fitContent,
19
- containerCount
20
- });
21
- };
22
- function FlexLayout({
23
- layoutName,
24
- direction,
25
- children,
26
- ref,
27
- className,
28
- panelClassName,
29
- panelMovementMode = "divorce",
30
- ...props
31
- }) {
32
- const containerCount = Children.count(children);
33
- const fitContent = direction === "row" ? "width" : "height";
34
- const isFragmentElement = (node) => isValidElement(node) && node.type === Fragment2;
35
- const nodes = Children.toArray(children).flatMap(
36
- (node) => isFragmentElement(node) ? Children.toArray(node.props.children) : [node]
37
- );
38
- const flattenedChildren = nodes.filter(
39
- isValidElement
40
- );
41
- if (flattenedChildren.length === 0) {
42
- return null;
43
- }
44
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
45
- FlexLayoutProvider,
46
- {
47
- value: {
48
- layoutName,
49
- direction,
50
- panelMovementMode,
51
- panelClassName,
52
- containerCount,
53
- fitContent
54
- },
55
- children: /* @__PURE__ */ jsx(
56
- "div",
57
- {
58
- className: `${styles["flex-layout"]} ${className && className !== "" ? className : ""}`,
59
- ...ref ? { ref } : {},
60
- ...props,
61
- "data-layout_name": layoutName,
62
- "data-direction": direction,
63
- children: flattenedChildren.map((child, index) => {
64
- if (!child || !isValidElement(child)) return null;
65
- return /* @__PURE__ */ jsxs(Fragment2, { children: [
66
- child,
67
- /* @__PURE__ */ jsx(
68
- ContainerOpenCloseProvider,
69
- {
70
- layoutName,
71
- containerName: child.props.containerName,
72
- sizeName: fitContent
73
- }
74
- )
75
- ] }, index);
76
- })
77
- }
78
- )
79
- }
80
- ) });
81
- }
82
- export {
83
- FlexLayout as default
84
- };
85
- //# sourceMappingURL=FlexLayout.js.map
1
+ "use client";import{Fragment as k,jsx as r,jsxs as N}from"react/jsx-runtime";import{Children as i,forwardRef as d,Fragment as f,isValidElement as u,useCallback as P,useMemo as R,useRef as h}from"react";import{ContainerOpenCloseProvider as T}from"../providers/FlexLayoutHooks";import D from"../styles/FlexLayout.module.css";import{FlexLayoutProvider as H}from"../providers/FlexLayoutContext";const M=d(function({layoutName:n,direction:o,children:m,className:l,panelClassName:s,panelMovementMode:c="divorce",scrollMode:F,...C},t){const p=i.count(m),a=o==="row"?"width":"height",L=h(null),v=P(e=>{if(L.current=e,typeof t=="function"){t(e);return}t&&(t.current=e)},[t]),x=e=>u(e)&&e.type===f,y=i.toArray(m).flatMap(e=>x(e)?i.toArray(e.props.children):[e]).filter(u),E=R(()=>({layoutName:n,direction:o,panelMovementMode:c,panelClassName:s,containerCount:p,fitContent:a}),[n,o,c,s,p,a]);return y.length===0?null:r(k,{children:r(H,{value:E,children:r("div",{ref:v,className:`${D["flex-layout"]} ${l&&l!==""?l:""}`,...C,"data-scroll-mode":F,"data-layout_name":n,"data-direction":o,children:y.map((e,g)=>!e||!u(e)?null:N(f,{children:[e,r(T,{layoutName:n,containerName:e.props.containerName,sizeName:a})]},e.props.containerName??g))})})})});var K=M;export{K as default};
@@ -1,262 +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 FlexLayoutContainer_exports = {};
31
- __export(FlexLayoutContainer_exports, {
32
- default: () => FlexLayoutContainer
33
- });
34
- module.exports = __toCommonJS(FlexLayoutContainer_exports);
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_react = require("react");
37
- var import_useSizes = require("../hooks/useSizes");
38
- var import_FlexLayoutContext = require("../providers/FlexLayoutContext");
39
- var import_FlexLayoutContainerStore = require("../store/FlexLayoutContainerStore");
40
- var import_FlexLayout = __toESM(require("../styles/FlexLayout.module.css"), 1);
41
- var import_FlexLayoutUtils = require("../utils/FlexLayoutUtils");
42
- var import_FlexLayoutResizePanel = __toESM(require("./FlexLayoutResizePanel"), 1);
43
- function FlexLayoutContainer({
44
- isFitContent,
45
- isFitResize,
46
- // fitContent,
47
- // containerCount,
48
- // layoutName,
49
- containerName,
50
- grow: initialGrow,
51
- prevGrow: initialPrevGrow,
52
- isInitialResizable,
53
- isResizePanel,
54
- children,
55
- className,
56
- panelMode
57
- }) {
58
- const {
59
- direction,
60
- panelMovementMode,
61
- panelClassName,
62
- layoutName,
63
- fitContent,
64
- containerCount
65
- } = (0, import_FlexLayoutContext.useFlexLayoutContext)();
66
- const { ref, size } = (
67
- // isFitContent && fitContent
68
- //?
69
- (0, import_useSizes.useSize)(fitContent)
70
- );
71
- const flexContainerNodeRef = (0, import_react.useRef)(null);
72
- const isUserResizingRef = (0, import_react.useRef)(false);
73
- const handleResizingChange = (0, import_react.useCallback)((v) => {
74
- isUserResizingRef.current = v;
75
- }, []);
76
- const flexContainerRef = (0, import_react.useCallback)(
77
- (node) => {
78
- flexContainerNodeRef.current = node;
79
- if (node) {
80
- (0, import_FlexLayoutContainerStore.setContainerRef)(
81
- layoutName,
82
- containerName,
83
- flexContainerNodeRef
84
- );
85
- } else {
86
- (0, import_FlexLayoutContainerStore.setContainerRef)(layoutName, containerName, null);
87
- }
88
- },
89
- [layoutName, containerName]
90
- );
91
- const [growState, setGrowState] = (0, import_react.useState)(initialGrow);
92
- (0, import_react.useEffect)(() => {
93
- setGrowState(initialGrow);
94
- }, [initialGrow]);
95
- const [prevGrowState, setPrevGrowState] = (0, import_react.useState)(
96
- initialPrevGrow
97
- );
98
- const [isFirstLoad, setIsFirstLoad] = (0, import_react.useState)(true);
99
- (0, import_react.useEffect)(() => {
100
- if (typeof window == "undefined" || flexContainerNodeRef.current === null)
101
- return;
102
- const storedGrow = sessionStorage.getItem(containerName);
103
- if (storedGrow !== null) {
104
- const parsed = parseFloat(storedGrow);
105
- if (!isNaN(parsed)) {
106
- flexContainerNodeRef.current.style.flex = `${parsed} 1 0%`;
107
- setGrowState(parsed);
108
- }
109
- }
110
- }, [containerName]);
111
- (0, import_react.useEffect)(() => {
112
- if (!flexContainerNodeRef.current) return;
113
- const targetNode = flexContainerNodeRef.current;
114
- const observer = new MutationObserver((mutations) => {
115
- for (const mutation of mutations) {
116
- if (mutation.type === "attributes" && mutation.attributeName === "style" && targetNode.style.flex) {
117
- const flexValue = targetNode.style.flex;
118
- const parsedGrow = parseFloat(flexValue.split(" ")[0]);
119
- if (!isNaN(parsedGrow)) {
120
- setGrowState(parsedGrow);
121
- }
122
- }
123
- }
124
- });
125
- observer.observe(targetNode, {
126
- attributes: true,
127
- attributeFilter: ["style"],
128
- attributeOldValue: true
129
- });
130
- return () => {
131
- observer.disconnect();
132
- };
133
- }, [containerName]);
134
- (0, import_react.useEffect)(() => {
135
- if (!flexContainerNodeRef.current || !ref || !ref.current || !size || !fitContent || // getGrow(flexContainerNodeRef.current) == 0 ||
136
- isUserResizingRef.current)
137
- return;
138
- requestAnimationFrame(() => {
139
- if (!flexContainerNodeRef.current) return;
140
- const sizeName = `${fitContent.charAt(0).toUpperCase() + fitContent.substring(1)}`;
141
- const parentSize = flexContainerNodeRef.current.parentElement && flexContainerNodeRef.current.parentElement["client" + sizeName] || 0;
142
- if (isFitContent) {
143
- flexContainerNodeRef.current.style["max" + sizeName] = size + "px";
144
- }
145
- if (!isFitResize && isFirstLoad) {
146
- setIsFirstLoad(false);
147
- return;
148
- }
149
- if ((0, import_FlexLayoutUtils.getGrow)(flexContainerNodeRef.current) != 0 && isFitResize) {
150
- const newGrow = (0, import_FlexLayoutUtils.mathGrow)(size, parentSize, containerCount);
151
- setPrevGrowState(growState);
152
- setGrowState(newGrow);
153
- }
154
- });
155
- }, [size, containerCount, isFitResize, children]);
156
- (0, import_react.useEffect)(() => {
157
- if (!flexContainerNodeRef.current) return;
158
- let notGrowList = [];
159
- let containerList = [
160
- ...flexContainerNodeRef.current.parentElement?.children || []
161
- ].filter((e) => e.hasAttribute("data-container_name"));
162
- let remainingGrow = containerList.reduce((t, e, i) => {
163
- let item = e;
164
- if (item.classList.contains(import_FlexLayout.default["flex-resize-panel"])) return t;
165
- if (e.hasAttribute("data-grow") == false || e.getAttribute("data-is_resize") === "true") {
166
- notGrowList.push(item);
167
- return t;
168
- }
169
- let grow = parseFloat(item.dataset.grow || "");
170
- item.style.flex = `${grow} 1 0%`;
171
- t -= grow;
172
- return t;
173
- }, containerList.length);
174
- if (notGrowList.length != 0) {
175
- let resizeWeight = (0, import_FlexLayoutUtils.mathWeight)(notGrowList.length, remainingGrow);
176
- notGrowList.forEach((e) => {
177
- e.dataset.grow = resizeWeight.toString();
178
- e.style.flex = `${resizeWeight} 1 0%`;
179
- });
180
- }
181
- }, []);
182
- (0, import_react.useEffect)(() => {
183
- if (!flexContainerNodeRef.current || !isFitContent || !fitContent || !size || (0, import_FlexLayoutUtils.getGrow)(flexContainerNodeRef.current) == 0)
184
- return;
185
- const parent = flexContainerNodeRef.current.parentElement;
186
- if (!parent) return;
187
- const sizeName = fitContent.charAt(0).toUpperCase() + fitContent.substring(1);
188
- const parentSize = parent["client" + sizeName] || 0;
189
- if (!parentSize || containerCount <= 0) return;
190
- const nextGrowRaw = (0, import_FlexLayoutUtils.mathGrow)(size, parentSize, containerCount);
191
- const nextGrow = Math.min(containerCount, Math.max(0, nextGrowRaw));
192
- const currentGrow = (0, import_FlexLayoutUtils.getGrow)(flexContainerNodeRef.current);
193
- if (Math.abs(nextGrow - currentGrow) < 1e-3) return;
194
- setPrevGrowState(currentGrow);
195
- setGrowState(nextGrow);
196
- const containers = [...parent.children || []].filter((el) => {
197
- const item = el;
198
- return item.hasAttribute("data-container_name") && !item.classList.contains(import_FlexLayout.default["flex-resize-panel"]);
199
- });
200
- const siblings = containers.filter(
201
- (el) => el !== flexContainerNodeRef.current
202
- );
203
- const adjustable = siblings.filter((el) => el.style.flex !== "0 1 0%");
204
- const remaining = containerCount - nextGrow;
205
- if (remaining <= 0 || adjustable.length === 0) return;
206
- const oldSum = adjustable.reduce((sum, el) => sum + (0, import_FlexLayoutUtils.getGrow)(el), 0);
207
- if (oldSum <= 0) {
208
- const each = remaining / adjustable.length;
209
- adjustable.forEach((el) => {
210
- el.dataset.grow = each.toString();
211
- el.style.flex = `${each} 1 0%`;
212
- });
213
- } else {
214
- adjustable.forEach((el) => {
215
- const g = (0, import_FlexLayoutUtils.getGrow)(el);
216
- const scaled = remaining * (g / oldSum);
217
- el.dataset.grow = scaled.toString();
218
- el.style.flex = `${scaled} 1 0%`;
219
- });
220
- }
221
- }, [size, isFitContent, fitContent, containerCount]);
222
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
223
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
224
- "div",
225
- {
226
- id: containerName,
227
- "data-container_name": containerName,
228
- ref: flexContainerRef,
229
- className: `${import_FlexLayout.default["flex-container"]} ${className && className !== "" ? className : ""}`,
230
- ...growState !== void 0 ? { ["data-grow"]: growState } : {},
231
- ...prevGrowState != void 0 ? { ["data-prev_grow"]: prevGrowState } : {},
232
- "data-is_resize": isInitialResizable,
233
- "data-is_resize_panel": isResizePanel,
234
- style: growState !== void 0 && {
235
- flex: `${growState} 1 0%`
236
- } || {},
237
- children: isFitContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
238
- "div",
239
- {
240
- className: `${import_FlexLayout.default["flex-content-fit-wrapper"]}`,
241
- ref,
242
- children
243
- }
244
- ) || children
245
- }
246
- ),
247
- isResizePanel && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
248
- import_FlexLayoutResizePanel.default,
249
- {
250
- containerName,
251
- layoutName,
252
- direction,
253
- containerCount,
254
- panelMode,
255
- panelClassName,
256
- panelMovementMode,
257
- onResizingChange: handleResizingChange
258
- }
259
- )
260
- ] });
261
- }
262
- //# sourceMappingURL=FlexLayoutContainer.cjs.map
1
+ "use strict";"use client";var oe=Object.create;var H=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var ue=(l,c)=>{for(var a in c)H(l,a,{get:c[a],enumerable:!0})},B=(l,c,a,x)=>{if(c&&typeof c=="object"||typeof c=="function")for(let p of ie(c))!ae.call(l,p)&&p!==a&&H(l,p,{get:()=>c[p],enumerable:!(x=se(c,p))||x.enumerable});return l};var G=(l,c,a)=>(a=l!=null?oe(le(l)):{},B(c||!l||!l.__esModule?H(a,"default",{value:l,enumerable:!0}):a,l)),fe=l=>B(H({},"__esModule",{value:!0}),l);var ce={};ue(ce,{default:()=>Q});module.exports=fe(ce);var y=require("react/jsx-runtime"),n=require("react"),j=require("../hooks/useSizes"),J=require("../providers/FlexLayoutContext"),T=require("../store/FlexLayoutContainerStore"),z=G(require("../styles/FlexLayout.module.css"),1),g=require("../utils/FlexLayoutUtils"),K=G(require("./FlexLayoutResizePanel"),1);function Q({isFitContent:l,isFitResize:c,containerName:a,grow:x,prevGrow:p,isInitialResizable:X,isResizePanel:C,stickyMode:m,children:$,className:R,panelMode:Y}){const{direction:A,panelMovementMode:Z,panelClassName:k,layoutName:S,fitContent:h,containerCount:N}=(0,J.useFlexLayoutContext)(),{ref:w,size:b}=(0,j.useSize)(h),s=(0,n.useRef)(null),P=(0,n.useRef)(!1),_=(0,n.useRef)(null),M=(0,n.useRef)(null),O=(0,n.useRef)(!1),ee=(0,n.useCallback)(e=>{P.current=e},[]),te=(0,n.useCallback)(e=>{s.current=e,e?(0,T.setContainerRef)(S,a,s):(0,T.setContainerRef)(S,a,null)},[S,a]),[v,W]=(0,n.useState)(x),[I,V]=(0,n.useState)(p);(0,n.useEffect)(()=>{W(x)},[x]),(0,n.useEffect)(()=>{V(p)},[p]);const F=(0,n.useCallback)((e,r)=>{typeof e=="number"&&Number.isNaN(e)||W(u=>(typeof e=="number"&&typeof u=="number"?Math.abs(e-u)<.001:Object.is(e,u))?u:(V(r??u),e))},[]);(0,n.useLayoutEffect)(()=>{if(typeof window>"u"||s.current===null)return;const e=sessionStorage.getItem(a);if(e!==null){const r=parseFloat(e);isNaN(r)||(s.current.style.flex=`${r} 1 0%`,F(r))}},[a,F]),(0,n.useEffect)(()=>{if(!s.current)return;const e=s.current,r=o=>{if(!o)return;const i=o.match(/flex\s*:\s*([^;]+)/);if(!i)return;const t=parseFloat(i[1].trim().split(/\s+/)[0]);return Number.isNaN(t)?void 0:t},u=new MutationObserver(o=>{for(const i of o)if(i.type==="attributes"&&i.attributeName==="style"&&e.style.flex){const t=e.style.flex,f=parseFloat(t.split(" ")[0]);if(!isNaN(f)){const d=r(i.oldValue);F(f,d)}}});return u.observe(e,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0}),()=>{u.disconnect()}},[a,F]),(0,n.useEffect)(()=>{if(!s.current||!w||!w.current||!b||_.current==b||Math.abs((_.current??0)-b)<=5||P.current)return;_.current=b;const e=requestAnimationFrame(()=>{if(!s.current)return;const r=`${h.charAt(0).toUpperCase()+h.substring(1)}`,u=M.current;if(l&&(s.current.style["max"+r]=b+"px",M.current=b),!(!c&&O.current)){if((0,g.getGrow)(s.current)!=0){const o=s.current.parentElement&&s.current.parentElement["client"+r]||0,i=(0,g.mathGrow)(b,o,N);if(u&&s.current.getBoundingClientRect()[h]/u<=.95)return;const t=[...s.current.parentElement?.children||[]].filter(f=>f.hasAttribute("data-container_name")).filter(f=>f.style.flex!="0 1 0%"&&f!=s.current);s.current.style.flex=`${i} 1 0%`,(0,g.resize)(t,t.length+1-i)}O.current=!0}});return()=>{cancelAnimationFrame(e)}},[b,N,c,$,h,l,w]),(0,n.useEffect)(()=>{if(!s.current)return;let e=[],r=[...s.current.parentElement?.children||[]].filter(o=>o.hasAttribute("data-container_name")),u=r.reduce((o,i,t)=>{let f=i;if(f.classList.contains(z.default["flex-resize-panel"]))return o;if(i.hasAttribute("data-grow")==!1||i.getAttribute("data-is_resize")==="true")return e.push(f),o;let d=parseFloat(f.dataset.grow||"");return f.style.flex=`${d} 1 0%`,o-=d,o},r.length);if(e.length!=0){let o=(0,g.mathWeight)(e.length,u);e.forEach(i=>{i.dataset.grow=o.toString(),i.style.flex=`${o} 1 0%`})}},[]),(0,n.useEffect)(()=>{if(!m||!C||!(m.stickyResizePanel??!0))return;const r=s.current;if(!r)return;const u=r.nextElementSibling,o=r.previousElementSibling,i=L=>!!L&&L.classList.contains(z.default["flex-resize-panel"]),t=m.position==="top"?i(u)?u:null:i(o)?o:null;if(!t)return;const f={position:t.style.position,top:t.style.top,bottom:t.style.bottom},d=m.offsetPx??0;let E=0;const D=()=>{if(!r.isConnected||!t.isConnected)return;const L=r.offsetHeight;if(t.style.position="sticky",A==="row"){m.position==="top"?(t.style.top=`${d}px`,t.style.bottom="auto"):(t.style.bottom=`${d}px`,t.style.top="auto");return}m.position==="top"?(t.style.top=`${d+L}px`,t.style.bottom="auto"):(t.style.bottom=`${d+L}px`,t.style.top="auto")},re=()=>{E&&cancelAnimationFrame(E),E=requestAnimationFrame(D)};D();const U=typeof ResizeObserver<"u"?new ResizeObserver(re):null;return U?.observe(r),()=>{E&&cancelAnimationFrame(E),U?.disconnect(),t.style.position=f.position,t.style.top=f.top,t.style.bottom=f.bottom}},[m,C,A]);const q=m?.offsetPx??0,ne=m&&m.position==="top"?{position:"sticky",top:q,bottom:"auto"}:m&&m.position==="bottom"?{position:"sticky",bottom:q,top:"auto"}:{};return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{id:a,"data-container_name":a,"data-is_sticky":m?"true":"false",ref:te,className:`${z.default["flex-container"]} ${R&&R!==""?R:""}`,...v!==void 0?{"data-grow":v}:{},...I!=null?{"data-prev_grow":I}:{},"data-is_resize":X,"data-is_resize_panel":C,style:{...v!==void 0?{flex:`${v} 1 0%`}:{},...ne},children:l&&(0,y.jsx)("div",{className:`${z.default["flex-content-fit-wrapper"]}`,ref:w,children:$})||$}),C&&(0,y.jsx)(K.default,{containerName:a,layoutName:S,direction:A,containerCount:N,panelMode:Y,panelClassName:k,panelMovementMode:Z,onResizingChange:ee})]})}
@@ -1,2 +1,2 @@
1
1
  import { FlexContainerProps } from "../types/FlexLayoutTypes";
2
- export default function FlexLayoutContainer({ isFitContent, isFitResize, containerName, grow: initialGrow, prevGrow: initialPrevGrow, isInitialResizable, isResizePanel, children, className, panelMode, }: FlexContainerProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function FlexLayoutContainer({ isFitContent, isFitResize, containerName, grow: initialGrow, prevGrow: initialPrevGrow, isInitialResizable, isResizePanel, stickyMode, children, className, panelMode, }: FlexContainerProps): import("react/jsx-runtime").JSX.Element;