@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,4 +1 @@
1
- 'use strict';
2
-
3
- //# sourceMappingURL=FlexDirectionTypes.cjs.map
4
- //# sourceMappingURL=FlexDirectionTypes.cjs.map
1
+ "use strict";var o=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var z=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!x.call(t,i)&&i!==s&&o(t,i,{get:()=>e[i],enumerable:!(r=y(e,i))||r.enumerable});return t};var c=t=>z(o({},"__esModule",{value:!0}),t);var h={};module.exports=c(h);
@@ -1,3 +0,0 @@
1
-
2
- //# sourceMappingURL=FlexDirectionTypes.js.map
3
- //# sourceMappingURL=FlexDirectionTypes.js.map
@@ -1,4 +1 @@
1
- 'use strict';
2
-
3
- //# sourceMappingURL=FlexLayoutTypes.cjs.map
4
- //# sourceMappingURL=FlexLayoutTypes.cjs.map
1
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!s.call(t,n)&&n!==r&&i(t,n,{get:()=>e[n],enumerable:!(o=a(e,n))||o.enumerable});return t};var p=t=>d(i({},"__esModule",{value:!0}),t);var c={};module.exports=p(c);
@@ -16,9 +16,6 @@ export interface FlexLayoutChildrenType {
16
16
  className?: string;
17
17
  }
18
18
  export interface FlexContainerProps extends FlexLayoutChildrenType {
19
- readonly fitContent?: FitContent;
20
- readonly containerCount?: number;
21
- readonly layoutName?: string;
22
19
  }
23
20
  export interface FlexLayoutPanelStyle {
24
21
  color: string;
@@ -42,6 +39,7 @@ export type FlexLayoutResizePanelProps = {
42
39
  layoutName: string;
43
40
  panelMovementMode: PanelMovementMode;
44
41
  panelClassName?: string;
42
+ onResizingChange?: (isResizing: boolean) => void;
45
43
  };
46
44
  export interface FlexLayoutContextValue {
47
45
  layoutName: string;
@@ -1,3 +0,0 @@
1
-
2
- //# sourceMappingURL=FlexLayoutTypes.js.map
3
- //# sourceMappingURL=FlexLayoutTypes.js.map
@@ -1,208 +1 @@
1
- 'use strict';
2
-
3
- function isDocumentOut({ x, y }) {
4
- if (typeof window == "undefined") return;
5
- const { innerWidth, innerHeight, scrollX, scrollY } = window;
6
- return x < 0 || y < 0 || x > innerWidth + scrollX || y > innerHeight + scrollY;
7
- }
8
- let lastTouchEvent;
9
- function getClientXy(event) {
10
- let clientX;
11
- let clientY;
12
- if (window.MouseEvent && event instanceof window.MouseEvent) {
13
- clientX = event.clientX;
14
- clientY = event.clientY;
15
- } else if (window.TouchEvent && event instanceof window.TouchEvent) {
16
- const _event = event.touches.length == 0 ? lastTouchEvent : event;
17
- clientX = _event.touches[0].clientX;
18
- clientY = _event.touches[0].clientY;
19
- lastTouchEvent = event;
20
- } else {
21
- return;
22
- }
23
- return { clientX, clientY };
24
- }
25
- function isOverMove(elementSize, elementMinSize) {
26
- return Math.floor(elementSize) <= 0 || (isNaN(elementMinSize) ? false : elementMinSize >= Math.floor(elementSize));
27
- }
28
- function findNotCloseFlexContent(target, direction) {
29
- if (!target) return target;
30
- let _target = target;
31
- const isCloseCheck = () => {
32
- let grow = parseFloat(window.getComputedStyle(_target).flex.split(" ")[0]) || 0;
33
- if (grow == 0) {
34
- return true;
35
- } else {
36
- return false;
37
- }
38
- };
39
- while (isCloseCheck()) {
40
- let nextTarget = _target[direction]?.[direction];
41
- _target = nextTarget;
42
- if (!_target) {
43
- break;
44
- }
45
- }
46
- return _target;
47
- }
48
- function remain(flexContainerList) {
49
- return new Promise((resolve) => {
50
- let notGrowList = [];
51
- let totalGrow = flexContainerList.reduce((t, e, i) => {
52
- if (e.hasAttribute("data-grow") == false) {
53
- notGrowList.push(e);
54
- return t;
55
- }
56
- let grow = parseFloat(e.dataset.grow || "");
57
- e.style.flex = `${grow} 1 0%`;
58
- t -= grow;
59
- return t;
60
- }, flexContainerList.length);
61
- if (notGrowList.length != 0) {
62
- resize(notGrowList, totalGrow);
63
- }
64
- resolve(flexContainerList);
65
- });
66
- }
67
- function resize(list, totalGrow) {
68
- return new Promise((resolve) => {
69
- let resizeWeight = totalGrow / list.length;
70
- list.forEach((e) => {
71
- e.dataset.grow = resizeWeight.toString();
72
- e.style.flex = `${resizeWeight} 1 0%`;
73
- });
74
- resolve(resizeWeight);
75
- });
76
- }
77
- function mathWeight(totalCount, totalGrow) {
78
- return 1 + (totalGrow - totalCount) / totalCount;
79
- }
80
- function mathGrow(childSize, parentSize, containerCount) {
81
- return containerCount * (childSize / parentSize);
82
- }
83
- function getGrow(growTarget) {
84
- const target = growTarget instanceof Element ? growTarget : growTarget;
85
- return parseFloat(target.style.flex.split(" ")[0]) || parseFloat(target.dataset.grow || "");
86
- }
87
- function closeFlex(resizeTarget, containers, {
88
- isResize = false,
89
- isDsiabledResizePanel = false,
90
- sizeName
91
- }) {
92
- return new Promise((resolve) => {
93
- if (!resizeTarget.hasAttribute("data-is_resize_panel")) ; else if (isDsiabledResizePanel) {
94
- resizeTarget.dataset.is_resize_panel = "false";
95
- }
96
- resizeTarget.dataset.prev_grow = getGrow(resizeTarget).toString();
97
- let notCloseList = containers.filter(
98
- (e) => e.style.flex != "0 1 0%" && e != resizeTarget
99
- );
100
- let notCloseAndOpenTargetList = [...notCloseList, resizeTarget];
101
- notCloseAndOpenTargetList.forEach((e) => {
102
- e.style.transition = "flex 0.5s";
103
- e.ontransitionend = (event) => {
104
- if (event.propertyName != "flex-grow") {
105
- return;
106
- }
107
- notCloseAndOpenTargetList.forEach(
108
- (e2) => e2.style.transition = ""
109
- );
110
- e.ontransitionend = () => {
111
- };
112
- };
113
- if (e == resizeTarget) {
114
- e.dataset.grow = "0";
115
- e.style.flex = `0 1 0%`;
116
- return;
117
- }
118
- if (isResize) {
119
- return;
120
- }
121
- let percent = getGrow(e) / containers.length;
122
- if (notCloseList.length == 1) {
123
- e.dataset.grow = containers.length.toString();
124
- e.style.flex = `${containers.length} 1 0%`;
125
- return;
126
- }
127
- e.dataset.grow = (containers.length * percent).toString();
128
- e.style.flex = `${containers.length * percent} 1 0%`;
129
- });
130
- if (isResize) {
131
- resize(notCloseList, containers.length);
132
- }
133
- resolve(resizeTarget);
134
- });
135
- }
136
- function openFlex(resizeTarget, containers, {
137
- isPrevSizeOpen = false,
138
- isResize = false,
139
- openGrowImportant = 0,
140
- sizeName
141
- }) {
142
- return new Promise((resolve) => {
143
- if (!resizeTarget.hasAttribute("data-is_resize_panel")) ; else if (resizeTarget.hasAttribute("data-is_resize_panel") && resizeTarget.dataset.is_resize_panel == "false") {
144
- resizeTarget.dataset.is_resize_panel = "true";
145
- }
146
- let notCloseList = containers.filter(
147
- (e) => e.style.flex != "0 1 0%" && e != resizeTarget
148
- );
149
- let notCloseAndOpenTargetList = [...notCloseList, resizeTarget];
150
- let openTargetGrow = 1;
151
- const sizeStyleName = "client" + sizeName.charAt(0).toUpperCase() + sizeName.substring(1);
152
- const parentSize = sizeName && resizeTarget.parentElement && resizeTarget.parentElement[sizeStyleName] || 0;
153
- if (isPrevSizeOpen && resizeTarget.hasAttribute("data-prev_grow")) {
154
- openTargetGrow = parseFloat(resizeTarget.dataset.prev_grow || "1") || 1;
155
- } else if (parentSize && parentSize !== 0) {
156
- openTargetGrow = parentSize / notCloseList.length / (parentSize - 1) * containers.length;
157
- } else {
158
- openTargetGrow = 1;
159
- }
160
- if (openGrowImportant) {
161
- openTargetGrow = openGrowImportant;
162
- }
163
- openTargetGrow = openTargetGrow === Infinity ? 1 : openTargetGrow;
164
- notCloseAndOpenTargetList.forEach((e) => {
165
- e.style.transition = "flex 0.5s";
166
- e.ontransitionend = (event) => {
167
- if (event.propertyName != "flex-grow") {
168
- return;
169
- }
170
- notCloseAndOpenTargetList.forEach(
171
- (e2) => e2.style.transition = ""
172
- );
173
- e.ontransitionend = () => {
174
- };
175
- };
176
- if (e == resizeTarget) {
177
- resizeTarget.dataset.grow = openTargetGrow.toString();
178
- resizeTarget.style.flex = `${openTargetGrow} 1 0%`;
179
- return;
180
- }
181
- if (isResize) {
182
- return;
183
- }
184
- let grow = parentSize / notCloseList.length / (parentSize - 1) * (containers.length - openTargetGrow);
185
- grow = grow === Infinity ? 1 : grow;
186
- e.dataset.grow = grow.toString();
187
- e.style.flex = `${grow} 1 0%`;
188
- });
189
- if (isResize) {
190
- resize(notCloseAndOpenTargetList, containers.length);
191
- }
192
- resolve(openTargetGrow);
193
- });
194
- }
195
-
196
- exports.closeFlex = closeFlex;
197
- exports.findNotCloseFlexContent = findNotCloseFlexContent;
198
- exports.getClientXy = getClientXy;
199
- exports.getGrow = getGrow;
200
- exports.isDocumentOut = isDocumentOut;
201
- exports.isOverMove = isOverMove;
202
- exports.mathGrow = mathGrow;
203
- exports.mathWeight = mathWeight;
204
- exports.openFlex = openFlex;
205
- exports.remain = remain;
206
- exports.resize = resize;
207
- //# sourceMappingURL=FlexLayoutUtils.cjs.map
208
- //# sourceMappingURL=FlexLayoutUtils.cjs.map
1
+ "use strict";var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},_=(t,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!M.call(t,r)&&r!==n&&c(t,r,{get:()=>e[r],enumerable:!(l=x(e,r))||l.enumerable});return t};var H=t=>_(c({},"__esModule",{value:!0}),t);var O={};L(O,{closeFlex:()=>$,findNotCloseFlexContent:()=>S,getClientXy:()=>A,getGrow:()=>d,isDocumentOut:()=>N,isOverMove:()=>v,mathGrow:()=>P,mathWeight:()=>F,openFlex:()=>G,remain:()=>C,resize:()=>p});module.exports=H(O);function N({x:t,y:e}){if(typeof window>"u")return;const{innerWidth:n,innerHeight:l,scrollX:r,scrollY:s}=window;return t<0||e<0||t>n+r||e>l+s}let g;function A(t){let e,n;if(window.MouseEvent&&t instanceof window.MouseEvent)e=t.clientX,n=t.clientY;else if(window.TouchEvent&&t instanceof window.TouchEvent){const l=t.touches.length==0?g:t;e=l.touches[0].clientX,n=l.touches[0].clientY,g=t}else return;return{clientX:e,clientY:n}}function v(t,e){return Math.floor(t)<=0||(isNaN(e)?!1:e>=Math.floor(t))}function S(t,e){if(!t)return t;let n=t;const l=()=>(parseFloat(window.getComputedStyle(n).flex.split(" ")[0])||0)==0;for(;l()&&(n=n[e]?.[e],!!n););return n}function C(t){return new Promise(e=>{let n=[],l=t.reduce((r,s,h)=>{if(s.hasAttribute("data-grow")==!1)return n.push(s),r;let a=parseFloat(s.dataset.grow||"");return s.style.flex=`${a} 1 0%`,r-=a,r},t.length);n.length!=0&&p(n,l),e(t)})}function p(t,e){return new Promise(n=>{let l=e/t.length;t.forEach(r=>{r.dataset.grow=l.toString(),r.style.flex=`${l} 1 0%`}),n(l)})}function F(t,e){return 1+(e-t)/t}function P(t,e,n){return n*(t/e)}function d(t){const e=(t instanceof Element,t),n=parseFloat(e.style.flex.split(" ")[0]);if(!Number.isNaN(n))return n;const l=parseFloat(e.dataset.grow??"0");return Number.isNaN(l)?0:l}function $(t,e,{isResize:n=!1,isDsiabledResizePanel:l=!1,sizeName:r}){return new Promise(s=>{t.hasAttribute("data-is_resize_panel")&&l&&(t.dataset.is_resize_panel="false"),t.dataset.prev_grow=d(t).toString();let h=e.filter(o=>o.style.flex!="0 1 0%"&&o!=t),a=[...h,t];a.forEach(o=>{if(o.style.transition="flex 0.5s",o.ontransitionend=w=>{w.propertyName=="flex-grow"&&(a.forEach(f=>f.style.transition=""),o.ontransitionend=()=>{})},o==t){o.dataset.grow="0",o.style.flex="0 1 0%";return}if(n)return;let i=d(o)/e.length;if(h.length==1){o.dataset.grow=e.length.toString(),o.style.flex=`${e.length} 1 0%`;return}o.dataset.grow=(e.length*i).toString(),o.style.flex=`${e.length*i} 1 0%`}),n&&p(h,e.length),s(t)})}function G(t,e,{isPrevSizeOpen:n=!1,isResize:l=!1,openGrowImportant:r=0,sizeName:s}){return new Promise(h=>{t.hasAttribute("data-is_resize_panel")&&t.hasAttribute("data-is_resize_panel")&&t.dataset.is_resize_panel=="false"&&(t.dataset.is_resize_panel="true");let a=e.filter(u=>u.style.flex!="0 1 0%"&&u!=t),o=[...a,t],i=1;const w="client"+s.charAt(0).toUpperCase()+s.substring(1),f=s&&t.parentElement&&t.parentElement[w]||0;n&&t.hasAttribute("data-prev_grow")?i=parseFloat(t.dataset.prev_grow||"1")||1:f&&f!==0?i=f/a.length/(f-1)*e.length:i=1,r&&(i=r),i=i===1/0?1:i,o.forEach(u=>{if(u.style.transition="flex 0.5s",u.ontransitionend=E=>{E.propertyName=="flex-grow"&&(o.forEach(b=>b.style.transition=""),u.ontransitionend=()=>{})},u==t){t.dataset.grow=i.toString(),t.style.flex=`${i} 1 0%`;return}if(l)return;let m=f/a.length/(f-1)*(e.length-i);m=m===1/0?1:m,u.dataset.grow=m.toString(),u.style.flex=`${m} 1 0%`}),l&&p(o,e.length),h(i)})}0&&(module.exports={closeFlex,findNotCloseFlexContent,getClientXy,getGrow,isDocumentOut,isOverMove,mathGrow,mathWeight,openFlex,remain,resize});
@@ -7,20 +7,20 @@ export declare function getClientXy(event: Event): {
7
7
  clientY: number;
8
8
  } | undefined;
9
9
  export declare function isOverMove(elementSize: number, elementMinSize: number): boolean;
10
- export declare function findNotCloseFlexContent(target: HTMLElement | Element | null, direction: 'previousElementSibling' | 'nextElementSibling'): HTMLElement | null;
10
+ export declare function findNotCloseFlexContent(target: HTMLElement | Element | null, direction: "previousElementSibling" | "nextElementSibling"): HTMLElement | null;
11
11
  export declare function remain(flexContainerList: Array<HTMLElement>): Promise<unknown>;
12
12
  export declare function resize(list: Array<HTMLElement>, totalGrow: number): Promise<unknown>;
13
13
  export declare function mathWeight(totalCount: number, totalGrow: number): number;
14
14
  export declare function mathGrow(childSize: number, parentSize: number, containerCount: number): number;
15
- export declare function getGrow(growTarget: HTMLElement | Element): number;
15
+ export declare function getGrow(el: HTMLElement | Element): number;
16
16
  export declare function closeFlex(resizeTarget: HTMLElement, containers: HTMLElement[], { isResize, isDsiabledResizePanel, sizeName, }: {
17
17
  isResize?: boolean;
18
18
  isDsiabledResizePanel?: boolean;
19
- sizeName: 'width' | 'height';
19
+ sizeName: "width" | "height";
20
20
  }): Promise<unknown>;
21
21
  export declare function openFlex(resizeTarget: HTMLElement, containers: HTMLElement[], { isPrevSizeOpen, isResize, openGrowImportant, sizeName, }: {
22
22
  isPrevSizeOpen?: boolean;
23
23
  isResize?: boolean;
24
24
  openGrowImportant?: number;
25
- sizeName?: 'width' | 'height';
25
+ sizeName?: "width" | "height";
26
26
  }): Promise<unknown>;
@@ -1,196 +1 @@
1
- function isDocumentOut({ x, y }) {
2
- if (typeof window == "undefined") return;
3
- const { innerWidth, innerHeight, scrollX, scrollY } = window;
4
- return x < 0 || y < 0 || x > innerWidth + scrollX || y > innerHeight + scrollY;
5
- }
6
- let lastTouchEvent;
7
- function getClientXy(event) {
8
- let clientX;
9
- let clientY;
10
- if (window.MouseEvent && event instanceof window.MouseEvent) {
11
- clientX = event.clientX;
12
- clientY = event.clientY;
13
- } else if (window.TouchEvent && event instanceof window.TouchEvent) {
14
- const _event = event.touches.length == 0 ? lastTouchEvent : event;
15
- clientX = _event.touches[0].clientX;
16
- clientY = _event.touches[0].clientY;
17
- lastTouchEvent = event;
18
- } else {
19
- return;
20
- }
21
- return { clientX, clientY };
22
- }
23
- function isOverMove(elementSize, elementMinSize) {
24
- return Math.floor(elementSize) <= 0 || (isNaN(elementMinSize) ? false : elementMinSize >= Math.floor(elementSize));
25
- }
26
- function findNotCloseFlexContent(target, direction) {
27
- if (!target) return target;
28
- let _target = target;
29
- const isCloseCheck = () => {
30
- let grow = parseFloat(window.getComputedStyle(_target).flex.split(" ")[0]) || 0;
31
- if (grow == 0) {
32
- return true;
33
- } else {
34
- return false;
35
- }
36
- };
37
- while (isCloseCheck()) {
38
- let nextTarget = _target[direction]?.[direction];
39
- _target = nextTarget;
40
- if (!_target) {
41
- break;
42
- }
43
- }
44
- return _target;
45
- }
46
- function remain(flexContainerList) {
47
- return new Promise((resolve) => {
48
- let notGrowList = [];
49
- let totalGrow = flexContainerList.reduce((t, e, i) => {
50
- if (e.hasAttribute("data-grow") == false) {
51
- notGrowList.push(e);
52
- return t;
53
- }
54
- let grow = parseFloat(e.dataset.grow || "");
55
- e.style.flex = `${grow} 1 0%`;
56
- t -= grow;
57
- return t;
58
- }, flexContainerList.length);
59
- if (notGrowList.length != 0) {
60
- resize(notGrowList, totalGrow);
61
- }
62
- resolve(flexContainerList);
63
- });
64
- }
65
- function resize(list, totalGrow) {
66
- return new Promise((resolve) => {
67
- let resizeWeight = totalGrow / list.length;
68
- list.forEach((e) => {
69
- e.dataset.grow = resizeWeight.toString();
70
- e.style.flex = `${resizeWeight} 1 0%`;
71
- });
72
- resolve(resizeWeight);
73
- });
74
- }
75
- function mathWeight(totalCount, totalGrow) {
76
- return 1 + (totalGrow - totalCount) / totalCount;
77
- }
78
- function mathGrow(childSize, parentSize, containerCount) {
79
- return containerCount * (childSize / parentSize);
80
- }
81
- function getGrow(growTarget) {
82
- const target = growTarget instanceof Element ? growTarget : growTarget;
83
- return parseFloat(target.style.flex.split(" ")[0]) || parseFloat(target.dataset.grow || "");
84
- }
85
- function closeFlex(resizeTarget, containers, {
86
- isResize = false,
87
- isDsiabledResizePanel = false,
88
- sizeName
89
- }) {
90
- return new Promise((resolve) => {
91
- if (!resizeTarget.hasAttribute("data-is_resize_panel")) ; else if (isDsiabledResizePanel) {
92
- resizeTarget.dataset.is_resize_panel = "false";
93
- }
94
- resizeTarget.dataset.prev_grow = getGrow(resizeTarget).toString();
95
- let notCloseList = containers.filter(
96
- (e) => e.style.flex != "0 1 0%" && e != resizeTarget
97
- );
98
- let notCloseAndOpenTargetList = [...notCloseList, resizeTarget];
99
- notCloseAndOpenTargetList.forEach((e) => {
100
- e.style.transition = "flex 0.5s";
101
- e.ontransitionend = (event) => {
102
- if (event.propertyName != "flex-grow") {
103
- return;
104
- }
105
- notCloseAndOpenTargetList.forEach(
106
- (e2) => e2.style.transition = ""
107
- );
108
- e.ontransitionend = () => {
109
- };
110
- };
111
- if (e == resizeTarget) {
112
- e.dataset.grow = "0";
113
- e.style.flex = `0 1 0%`;
114
- return;
115
- }
116
- if (isResize) {
117
- return;
118
- }
119
- let percent = getGrow(e) / containers.length;
120
- if (notCloseList.length == 1) {
121
- e.dataset.grow = containers.length.toString();
122
- e.style.flex = `${containers.length} 1 0%`;
123
- return;
124
- }
125
- e.dataset.grow = (containers.length * percent).toString();
126
- e.style.flex = `${containers.length * percent} 1 0%`;
127
- });
128
- if (isResize) {
129
- resize(notCloseList, containers.length);
130
- }
131
- resolve(resizeTarget);
132
- });
133
- }
134
- function openFlex(resizeTarget, containers, {
135
- isPrevSizeOpen = false,
136
- isResize = false,
137
- openGrowImportant = 0,
138
- sizeName
139
- }) {
140
- return new Promise((resolve) => {
141
- if (!resizeTarget.hasAttribute("data-is_resize_panel")) ; else if (resizeTarget.hasAttribute("data-is_resize_panel") && resizeTarget.dataset.is_resize_panel == "false") {
142
- resizeTarget.dataset.is_resize_panel = "true";
143
- }
144
- let notCloseList = containers.filter(
145
- (e) => e.style.flex != "0 1 0%" && e != resizeTarget
146
- );
147
- let notCloseAndOpenTargetList = [...notCloseList, resizeTarget];
148
- let openTargetGrow = 1;
149
- const sizeStyleName = "client" + sizeName.charAt(0).toUpperCase() + sizeName.substring(1);
150
- const parentSize = sizeName && resizeTarget.parentElement && resizeTarget.parentElement[sizeStyleName] || 0;
151
- if (isPrevSizeOpen && resizeTarget.hasAttribute("data-prev_grow")) {
152
- openTargetGrow = parseFloat(resizeTarget.dataset.prev_grow || "1") || 1;
153
- } else if (parentSize && parentSize !== 0) {
154
- openTargetGrow = parentSize / notCloseList.length / (parentSize - 1) * containers.length;
155
- } else {
156
- openTargetGrow = 1;
157
- }
158
- if (openGrowImportant) {
159
- openTargetGrow = openGrowImportant;
160
- }
161
- openTargetGrow = openTargetGrow === Infinity ? 1 : openTargetGrow;
162
- notCloseAndOpenTargetList.forEach((e) => {
163
- e.style.transition = "flex 0.5s";
164
- e.ontransitionend = (event) => {
165
- if (event.propertyName != "flex-grow") {
166
- return;
167
- }
168
- notCloseAndOpenTargetList.forEach(
169
- (e2) => e2.style.transition = ""
170
- );
171
- e.ontransitionend = () => {
172
- };
173
- };
174
- if (e == resizeTarget) {
175
- resizeTarget.dataset.grow = openTargetGrow.toString();
176
- resizeTarget.style.flex = `${openTargetGrow} 1 0%`;
177
- return;
178
- }
179
- if (isResize) {
180
- return;
181
- }
182
- let grow = parentSize / notCloseList.length / (parentSize - 1) * (containers.length - openTargetGrow);
183
- grow = grow === Infinity ? 1 : grow;
184
- e.dataset.grow = grow.toString();
185
- e.style.flex = `${grow} 1 0%`;
186
- });
187
- if (isResize) {
188
- resize(notCloseAndOpenTargetList, containers.length);
189
- }
190
- resolve(openTargetGrow);
191
- });
192
- }
193
-
194
- export { closeFlex, findNotCloseFlexContent, getClientXy, getGrow, isDocumentOut, isOverMove, mathGrow, mathWeight, openFlex, remain, resize };
195
- //# sourceMappingURL=FlexLayoutUtils.js.map
196
- //# sourceMappingURL=FlexLayoutUtils.js.map
1
+ function b({x:t,y:e}){if(typeof window>"u")return;const{innerWidth:n,innerHeight:l,scrollX:o,scrollY:s}=window;return t<0||e<0||t>n+o||e>l+s}let c;function x(t){let e,n;if(window.MouseEvent&&t instanceof window.MouseEvent)e=t.clientX,n=t.clientY;else if(window.TouchEvent&&t instanceof window.TouchEvent){const l=t.touches.length==0?c:t;e=l.touches[0].clientX,n=l.touches[0].clientY,c=t}else return;return{clientX:e,clientY:n}}function y(t,e){return Math.floor(t)<=0||(isNaN(e)?!1:e>=Math.floor(t))}function M(t,e){if(!t)return t;let n=t;const l=()=>(parseFloat(window.getComputedStyle(n).flex.split(" ")[0])||0)==0;for(;l()&&(n=n[e]?.[e],!!n););return n}function L(t){return new Promise(e=>{let n=[],l=t.reduce((o,s,h)=>{if(s.hasAttribute("data-grow")==!1)return n.push(s),o;let a=parseFloat(s.dataset.grow||"");return s.style.flex=`${a} 1 0%`,o-=a,o},t.length);n.length!=0&&w(n,l),e(t)})}function w(t,e){return new Promise(n=>{let l=e/t.length;t.forEach(o=>{o.dataset.grow=l.toString(),o.style.flex=`${l} 1 0%`}),n(l)})}function _(t,e){return 1+(e-t)/t}function H(t,e,n){return n*(t/e)}function d(t){const e=(t instanceof Element,t),n=parseFloat(e.style.flex.split(" ")[0]);if(!Number.isNaN(n))return n;const l=parseFloat(e.dataset.grow??"0");return Number.isNaN(l)?0:l}function N(t,e,{isResize:n=!1,isDsiabledResizePanel:l=!1,sizeName:o}){return new Promise(s=>{t.hasAttribute("data-is_resize_panel")&&l&&(t.dataset.is_resize_panel="false"),t.dataset.prev_grow=d(t).toString();let h=e.filter(r=>r.style.flex!="0 1 0%"&&r!=t),a=[...h,t];a.forEach(r=>{if(r.style.transition="flex 0.5s",r.ontransitionend=p=>{p.propertyName=="flex-grow"&&(a.forEach(f=>f.style.transition=""),r.ontransitionend=()=>{})},r==t){r.dataset.grow="0",r.style.flex="0 1 0%";return}if(n)return;let i=d(r)/e.length;if(h.length==1){r.dataset.grow=e.length.toString(),r.style.flex=`${e.length} 1 0%`;return}r.dataset.grow=(e.length*i).toString(),r.style.flex=`${e.length*i} 1 0%`}),n&&w(h,e.length),s(t)})}function A(t,e,{isPrevSizeOpen:n=!1,isResize:l=!1,openGrowImportant:o=0,sizeName:s}){return new Promise(h=>{t.hasAttribute("data-is_resize_panel")&&t.hasAttribute("data-is_resize_panel")&&t.dataset.is_resize_panel=="false"&&(t.dataset.is_resize_panel="true");let a=e.filter(u=>u.style.flex!="0 1 0%"&&u!=t),r=[...a,t],i=1;const p="client"+s.charAt(0).toUpperCase()+s.substring(1),f=s&&t.parentElement&&t.parentElement[p]||0;n&&t.hasAttribute("data-prev_grow")?i=parseFloat(t.dataset.prev_grow||"1")||1:f&&f!==0?i=f/a.length/(f-1)*e.length:i=1,o&&(i=o),i=i===1/0?1:i,r.forEach(u=>{if(u.style.transition="flex 0.5s",u.ontransitionend=g=>{g.propertyName=="flex-grow"&&(r.forEach(E=>E.style.transition=""),u.ontransitionend=()=>{})},u==t){t.dataset.grow=i.toString(),t.style.flex=`${i} 1 0%`;return}if(l)return;let m=f/a.length/(f-1)*(e.length-i);m=m===1/0?1:m,u.dataset.grow=m.toString(),u.style.flex=`${m} 1 0%`}),l&&w(r,e.length),h(i)})}export{N as closeFlex,M as findNotCloseFlexContent,x as getClientXy,d as getGrow,b as isDocumentOut,y as isOverMove,H as mathGrow,_ as mathWeight,A as openFlex,L as remain,w as resize};
@@ -1,14 +1 @@
1
- 'use strict';
2
-
3
- var FlexLayoutUtils = require('./FlexLayoutUtils');
4
-
5
-
6
-
7
- Object.keys(FlexLayoutUtils).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
- enumerable: true,
10
- get: function () { return FlexLayoutUtils[k]; }
11
- });
12
- });
13
- //# sourceMappingURL=index.cjs.map
14
- //# sourceMappingURL=index.cjs.map
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./FlexLayoutUtils"),module.exports);0&&(module.exports={...require("./FlexLayoutUtils")});
@@ -1,3 +1 @@
1
- export * from './FlexLayoutUtils';
2
- //# sourceMappingURL=index.js.map
3
- //# sourceMappingURL=index.js.map
1
+ export*from"./FlexLayoutUtils";
package/dist/index.cjs CHANGED
@@ -1,14 +1 @@
1
- 'use strict';
2
-
3
- var flexLayout = require('./flex-layout');
4
-
5
-
6
-
7
- Object.keys(flexLayout).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
- enumerable: true,
10
- get: function () { return flexLayout[k]; }
11
- });
12
- });
13
- //# sourceMappingURL=index.cjs.map
14
- //# sourceMappingURL=index.cjs.map
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./flex-layout"),module.exports);0&&(module.exports={...require("./flex-layout")});
package/dist/index.js CHANGED
@@ -1,3 +1 @@
1
- export * from './flex-layout';
2
- //# sourceMappingURL=index.js.map
3
- //# sourceMappingURL=index.js.map
1
+ export*from"./flex-layout";
@@ -1,4 +1 @@
1
- 'use strict';
2
-
3
- //# sourceMappingURL=css.d.cjs.map
4
- //# sourceMappingURL=css.d.cjs.map
1
+ "use strict";
@@ -1,3 +0,0 @@
1
-
2
- //# sourceMappingURL=css.d.js.map
3
- //# sourceMappingURL=css.d.js.map