@orion-studios/payload-studio 0.6.0-beta.157 → 0.6.0-beta.159
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.
|
@@ -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);
|
|
@@ -1425,8 +1426,14 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1425
1426
|
const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
|
|
1426
1427
|
const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
|
|
1427
1428
|
input.value = nextValue2;
|
|
1429
|
+
input.dataset.orionRawValue = nextValue2;
|
|
1428
1430
|
const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
|
|
1429
1431
|
input.setSelectionRange(nextCursor2, nextCursor2);
|
|
1432
|
+
window.dispatchEvent(
|
|
1433
|
+
new CustomEvent("orion-builder-v2-negative-padding-input", {
|
|
1434
|
+
detail: { property, value: nextValue2 }
|
|
1435
|
+
})
|
|
1436
|
+
);
|
|
1430
1437
|
return;
|
|
1431
1438
|
}
|
|
1432
1439
|
if (value2.startsWith("-") && (event.key === "Backspace" || event.key === "Delete")) {
|
|
@@ -1903,7 +1910,8 @@ var readStylePanelValue = (property) => {
|
|
|
1903
1910
|
};
|
|
1904
1911
|
var readStylePanelLength = (property) => {
|
|
1905
1912
|
const control = readStylePanelValue(property);
|
|
1906
|
-
const
|
|
1913
|
+
const input = control?.querySelector("input");
|
|
1914
|
+
const value = (input?.dataset.orionRawValue || input?.value || "").trim();
|
|
1907
1915
|
const unit = control?.querySelector("select")?.value.trim() || "";
|
|
1908
1916
|
if (!value) {
|
|
1909
1917
|
return "";
|
|
@@ -1925,6 +1933,7 @@ var readStylePanelColor = (property) => {
|
|
|
1925
1933
|
return swatchColor;
|
|
1926
1934
|
};
|
|
1927
1935
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1936
|
+
var negativePaddingMarginProperty = (property) => property === "padding-top" ? "margin-top" : property === "padding-right" ? "margin-right" : property === "padding-bottom" ? "margin-bottom" : property === "padding-left" ? "margin-left" : "";
|
|
1928
1937
|
var propertyNameFromStyleControl = (element) => {
|
|
1929
1938
|
const property = element?.closest(".gjs-sm-property");
|
|
1930
1939
|
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
@@ -2540,7 +2549,23 @@ function GrapesPageEditor({
|
|
|
2540
2549
|
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2541
2550
|
selectedComponentRef.current = selected;
|
|
2542
2551
|
lastSelectedComponentRef.current = selected;
|
|
2543
|
-
|
|
2552
|
+
const negativePaddingMargin = value.startsWith("-") ? negativePaddingMarginProperty(property) : "";
|
|
2553
|
+
selected.addStyle?.(
|
|
2554
|
+
negativePaddingMargin ? { [property]: "0px", [negativePaddingMargin]: value } : { [property]: value }
|
|
2555
|
+
);
|
|
2556
|
+
editorRef.current?.select?.(selected);
|
|
2557
|
+
};
|
|
2558
|
+
const applyNegativePaddingInput = (property, value) => {
|
|
2559
|
+
const negativePaddingMargin = negativePaddingMarginProperty(property);
|
|
2560
|
+
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2561
|
+
if (!selected || !negativePaddingMargin || !value.startsWith("-")) {
|
|
2562
|
+
return;
|
|
2563
|
+
}
|
|
2564
|
+
const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
|
|
2565
|
+
const styleValue = `${value}${unit}`;
|
|
2566
|
+
selectedComponentRef.current = selected;
|
|
2567
|
+
lastSelectedComponentRef.current = selected;
|
|
2568
|
+
selected.addStyle?.({ [property]: "0px", [negativePaddingMargin]: styleValue });
|
|
2544
2569
|
editorRef.current?.select?.(selected);
|
|
2545
2570
|
};
|
|
2546
2571
|
const updateSelectedOrionBlock = (updates) => {
|
|
@@ -3608,6 +3633,9 @@ function GrapesPageEditor({
|
|
|
3608
3633
|
const onStylePanelInput = (event) => {
|
|
3609
3634
|
const target = event.target;
|
|
3610
3635
|
if (target?.closest("#orion-builder-v2-styles")) {
|
|
3636
|
+
if (target?.dataset?.orionRawValue?.startsWith("-")) {
|
|
3637
|
+
return;
|
|
3638
|
+
}
|
|
3611
3639
|
const activeElement = document.activeElement;
|
|
3612
3640
|
if (!sidebarPointerActiveRef.current && !activeElement?.closest("#orion-builder-v2-styles")) {
|
|
3613
3641
|
return;
|
|
@@ -3662,6 +3690,13 @@ function GrapesPageEditor({
|
|
|
3662
3690
|
closeBuilderHelpPopovers(wrapper);
|
|
3663
3691
|
openBuilderHelpPopover(helpTrigger, wrapper, willOpen);
|
|
3664
3692
|
};
|
|
3693
|
+
const onNegativePaddingInput = (event) => {
|
|
3694
|
+
const detail = event.detail || {};
|
|
3695
|
+
if (!detail.property || !detail.value) {
|
|
3696
|
+
return;
|
|
3697
|
+
}
|
|
3698
|
+
applyNegativePaddingInput(detail.property, detail.value);
|
|
3699
|
+
};
|
|
3665
3700
|
const observer = new MutationObserver(() => {
|
|
3666
3701
|
decorateBuilderControls();
|
|
3667
3702
|
});
|
|
@@ -3675,6 +3710,7 @@ function GrapesPageEditor({
|
|
|
3675
3710
|
document.addEventListener("input", refreshControls);
|
|
3676
3711
|
document.addEventListener("input", onStylePanelInput, true);
|
|
3677
3712
|
document.addEventListener("keydown", onDocumentKeydown, true);
|
|
3713
|
+
window.addEventListener("orion-builder-v2-negative-padding-input", onNegativePaddingInput);
|
|
3678
3714
|
return () => {
|
|
3679
3715
|
observer.disconnect();
|
|
3680
3716
|
document.removeEventListener("change", refreshControls);
|
|
@@ -3683,6 +3719,7 @@ function GrapesPageEditor({
|
|
|
3683
3719
|
document.removeEventListener("input", refreshControls);
|
|
3684
3720
|
document.removeEventListener("input", onStylePanelInput, true);
|
|
3685
3721
|
document.removeEventListener("keydown", onDocumentKeydown, true);
|
|
3722
|
+
window.removeEventListener("orion-builder-v2-negative-padding-input", onNegativePaddingInput);
|
|
3686
3723
|
};
|
|
3687
3724
|
}, []);
|
|
3688
3725
|
(0, import_react.useEffect)(() => {
|
|
@@ -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);
|
|
@@ -1301,8 +1302,14 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1301
1302
|
const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
|
|
1302
1303
|
const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
|
|
1303
1304
|
input.value = nextValue2;
|
|
1305
|
+
input.dataset.orionRawValue = nextValue2;
|
|
1304
1306
|
const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
|
|
1305
1307
|
input.setSelectionRange(nextCursor2, nextCursor2);
|
|
1308
|
+
window.dispatchEvent(
|
|
1309
|
+
new CustomEvent("orion-builder-v2-negative-padding-input", {
|
|
1310
|
+
detail: { property, value: nextValue2 }
|
|
1311
|
+
})
|
|
1312
|
+
);
|
|
1306
1313
|
return;
|
|
1307
1314
|
}
|
|
1308
1315
|
if (value2.startsWith("-") && (event.key === "Backspace" || event.key === "Delete")) {
|
|
@@ -1779,7 +1786,8 @@ var readStylePanelValue = (property) => {
|
|
|
1779
1786
|
};
|
|
1780
1787
|
var readStylePanelLength = (property) => {
|
|
1781
1788
|
const control = readStylePanelValue(property);
|
|
1782
|
-
const
|
|
1789
|
+
const input = control?.querySelector("input");
|
|
1790
|
+
const value = (input?.dataset.orionRawValue || input?.value || "").trim();
|
|
1783
1791
|
const unit = control?.querySelector("select")?.value.trim() || "";
|
|
1784
1792
|
if (!value) {
|
|
1785
1793
|
return "";
|
|
@@ -1801,6 +1809,7 @@ var readStylePanelColor = (property) => {
|
|
|
1801
1809
|
return swatchColor;
|
|
1802
1810
|
};
|
|
1803
1811
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1812
|
+
var negativePaddingMarginProperty = (property) => property === "padding-top" ? "margin-top" : property === "padding-right" ? "margin-right" : property === "padding-bottom" ? "margin-bottom" : property === "padding-left" ? "margin-left" : "";
|
|
1804
1813
|
var propertyNameFromStyleControl = (element) => {
|
|
1805
1814
|
const property = element?.closest(".gjs-sm-property");
|
|
1806
1815
|
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
@@ -2416,7 +2425,23 @@ function GrapesPageEditor({
|
|
|
2416
2425
|
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2417
2426
|
selectedComponentRef.current = selected;
|
|
2418
2427
|
lastSelectedComponentRef.current = selected;
|
|
2419
|
-
|
|
2428
|
+
const negativePaddingMargin = value.startsWith("-") ? negativePaddingMarginProperty(property) : "";
|
|
2429
|
+
selected.addStyle?.(
|
|
2430
|
+
negativePaddingMargin ? { [property]: "0px", [negativePaddingMargin]: value } : { [property]: value }
|
|
2431
|
+
);
|
|
2432
|
+
editorRef.current?.select?.(selected);
|
|
2433
|
+
};
|
|
2434
|
+
const applyNegativePaddingInput = (property, value) => {
|
|
2435
|
+
const negativePaddingMargin = negativePaddingMarginProperty(property);
|
|
2436
|
+
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2437
|
+
if (!selected || !negativePaddingMargin || !value.startsWith("-")) {
|
|
2438
|
+
return;
|
|
2439
|
+
}
|
|
2440
|
+
const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
|
|
2441
|
+
const styleValue = `${value}${unit}`;
|
|
2442
|
+
selectedComponentRef.current = selected;
|
|
2443
|
+
lastSelectedComponentRef.current = selected;
|
|
2444
|
+
selected.addStyle?.({ [property]: "0px", [negativePaddingMargin]: styleValue });
|
|
2420
2445
|
editorRef.current?.select?.(selected);
|
|
2421
2446
|
};
|
|
2422
2447
|
const updateSelectedOrionBlock = (updates) => {
|
|
@@ -3484,6 +3509,9 @@ function GrapesPageEditor({
|
|
|
3484
3509
|
const onStylePanelInput = (event) => {
|
|
3485
3510
|
const target = event.target;
|
|
3486
3511
|
if (target?.closest("#orion-builder-v2-styles")) {
|
|
3512
|
+
if (target?.dataset?.orionRawValue?.startsWith("-")) {
|
|
3513
|
+
return;
|
|
3514
|
+
}
|
|
3487
3515
|
const activeElement = document.activeElement;
|
|
3488
3516
|
if (!sidebarPointerActiveRef.current && !activeElement?.closest("#orion-builder-v2-styles")) {
|
|
3489
3517
|
return;
|
|
@@ -3538,6 +3566,13 @@ function GrapesPageEditor({
|
|
|
3538
3566
|
closeBuilderHelpPopovers(wrapper);
|
|
3539
3567
|
openBuilderHelpPopover(helpTrigger, wrapper, willOpen);
|
|
3540
3568
|
};
|
|
3569
|
+
const onNegativePaddingInput = (event) => {
|
|
3570
|
+
const detail = event.detail || {};
|
|
3571
|
+
if (!detail.property || !detail.value) {
|
|
3572
|
+
return;
|
|
3573
|
+
}
|
|
3574
|
+
applyNegativePaddingInput(detail.property, detail.value);
|
|
3575
|
+
};
|
|
3541
3576
|
const observer = new MutationObserver(() => {
|
|
3542
3577
|
decorateBuilderControls();
|
|
3543
3578
|
});
|
|
@@ -3551,6 +3586,7 @@ function GrapesPageEditor({
|
|
|
3551
3586
|
document.addEventListener("input", refreshControls);
|
|
3552
3587
|
document.addEventListener("input", onStylePanelInput, true);
|
|
3553
3588
|
document.addEventListener("keydown", onDocumentKeydown, true);
|
|
3589
|
+
window.addEventListener("orion-builder-v2-negative-padding-input", onNegativePaddingInput);
|
|
3554
3590
|
return () => {
|
|
3555
3591
|
observer.disconnect();
|
|
3556
3592
|
document.removeEventListener("change", refreshControls);
|
|
@@ -3559,6 +3595,7 @@ function GrapesPageEditor({
|
|
|
3559
3595
|
document.removeEventListener("input", refreshControls);
|
|
3560
3596
|
document.removeEventListener("input", onStylePanelInput, true);
|
|
3561
3597
|
document.removeEventListener("keydown", onDocumentKeydown, true);
|
|
3598
|
+
window.removeEventListener("orion-builder-v2-negative-padding-input", onNegativePaddingInput);
|
|
3562
3599
|
};
|
|
3563
3600
|
}, []);
|
|
3564
3601
|
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-276KAPGM.mjs";
|
|
14
14
|
import "./chunk-7ZMXZRBP.mjs";
|
|
15
|
+
import "./chunk-OQSEJXC4.mjs";
|
|
15
16
|
import {
|
|
16
17
|
studio_exports
|
|
17
18
|
} 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-276KAPGM.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-ADIIWIYL.mjs";
|
|
18
17
|
import "../chunk-OQSEJXC4.mjs";
|
|
18
|
+
import "../chunk-ADIIWIYL.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";
|
|
8
11
|
import {
|
|
9
12
|
assertStudioDocumentV1,
|
|
10
13
|
compileStudioDocument,
|
|
11
14
|
createEmptyStudioDocument,
|
|
12
15
|
validateStudioDocument
|
|
13
16
|
} 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";
|