@orion-studios/payload-studio 0.6.0-beta.167 → 0.6.0-beta.169
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.
|
@@ -1415,7 +1415,8 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1415
1415
|
const selectionStart2 = input.selectionStart ?? 0;
|
|
1416
1416
|
const selectionEnd2 = input.selectionEnd ?? selectionStart2;
|
|
1417
1417
|
const value2 = input.dataset.orionPaddingDraft || input.value || "";
|
|
1418
|
-
const
|
|
1418
|
+
const displayedValue = input.value || "";
|
|
1419
|
+
const isReplacingAll = selectionStart2 === 0 && (selectionEnd2 === value2.length || selectionEnd2 === displayedValue.length);
|
|
1419
1420
|
const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionPaddingDraft?.startsWith("-")) || event.key === "-";
|
|
1420
1421
|
if (input.dataset.orionPaddingDraft?.startsWith("-") && isReplacingAll && event.key !== "-" && event.key.length === 1 && /^[.\d]$/.test(event.key)) {
|
|
1421
1422
|
delete input.dataset.orionPaddingBase;
|
|
@@ -1771,7 +1772,21 @@ var quickVerticalAlignStyles = {
|
|
|
1771
1772
|
middle: "center",
|
|
1772
1773
|
top: "flex-start"
|
|
1773
1774
|
};
|
|
1775
|
+
var negativePaddingCss = `
|
|
1776
|
+
.orion-builder-v2-negative-padding {
|
|
1777
|
+
overflow: visible;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
.orion-builder-v2-negative-padding > * {
|
|
1781
|
+
margin-top: var(--orion-negative-padding-top, 0px);
|
|
1782
|
+
margin-right: var(--orion-negative-padding-right, 0px);
|
|
1783
|
+
margin-bottom: var(--orion-negative-padding-bottom, 0px);
|
|
1784
|
+
margin-left: var(--orion-negative-padding-left, 0px);
|
|
1785
|
+
}
|
|
1786
|
+
`;
|
|
1774
1787
|
var canvasSelectionCss = `
|
|
1788
|
+
${negativePaddingCss}
|
|
1789
|
+
|
|
1775
1790
|
.gjs-selected,
|
|
1776
1791
|
[data-gjs-highlightable].gjs-selected {
|
|
1777
1792
|
outline-color: #c7643d !important;
|
|
@@ -1979,6 +1994,10 @@ var spacingProperties = [
|
|
|
1979
1994
|
"padding-left",
|
|
1980
1995
|
"padding-right"
|
|
1981
1996
|
];
|
|
1997
|
+
var negativePaddingSides = ["top", "bottom", "left", "right"];
|
|
1998
|
+
var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
|
|
1999
|
+
var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
|
|
2000
|
+
var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
|
|
1982
2001
|
var spacingTargetForComponent = (component) => {
|
|
1983
2002
|
const element = component?.getEl?.();
|
|
1984
2003
|
return element || null;
|
|
@@ -2170,7 +2189,8 @@ var postToParent = (payload) => {
|
|
|
2170
2189
|
};
|
|
2171
2190
|
var buildSavePayload = (editor, status, projectData) => ({
|
|
2172
2191
|
builderMode: "grapes-v2",
|
|
2173
|
-
compiledCss: scopeBuilderCss(
|
|
2192
|
+
compiledCss: scopeBuilderCss(`${negativePaddingCss}
|
|
2193
|
+
${editor.getCss()}`),
|
|
2174
2194
|
compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
|
|
2175
2195
|
projectData,
|
|
2176
2196
|
status
|
|
@@ -2562,6 +2582,20 @@ function GrapesPageEditor({
|
|
|
2562
2582
|
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2563
2583
|
selectedComponentRef.current = selected;
|
|
2564
2584
|
lastSelectedComponentRef.current = selected;
|
|
2585
|
+
if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
|
|
2586
|
+
const side = negativePaddingSideFromProperty(property);
|
|
2587
|
+
if (side) {
|
|
2588
|
+
selected.removeStyle?.(negativePaddingVariableForSide(side));
|
|
2589
|
+
selected.removeAttributes?.(negativePaddingAttributeForSide(side));
|
|
2590
|
+
const attrs = selected.getAttributes?.() || {};
|
|
2591
|
+
const hasOtherNegativePadding = negativePaddingSides.some(
|
|
2592
|
+
(paddingSide) => paddingSide !== side && Boolean(attrs[negativePaddingAttributeForSide(paddingSide)])
|
|
2593
|
+
);
|
|
2594
|
+
if (!hasOtherNegativePadding) {
|
|
2595
|
+
selected.removeClass?.("orion-builder-v2-negative-padding");
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2565
2599
|
selected.addStyle?.({ [property]: value });
|
|
2566
2600
|
editorRef.current?.select?.(selected);
|
|
2567
2601
|
};
|
|
@@ -2582,7 +2616,18 @@ function GrapesPageEditor({
|
|
|
2582
2616
|
const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
|
|
2583
2617
|
selectedComponentRef.current = selected;
|
|
2584
2618
|
lastSelectedComponentRef.current = selected;
|
|
2585
|
-
|
|
2619
|
+
if (isPadding) {
|
|
2620
|
+
const side = negativePaddingSideFromProperty(property);
|
|
2621
|
+
const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
|
|
2622
|
+
selected.addClass?.("orion-builder-v2-negative-padding");
|
|
2623
|
+
selected.addAttributes?.({ [negativePaddingAttributeForSide(side)]: negativeStyleValue });
|
|
2624
|
+
selected.addStyle?.({
|
|
2625
|
+
[negativePaddingVariableForSide(side)]: negativeStyleValue,
|
|
2626
|
+
[property]: "0px"
|
|
2627
|
+
});
|
|
2628
|
+
} else {
|
|
2629
|
+
selected.addStyle?.({ [property]: styleValue });
|
|
2630
|
+
}
|
|
2586
2631
|
editorRef.current?.select?.(selected);
|
|
2587
2632
|
};
|
|
2588
2633
|
const updateSelectedOrionBlock = (updates) => {
|
|
@@ -2882,7 +2927,14 @@ function GrapesPageEditor({
|
|
|
2882
2927
|
return;
|
|
2883
2928
|
}
|
|
2884
2929
|
const computed = window.getComputedStyle(element);
|
|
2930
|
+
const attrs = component.getAttributes?.() || {};
|
|
2885
2931
|
spacingProperties.forEach((property) => {
|
|
2932
|
+
const negativePaddingSide = negativePaddingSideFromProperty(property);
|
|
2933
|
+
const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
|
|
2934
|
+
if (negativePaddingValue) {
|
|
2935
|
+
writeStylePanelLength(property, negativePaddingValue);
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2886
2938
|
writeStylePanelLength(property, computed.getPropertyValue(property));
|
|
2887
2939
|
});
|
|
2888
2940
|
});
|
|
@@ -1291,7 +1291,8 @@ var decorateBuilderNumericSteppers = (root = document) => {
|
|
|
1291
1291
|
const selectionStart2 = input.selectionStart ?? 0;
|
|
1292
1292
|
const selectionEnd2 = input.selectionEnd ?? selectionStart2;
|
|
1293
1293
|
const value2 = input.dataset.orionPaddingDraft || input.value || "";
|
|
1294
|
-
const
|
|
1294
|
+
const displayedValue = input.value || "";
|
|
1295
|
+
const isReplacingAll = selectionStart2 === 0 && (selectionEnd2 === value2.length || selectionEnd2 === displayedValue.length);
|
|
1295
1296
|
const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionPaddingDraft?.startsWith("-")) || event.key === "-";
|
|
1296
1297
|
if (input.dataset.orionPaddingDraft?.startsWith("-") && isReplacingAll && event.key !== "-" && event.key.length === 1 && /^[.\d]$/.test(event.key)) {
|
|
1297
1298
|
delete input.dataset.orionPaddingBase;
|
|
@@ -1647,7 +1648,21 @@ var quickVerticalAlignStyles = {
|
|
|
1647
1648
|
middle: "center",
|
|
1648
1649
|
top: "flex-start"
|
|
1649
1650
|
};
|
|
1651
|
+
var negativePaddingCss = `
|
|
1652
|
+
.orion-builder-v2-negative-padding {
|
|
1653
|
+
overflow: visible;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
.orion-builder-v2-negative-padding > * {
|
|
1657
|
+
margin-top: var(--orion-negative-padding-top, 0px);
|
|
1658
|
+
margin-right: var(--orion-negative-padding-right, 0px);
|
|
1659
|
+
margin-bottom: var(--orion-negative-padding-bottom, 0px);
|
|
1660
|
+
margin-left: var(--orion-negative-padding-left, 0px);
|
|
1661
|
+
}
|
|
1662
|
+
`;
|
|
1650
1663
|
var canvasSelectionCss = `
|
|
1664
|
+
${negativePaddingCss}
|
|
1665
|
+
|
|
1651
1666
|
.gjs-selected,
|
|
1652
1667
|
[data-gjs-highlightable].gjs-selected {
|
|
1653
1668
|
outline-color: #c7643d !important;
|
|
@@ -1855,6 +1870,10 @@ var spacingProperties = [
|
|
|
1855
1870
|
"padding-left",
|
|
1856
1871
|
"padding-right"
|
|
1857
1872
|
];
|
|
1873
|
+
var negativePaddingSides = ["top", "bottom", "left", "right"];
|
|
1874
|
+
var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
|
|
1875
|
+
var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
|
|
1876
|
+
var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
|
|
1858
1877
|
var spacingTargetForComponent = (component) => {
|
|
1859
1878
|
const element = component?.getEl?.();
|
|
1860
1879
|
return element || null;
|
|
@@ -2046,7 +2065,8 @@ var postToParent = (payload) => {
|
|
|
2046
2065
|
};
|
|
2047
2066
|
var buildSavePayload = (editor, status, projectData) => ({
|
|
2048
2067
|
builderMode: "grapes-v2",
|
|
2049
|
-
compiledCss: scopeBuilderCss(
|
|
2068
|
+
compiledCss: scopeBuilderCss(`${negativePaddingCss}
|
|
2069
|
+
${editor.getCss()}`),
|
|
2050
2070
|
compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
|
|
2051
2071
|
projectData,
|
|
2052
2072
|
status
|
|
@@ -2438,6 +2458,20 @@ function GrapesPageEditor({
|
|
|
2438
2458
|
const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2439
2459
|
selectedComponentRef.current = selected;
|
|
2440
2460
|
lastSelectedComponentRef.current = selected;
|
|
2461
|
+
if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
|
|
2462
|
+
const side = negativePaddingSideFromProperty(property);
|
|
2463
|
+
if (side) {
|
|
2464
|
+
selected.removeStyle?.(negativePaddingVariableForSide(side));
|
|
2465
|
+
selected.removeAttributes?.(negativePaddingAttributeForSide(side));
|
|
2466
|
+
const attrs = selected.getAttributes?.() || {};
|
|
2467
|
+
const hasOtherNegativePadding = negativePaddingSides.some(
|
|
2468
|
+
(paddingSide) => paddingSide !== side && Boolean(attrs[negativePaddingAttributeForSide(paddingSide)])
|
|
2469
|
+
);
|
|
2470
|
+
if (!hasOtherNegativePadding) {
|
|
2471
|
+
selected.removeClass?.("orion-builder-v2-negative-padding");
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2441
2475
|
selected.addStyle?.({ [property]: value });
|
|
2442
2476
|
editorRef.current?.select?.(selected);
|
|
2443
2477
|
};
|
|
@@ -2458,7 +2492,18 @@ function GrapesPageEditor({
|
|
|
2458
2492
|
const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
|
|
2459
2493
|
selectedComponentRef.current = selected;
|
|
2460
2494
|
lastSelectedComponentRef.current = selected;
|
|
2461
|
-
|
|
2495
|
+
if (isPadding) {
|
|
2496
|
+
const side = negativePaddingSideFromProperty(property);
|
|
2497
|
+
const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
|
|
2498
|
+
selected.addClass?.("orion-builder-v2-negative-padding");
|
|
2499
|
+
selected.addAttributes?.({ [negativePaddingAttributeForSide(side)]: negativeStyleValue });
|
|
2500
|
+
selected.addStyle?.({
|
|
2501
|
+
[negativePaddingVariableForSide(side)]: negativeStyleValue,
|
|
2502
|
+
[property]: "0px"
|
|
2503
|
+
});
|
|
2504
|
+
} else {
|
|
2505
|
+
selected.addStyle?.({ [property]: styleValue });
|
|
2506
|
+
}
|
|
2462
2507
|
editorRef.current?.select?.(selected);
|
|
2463
2508
|
};
|
|
2464
2509
|
const updateSelectedOrionBlock = (updates) => {
|
|
@@ -2758,7 +2803,14 @@ function GrapesPageEditor({
|
|
|
2758
2803
|
return;
|
|
2759
2804
|
}
|
|
2760
2805
|
const computed = window.getComputedStyle(element);
|
|
2806
|
+
const attrs = component.getAttributes?.() || {};
|
|
2761
2807
|
spacingProperties.forEach((property) => {
|
|
2808
|
+
const negativePaddingSide = negativePaddingSideFromProperty(property);
|
|
2809
|
+
const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
|
|
2810
|
+
if (negativePaddingValue) {
|
|
2811
|
+
writeStylePanelLength(property, negativePaddingValue);
|
|
2812
|
+
return;
|
|
2813
|
+
}
|
|
2762
2814
|
writeStylePanelLength(property, computed.getPropertyValue(property));
|
|
2763
2815
|
});
|
|
2764
2816
|
});
|
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";
|