lilact 0.24.2 → 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/README.md +1 -1
- package/dist/lilact.development.js +169 -60
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +28 -28
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +28 -28
- package/docs/classes/accessories.ErrorBoundary.html +8 -8
- package/docs/classes/accessories.Suspense.html +7 -7
- package/docs/classes/components.Component.html +11 -11
- package/docs/classes/components.HTMLComponent.html +11 -11
- package/docs/classes/components.RootComponent.html +11 -11
- package/docs/functions/components.cloneComponent.html +1 -1
- package/docs/functions/components.createComponent.html +1 -1
- package/docs/functions/components.createPortal.html +1 -1
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.memo.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +7 -2
- package/docs/index.html +1 -7
- package/docs/static/demos/usedefered.jsx +1 -1
- package/docs/static/lilact.development.js +169 -60
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +28 -28
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +28 -28
- package/docs/variables/accessories.SplitPane.html +8 -3
- package/docs/variables/components.cloneElement.html +1 -1
- package/examples/demos/usedefered.jsx +1 -1
- package/examples/lilact.development.js +169 -60
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +28 -28
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +28 -28
- package/package.json +1 -1
- package/src/accessories.jsx +195 -89
- package/src/components.jsx +5 -3
- package/src/jsx.js +1 -1
- package/src/lilact.jsx +1 -1
package/README.md
CHANGED
|
@@ -2408,6 +2408,8 @@ var ComponentCore = class {
|
|
|
2408
2408
|
insert_index
|
|
2409
2409
|
loader_args
|
|
2410
2410
|
|
|
2411
|
+
is_svg
|
|
2412
|
+
|
|
2411
2413
|
*/
|
|
2412
2414
|
__publicField(this, "component");
|
|
2413
2415
|
__publicField(this, "props");
|
|
@@ -3039,7 +3041,7 @@ var HTMLComponent = class extends Component {
|
|
|
3039
3041
|
};
|
|
3040
3042
|
var RootComponent = class extends HTMLComponent {
|
|
3041
3043
|
constructor(element, props) {
|
|
3042
|
-
super(":root", props);
|
|
3044
|
+
super(":root:", props);
|
|
3043
3045
|
__publicField(this, "displayName", "Root");
|
|
3044
3046
|
if (typeof this.element === "string") {
|
|
3045
3047
|
element = document.querySelector(element);
|
|
@@ -4968,26 +4970,55 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
4968
4970
|
max = 0.9,
|
|
4969
4971
|
splitterSize = 8,
|
|
4970
4972
|
onSizeChange,
|
|
4973
|
+
resizePolicy = "proportional",
|
|
4971
4974
|
style,
|
|
4972
4975
|
className,
|
|
4973
4976
|
firstPaneStyle,
|
|
4974
4977
|
secondPaneStyle,
|
|
4975
4978
|
splitterStyle,
|
|
4979
|
+
splitterChild,
|
|
4976
4980
|
children
|
|
4977
4981
|
}, ref) {
|
|
4982
|
+
const containerRef = useRef(null);
|
|
4983
|
+
const sizeRef = useRef({ w: 0, h: 0 });
|
|
4978
4984
|
const initialMode = mode === "vertical" ? "vertical" : "horizontal";
|
|
4979
4985
|
const [internalMode, setInternalMode] = useState(initialMode);
|
|
4980
|
-
const [internalPos, setInternalPos] = useState(clamp(
|
|
4981
|
-
|
|
4986
|
+
const [internalPos, setInternalPos] = useState(clamp(
|
|
4987
|
+
defaultPosition,
|
|
4988
|
+
min,
|
|
4989
|
+
max,
|
|
4990
|
+
mode === "verical" ? sizeRef.current.h : sizeRef.current.w,
|
|
4991
|
+
splitterSize
|
|
4992
|
+
));
|
|
4993
|
+
let posResolved = position2 == null ? internalPos : position2;
|
|
4994
|
+
posResolved = clamp(
|
|
4995
|
+
posResolved,
|
|
4996
|
+
min,
|
|
4997
|
+
max,
|
|
4998
|
+
mode === "verical" ? sizeRef.current.h : sizeRef.current.w,
|
|
4999
|
+
splitterSize
|
|
5000
|
+
);
|
|
4982
5001
|
useEffect(() => {
|
|
4983
5002
|
if (position2 == null) return;
|
|
4984
|
-
setInternalPos(clamp(
|
|
5003
|
+
setInternalPos(clamp(
|
|
5004
|
+
position2,
|
|
5005
|
+
min,
|
|
5006
|
+
max,
|
|
5007
|
+
mode === "verical" ? sizeRef.current.h : sizeRef.current.w,
|
|
5008
|
+
splitterSize
|
|
5009
|
+
));
|
|
4985
5010
|
}, [position2, min, max]);
|
|
4986
5011
|
useEffect(() => {
|
|
4987
5012
|
setInternalMode(mode === "vertical" ? "vertical" : "horizontal");
|
|
4988
5013
|
}, [mode]);
|
|
4989
5014
|
const setPosition = (next2) => {
|
|
4990
|
-
const clamped = clamp(
|
|
5015
|
+
const clamped = clamp(
|
|
5016
|
+
next2,
|
|
5017
|
+
min,
|
|
5018
|
+
max,
|
|
5019
|
+
mode === "verical" ? sizeRef.current.h : sizeRef.current.w,
|
|
5020
|
+
splitterSize
|
|
5021
|
+
);
|
|
4991
5022
|
if (position2 == null) setInternalPos(clamped);
|
|
4992
5023
|
onSizeChange == null ? void 0 : onSizeChange(clamped);
|
|
4993
5024
|
};
|
|
@@ -4997,20 +5028,64 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
4997
5028
|
getPosition: () => posResolved,
|
|
4998
5029
|
getMode: () => internalMode
|
|
4999
5030
|
}));
|
|
5000
|
-
const containerRef = useRef(null);
|
|
5001
|
-
const sizeRef = useRef({ w: 0, h: 0 });
|
|
5002
5031
|
useLayoutEffect(() => {
|
|
5003
5032
|
const el = containerRef.current;
|
|
5004
5033
|
if (!el) return;
|
|
5005
5034
|
const ro = new ResizeObserver(() => {
|
|
5035
|
+
var _a;
|
|
5006
5036
|
const rect2 = el.getBoundingClientRect();
|
|
5037
|
+
const o = sizeRef.current;
|
|
5007
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
|
+
}
|
|
5043
|
+
if ((_a = ref.current) == null ? void 0 : _a.getPosition) {
|
|
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
|
+
}
|
|
5062
|
+
}
|
|
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
|
+
}
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5008
5083
|
});
|
|
5009
5084
|
ro.observe(el);
|
|
5010
5085
|
const rect = el.getBoundingClientRect();
|
|
5011
5086
|
sizeRef.current = { w: rect.width, h: rect.height };
|
|
5012
5087
|
return () => ro.disconnect();
|
|
5013
|
-
}, []);
|
|
5088
|
+
}, [resizePolicy, internalMode]);
|
|
5014
5089
|
const startPosRef = useRef(posResolved);
|
|
5015
5090
|
const [dragging, setDragging] = useState(false);
|
|
5016
5091
|
const handleStart = () => {
|
|
@@ -5018,11 +5093,11 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5018
5093
|
startPosRef.current = posResolved;
|
|
5019
5094
|
};
|
|
5020
5095
|
const handleDelta = (x, y, _data) => {
|
|
5021
|
-
const { w, h } = sizeRef.current;
|
|
5096
|
+
const { w: w2, h: h2 } = sizeRef.current;
|
|
5022
5097
|
if (internalMode === "horizontal") {
|
|
5023
|
-
setPosition(startPosRef.current + x / (
|
|
5098
|
+
setPosition(startPosRef.current + x / (w2 || 1));
|
|
5024
5099
|
} else {
|
|
5025
|
-
setPosition(startPosRef.current + y / (
|
|
5100
|
+
setPosition(startPosRef.current + y / (h2 || 1));
|
|
5026
5101
|
}
|
|
5027
5102
|
};
|
|
5028
5103
|
const handleEnd = () => setDragging(false);
|
|
@@ -5030,79 +5105,113 @@ var SplitPane = forwardRef(function SplitPane2({
|
|
|
5030
5105
|
const firstChild = arr[0];
|
|
5031
5106
|
const secondChild = arr[1];
|
|
5032
5107
|
const p = posResolved;
|
|
5033
|
-
const
|
|
5108
|
+
const { w, h } = sizeRef.current;
|
|
5109
|
+
const computedPane1Style = {
|
|
5034
5110
|
position: "absolute",
|
|
5035
5111
|
top: 0,
|
|
5036
|
-
bottom: 0,
|
|
5037
|
-
left: 0,
|
|
5038
|
-
width: `calc(${p} * (100% - ${splitterSize}px))`,
|
|
5039
|
-
overflow: "auto",
|
|
5040
|
-
...firstPaneStyle || {}
|
|
5041
|
-
} : {
|
|
5042
|
-
position: "absolute",
|
|
5043
5112
|
left: 0,
|
|
5044
|
-
right: 0,
|
|
5045
|
-
top: 0,
|
|
5046
|
-
height: `calc(${p} * (100% - ${splitterSize}px))`,
|
|
5047
5113
|
overflow: "auto",
|
|
5048
5114
|
...firstPaneStyle || {}
|
|
5049
5115
|
};
|
|
5050
|
-
const
|
|
5116
|
+
const computedPane2Style = {
|
|
5051
5117
|
position: "absolute",
|
|
5052
|
-
top: 0,
|
|
5053
5118
|
bottom: 0,
|
|
5054
|
-
left: `calc(${p} * (100% - ${splitterSize}px) + ${splitterSize}px)`,
|
|
5055
|
-
right: 0,
|
|
5056
|
-
overflow: "auto",
|
|
5057
|
-
...secondPaneStyle || {}
|
|
5058
|
-
} : {
|
|
5059
|
-
position: "absolute",
|
|
5060
|
-
left: 0,
|
|
5061
5119
|
right: 0,
|
|
5062
|
-
top: `calc(${p} * (100% - ${splitterSize}px) + ${splitterSize}px)`,
|
|
5063
|
-
bottom: 0,
|
|
5064
5120
|
overflow: "auto",
|
|
5065
5121
|
...secondPaneStyle || {}
|
|
5066
5122
|
};
|
|
5067
|
-
const
|
|
5123
|
+
const computedSplitterStyle = {
|
|
5068
5124
|
background: "rgba(0,0,0,0.08)",
|
|
5069
5125
|
boxShadow: "inset 0 0 2px rgba(0,0,0,0.25)",
|
|
5070
|
-
zIndex: 10
|
|
5071
|
-
};
|
|
5072
|
-
const splitterAbsStyle = internalMode === "horizontal" ? {
|
|
5126
|
+
zIndex: 10,
|
|
5073
5127
|
position: "absolute",
|
|
5074
|
-
|
|
5075
|
-
bottom: 0,
|
|
5076
|
-
left: `calc(${p} * (100% - ${splitterSize}px))`,
|
|
5077
|
-
width: splitterSize,
|
|
5078
|
-
height: "100%",
|
|
5079
|
-
cursor: dragging ? "col-resize" : "col-resize",
|
|
5128
|
+
cursor: internalMode === "horizontal" ? "col-resize" : "row-resize",
|
|
5080
5129
|
touchAction: "none",
|
|
5081
5130
|
pointerEvents: "auto",
|
|
5082
|
-
...splitterBase,
|
|
5083
|
-
...splitterStyle || {}
|
|
5084
|
-
} : {
|
|
5085
|
-
position: "absolute",
|
|
5086
|
-
left: 0,
|
|
5087
|
-
right: 0,
|
|
5088
|
-
top: `calc(${p} * (100% - ${splitterSize}px))`,
|
|
5089
|
-
height: splitterSize,
|
|
5090
|
-
width: "100%",
|
|
5091
|
-
cursor: dragging ? "row-resize" : "row-resize",
|
|
5092
|
-
touchAction: "none",
|
|
5093
|
-
pointerEvents: "auto",
|
|
5094
|
-
...splitterBase,
|
|
5095
5131
|
...splitterStyle || {}
|
|
5096
5132
|
};
|
|
5133
|
+
if (internalMode === "horizontal") {
|
|
5134
|
+
computedPane1Style.bottom = 0;
|
|
5135
|
+
computedPane2Style.top = 0;
|
|
5136
|
+
if (resizePolicy === "fixFirst") {
|
|
5137
|
+
computedPane1Style.width = p * (w - splitterSize);
|
|
5138
|
+
computedPane2Style.left = computedPane1Style.width + splitterSize;
|
|
5139
|
+
Object.assign(computedSplitterStyle, {
|
|
5140
|
+
top: 0,
|
|
5141
|
+
bottom: 0,
|
|
5142
|
+
left: computedPane1Style.width,
|
|
5143
|
+
width: splitterSize
|
|
5144
|
+
});
|
|
5145
|
+
} else if (resizePolicy === "fixSecond") {
|
|
5146
|
+
computedPane2Style.width = (1 - p) * (w - splitterSize);
|
|
5147
|
+
computedPane1Style.right = computedPane2Style.width + splitterSize;
|
|
5148
|
+
Object.assign(computedSplitterStyle, {
|
|
5149
|
+
top: 0,
|
|
5150
|
+
bottom: 0,
|
|
5151
|
+
right: computedPane2Style.width,
|
|
5152
|
+
width: splitterSize
|
|
5153
|
+
});
|
|
5154
|
+
} else {
|
|
5155
|
+
computedPane1Style.width = `calc(${p} * (100% - ${splitterSize}px))`;
|
|
5156
|
+
computedPane2Style.left = `calc(${p} * (100% - ${splitterSize}px) + ${splitterSize}px)`;
|
|
5157
|
+
Object.assign(computedSplitterStyle, {
|
|
5158
|
+
top: 0,
|
|
5159
|
+
bottom: 0,
|
|
5160
|
+
left: `calc(${p} * (100% - ${splitterSize}px))`,
|
|
5161
|
+
width: splitterSize
|
|
5162
|
+
});
|
|
5163
|
+
}
|
|
5164
|
+
} else {
|
|
5165
|
+
computedPane1Style.right = 0;
|
|
5166
|
+
computedPane2Style.left = 0;
|
|
5167
|
+
if (resizePolicy === "fixFirst") {
|
|
5168
|
+
computedPane1Style.height = p * (h - splitterSize);
|
|
5169
|
+
computedPane2Style.top = computedPane1Style.height + splitterSize;
|
|
5170
|
+
Object.assign(computedSplitterStyle, {
|
|
5171
|
+
left: 0,
|
|
5172
|
+
right: 0,
|
|
5173
|
+
top: computedPane1Style.height,
|
|
5174
|
+
height: splitterSize
|
|
5175
|
+
});
|
|
5176
|
+
} else if (resizePolicy === "fixSecond") {
|
|
5177
|
+
computedPane2Style.height = (1 - p) * (h - splitterSize);
|
|
5178
|
+
computedPane1Style.bottom = computedPane2Style.height + splitterSize;
|
|
5179
|
+
Object.assign(computedSplitterStyle, {
|
|
5180
|
+
left: 0,
|
|
5181
|
+
right: 0,
|
|
5182
|
+
bottom: computedPane2Style.height,
|
|
5183
|
+
height: splitterSize
|
|
5184
|
+
});
|
|
5185
|
+
} else {
|
|
5186
|
+
computedPane1Style.height = `calc(${p} * (100% - ${splitterSize}px))`;
|
|
5187
|
+
computedPane2Style.top = `calc(${p} * (100% - ${splitterSize}px) + ${splitterSize}px)`;
|
|
5188
|
+
Object.assign(computedSplitterStyle, {
|
|
5189
|
+
left: 0,
|
|
5190
|
+
right: 0,
|
|
5191
|
+
top: computedPane1Style.height,
|
|
5192
|
+
height: splitterSize
|
|
5193
|
+
});
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5097
5196
|
return createComponent("div", { "ref": containerRef, "className": className, "style": {
|
|
5098
5197
|
position: "relative",
|
|
5099
5198
|
width: "100%",
|
|
5100
5199
|
height: "100%",
|
|
5101
5200
|
overflow: "hidden",
|
|
5102
5201
|
...style || {}
|
|
5103
|
-
} }, createComponent("div", { "style":
|
|
5202
|
+
} }, createComponent("div", { "style": computedPane1Style }, firstChild), createComponent("div", { "style": computedPane2Style }, secondChild), createComponent(DragHandle, { "onStart": handleStart, "onDelta": handleDelta, "onEnd": handleEnd, "style": computedSplitterStyle, "className": "splitter" }, splitterChild));
|
|
5104
5203
|
});
|
|
5105
|
-
var clamp = (v, min, max
|
|
5204
|
+
var clamp = function(v, min, max, size, splitterSize) {
|
|
5205
|
+
if (typeof min === "function") {
|
|
5206
|
+
if (size > 0) min = min(size, splitterSize);
|
|
5207
|
+
else min = 0;
|
|
5208
|
+
}
|
|
5209
|
+
if (typeof max === "function") {
|
|
5210
|
+
if (size > 0) max = max(size, splitterSize);
|
|
5211
|
+
else max = 1;
|
|
5212
|
+
}
|
|
5213
|
+
return Math.max(min, Math.min(max, v));
|
|
5214
|
+
};
|
|
5106
5215
|
|
|
5107
5216
|
// .tmp/src/vlq.js
|
|
5108
5217
|
var char_to_integer = {};
|
|
@@ -5568,7 +5677,7 @@ var transpilerConfig = {
|
|
|
5568
5677
|
};
|
|
5569
5678
|
var raiseError;
|
|
5570
5679
|
var tab = 0;
|
|
5571
|
-
var TOKENIZE_RE = /(\{|\}|\[|\]|\(|\)|\.\.\.|=>|\?\?=|\?\?|\?\.|===|!==|>>>|<<=|>>=|>>>=|\*\*=|\*\*|&&=|\|\|=|<=|>=|==|!=|<<|>>|\+\+|--|\+=|-=|\*=|\/=|%=|&=|\^=|\|=|=|\+|-|\*|\/|%|&|\^|\||!|~|\?|:|<|>|=|\.|,|;|\n+|[\s^\n]+)/
|
|
5680
|
+
var TOKENIZE_RE = /(\{|\}|\[|\]|\(|\)|\.\.\.|=>|\?\?=|\?\?|\?\.|===|!==|>>>|<<=|>>=|>>>=|\*\*=|\*\*|&&=|\|\|=|<=|>=|==|!=|<<|>>|\+\+|--|\+=|-=|\*=|\/=|%=|&=|\^=|\|=|=|\+|-|\*|\/|%|&|\^|\||!|~|\?|:|<|>|=|\.|,|;|\n+|[\s^\n]+)/g;
|
|
5572
5681
|
function lookAhead(f, code2, index2, ...args) {
|
|
5573
5682
|
const b2 = f(code2, index2, ...args);
|
|
5574
5683
|
if (b2) {
|
|
@@ -6433,7 +6542,7 @@ function transpileJSX(jsx2, {
|
|
|
6433
6542
|
|
|
6434
6543
|
// .tmp/src/lilact.jsx
|
|
6435
6544
|
var Lilact2 = {
|
|
6436
|
-
VERSION: "RC.
|
|
6545
|
+
VERSION: "RC.3",
|
|
6437
6546
|
// Configuration
|
|
6438
6547
|
defaultTransitionTimeout: 300,
|
|
6439
6548
|
defaultIsEqual: Object.is,
|