@orion-studios/payload-studio 0.6.0-beta.156 → 0.6.0-beta.158
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/builder-v2/client.js +32 -3
- package/dist/builder-v2/client.mjs +32 -3
- package/dist/index.mjs +4 -4
- package/package.json +1 -1
|
@@ -1402,9 +1402,10 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1402
1402
|
if (property.startsWith("padding-")) {
|
|
1403
1403
|
const keepNegativePaddingValue = (event) => {
|
|
1404
1404
|
if (!input.value.trim().startsWith("-")) {
|
|
1405
|
+
delete input.dataset.orionRawValue;
|
|
1405
1406
|
return;
|
|
1406
1407
|
}
|
|
1407
|
-
|
|
1408
|
+
input.dataset.orionRawValue = input.value.trim();
|
|
1408
1409
|
};
|
|
1409
1410
|
input.addEventListener("input", keepNegativePaddingValue, true);
|
|
1410
1411
|
input.addEventListener("change", keepNegativePaddingValue, true);
|
|
@@ -1412,6 +1413,29 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1412
1413
|
input.addEventListener(
|
|
1413
1414
|
"keydown",
|
|
1414
1415
|
(event) => {
|
|
1416
|
+
if (property.startsWith("padding-")) {
|
|
1417
|
+
const selectionStart2 = input.selectionStart ?? 0;
|
|
1418
|
+
const selectionEnd2 = input.selectionEnd ?? selectionStart2;
|
|
1419
|
+
const value2 = input.value || "";
|
|
1420
|
+
const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
|
|
1421
|
+
const isNegativeEntry = value2.startsWith("-") || event.key === "-";
|
|
1422
|
+
if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
|
|
1423
|
+
event.preventDefault();
|
|
1424
|
+
event.stopImmediatePropagation();
|
|
1425
|
+
const inserted = event.key === "-" ? "-" : event.key;
|
|
1426
|
+
const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
|
|
1427
|
+
const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
|
|
1428
|
+
input.value = nextValue2;
|
|
1429
|
+
input.dataset.orionRawValue = nextValue2;
|
|
1430
|
+
const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
|
|
1431
|
+
input.setSelectionRange(nextCursor2, nextCursor2);
|
|
1432
|
+
input.dispatchEvent(new InputEvent("input", { bubbles: true, inputType: "insertText" }));
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
if (value2.startsWith("-") && (event.key === "Backspace" || event.key === "Delete")) {
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1415
1439
|
if (event.key !== "-" || event.metaKey || event.ctrlKey || event.altKey) {
|
|
1416
1440
|
return;
|
|
1417
1441
|
}
|
|
@@ -1882,7 +1906,8 @@ var readStylePanelValue = (property) => {
|
|
|
1882
1906
|
};
|
|
1883
1907
|
var readStylePanelLength = (property) => {
|
|
1884
1908
|
const control = readStylePanelValue(property);
|
|
1885
|
-
const
|
|
1909
|
+
const input = control?.querySelector("input");
|
|
1910
|
+
const value = (input?.dataset.orionRawValue || input?.value || "").trim();
|
|
1886
1911
|
const unit = control?.querySelector("select")?.value.trim() || "";
|
|
1887
1912
|
if (!value) {
|
|
1888
1913
|
return "";
|
|
@@ -1904,6 +1929,7 @@ var readStylePanelColor = (property) => {
|
|
|
1904
1929
|
return swatchColor;
|
|
1905
1930
|
};
|
|
1906
1931
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1932
|
+
var negativePaddingMarginProperty = (property) => property === "padding-top" ? "margin-top" : property === "padding-right" ? "margin-right" : property === "padding-bottom" ? "margin-bottom" : property === "padding-left" ? "margin-left" : "";
|
|
1907
1933
|
var propertyNameFromStyleControl = (element) => {
|
|
1908
1934
|
const property = element?.closest(".gjs-sm-property");
|
|
1909
1935
|
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
@@ -2519,7 +2545,10 @@ function GrapesPageEditor({
|
|
|
2519
2545
|
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2520
2546
|
selectedComponentRef.current = selected;
|
|
2521
2547
|
lastSelectedComponentRef.current = selected;
|
|
2522
|
-
|
|
2548
|
+
const negativePaddingMargin = value.startsWith("-") ? negativePaddingMarginProperty(property) : "";
|
|
2549
|
+
selected.addStyle?.(
|
|
2550
|
+
negativePaddingMargin ? { [property]: "0px", [negativePaddingMargin]: value } : { [property]: value }
|
|
2551
|
+
);
|
|
2523
2552
|
editorRef.current?.select?.(selected);
|
|
2524
2553
|
};
|
|
2525
2554
|
const updateSelectedOrionBlock = (updates) => {
|
|
@@ -1278,9 +1278,10 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1278
1278
|
if (property.startsWith("padding-")) {
|
|
1279
1279
|
const keepNegativePaddingValue = (event) => {
|
|
1280
1280
|
if (!input.value.trim().startsWith("-")) {
|
|
1281
|
+
delete input.dataset.orionRawValue;
|
|
1281
1282
|
return;
|
|
1282
1283
|
}
|
|
1283
|
-
|
|
1284
|
+
input.dataset.orionRawValue = input.value.trim();
|
|
1284
1285
|
};
|
|
1285
1286
|
input.addEventListener("input", keepNegativePaddingValue, true);
|
|
1286
1287
|
input.addEventListener("change", keepNegativePaddingValue, true);
|
|
@@ -1288,6 +1289,29 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1288
1289
|
input.addEventListener(
|
|
1289
1290
|
"keydown",
|
|
1290
1291
|
(event) => {
|
|
1292
|
+
if (property.startsWith("padding-")) {
|
|
1293
|
+
const selectionStart2 = input.selectionStart ?? 0;
|
|
1294
|
+
const selectionEnd2 = input.selectionEnd ?? selectionStart2;
|
|
1295
|
+
const value2 = input.value || "";
|
|
1296
|
+
const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
|
|
1297
|
+
const isNegativeEntry = value2.startsWith("-") || event.key === "-";
|
|
1298
|
+
if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
|
|
1299
|
+
event.preventDefault();
|
|
1300
|
+
event.stopImmediatePropagation();
|
|
1301
|
+
const inserted = event.key === "-" ? "-" : event.key;
|
|
1302
|
+
const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
|
|
1303
|
+
const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
|
|
1304
|
+
input.value = nextValue2;
|
|
1305
|
+
input.dataset.orionRawValue = nextValue2;
|
|
1306
|
+
const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
|
|
1307
|
+
input.setSelectionRange(nextCursor2, nextCursor2);
|
|
1308
|
+
input.dispatchEvent(new InputEvent("input", { bubbles: true, inputType: "insertText" }));
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
if (value2.startsWith("-") && (event.key === "Backspace" || event.key === "Delete")) {
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1291
1315
|
if (event.key !== "-" || event.metaKey || event.ctrlKey || event.altKey) {
|
|
1292
1316
|
return;
|
|
1293
1317
|
}
|
|
@@ -1758,7 +1782,8 @@ var readStylePanelValue = (property) => {
|
|
|
1758
1782
|
};
|
|
1759
1783
|
var readStylePanelLength = (property) => {
|
|
1760
1784
|
const control = readStylePanelValue(property);
|
|
1761
|
-
const
|
|
1785
|
+
const input = control?.querySelector("input");
|
|
1786
|
+
const value = (input?.dataset.orionRawValue || input?.value || "").trim();
|
|
1762
1787
|
const unit = control?.querySelector("select")?.value.trim() || "";
|
|
1763
1788
|
if (!value) {
|
|
1764
1789
|
return "";
|
|
@@ -1780,6 +1805,7 @@ var readStylePanelColor = (property) => {
|
|
|
1780
1805
|
return swatchColor;
|
|
1781
1806
|
};
|
|
1782
1807
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1808
|
+
var negativePaddingMarginProperty = (property) => property === "padding-top" ? "margin-top" : property === "padding-right" ? "margin-right" : property === "padding-bottom" ? "margin-bottom" : property === "padding-left" ? "margin-left" : "";
|
|
1783
1809
|
var propertyNameFromStyleControl = (element) => {
|
|
1784
1810
|
const property = element?.closest(".gjs-sm-property");
|
|
1785
1811
|
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
@@ -2395,7 +2421,10 @@ function GrapesPageEditor({
|
|
|
2395
2421
|
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2396
2422
|
selectedComponentRef.current = selected;
|
|
2397
2423
|
lastSelectedComponentRef.current = selected;
|
|
2398
|
-
|
|
2424
|
+
const negativePaddingMargin = value.startsWith("-") ? negativePaddingMarginProperty(property) : "";
|
|
2425
|
+
selected.addStyle?.(
|
|
2426
|
+
negativePaddingMargin ? { [property]: "0px", [negativePaddingMargin]: value } : { [property]: value }
|
|
2427
|
+
);
|
|
2399
2428
|
editorRef.current?.select?.(selected);
|
|
2400
2429
|
};
|
|
2401
2430
|
const updateSelectedOrionBlock = (updates) => {
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,10 @@ import "./chunk-ZTXJG4K5.mjs";
|
|
|
8
8
|
import {
|
|
9
9
|
blocks_exports
|
|
10
10
|
} from "./chunk-JQAHXYAM.mjs";
|
|
11
|
+
import {
|
|
12
|
+
admin_app_exports
|
|
13
|
+
} from "./chunk-RKTIFEUY.mjs";
|
|
14
|
+
import "./chunk-W2UOCJDX.mjs";
|
|
11
15
|
import {
|
|
12
16
|
studio_pages_exports
|
|
13
17
|
} from "./chunk-276KAPGM.mjs";
|
|
@@ -16,10 +20,6 @@ import "./chunk-OQSEJXC4.mjs";
|
|
|
16
20
|
import {
|
|
17
21
|
studio_exports
|
|
18
22
|
} from "./chunk-ADIIWIYL.mjs";
|
|
19
|
-
import {
|
|
20
|
-
admin_app_exports
|
|
21
|
-
} from "./chunk-RKTIFEUY.mjs";
|
|
22
|
-
import "./chunk-W2UOCJDX.mjs";
|
|
23
23
|
import "./chunk-6BWS3CLP.mjs";
|
|
24
24
|
export {
|
|
25
25
|
admin_exports as admin,
|
package/package.json
CHANGED