@jxsuite/studio 0.25.5 → 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/studio.js +23 -10
- package/dist/studio.js.map +3 -3
- package/package.json +7 -7
- package/src/ui/unit-selector.ts +21 -9
package/dist/studio.js
CHANGED
|
@@ -195015,6 +195015,10 @@ function debouncedStyleCommit(prop, ms, fn) {
|
|
|
195015
195015
|
}, ms));
|
|
195016
195016
|
};
|
|
195017
195017
|
}
|
|
195018
|
+
function cancelStyleDebounce(prop) {
|
|
195019
|
+
clearTimeout(_styleDebounceTimers.get(prop));
|
|
195020
|
+
_styleDebounceTimers.delete(prop);
|
|
195021
|
+
}
|
|
195018
195022
|
function stripEventHandlers(node) {
|
|
195019
195023
|
if (!node || typeof node !== "object")
|
|
195020
195024
|
return node;
|
|
@@ -308477,18 +308481,13 @@ function renderUnitSelector(entry, prop, value2, onChange, placeholder = "") {
|
|
|
308477
308481
|
displayValue = isNaN(num) ? strVal : String(num);
|
|
308478
308482
|
} else
|
|
308479
308483
|
displayValue = "";
|
|
308484
|
+
const placeholderMatch = placeholder.match(UNIT_RE);
|
|
308485
|
+
const numericPlaceholder = placeholderMatch ? placeholderMatch[1] : placeholder || "0";
|
|
308480
308486
|
const isExpression = isKeyword || displayValue !== "" && !isNumericVal(displayValue);
|
|
308481
308487
|
const hasUnits = units.length > 0 || keywords.length > 0;
|
|
308482
308488
|
const btnId = `style-unit-${prop}`;
|
|
308483
|
-
|
|
308484
|
-
|
|
308485
|
-
<div class=${classMap({ "input-group": true, "is-expression": isExpression })}>
|
|
308486
|
-
<sp-textfield
|
|
308487
|
-
size="s"
|
|
308488
|
-
placeholder=${placeholder || "0"}
|
|
308489
|
-
.value=${live(displayValue)}
|
|
308490
|
-
@input=${debouncedStyleCommit(`nui:${prop}`, 400, (e20) => {
|
|
308491
|
-
const val = e20.target.value.trim();
|
|
308489
|
+
const commitValue = (rawVal) => {
|
|
308490
|
+
const val = rawVal.trim();
|
|
308492
308491
|
if (val === "") {
|
|
308493
308492
|
onChange("");
|
|
308494
308493
|
return;
|
|
@@ -308497,7 +308496,21 @@ function renderUnitSelector(entry, prop, value2, onChange, placeholder = "") {
|
|
|
308497
308496
|
onChange(units.length > 0 ? val + currentUnit : val);
|
|
308498
308497
|
else
|
|
308499
308498
|
onChange(val);
|
|
308499
|
+
};
|
|
308500
|
+
return html3`
|
|
308501
|
+
<div class="style-input-number-unit">
|
|
308502
|
+
<div class=${classMap({ "input-group": true, "is-expression": isExpression })}>
|
|
308503
|
+
<sp-textfield
|
|
308504
|
+
size="s"
|
|
308505
|
+
placeholder=${numericPlaceholder}
|
|
308506
|
+
.value=${live(displayValue)}
|
|
308507
|
+
@input=${debouncedStyleCommit(`nui:${prop}`, 400, (e20) => {
|
|
308508
|
+
commitValue(e20.target.value);
|
|
308500
308509
|
})}
|
|
308510
|
+
@change=${(e20) => {
|
|
308511
|
+
cancelStyleDebounce(`nui:${prop}`);
|
|
308512
|
+
commitValue(e20.target.value);
|
|
308513
|
+
}}
|
|
308501
308514
|
></sp-textfield>
|
|
308502
308515
|
${hasUnits ? html3`
|
|
308503
308516
|
<sp-picker-button id=${btnId} size="s">
|
|
@@ -312816,5 +312829,5 @@ effect(() => {
|
|
|
312816
312829
|
scheduleAutosave();
|
|
312817
312830
|
});
|
|
312818
312831
|
|
|
312819
|
-
//# debugId=
|
|
312832
|
+
//# debugId=F148FB20E5E187A864756E2164756E21
|
|
312820
312833
|
//# sourceMappingURL=studio.js.map
|