lilact 0.26.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lilact.development.js +46 -17
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +23 -23
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +23 -23
- package/docs/functions/timers.timeoutPromise.html +1 -1
- package/docs/static/lilact.development.js +46 -17
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +23 -23
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +23 -23
- package/docs/variables/accessories.SplitPane.html +1 -1
- package/examples/lilact.development.js +46 -17
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +23 -23
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +23 -23
- package/package.json +1 -1
- package/src/accessories.jsx +59 -22
|
@@ -4970,7 +4970,7 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
4970
4970
|
max = 0.9,
|
|
4971
4971
|
splitterSize = 8,
|
|
4972
4972
|
onSizeChange,
|
|
4973
|
-
|
|
4973
|
+
resizePolicy = "proportional",
|
|
4974
4974
|
style,
|
|
4975
4975
|
className,
|
|
4976
4976
|
firstPaneStyle,
|
|
@@ -5036,18 +5036,47 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5036
5036
|
const rect2 = el.getBoundingClientRect();
|
|
5037
5037
|
const o = sizeRef.current;
|
|
5038
5038
|
sizeRef.current = { w: rect2.width, h: rect2.height };
|
|
5039
|
+
const EPS = 1e-6;
|
|
5040
|
+
function clamp01(x) {
|
|
5041
|
+
return Math.min(1, Math.max(0, x));
|
|
5042
|
+
}
|
|
5039
5043
|
if ((_a = ref.current) == null ? void 0 : _a.getPosition) {
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5044
|
+
const p2 = ref.current.getPosition();
|
|
5045
|
+
if (resizePolicy === "fixFirst") {
|
|
5046
|
+
if (internalMode === "vertical") {
|
|
5047
|
+
const availOld = o.h - splitterSize;
|
|
5048
|
+
const availNew = sizeRef.current.h - splitterSize;
|
|
5049
|
+
if (availOld > 0 && availNew > 0) {
|
|
5050
|
+
const firstPx = p2 * availOld;
|
|
5051
|
+
const nextP = firstPx / availNew;
|
|
5052
|
+
if (Math.abs(nextP - p2) > EPS) setPosition(clamp01(nextP));
|
|
5053
|
+
}
|
|
5054
|
+
} else {
|
|
5055
|
+
const availOld = o.w - splitterSize;
|
|
5056
|
+
const availNew = sizeRef.current.w - splitterSize;
|
|
5057
|
+
if (availOld > 0 && availNew > 0) {
|
|
5058
|
+
const firstPx = p2 * availOld;
|
|
5059
|
+
const nextP = firstPx / availNew;
|
|
5060
|
+
if (Math.abs(nextP - p2) > EPS) setPosition(clamp01(nextP));
|
|
5061
|
+
}
|
|
5045
5062
|
}
|
|
5046
|
-
} else if (
|
|
5047
|
-
if (internalMode === "vertical"
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5063
|
+
} else if (resizePolicy === "fixSecond") {
|
|
5064
|
+
if (internalMode === "vertical") {
|
|
5065
|
+
const availOld = o.h - splitterSize;
|
|
5066
|
+
const availNew = sizeRef.current.h - splitterSize;
|
|
5067
|
+
if (availOld > 0 && availNew > 0) {
|
|
5068
|
+
const secondPx = (1 - p2) * availOld;
|
|
5069
|
+
const nextP = 1 - secondPx / availNew;
|
|
5070
|
+
if (Math.abs(nextP - p2) > EPS) setPosition(clamp01(nextP));
|
|
5071
|
+
}
|
|
5072
|
+
} else {
|
|
5073
|
+
const availOld = o.w - splitterSize;
|
|
5074
|
+
const availNew = sizeRef.current.w - splitterSize;
|
|
5075
|
+
if (availOld > 0 && availNew > 0) {
|
|
5076
|
+
const secondPx = (1 - p2) * availOld;
|
|
5077
|
+
const nextP = 1 - secondPx / availNew;
|
|
5078
|
+
if (Math.abs(nextP - p2) > EPS) setPosition(clamp01(nextP));
|
|
5079
|
+
}
|
|
5051
5080
|
}
|
|
5052
5081
|
}
|
|
5053
5082
|
}
|
|
@@ -5056,7 +5085,7 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5056
5085
|
const rect = el.getBoundingClientRect();
|
|
5057
5086
|
sizeRef.current = { w: rect.width, h: rect.height };
|
|
5058
5087
|
return () => ro.disconnect();
|
|
5059
|
-
}, [
|
|
5088
|
+
}, [resizePolicy, internalMode]);
|
|
5060
5089
|
const startPosRef = useRef(posResolved);
|
|
5061
5090
|
const [dragging, setDragging] = useState(false);
|
|
5062
5091
|
const handleStart = () => {
|
|
@@ -5104,7 +5133,7 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5104
5133
|
if (internalMode === "horizontal") {
|
|
5105
5134
|
computedPane1Style.bottom = 0;
|
|
5106
5135
|
computedPane2Style.top = 0;
|
|
5107
|
-
if (
|
|
5136
|
+
if (resizePolicy === "fixFirst") {
|
|
5108
5137
|
computedPane1Style.width = p * (w - splitterSize);
|
|
5109
5138
|
computedPane2Style.left = computedPane1Style.width + splitterSize;
|
|
5110
5139
|
Object.assign(computedSplitterStyle, {
|
|
@@ -5113,13 +5142,13 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5113
5142
|
left: computedPane1Style.width,
|
|
5114
5143
|
width: splitterSize
|
|
5115
5144
|
});
|
|
5116
|
-
} else if (
|
|
5145
|
+
} else if (resizePolicy === "fixSecond") {
|
|
5117
5146
|
computedPane2Style.width = (1 - p) * (w - splitterSize);
|
|
5118
5147
|
computedPane1Style.right = computedPane2Style.width + splitterSize;
|
|
5119
5148
|
Object.assign(computedSplitterStyle, {
|
|
5120
5149
|
top: 0,
|
|
5121
5150
|
bottom: 0,
|
|
5122
|
-
|
|
5151
|
+
right: computedPane2Style.width,
|
|
5123
5152
|
width: splitterSize
|
|
5124
5153
|
});
|
|
5125
5154
|
} else {
|
|
@@ -5135,7 +5164,7 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5135
5164
|
} else {
|
|
5136
5165
|
computedPane1Style.right = 0;
|
|
5137
5166
|
computedPane2Style.left = 0;
|
|
5138
|
-
if (
|
|
5167
|
+
if (resizePolicy === "fixFirst") {
|
|
5139
5168
|
computedPane1Style.height = p * (h - splitterSize);
|
|
5140
5169
|
computedPane2Style.top = computedPane1Style.height + splitterSize;
|
|
5141
5170
|
Object.assign(computedSplitterStyle, {
|
|
@@ -5144,7 +5173,7 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5144
5173
|
top: computedPane1Style.height,
|
|
5145
5174
|
height: splitterSize
|
|
5146
5175
|
});
|
|
5147
|
-
} else if (
|
|
5176
|
+
} else if (resizePolicy === "fixSecond") {
|
|
5148
5177
|
computedPane2Style.height = (1 - p) * (h - splitterSize);
|
|
5149
5178
|
computedPane1Style.bottom = computedPane2Style.height + splitterSize;
|
|
5150
5179
|
Object.assign(computedSplitterStyle, {
|