@byeolnaerim/flex-layout 0.0.8 → 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.
Files changed (125) hide show
  1. package/dist/flex-layout/components/FlexLayout.cjs +1 -76
  2. package/dist/flex-layout/components/FlexLayout.js +1 -70
  3. package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -196
  4. package/dist/flex-layout/components/FlexLayoutContainer.js +1 -189
  5. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -0
  6. package/dist/flex-layout/components/FlexLayoutIFramePane.d.ts +4 -0
  7. package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -0
  8. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -192
  9. package/dist/flex-layout/components/FlexLayoutResizePanel.d.ts +1 -1
  10. package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -186
  11. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1211
  12. package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1197
  13. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -339
  14. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.d.ts +1 -1
  15. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -333
  16. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -32
  17. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
  18. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -40
  19. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -34
  20. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -30
  21. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -24
  22. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -109
  23. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -103
  24. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -226
  25. package/dist/flex-layout/components/FlexLayoutStickyBox.d.ts +1 -0
  26. package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -224
  27. package/dist/flex-layout/components/index.cjs +1 -52
  28. package/dist/flex-layout/components/index.js +1 -9
  29. package/dist/flex-layout/hooks/index.cjs +1 -21
  30. package/dist/flex-layout/hooks/index.js +1 -4
  31. package/dist/flex-layout/hooks/useDrag.cjs +1 -232
  32. package/dist/flex-layout/hooks/useDrag.d.ts +20 -0
  33. package/dist/flex-layout/hooks/useDrag.js +1 -219
  34. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -118
  35. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -116
  36. package/dist/flex-layout/hooks/useListPaging.cjs +1 -179
  37. package/dist/flex-layout/hooks/useListPaging.js +1 -175
  38. package/dist/flex-layout/hooks/useSizes.cjs +1 -104
  39. package/dist/flex-layout/hooks/useSizes.js +1 -101
  40. package/dist/flex-layout/index.cjs +1 -42
  41. package/dist/flex-layout/index.js +1 -7
  42. package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -26
  43. package/dist/flex-layout/providers/FlexLayoutContext.js +1 -23
  44. package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -247
  45. package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
  46. package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -238
  47. package/dist/flex-layout/providers/index.cjs +1 -14
  48. package/dist/flex-layout/providers/index.js +1 -3
  49. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -203
  50. package/dist/flex-layout/store/FlexLayoutContainerStore.d.ts +1 -0
  51. package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -181
  52. package/dist/flex-layout/store/index.cjs +1 -14
  53. package/dist/flex-layout/store/index.js +1 -3
  54. package/dist/flex-layout/styles/FlexLayout.module.css +473 -416
  55. package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -4
  56. package/dist/flex-layout/types/FlexDirectionTypes.js +0 -3
  57. package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -4
  58. package/dist/flex-layout/types/FlexLayoutTypes.d.ts +1 -3
  59. package/dist/flex-layout/types/FlexLayoutTypes.js +0 -3
  60. package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -208
  61. package/dist/flex-layout/utils/FlexLayoutUtils.d.ts +4 -4
  62. package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -196
  63. package/dist/flex-layout/utils/index.cjs +1 -14
  64. package/dist/flex-layout/utils/index.js +1 -3
  65. package/dist/index.cjs +1 -14
  66. package/dist/index.js +1 -3
  67. package/dist/types/css.d.cjs +1 -4
  68. package/dist/types/css.d.js +0 -3
  69. package/package.json +116 -109
  70. package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
  71. package/dist/flex-layout/components/FlexLayout.js.map +0 -1
  72. package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
  73. package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
  74. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
  75. package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
  76. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
  77. package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
  78. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
  79. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
  80. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
  81. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
  82. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
  83. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
  84. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
  85. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
  86. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
  87. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
  88. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
  89. package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
  90. package/dist/flex-layout/components/index.cjs.map +0 -1
  91. package/dist/flex-layout/components/index.js.map +0 -1
  92. package/dist/flex-layout/hooks/index.cjs.map +0 -1
  93. package/dist/flex-layout/hooks/index.js.map +0 -1
  94. package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
  95. package/dist/flex-layout/hooks/useDrag.js.map +0 -1
  96. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
  97. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
  98. package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
  99. package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
  100. package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
  101. package/dist/flex-layout/hooks/useSizes.js.map +0 -1
  102. package/dist/flex-layout/index.cjs.map +0 -1
  103. package/dist/flex-layout/index.js.map +0 -1
  104. package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
  105. package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
  106. package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
  107. package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
  108. package/dist/flex-layout/providers/index.cjs.map +0 -1
  109. package/dist/flex-layout/providers/index.js.map +0 -1
  110. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
  111. package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
  112. package/dist/flex-layout/store/index.cjs.map +0 -1
  113. package/dist/flex-layout/store/index.js.map +0 -1
  114. package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
  115. package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
  116. package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
  117. package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
  118. package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
  119. package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
  120. package/dist/flex-layout/utils/index.cjs.map +0 -1
  121. package/dist/flex-layout/utils/index.js.map +0 -1
  122. package/dist/index.cjs.map +0 -1
  123. package/dist/index.js.map +0 -1
  124. package/dist/types/css.d.cjs.map +0 -1
  125. package/dist/types/css.d.js.map +0 -1
@@ -1,76 +1 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var FlexLayoutHooks = require('../providers/FlexLayoutHooks');
6
- var styles = require('../styles/FlexLayout.module.css');
7
- var FlexLayoutContext = require('../providers/FlexLayoutContext');
8
-
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
-
11
- var styles__default = /*#__PURE__*/_interopDefault(styles);
12
-
13
- function FlexLayout({
14
- layoutName,
15
- direction,
16
- children,
17
- ref,
18
- className,
19
- panelClassName,
20
- panelMovementMode = "divorce",
21
- ...props
22
- }) {
23
- const containerCount = react.Children.count(children);
24
- const fitContent = direction === "row" ? "width" : "height";
25
- const isFragmentElement = (node) => react.isValidElement(node) && node.type === react.Fragment;
26
- const nodes = react.Children.toArray(children).flatMap(
27
- (node) => isFragmentElement(node) ? react.Children.toArray(node.props.children) : [node]
28
- );
29
- const flattenedChildren = nodes.filter(
30
- react.isValidElement
31
- );
32
- if (flattenedChildren.length === 0) {
33
- return null;
34
- }
35
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
36
- FlexLayoutContext.FlexLayoutProvider,
37
- {
38
- value: {
39
- layoutName,
40
- direction,
41
- panelMovementMode,
42
- panelClassName,
43
- containerCount,
44
- fitContent
45
- },
46
- children: /* @__PURE__ */ jsxRuntime.jsx(
47
- "div",
48
- {
49
- className: `${styles__default.default["flex-layout"]} ${className && className !== "" ? className : ""}`,
50
- ...ref ? { ref } : {},
51
- ...props,
52
- "data-layout_name": layoutName,
53
- "data-direction": direction,
54
- children: flattenedChildren.map((child, index) => {
55
- if (!child || !react.isValidElement(child)) return null;
56
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
57
- child,
58
- /* @__PURE__ */ jsxRuntime.jsx(
59
- FlexLayoutHooks.ContainerOpenCloseProvider,
60
- {
61
- layoutName,
62
- containerName: child.props.containerName,
63
- sizeName: fitContent
64
- }
65
- )
66
- ] }, index);
67
- })
68
- }
69
- )
70
- }
71
- ) });
72
- }
73
-
74
- module.exports = FlexLayout;
75
- //# sourceMappingURL=FlexLayout.cjs.map
76
- //# sourceMappingURL=FlexLayout.cjs.map
1
+ "use strict";"use client";var E=Object.create;var m=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of P(t))!w.call(e,l)&&l!==n&&m(e,l,{get:()=>t[l],enumerable:!(o=L(t,l))||o.enumerable});return e};var T=(e,t,n)=>(n=e!=null?E(R(e)):{},y(t||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)),A=e=>y(m({},"__esModule",{value:!0}),e);var O={};N(O,{default:()=>p});module.exports=A(O);var i=require("react/jsx-runtime"),r=require("react"),F=require("../providers/FlexLayoutHooks"),c=T(require("../styles/FlexLayout.module.css"),1),d=require("../providers/FlexLayoutContext");const B=(e,t,n)=>o=>o.type===r.Fragment||o.type==="div"||o.type==="span"?o:(0,r.cloneElement)(o,{layoutName:e,fitContent:t,containerCount:n});function p({layoutName:e,direction:t,children:n,ref:o,className:l,panelClassName:f,panelMovementMode:x="divorce",...h}){const g=r.Children.count(n),s=t==="row"?"width":"height",v=a=>(0,r.isValidElement)(a)&&a.type===r.Fragment,u=r.Children.toArray(n).flatMap(a=>v(a)?r.Children.toArray(a.props.children):[a]).filter(r.isValidElement);return u.length===0?null:(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(d.FlexLayoutProvider,{value:{layoutName:e,direction:t,panelMovementMode:x,panelClassName:f,containerCount:g,fitContent:s},children:(0,i.jsx)("div",{className:`${c.default["flex-layout"]} ${l&&l!==""?l:""}`,...o?{ref:o}:{},...h,"data-layout_name":e,"data-direction":t,children:u.map((a,C)=>!a||!(0,r.isValidElement)(a)?null:(0,i.jsxs)(r.Fragment,{children:[a,(0,i.jsx)(F.ContainerOpenCloseProvider,{layoutName:e,containerName:a.props.containerName,sizeName:s})]},C))})})})}
@@ -1,70 +1 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { Children, isValidElement, Fragment as Fragment$1 } from 'react';
3
- import { ContainerOpenCloseProvider } from '../providers/FlexLayoutHooks';
4
- import styles from '../styles/FlexLayout.module.css';
5
- import { FlexLayoutProvider } from '../providers/FlexLayoutContext';
6
-
7
- function FlexLayout({
8
- layoutName,
9
- direction,
10
- children,
11
- ref,
12
- className,
13
- panelClassName,
14
- panelMovementMode = "divorce",
15
- ...props
16
- }) {
17
- const containerCount = Children.count(children);
18
- const fitContent = direction === "row" ? "width" : "height";
19
- const isFragmentElement = (node) => isValidElement(node) && node.type === Fragment$1;
20
- const nodes = Children.toArray(children).flatMap(
21
- (node) => isFragmentElement(node) ? Children.toArray(node.props.children) : [node]
22
- );
23
- const flattenedChildren = nodes.filter(
24
- isValidElement
25
- );
26
- if (flattenedChildren.length === 0) {
27
- return null;
28
- }
29
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
30
- FlexLayoutProvider,
31
- {
32
- value: {
33
- layoutName,
34
- direction,
35
- panelMovementMode,
36
- panelClassName,
37
- containerCount,
38
- fitContent
39
- },
40
- children: /* @__PURE__ */ jsx(
41
- "div",
42
- {
43
- className: `${styles["flex-layout"]} ${className && className !== "" ? className : ""}`,
44
- ...ref ? { ref } : {},
45
- ...props,
46
- "data-layout_name": layoutName,
47
- "data-direction": direction,
48
- children: flattenedChildren.map((child, index) => {
49
- if (!child || !isValidElement(child)) return null;
50
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
51
- child,
52
- /* @__PURE__ */ jsx(
53
- ContainerOpenCloseProvider,
54
- {
55
- layoutName,
56
- containerName: child.props.containerName,
57
- sizeName: fitContent
58
- }
59
- )
60
- ] }, index);
61
- })
62
- }
63
- )
64
- }
65
- ) });
66
- }
67
-
68
- export { FlexLayout as default };
69
- //# sourceMappingURL=FlexLayout.js.map
70
- //# sourceMappingURL=FlexLayout.js.map
1
+ "use client";import{Fragment as P,jsx as a,jsxs as L}from"react/jsx-runtime";import{Children as i,cloneElement as h,Fragment as m,isValidElement as s}from"react";import{ContainerOpenCloseProvider as g}from"../providers/FlexLayoutHooks";import v from"../styles/FlexLayout.module.css";import{FlexLayoutProvider as C}from"../providers/FlexLayoutContext";const V=(r,n,o)=>t=>t.type===m||t.type==="div"||t.type==="span"?t:h(t,{layoutName:r,fitContent:n,containerCount:o});function E({layoutName:r,direction:n,children:o,ref:t,className:l,panelClassName:F,panelMovementMode:c="divorce",...d}){const p=i.count(o),u=n==="row"?"width":"height",f=e=>s(e)&&e.type===m,y=i.toArray(o).flatMap(e=>f(e)?i.toArray(e.props.children):[e]).filter(s);return y.length===0?null:a(P,{children:a(C,{value:{layoutName:r,direction:n,panelMovementMode:c,panelClassName:F,containerCount:p,fitContent:u},children:a("div",{className:`${v["flex-layout"]} ${l&&l!==""?l:""}`,...t?{ref:t}:{},...d,"data-layout_name":r,"data-direction":n,children:y.map((e,x)=>!e||!s(e)?null:L(m,{children:[e,a(g,{layoutName:r,containerName:e.props.containerName,sizeName:u})]},x))})})})}export{E as default};
@@ -1,196 +1 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var useSizes = require('../hooks/useSizes');
6
- var FlexLayoutContext = require('../providers/FlexLayoutContext');
7
- var FlexLayoutContainerStore = require('../store/FlexLayoutContainerStore');
8
- var styles = require('../styles/FlexLayout.module.css');
9
- var FlexLayoutUtils = require('../utils/FlexLayoutUtils');
10
- var FlexLayoutResizePanel = require('./FlexLayoutResizePanel');
11
-
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
-
14
- var styles__default = /*#__PURE__*/_interopDefault(styles);
15
- var FlexLayoutResizePanel__default = /*#__PURE__*/_interopDefault(FlexLayoutResizePanel);
16
-
17
- function FlexLayoutContainer({
18
- isFitContent,
19
- isFitResize,
20
- // fitContent,
21
- // containerCount,
22
- // layoutName,
23
- containerName,
24
- grow: initialGrow,
25
- prevGrow: initialPrevGrow,
26
- isInitialResizable,
27
- isResizePanel,
28
- children,
29
- className,
30
- panelMode
31
- }) {
32
- const {
33
- direction,
34
- panelMovementMode,
35
- panelClassName,
36
- layoutName,
37
- fitContent,
38
- containerCount
39
- } = FlexLayoutContext.useFlexLayoutContext();
40
- const { ref, size } = (
41
- // isFitContent && fitContent
42
- //?
43
- useSizes.useSize(fitContent)
44
- );
45
- const flexContainerNodeRef = react.useRef(null);
46
- const flexContainerRef = react.useCallback(
47
- (node) => {
48
- flexContainerNodeRef.current = node;
49
- if (node !== null) {
50
- FlexLayoutContainerStore.setContainerRef(layoutName, containerName, { current: node });
51
- }
52
- },
53
- [layoutName, containerName]
54
- );
55
- const [growState, setGrowState] = react.useState(initialGrow);
56
- react.useEffect(() => {
57
- setGrowState(initialGrow);
58
- }, [initialGrow]);
59
- const [prevGrowState, setPrevGrowState] = react.useState(
60
- initialPrevGrow
61
- );
62
- const [isFirstLoad, setIsFirstLoad] = react.useState(true);
63
- react.useEffect(() => {
64
- if (!flexContainerNodeRef.current) return;
65
- FlexLayoutContainerStore.setContainerRef(layoutName, containerName, flexContainerNodeRef);
66
- return () => {
67
- FlexLayoutContainerStore.setContainerRef(layoutName, containerName, {
68
- current: null
69
- });
70
- };
71
- }, [containerName, layoutName]);
72
- react.useEffect(() => {
73
- if (typeof window == "undefined" || flexContainerNodeRef.current === null)
74
- return;
75
- const storedGrow = sessionStorage.getItem(containerName);
76
- if (storedGrow !== null) {
77
- const parsed = parseFloat(storedGrow);
78
- if (!isNaN(parsed)) {
79
- flexContainerNodeRef.current.style.flex = `${parsed} 1 0%`;
80
- setGrowState(parsed);
81
- }
82
- }
83
- }, [containerName]);
84
- react.useEffect(() => {
85
- if (!flexContainerNodeRef.current) return;
86
- const targetNode = flexContainerNodeRef.current;
87
- const observer = new MutationObserver((mutations) => {
88
- for (const mutation of mutations) {
89
- if (mutation.type === "attributes" && mutation.attributeName === "style" && targetNode.style.flex) {
90
- const flexValue = targetNode.style.flex;
91
- const parsedGrow = parseFloat(flexValue.split(" ")[0]);
92
- if (!isNaN(parsedGrow)) {
93
- setGrowState(parsedGrow);
94
- }
95
- }
96
- }
97
- });
98
- observer.observe(targetNode, {
99
- attributes: true,
100
- attributeFilter: ["style"],
101
- attributeOldValue: true
102
- });
103
- return () => {
104
- observer.disconnect();
105
- };
106
- }, [containerName]);
107
- react.useEffect(() => {
108
- if (!flexContainerNodeRef.current || !ref || !ref.current || !size || !fitContent)
109
- return;
110
- requestAnimationFrame(() => {
111
- if (!flexContainerNodeRef.current) return;
112
- const sizeName = `${fitContent.charAt(0).toUpperCase() + fitContent.substring(1)}`;
113
- const parentSize = flexContainerNodeRef.current.parentElement && flexContainerNodeRef.current.parentElement["client" + sizeName] || 0;
114
- if (isFitContent) {
115
- flexContainerNodeRef.current.style["max" + sizeName] = size + "px";
116
- }
117
- if (!isFitResize && isFirstLoad) {
118
- setIsFirstLoad(false);
119
- return;
120
- }
121
- if (FlexLayoutUtils.getGrow(flexContainerNodeRef.current) != 0 && isFitResize) {
122
- const newGrow = FlexLayoutUtils.mathGrow(size, parentSize, containerCount);
123
- setPrevGrowState(growState);
124
- setGrowState(newGrow);
125
- }
126
- });
127
- }, [size, containerCount, isFitResize, children]);
128
- react.useEffect(() => {
129
- if (!flexContainerNodeRef.current) return;
130
- let notGrowList = [];
131
- let containerList = [
132
- ...flexContainerNodeRef.current.parentElement?.children || []
133
- ].filter((e) => e.hasAttribute("data-container_name"));
134
- let remainingGrow = containerList.reduce((t, e, i) => {
135
- let item = e;
136
- if (item.classList.contains(styles__default.default["flex-resize-panel"])) return t;
137
- if (e.hasAttribute("data-grow") == false || e.getAttribute("data-is_resize") === "true") {
138
- notGrowList.push(item);
139
- return t;
140
- }
141
- let grow = parseFloat(item.dataset.grow || "");
142
- item.style.flex = `${grow} 1 0%`;
143
- t -= grow;
144
- return t;
145
- }, containerList.length);
146
- if (notGrowList.length != 0) {
147
- let resizeWeight = FlexLayoutUtils.mathWeight(notGrowList.length, remainingGrow);
148
- notGrowList.forEach((e) => {
149
- e.dataset.grow = resizeWeight.toString();
150
- e.style.flex = `${resizeWeight} 1 0%`;
151
- });
152
- }
153
- }, []);
154
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
155
- /* @__PURE__ */ jsxRuntime.jsx(
156
- "div",
157
- {
158
- id: containerName,
159
- "data-container_name": containerName,
160
- ref: flexContainerRef,
161
- className: `${styles__default.default["flex-container"]} ${className && className !== "" ? className : ""}`,
162
- ...growState !== void 0 ? { ["data-grow"]: growState } : {},
163
- ...prevGrowState != void 0 ? { ["data-prev_grow"]: prevGrowState } : {},
164
- "data-is_resize": isInitialResizable,
165
- "data-is_resize_panel": isResizePanel,
166
- style: growState !== void 0 && {
167
- flex: `${growState} 1 0%`
168
- } || {},
169
- children: isFitContent && /* @__PURE__ */ jsxRuntime.jsx(
170
- "div",
171
- {
172
- className: `${styles__default.default["flex-content-fit-wrapper"]}`,
173
- ref,
174
- children
175
- }
176
- ) || children
177
- }
178
- ),
179
- isResizePanel && /* @__PURE__ */ jsxRuntime.jsx(
180
- FlexLayoutResizePanel__default.default,
181
- {
182
- containerName,
183
- layoutName,
184
- direction,
185
- containerCount,
186
- panelMode,
187
- panelClassName,
188
- panelMovementMode
189
- }
190
- )
191
- ] });
192
- }
193
-
194
- module.exports = FlexLayoutContainer;
195
- //# sourceMappingURL=FlexLayoutContainer.cjs.map
196
- //# sourceMappingURL=FlexLayoutContainer.cjs.map
1
+ "use strict";"use client";var ee=Object.create;var z=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var ae=(t,a)=>{for(var n in a)z(t,n,{get:a[n],enumerable:!0})},U=(t,a,n,w)=>{if(a&&typeof a=="object"||typeof a=="function")for(let h of re(a))!se.call(t,h)&&h!==n&&z(t,h,{get:()=>a[h],enumerable:!(w=te(a,h))||w.enumerable});return t};var D=(t,a,n)=>(n=t!=null?ee(ne(t)):{},U(a||!t||!t.__esModule?z(n,"default",{value:t,enumerable:!0}):n,t)),oe=t=>U(z({},"__esModule",{value:!0}),t);var ie={};ae(ie,{default:()=>k});module.exports=oe(ie);var g=require("react/jsx-runtime"),s=require("react"),I=require("../hooks/useSizes"),O=require("../providers/FlexLayoutContext"),F=require("../store/FlexLayoutContainerStore"),E=D(require("../styles/FlexLayout.module.css"),1),c=require("../utils/FlexLayoutUtils"),V=D(require("./FlexLayoutResizePanel"),1);function k({isFitContent:t,isFitResize:a,containerName:n,grow:w,prevGrow:h,isInitialResizable:q,isResizePanel:R,children:S,className:G,panelMode:j}){const{direction:B,panelMovementMode:J,panelClassName:K,layoutName:C,fitContent:d,containerCount:m}=(0,O.useFlexLayoutContext)(),{ref:H,size:x}=(0,I.useSize)(d),r=(0,s.useRef)(null),$=(0,s.useRef)(!1),Q=(0,s.useCallback)(e=>{$.current=e},[]),X=(0,s.useCallback)(e=>{r.current=e,e?(0,F.setContainerRef)(C,n,r):(0,F.setContainerRef)(C,n,null)},[C,n]),[y,L]=(0,s.useState)(w);(0,s.useEffect)(()=>{L(w)},[w]);const[T,N]=(0,s.useState)(h),[Y,Z]=(0,s.useState)(!0);return(0,s.useEffect)(()=>{if(typeof window>"u"||r.current===null)return;const e=sessionStorage.getItem(n);if(e!==null){const l=parseFloat(e);isNaN(l)||(r.current.style.flex=`${l} 1 0%`,L(l))}},[n]),(0,s.useEffect)(()=>{if(!r.current)return;const e=r.current,l=new MutationObserver(p=>{for(const o of p)if(o.type==="attributes"&&o.attributeName==="style"&&e.style.flex){const u=e.style.flex,b=parseFloat(u.split(" ")[0]);isNaN(b)||L(b)}});return l.observe(e,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0}),()=>{l.disconnect()}},[n]),(0,s.useEffect)(()=>{!r.current||!H||!H.current||!x||!d||$.current||requestAnimationFrame(()=>{if(!r.current)return;const e=`${d.charAt(0).toUpperCase()+d.substring(1)}`,l=r.current.parentElement&&r.current.parentElement["client"+e]||0;if(t&&(r.current.style["max"+e]=x+"px"),!a&&Y){Z(!1);return}if((0,c.getGrow)(r.current)!=0&&a){const p=(0,c.mathGrow)(x,l,m);N(y),L(p)}})},[x,m,a,S]),(0,s.useEffect)(()=>{if(!r.current)return;let e=[],l=[...r.current.parentElement?.children||[]].filter(o=>o.hasAttribute("data-container_name")),p=l.reduce((o,u,b)=>{let M=u;if(M.classList.contains(E.default["flex-resize-panel"]))return o;if(u.hasAttribute("data-grow")==!1||u.getAttribute("data-is_resize")==="true")return e.push(M),o;let A=parseFloat(M.dataset.grow||"");return M.style.flex=`${A} 1 0%`,o-=A,o},l.length);if(e.length!=0){let o=(0,c.mathWeight)(e.length,p);e.forEach(u=>{u.dataset.grow=o.toString(),u.style.flex=`${o} 1 0%`})}},[]),(0,s.useEffect)(()=>{if(!r.current||!t||!d||!x||(0,c.getGrow)(r.current)==0||$.current)return;const e=r.current.parentElement;if(!e)return;const l=d.charAt(0).toUpperCase()+d.substring(1),p=e["client"+l]||0;if(!p||m<=0)return;const o=(0,c.mathGrow)(x,p,m),u=Math.min(m,Math.max(0,o)),b=(0,c.getGrow)(r.current);if(Math.abs(u-b)<.001)return;N(b),L(u);const v=[...e.children||[]].filter(i=>{const f=i;return f.hasAttribute("data-container_name")&&!f.classList.contains(E.default["flex-resize-panel"])}).filter(i=>i!==r.current).filter(i=>i.style.flex!=="0 1 0%"),_=m-u;if(_<=0||v.length===0)return;const W=v.reduce((i,f)=>i+(0,c.getGrow)(f),0);if(W<=0){const i=_/v.length;v.forEach(f=>{f.dataset.grow=i.toString(),f.style.flex=`${i} 1 0%`})}else v.forEach(i=>{const f=(0,c.getGrow)(i),P=_*(f/W);i.dataset.grow=P.toString(),i.style.flex=`${P} 1 0%`})},[x,t,d,m]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{id:n,"data-container_name":n,ref:X,className:`${E.default["flex-container"]} ${G&&G!==""?G:""}`,...y!==void 0?{"data-grow":y}:{},...T!=null?{"data-prev_grow":T}:{},"data-is_resize":q,"data-is_resize_panel":R,style:y!==void 0&&{flex:`${y} 1 0%`}||{},children:t&&(0,g.jsx)("div",{className:`${E.default["flex-content-fit-wrapper"]}`,ref:H,children:S})||S}),R&&(0,g.jsx)(V.default,{containerName:n,layoutName:C,direction:B,containerCount:m,panelMode:j,panelClassName:K,panelMovementMode:J,onResizingChange:Q})]})}
@@ -1,189 +1 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { useRef, useCallback, useState, useEffect } from 'react';
3
- import { useSize } from '../hooks/useSizes';
4
- import { useFlexLayoutContext } from '../providers/FlexLayoutContext';
5
- import { setContainerRef } from '../store/FlexLayoutContainerStore';
6
- import styles from '../styles/FlexLayout.module.css';
7
- import { getGrow, mathGrow, mathWeight } from '../utils/FlexLayoutUtils';
8
- import FlexLayoutResizePanel from './FlexLayoutResizePanel';
9
-
10
- function FlexLayoutContainer({
11
- isFitContent,
12
- isFitResize,
13
- // fitContent,
14
- // containerCount,
15
- // layoutName,
16
- containerName,
17
- grow: initialGrow,
18
- prevGrow: initialPrevGrow,
19
- isInitialResizable,
20
- isResizePanel,
21
- children,
22
- className,
23
- panelMode
24
- }) {
25
- const {
26
- direction,
27
- panelMovementMode,
28
- panelClassName,
29
- layoutName,
30
- fitContent,
31
- containerCount
32
- } = useFlexLayoutContext();
33
- const { ref, size } = (
34
- // isFitContent && fitContent
35
- //?
36
- useSize(fitContent)
37
- );
38
- const flexContainerNodeRef = useRef(null);
39
- const flexContainerRef = useCallback(
40
- (node) => {
41
- flexContainerNodeRef.current = node;
42
- if (node !== null) {
43
- setContainerRef(layoutName, containerName, { current: node });
44
- }
45
- },
46
- [layoutName, containerName]
47
- );
48
- const [growState, setGrowState] = useState(initialGrow);
49
- useEffect(() => {
50
- setGrowState(initialGrow);
51
- }, [initialGrow]);
52
- const [prevGrowState, setPrevGrowState] = useState(
53
- initialPrevGrow
54
- );
55
- const [isFirstLoad, setIsFirstLoad] = useState(true);
56
- useEffect(() => {
57
- if (!flexContainerNodeRef.current) return;
58
- setContainerRef(layoutName, containerName, flexContainerNodeRef);
59
- return () => {
60
- setContainerRef(layoutName, containerName, {
61
- current: null
62
- });
63
- };
64
- }, [containerName, layoutName]);
65
- useEffect(() => {
66
- if (typeof window == "undefined" || flexContainerNodeRef.current === null)
67
- return;
68
- const storedGrow = sessionStorage.getItem(containerName);
69
- if (storedGrow !== null) {
70
- const parsed = parseFloat(storedGrow);
71
- if (!isNaN(parsed)) {
72
- flexContainerNodeRef.current.style.flex = `${parsed} 1 0%`;
73
- setGrowState(parsed);
74
- }
75
- }
76
- }, [containerName]);
77
- useEffect(() => {
78
- if (!flexContainerNodeRef.current) return;
79
- const targetNode = flexContainerNodeRef.current;
80
- const observer = new MutationObserver((mutations) => {
81
- for (const mutation of mutations) {
82
- if (mutation.type === "attributes" && mutation.attributeName === "style" && targetNode.style.flex) {
83
- const flexValue = targetNode.style.flex;
84
- const parsedGrow = parseFloat(flexValue.split(" ")[0]);
85
- if (!isNaN(parsedGrow)) {
86
- setGrowState(parsedGrow);
87
- }
88
- }
89
- }
90
- });
91
- observer.observe(targetNode, {
92
- attributes: true,
93
- attributeFilter: ["style"],
94
- attributeOldValue: true
95
- });
96
- return () => {
97
- observer.disconnect();
98
- };
99
- }, [containerName]);
100
- useEffect(() => {
101
- if (!flexContainerNodeRef.current || !ref || !ref.current || !size || !fitContent)
102
- return;
103
- requestAnimationFrame(() => {
104
- if (!flexContainerNodeRef.current) return;
105
- const sizeName = `${fitContent.charAt(0).toUpperCase() + fitContent.substring(1)}`;
106
- const parentSize = flexContainerNodeRef.current.parentElement && flexContainerNodeRef.current.parentElement["client" + sizeName] || 0;
107
- if (isFitContent) {
108
- flexContainerNodeRef.current.style["max" + sizeName] = size + "px";
109
- }
110
- if (!isFitResize && isFirstLoad) {
111
- setIsFirstLoad(false);
112
- return;
113
- }
114
- if (getGrow(flexContainerNodeRef.current) != 0 && isFitResize) {
115
- const newGrow = mathGrow(size, parentSize, containerCount);
116
- setPrevGrowState(growState);
117
- setGrowState(newGrow);
118
- }
119
- });
120
- }, [size, containerCount, isFitResize, children]);
121
- useEffect(() => {
122
- if (!flexContainerNodeRef.current) return;
123
- let notGrowList = [];
124
- let containerList = [
125
- ...flexContainerNodeRef.current.parentElement?.children || []
126
- ].filter((e) => e.hasAttribute("data-container_name"));
127
- let remainingGrow = containerList.reduce((t, e, i) => {
128
- let item = e;
129
- if (item.classList.contains(styles["flex-resize-panel"])) return t;
130
- if (e.hasAttribute("data-grow") == false || e.getAttribute("data-is_resize") === "true") {
131
- notGrowList.push(item);
132
- return t;
133
- }
134
- let grow = parseFloat(item.dataset.grow || "");
135
- item.style.flex = `${grow} 1 0%`;
136
- t -= grow;
137
- return t;
138
- }, containerList.length);
139
- if (notGrowList.length != 0) {
140
- let resizeWeight = mathWeight(notGrowList.length, remainingGrow);
141
- notGrowList.forEach((e) => {
142
- e.dataset.grow = resizeWeight.toString();
143
- e.style.flex = `${resizeWeight} 1 0%`;
144
- });
145
- }
146
- }, []);
147
- return /* @__PURE__ */ jsxs(Fragment, { children: [
148
- /* @__PURE__ */ jsx(
149
- "div",
150
- {
151
- id: containerName,
152
- "data-container_name": containerName,
153
- ref: flexContainerRef,
154
- className: `${styles["flex-container"]} ${className && className !== "" ? className : ""}`,
155
- ...growState !== void 0 ? { ["data-grow"]: growState } : {},
156
- ...prevGrowState != void 0 ? { ["data-prev_grow"]: prevGrowState } : {},
157
- "data-is_resize": isInitialResizable,
158
- "data-is_resize_panel": isResizePanel,
159
- style: growState !== void 0 && {
160
- flex: `${growState} 1 0%`
161
- } || {},
162
- children: isFitContent && /* @__PURE__ */ jsx(
163
- "div",
164
- {
165
- className: `${styles["flex-content-fit-wrapper"]}`,
166
- ref,
167
- children
168
- }
169
- ) || children
170
- }
171
- ),
172
- isResizePanel && /* @__PURE__ */ jsx(
173
- FlexLayoutResizePanel,
174
- {
175
- containerName,
176
- layoutName,
177
- direction,
178
- containerCount,
179
- panelMode,
180
- panelClassName,
181
- panelMovementMode
182
- }
183
- )
184
- ] });
185
- }
186
-
187
- export { FlexLayoutContainer as default };
188
- //# sourceMappingURL=FlexLayoutContainer.js.map
189
- //# sourceMappingURL=FlexLayoutContainer.js.map
1
+ "use client";import{Fragment as re,jsx as A,jsxs as ne}from"react/jsx-runtime";import{useCallback as W,useEffect as m,useRef as P,useState as $}from"react";import{useSize as X}from"../hooks/useSizes";import{useFlexLayoutContext as Y}from"../providers/FlexLayoutContext";import{setContainerRef as U}from"../store/FlexLayoutContainerStore";import L from"../styles/FlexLayout.module.css";import{getGrow as w,mathGrow as D,mathWeight as Z}from"../utils/FlexLayoutUtils";import ee from"./FlexLayoutResizePanel";function te({isFitContent:b,isFitResize:M,containerName:o,grow:v,prevGrow:I,isInitialResizable:O,isResizePanel:_,children:E,className:C,panelMode:V}){const{direction:k,panelMovementMode:q,panelClassName:j,layoutName:y,fitContent:l,containerCount:u}=Y(),{ref:z,size:f}=X(l),t=P(null),S=P(!1),B=W(e=>{S.current=e},[]),J=W(e=>{t.current=e,e?U(y,o,t):U(y,o,null)},[y,o]),[p,g]=$(v);m(()=>{g(v)},[v]);const[F,R]=$(I),[K,Q]=$(!0);return m(()=>{if(typeof window>"u"||t.current===null)return;const e=sessionStorage.getItem(o);if(e!==null){const s=parseFloat(e);isNaN(s)||(t.current.style.flex=`${s} 1 0%`,g(s))}},[o]),m(()=>{if(!t.current)return;const e=t.current,s=new MutationObserver(c=>{for(const r of c)if(r.type==="attributes"&&r.attributeName==="style"&&e.style.flex){const a=e.style.flex,d=parseFloat(a.split(" ")[0]);isNaN(d)||g(d)}});return s.observe(e,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0}),()=>{s.disconnect()}},[o]),m(()=>{!t.current||!z||!z.current||!f||!l||S.current||requestAnimationFrame(()=>{if(!t.current)return;const e=`${l.charAt(0).toUpperCase()+l.substring(1)}`,s=t.current.parentElement&&t.current.parentElement["client"+e]||0;if(b&&(t.current.style["max"+e]=f+"px"),!M&&K){Q(!1);return}if(w(t.current)!=0&&M){const c=D(f,s,u);R(p),g(c)}})},[f,u,M,E]),m(()=>{if(!t.current)return;let e=[],s=[...t.current.parentElement?.children||[]].filter(r=>r.hasAttribute("data-container_name")),c=s.reduce((r,a,d)=>{let h=a;if(h.classList.contains(L["flex-resize-panel"]))return r;if(a.hasAttribute("data-grow")==!1||a.getAttribute("data-is_resize")==="true")return e.push(h),r;let G=parseFloat(h.dataset.grow||"");return h.style.flex=`${G} 1 0%`,r-=G,r},s.length);if(e.length!=0){let r=Z(e.length,c);e.forEach(a=>{a.dataset.grow=r.toString(),a.style.flex=`${r} 1 0%`})}},[]),m(()=>{if(!t.current||!b||!l||!f||w(t.current)==0||S.current)return;const e=t.current.parentElement;if(!e)return;const s=l.charAt(0).toUpperCase()+l.substring(1),c=e["client"+s]||0;if(!c||u<=0)return;const r=D(f,c,u),a=Math.min(u,Math.max(0,r)),d=w(t.current);if(Math.abs(a-d)<.001)return;R(d),g(a);const x=[...e.children||[]].filter(n=>{const i=n;return i.hasAttribute("data-container_name")&&!i.classList.contains(L["flex-resize-panel"])}).filter(n=>n!==t.current).filter(n=>n.style.flex!=="0 1 0%"),H=u-a;if(H<=0||x.length===0)return;const T=x.reduce((n,i)=>n+w(i),0);if(T<=0){const n=H/x.length;x.forEach(i=>{i.dataset.grow=n.toString(),i.style.flex=`${n} 1 0%`})}else x.forEach(n=>{const i=w(n),N=H*(i/T);n.dataset.grow=N.toString(),n.style.flex=`${N} 1 0%`})},[f,b,l,u]),ne(re,{children:[A("div",{id:o,"data-container_name":o,ref:J,className:`${L["flex-container"]} ${C&&C!==""?C:""}`,...p!==void 0?{"data-grow":p}:{},...F!=null?{"data-prev_grow":F}:{},"data-is_resize":O,"data-is_resize_panel":_,style:p!==void 0&&{flex:`${p} 1 0%`}||{},children:b&&A("div",{className:`${L["flex-content-fit-wrapper"]}`,ref:z,children:E})||E}),_&&A(ee,{containerName:o,layoutName:y,direction:k,containerCount:u,panelMode:V,panelClassName:j,panelMovementMode:q,onResizingChange:B})]})}export{te as default};
@@ -0,0 +1 @@
1
+ "use strict";"use client";var c=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},y=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f(e))!m.call(t,i)&&i!==o&&c(t,i,{get:()=>e[i],enumerable:!(s=b(e,i))||s.enumerable});return t};var h=t=>y(c({},"__esModule",{value:!0}),t);var S={};d(S,{FlexLayoutIFramePane:()=>w});module.exports=h(S);var u=require("react/jsx-runtime"),n=require("react"),r=require("rxjs"),a=require("../hooks");function w({url:t,screenKey:e}){const[o,s]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{const i=a.dragStateSubject.pipe((0,r.map)(l=>!!l?.isDragging),(0,r.startWith)(!1),(0,r.distinctUntilChanged)()),g=(0,r.combineLatest)([i,a.isResizingSubject]).pipe((0,r.map)(([l,p])=>l||p),(0,r.distinctUntilChanged)()).subscribe(s);return()=>g.unsubscribe()},[]),(0,u.jsx)("iframe",{src:t,style:{width:"100%",height:"100%",border:0,pointerEvents:o?"none":"auto"},sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",referrerPolicy:"no-referrer",loading:"lazy"},e)}0&&(module.exports={FlexLayoutIFramePane});
@@ -0,0 +1,4 @@
1
+ export declare function FlexLayoutIFramePane({ url, screenKey, }: {
2
+ url: string;
3
+ screenKey?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as d}from"react/jsx-runtime";import{useEffect as u,useState as g}from"react";import{combineLatest as p,distinctUntilChanged as r,map as t,startWith as b}from"rxjs";import{dragStateSubject as f,isResizingSubject as m}from"../hooks";function S({url:i,screenKey:o}){const[s,n]=g(!1);return u(()=>{const a=f.pipe(t(e=>!!e?.isDragging),b(!1),r()),l=p([a,m]).pipe(t(([e,c])=>e||c),r()).subscribe(n);return()=>l.unsubscribe()},[]),d("iframe",{src:i,style:{width:"100%",height:"100%",border:0,pointerEvents:s?"none":"auto"},sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",referrerPolicy:"no-referrer",loading:"lazy"},o)}export{S as FlexLayoutIFramePane};