@orion-studios/payload-studio 0.6.0-beta.165 → 0.6.0-beta.167
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.
|
@@ -1399,7 +1399,7 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1399
1399
|
input.type = "text";
|
|
1400
1400
|
input.inputMode = "decimal";
|
|
1401
1401
|
field.querySelector("select")?.setAttribute("tabindex", "-1");
|
|
1402
|
-
if (property.startsWith("padding-")) {
|
|
1402
|
+
if (property.startsWith("padding-") || property.startsWith("margin-")) {
|
|
1403
1403
|
input.addEventListener("input", () => {
|
|
1404
1404
|
if (input.value.trim().startsWith("-")) {
|
|
1405
1405
|
return;
|
|
@@ -1411,12 +1411,17 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1411
1411
|
input.addEventListener(
|
|
1412
1412
|
"keydown",
|
|
1413
1413
|
(event) => {
|
|
1414
|
-
if (property.startsWith("padding-")) {
|
|
1414
|
+
if (property.startsWith("padding-") || property.startsWith("margin-")) {
|
|
1415
1415
|
const selectionStart2 = input.selectionStart ?? 0;
|
|
1416
1416
|
const selectionEnd2 = input.selectionEnd ?? selectionStart2;
|
|
1417
1417
|
const value2 = input.dataset.orionPaddingDraft || input.value || "";
|
|
1418
1418
|
const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
|
|
1419
1419
|
const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionPaddingDraft?.startsWith("-")) || event.key === "-";
|
|
1420
|
+
if (input.dataset.orionPaddingDraft?.startsWith("-") && isReplacingAll && event.key !== "-" && event.key.length === 1 && /^[.\d]$/.test(event.key)) {
|
|
1421
|
+
delete input.dataset.orionPaddingBase;
|
|
1422
|
+
delete input.dataset.orionPaddingDraft;
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1420
1425
|
if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
|
|
1421
1426
|
event.preventDefault();
|
|
1422
1427
|
event.stopImmediatePropagation();
|
|
@@ -1431,7 +1436,7 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1431
1436
|
const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
|
|
1432
1437
|
input.setSelectionRange(nextCursor2, nextCursor2);
|
|
1433
1438
|
window.dispatchEvent(
|
|
1434
|
-
new CustomEvent("orion-builder-v2-negative-
|
|
1439
|
+
new CustomEvent("orion-builder-v2-negative-spacing-input", {
|
|
1435
1440
|
detail: { baseValue: input.dataset.orionPaddingBase || "0", property, value: nextValue2 }
|
|
1436
1441
|
})
|
|
1437
1442
|
);
|
|
@@ -2560,18 +2565,20 @@ function GrapesPageEditor({
|
|
|
2560
2565
|
selected.addStyle?.({ [property]: value });
|
|
2561
2566
|
editorRef.current?.select?.(selected);
|
|
2562
2567
|
};
|
|
2563
|
-
const
|
|
2568
|
+
const applyNegativeSpacingInput = (property, value, baseValue) => {
|
|
2564
2569
|
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2565
|
-
|
|
2570
|
+
const isPadding = property.startsWith("padding-");
|
|
2571
|
+
const isMargin = property.startsWith("margin-");
|
|
2572
|
+
if (!selected || !isPadding && !isMargin || !value.startsWith("-")) {
|
|
2566
2573
|
return;
|
|
2567
2574
|
}
|
|
2568
2575
|
const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
|
|
2569
|
-
const base = cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0;
|
|
2570
2576
|
const adjustment = Number.parseFloat(value);
|
|
2571
2577
|
if (!Number.isFinite(adjustment)) {
|
|
2572
2578
|
return;
|
|
2573
2579
|
}
|
|
2574
|
-
const
|
|
2580
|
+
const base = isPadding ? cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0 : 0;
|
|
2581
|
+
const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
|
|
2575
2582
|
const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
|
|
2576
2583
|
selectedComponentRef.current = selected;
|
|
2577
2584
|
lastSelectedComponentRef.current = selected;
|
|
@@ -3713,12 +3720,12 @@ function GrapesPageEditor({
|
|
|
3713
3720
|
closeBuilderHelpPopovers(wrapper);
|
|
3714
3721
|
openBuilderHelpPopover(helpTrigger, wrapper, willOpen);
|
|
3715
3722
|
};
|
|
3716
|
-
const
|
|
3723
|
+
const onNegativeSpacingInput = (event) => {
|
|
3717
3724
|
const detail = event.detail || {};
|
|
3718
3725
|
if (!detail.property || !detail.value) {
|
|
3719
3726
|
return;
|
|
3720
3727
|
}
|
|
3721
|
-
|
|
3728
|
+
applyNegativeSpacingInput(detail.property, detail.value, detail.baseValue || "0");
|
|
3722
3729
|
};
|
|
3723
3730
|
const observer = new MutationObserver(() => {
|
|
3724
3731
|
decorateBuilderControls();
|
|
@@ -3733,7 +3740,7 @@ function GrapesPageEditor({
|
|
|
3733
3740
|
document.addEventListener("input", refreshControls);
|
|
3734
3741
|
document.addEventListener("input", onStylePanelInput, true);
|
|
3735
3742
|
document.addEventListener("keydown", onDocumentKeydown, true);
|
|
3736
|
-
window.addEventListener("orion-builder-v2-negative-
|
|
3743
|
+
window.addEventListener("orion-builder-v2-negative-spacing-input", onNegativeSpacingInput);
|
|
3737
3744
|
return () => {
|
|
3738
3745
|
observer.disconnect();
|
|
3739
3746
|
document.removeEventListener("change", refreshControls);
|
|
@@ -3742,7 +3749,7 @@ function GrapesPageEditor({
|
|
|
3742
3749
|
document.removeEventListener("input", refreshControls);
|
|
3743
3750
|
document.removeEventListener("input", onStylePanelInput, true);
|
|
3744
3751
|
document.removeEventListener("keydown", onDocumentKeydown, true);
|
|
3745
|
-
window.removeEventListener("orion-builder-v2-negative-
|
|
3752
|
+
window.removeEventListener("orion-builder-v2-negative-spacing-input", onNegativeSpacingInput);
|
|
3746
3753
|
};
|
|
3747
3754
|
}, []);
|
|
3748
3755
|
(0, import_react.useEffect)(() => {
|
|
@@ -1275,7 +1275,7 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1275
1275
|
input.type = "text";
|
|
1276
1276
|
input.inputMode = "decimal";
|
|
1277
1277
|
field.querySelector("select")?.setAttribute("tabindex", "-1");
|
|
1278
|
-
if (property.startsWith("padding-")) {
|
|
1278
|
+
if (property.startsWith("padding-") || property.startsWith("margin-")) {
|
|
1279
1279
|
input.addEventListener("input", () => {
|
|
1280
1280
|
if (input.value.trim().startsWith("-")) {
|
|
1281
1281
|
return;
|
|
@@ -1287,12 +1287,17 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1287
1287
|
input.addEventListener(
|
|
1288
1288
|
"keydown",
|
|
1289
1289
|
(event) => {
|
|
1290
|
-
if (property.startsWith("padding-")) {
|
|
1290
|
+
if (property.startsWith("padding-") || property.startsWith("margin-")) {
|
|
1291
1291
|
const selectionStart2 = input.selectionStart ?? 0;
|
|
1292
1292
|
const selectionEnd2 = input.selectionEnd ?? selectionStart2;
|
|
1293
1293
|
const value2 = input.dataset.orionPaddingDraft || input.value || "";
|
|
1294
1294
|
const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
|
|
1295
1295
|
const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionPaddingDraft?.startsWith("-")) || event.key === "-";
|
|
1296
|
+
if (input.dataset.orionPaddingDraft?.startsWith("-") && isReplacingAll && event.key !== "-" && event.key.length === 1 && /^[.\d]$/.test(event.key)) {
|
|
1297
|
+
delete input.dataset.orionPaddingBase;
|
|
1298
|
+
delete input.dataset.orionPaddingDraft;
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1296
1301
|
if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
|
|
1297
1302
|
event.preventDefault();
|
|
1298
1303
|
event.stopImmediatePropagation();
|
|
@@ -1307,7 +1312,7 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1307
1312
|
const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
|
|
1308
1313
|
input.setSelectionRange(nextCursor2, nextCursor2);
|
|
1309
1314
|
window.dispatchEvent(
|
|
1310
|
-
new CustomEvent("orion-builder-v2-negative-
|
|
1315
|
+
new CustomEvent("orion-builder-v2-negative-spacing-input", {
|
|
1311
1316
|
detail: { baseValue: input.dataset.orionPaddingBase || "0", property, value: nextValue2 }
|
|
1312
1317
|
})
|
|
1313
1318
|
);
|
|
@@ -2436,18 +2441,20 @@ function GrapesPageEditor({
|
|
|
2436
2441
|
selected.addStyle?.({ [property]: value });
|
|
2437
2442
|
editorRef.current?.select?.(selected);
|
|
2438
2443
|
};
|
|
2439
|
-
const
|
|
2444
|
+
const applyNegativeSpacingInput = (property, value, baseValue) => {
|
|
2440
2445
|
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2441
|
-
|
|
2446
|
+
const isPadding = property.startsWith("padding-");
|
|
2447
|
+
const isMargin = property.startsWith("margin-");
|
|
2448
|
+
if (!selected || !isPadding && !isMargin || !value.startsWith("-")) {
|
|
2442
2449
|
return;
|
|
2443
2450
|
}
|
|
2444
2451
|
const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
|
|
2445
|
-
const base = cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0;
|
|
2446
2452
|
const adjustment = Number.parseFloat(value);
|
|
2447
2453
|
if (!Number.isFinite(adjustment)) {
|
|
2448
2454
|
return;
|
|
2449
2455
|
}
|
|
2450
|
-
const
|
|
2456
|
+
const base = isPadding ? cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0 : 0;
|
|
2457
|
+
const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
|
|
2451
2458
|
const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
|
|
2452
2459
|
selectedComponentRef.current = selected;
|
|
2453
2460
|
lastSelectedComponentRef.current = selected;
|
|
@@ -3589,12 +3596,12 @@ function GrapesPageEditor({
|
|
|
3589
3596
|
closeBuilderHelpPopovers(wrapper);
|
|
3590
3597
|
openBuilderHelpPopover(helpTrigger, wrapper, willOpen);
|
|
3591
3598
|
};
|
|
3592
|
-
const
|
|
3599
|
+
const onNegativeSpacingInput = (event) => {
|
|
3593
3600
|
const detail = event.detail || {};
|
|
3594
3601
|
if (!detail.property || !detail.value) {
|
|
3595
3602
|
return;
|
|
3596
3603
|
}
|
|
3597
|
-
|
|
3604
|
+
applyNegativeSpacingInput(detail.property, detail.value, detail.baseValue || "0");
|
|
3598
3605
|
};
|
|
3599
3606
|
const observer = new MutationObserver(() => {
|
|
3600
3607
|
decorateBuilderControls();
|
|
@@ -3609,7 +3616,7 @@ function GrapesPageEditor({
|
|
|
3609
3616
|
document.addEventListener("input", refreshControls);
|
|
3610
3617
|
document.addEventListener("input", onStylePanelInput, true);
|
|
3611
3618
|
document.addEventListener("keydown", onDocumentKeydown, true);
|
|
3612
|
-
window.addEventListener("orion-builder-v2-negative-
|
|
3619
|
+
window.addEventListener("orion-builder-v2-negative-spacing-input", onNegativeSpacingInput);
|
|
3613
3620
|
return () => {
|
|
3614
3621
|
observer.disconnect();
|
|
3615
3622
|
document.removeEventListener("change", refreshControls);
|
|
@@ -3618,7 +3625,7 @@ function GrapesPageEditor({
|
|
|
3618
3625
|
document.removeEventListener("input", refreshControls);
|
|
3619
3626
|
document.removeEventListener("input", onStylePanelInput, true);
|
|
3620
3627
|
document.removeEventListener("keydown", onDocumentKeydown, true);
|
|
3621
|
-
window.removeEventListener("orion-builder-v2-negative-
|
|
3628
|
+
window.removeEventListener("orion-builder-v2-negative-spacing-input", onNegativeSpacingInput);
|
|
3622
3629
|
};
|
|
3623
3630
|
}, []);
|
|
3624
3631
|
useEffect(() => {
|
package/dist/index.mjs
CHANGED
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
} from "./chunk-JQAHXYAM.mjs";
|
|
11
11
|
import {
|
|
12
12
|
studio_pages_exports
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-7HME6R2V.mjs";
|
|
14
14
|
import "./chunk-7ZMXZRBP.mjs";
|
|
15
|
-
import "./chunk-OQSEJXC4.mjs";
|
|
16
15
|
import {
|
|
17
16
|
studio_exports
|
|
18
17
|
} from "./chunk-ADIIWIYL.mjs";
|
|
18
|
+
import "./chunk-OQSEJXC4.mjs";
|
|
19
19
|
import {
|
|
20
20
|
admin_app_exports
|
|
21
21
|
} from "./chunk-RKTIFEUY.mjs";
|
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
pageStudioModuleManifest,
|
|
8
8
|
resolveBuilderThemeTokens,
|
|
9
9
|
toEditorInitialDoc
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-7HME6R2V.mjs";
|
|
11
11
|
import {
|
|
12
12
|
createDefaultStudioDocument,
|
|
13
13
|
defaultBuilderThemeTokens,
|
|
14
14
|
layoutToStudioDocument,
|
|
15
15
|
studioDocumentToLayout
|
|
16
16
|
} from "../chunk-7ZMXZRBP.mjs";
|
|
17
|
-
import "../chunk-OQSEJXC4.mjs";
|
|
18
17
|
import "../chunk-ADIIWIYL.mjs";
|
|
18
|
+
import "../chunk-OQSEJXC4.mjs";
|
|
19
19
|
import "../chunk-6BWS3CLP.mjs";
|
|
20
20
|
export {
|
|
21
21
|
createDefaultStudioDocument,
|
package/package.json
CHANGED
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
migrateBlockToSettingsV2,
|
|
6
6
|
studioDocumentToLayout
|
|
7
7
|
} from "./chunk-7ZMXZRBP.mjs";
|
|
8
|
-
import {
|
|
9
|
-
sectionStyleDefaults
|
|
10
|
-
} from "./chunk-OQSEJXC4.mjs";
|
|
11
8
|
import {
|
|
12
9
|
assertStudioDocumentV1,
|
|
13
10
|
compileStudioDocument,
|
|
14
11
|
createEmptyStudioDocument,
|
|
15
12
|
validateStudioDocument
|
|
16
13
|
} from "./chunk-ADIIWIYL.mjs";
|
|
14
|
+
import {
|
|
15
|
+
sectionStyleDefaults
|
|
16
|
+
} from "./chunk-OQSEJXC4.mjs";
|
|
17
17
|
import {
|
|
18
18
|
__export
|
|
19
19
|
} from "./chunk-6BWS3CLP.mjs";
|