@orion-studios/payload-studio 0.6.0-beta.177 → 0.6.0-beta.179
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.
|
@@ -1909,7 +1909,8 @@ var normalizeCssColorValue = (value) => {
|
|
|
1909
1909
|
return "";
|
|
1910
1910
|
}
|
|
1911
1911
|
const trimmed = value.trim();
|
|
1912
|
-
|
|
1912
|
+
const normalized = trimmed.toLowerCase();
|
|
1913
|
+
return trimmed && normalized !== "none" && normalized !== "transparent" && normalized !== "rgba(0, 0, 0, 0)" ? trimmed : "";
|
|
1913
1914
|
};
|
|
1914
1915
|
var getStyleColorValue = (style, property) => normalizeCssColorValue(
|
|
1915
1916
|
style[property] || style[property.replace(/-([a-z])/g, (_, char) => char.toUpperCase())]
|
|
@@ -2025,6 +2026,33 @@ var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${s
|
|
|
2025
2026
|
var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
|
|
2026
2027
|
var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
|
|
2027
2028
|
var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
|
|
2029
|
+
var hasNegativePaddingState = (attrs, style) => negativePaddingSides.some((side) => Boolean(attrs[negativePaddingAttributeForSide(side)] || style[negativePaddingVariableForSide(side)]));
|
|
2030
|
+
var removeGeneratedSelectionMargins = (component) => {
|
|
2031
|
+
const style = component?.getStyle?.() || {};
|
|
2032
|
+
const cleanup = {};
|
|
2033
|
+
["margin-top", "margin-bottom"].forEach((property) => {
|
|
2034
|
+
const value = String(style[property] || "").trim();
|
|
2035
|
+
if (value === "-2px" || value === "-2") {
|
|
2036
|
+
cleanup[property] = "";
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
if (Object.keys(cleanup).length > 0) {
|
|
2040
|
+
component?.addStyle?.(cleanup);
|
|
2041
|
+
}
|
|
2042
|
+
};
|
|
2043
|
+
var removeGeneratedNegativePaddingMargin = (component, side, negativePaddingValue) => {
|
|
2044
|
+
if (side !== "top" && side !== "bottom") {
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
const property = `margin-${side}`;
|
|
2048
|
+
const style = component?.getStyle?.() || {};
|
|
2049
|
+
const currentMargin = String(style[property] || "").trim();
|
|
2050
|
+
const generatedMargin = String(negativePaddingValue || "").trim();
|
|
2051
|
+
if (generatedMargin && currentMargin === generatedMargin) {
|
|
2052
|
+
component?.addStyle?.({ [property]: "" });
|
|
2053
|
+
writeStylePanelLength(property, "0px");
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2028
2056
|
var getStoredOrionBackgroundColor = (attrs, style) => {
|
|
2029
2057
|
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
2030
2058
|
return firstString(
|
|
@@ -2619,10 +2647,12 @@ function GrapesPageEditor({
|
|
|
2619
2647
|
selectedComponentRef.current = selected;
|
|
2620
2648
|
lastSelectedComponentRef.current = selected;
|
|
2621
2649
|
if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
|
|
2650
|
+
removeGeneratedSelectionMargins(selected);
|
|
2622
2651
|
const side = negativePaddingSideFromProperty(property);
|
|
2623
2652
|
if (side) {
|
|
2624
2653
|
const attrs = selected.getAttributes?.() || {};
|
|
2625
2654
|
const selectedStyle = selected.getStyle?.() || {};
|
|
2655
|
+
const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
|
|
2626
2656
|
const nextNegativePaddingBySide = Object.fromEntries(
|
|
2627
2657
|
negativePaddingSides.map((paddingSide) => [
|
|
2628
2658
|
paddingSide,
|
|
@@ -2636,9 +2666,20 @@ function GrapesPageEditor({
|
|
|
2636
2666
|
selected.removeStyle?.(negativePaddingVariableForSide(side));
|
|
2637
2667
|
selected.removeAttributes?.(negativePaddingAttributeForSide(side));
|
|
2638
2668
|
selected.removeClass?.(`is-orion-negative-padding-${side}`);
|
|
2669
|
+
removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
|
|
2639
2670
|
if (!hasOtherNegativePadding) {
|
|
2640
2671
|
if (negativePaddingBackground) {
|
|
2641
2672
|
selected.addStyle?.({ "background-color": negativePaddingBackground });
|
|
2673
|
+
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
2674
|
+
if (Object.keys(block).length > 0) {
|
|
2675
|
+
selected.addAttributes?.({
|
|
2676
|
+
"data-orion-background-color": negativePaddingBackground,
|
|
2677
|
+
"data-orion-block": serializeOrionBlockAttribute({
|
|
2678
|
+
...block,
|
|
2679
|
+
backgroundColor: negativePaddingBackground
|
|
2680
|
+
})
|
|
2681
|
+
});
|
|
2682
|
+
}
|
|
2642
2683
|
}
|
|
2643
2684
|
selected.removeStyle?.(negativePaddingBackgroundVariable);
|
|
2644
2685
|
selected.removeAttributes?.(negativePaddingBackgroundAttribute);
|
|
@@ -2659,6 +2700,13 @@ function GrapesPageEditor({
|
|
|
2659
2700
|
}
|
|
2660
2701
|
selected.addStyle?.({ [property]: value });
|
|
2661
2702
|
editorRef.current?.select?.(selected);
|
|
2703
|
+
if (property.startsWith("padding-")) {
|
|
2704
|
+
window.requestAnimationFrame(() => {
|
|
2705
|
+
spacingProperties.filter((spacingProperty) => spacingProperty.startsWith("margin-")).forEach((spacingProperty) => {
|
|
2706
|
+
writeStylePanelLength(spacingProperty, firstString(selected.getStyle?.()?.[spacingProperty], "0px"));
|
|
2707
|
+
});
|
|
2708
|
+
});
|
|
2709
|
+
}
|
|
2662
2710
|
};
|
|
2663
2711
|
const applyNegativeSpacingInput = (property, value, baseValue) => {
|
|
2664
2712
|
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
@@ -2688,6 +2736,7 @@ function GrapesPageEditor({
|
|
|
2688
2736
|
);
|
|
2689
2737
|
selected.addClass?.("orion-builder-v2-negative-padding");
|
|
2690
2738
|
selected.addClass?.(`is-orion-negative-padding-${side}`);
|
|
2739
|
+
removeGeneratedSelectionMargins(selected);
|
|
2691
2740
|
selected.addAttributes?.({
|
|
2692
2741
|
...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
|
|
2693
2742
|
[negativePaddingAttributeForSide(side)]: negativeStyleValue
|
|
@@ -2791,7 +2840,10 @@ function GrapesPageEditor({
|
|
|
2791
2840
|
if (Object.keys(block).length === 0) {
|
|
2792
2841
|
return;
|
|
2793
2842
|
}
|
|
2794
|
-
const
|
|
2843
|
+
const targetStyle = target.getStyle?.() || {};
|
|
2844
|
+
const componentStyle = component?.getStyle?.() || targetStyle;
|
|
2845
|
+
const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
|
|
2846
|
+
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2795
2847
|
if (!backgroundColor) {
|
|
2796
2848
|
return;
|
|
2797
2849
|
}
|
|
@@ -2892,15 +2944,18 @@ function GrapesPageEditor({
|
|
|
2892
2944
|
return;
|
|
2893
2945
|
}
|
|
2894
2946
|
const panelBackgroundColor = normalizeCssColorValue(readStylePanelColor("background-color"));
|
|
2895
|
-
const
|
|
2896
|
-
const
|
|
2947
|
+
const targetStyle = target.getStyle?.() || {};
|
|
2948
|
+
const componentStyle = component?.getStyle?.() || targetStyle;
|
|
2949
|
+
const styleBackgroundColor = getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2950
|
+
const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
|
|
2951
|
+
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
|
|
2897
2952
|
if (!backgroundColor) {
|
|
2898
2953
|
return;
|
|
2899
2954
|
}
|
|
2900
|
-
if (getStyleColorValue(
|
|
2955
|
+
if (!negativePaddingActive && getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
|
|
2901
2956
|
target.addStyle?.({ "background-color": backgroundColor });
|
|
2902
2957
|
}
|
|
2903
|
-
if (component && component !== target && getStyleColorValue(
|
|
2958
|
+
if (!negativePaddingActive && component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
|
|
2904
2959
|
component.addStyle?.({ "background-color": backgroundColor });
|
|
2905
2960
|
}
|
|
2906
2961
|
target.addAttributes?.({
|
|
@@ -2926,7 +2981,9 @@ function GrapesPageEditor({
|
|
|
2926
2981
|
if (Object.keys(block).length === 0) {
|
|
2927
2982
|
return;
|
|
2928
2983
|
}
|
|
2929
|
-
const
|
|
2984
|
+
const style = component.getStyle?.() || {};
|
|
2985
|
+
const negativePaddingActive = hasNegativePaddingState(attrs, style);
|
|
2986
|
+
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, style) : getStyleColorValue(style, "background-color");
|
|
2930
2987
|
if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
|
|
2931
2988
|
return;
|
|
2932
2989
|
}
|
|
@@ -2996,7 +3053,11 @@ function GrapesPageEditor({
|
|
|
2996
3053
|
rememberComponentSnapshot(component);
|
|
2997
3054
|
markSelectedCanvasBlock(component);
|
|
2998
3055
|
refreshSelectedState(component);
|
|
2999
|
-
|
|
3056
|
+
const writeSpacingControls = () => {
|
|
3057
|
+
const activeComponent = selectedComponentRef.current;
|
|
3058
|
+
if (!activeComponent || component !== activeComponent && getCurrentOrionBlockTarget(component) !== activeComponent) {
|
|
3059
|
+
return;
|
|
3060
|
+
}
|
|
3000
3061
|
const element = spacingTargetForComponent(component);
|
|
3001
3062
|
if (!element) {
|
|
3002
3063
|
return;
|
|
@@ -3004,6 +3065,9 @@ function GrapesPageEditor({
|
|
|
3004
3065
|
const computed = window.getComputedStyle(element);
|
|
3005
3066
|
const attrs = component.getAttributes?.() || {};
|
|
3006
3067
|
const style = component.getStyle?.() || {};
|
|
3068
|
+
if (hasNegativePaddingState(attrs, style)) {
|
|
3069
|
+
removeGeneratedSelectionMargins(component);
|
|
3070
|
+
}
|
|
3007
3071
|
spacingProperties.forEach((property) => {
|
|
3008
3072
|
const negativePaddingSide = negativePaddingSideFromProperty(property);
|
|
3009
3073
|
const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
|
|
@@ -3012,12 +3076,16 @@ function GrapesPageEditor({
|
|
|
3012
3076
|
return;
|
|
3013
3077
|
}
|
|
3014
3078
|
if (property.startsWith("margin-")) {
|
|
3015
|
-
writeStylePanelLength(property, firstString(style[property],
|
|
3079
|
+
writeStylePanelLength(property, firstString(style[property], "0px"));
|
|
3016
3080
|
return;
|
|
3017
3081
|
}
|
|
3018
3082
|
writeStylePanelLength(property, computed.getPropertyValue(property));
|
|
3019
3083
|
});
|
|
3020
|
-
}
|
|
3084
|
+
};
|
|
3085
|
+
window.requestAnimationFrame(writeSpacingControls);
|
|
3086
|
+
window.setTimeout(writeSpacingControls, 80);
|
|
3087
|
+
window.setTimeout(writeSpacingControls, 240);
|
|
3088
|
+
window.setTimeout(writeSpacingControls, 600);
|
|
3021
3089
|
};
|
|
3022
3090
|
const applyQuickLayout = (layout) => {
|
|
3023
3091
|
const component = selectedComponentRef.current;
|
|
@@ -1785,7 +1785,8 @@ var normalizeCssColorValue = (value) => {
|
|
|
1785
1785
|
return "";
|
|
1786
1786
|
}
|
|
1787
1787
|
const trimmed = value.trim();
|
|
1788
|
-
|
|
1788
|
+
const normalized = trimmed.toLowerCase();
|
|
1789
|
+
return trimmed && normalized !== "none" && normalized !== "transparent" && normalized !== "rgba(0, 0, 0, 0)" ? trimmed : "";
|
|
1789
1790
|
};
|
|
1790
1791
|
var getStyleColorValue = (style, property) => normalizeCssColorValue(
|
|
1791
1792
|
style[property] || style[property.replace(/-([a-z])/g, (_, char) => char.toUpperCase())]
|
|
@@ -1901,6 +1902,33 @@ var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${s
|
|
|
1901
1902
|
var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
|
|
1902
1903
|
var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
|
|
1903
1904
|
var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
|
|
1905
|
+
var hasNegativePaddingState = (attrs, style) => negativePaddingSides.some((side) => Boolean(attrs[negativePaddingAttributeForSide(side)] || style[negativePaddingVariableForSide(side)]));
|
|
1906
|
+
var removeGeneratedSelectionMargins = (component) => {
|
|
1907
|
+
const style = component?.getStyle?.() || {};
|
|
1908
|
+
const cleanup = {};
|
|
1909
|
+
["margin-top", "margin-bottom"].forEach((property) => {
|
|
1910
|
+
const value = String(style[property] || "").trim();
|
|
1911
|
+
if (value === "-2px" || value === "-2") {
|
|
1912
|
+
cleanup[property] = "";
|
|
1913
|
+
}
|
|
1914
|
+
});
|
|
1915
|
+
if (Object.keys(cleanup).length > 0) {
|
|
1916
|
+
component?.addStyle?.(cleanup);
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
var removeGeneratedNegativePaddingMargin = (component, side, negativePaddingValue) => {
|
|
1920
|
+
if (side !== "top" && side !== "bottom") {
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1923
|
+
const property = `margin-${side}`;
|
|
1924
|
+
const style = component?.getStyle?.() || {};
|
|
1925
|
+
const currentMargin = String(style[property] || "").trim();
|
|
1926
|
+
const generatedMargin = String(negativePaddingValue || "").trim();
|
|
1927
|
+
if (generatedMargin && currentMargin === generatedMargin) {
|
|
1928
|
+
component?.addStyle?.({ [property]: "" });
|
|
1929
|
+
writeStylePanelLength(property, "0px");
|
|
1930
|
+
}
|
|
1931
|
+
};
|
|
1904
1932
|
var getStoredOrionBackgroundColor = (attrs, style) => {
|
|
1905
1933
|
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
1906
1934
|
return firstString(
|
|
@@ -2495,10 +2523,12 @@ function GrapesPageEditor({
|
|
|
2495
2523
|
selectedComponentRef.current = selected;
|
|
2496
2524
|
lastSelectedComponentRef.current = selected;
|
|
2497
2525
|
if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
|
|
2526
|
+
removeGeneratedSelectionMargins(selected);
|
|
2498
2527
|
const side = negativePaddingSideFromProperty(property);
|
|
2499
2528
|
if (side) {
|
|
2500
2529
|
const attrs = selected.getAttributes?.() || {};
|
|
2501
2530
|
const selectedStyle = selected.getStyle?.() || {};
|
|
2531
|
+
const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
|
|
2502
2532
|
const nextNegativePaddingBySide = Object.fromEntries(
|
|
2503
2533
|
negativePaddingSides.map((paddingSide) => [
|
|
2504
2534
|
paddingSide,
|
|
@@ -2512,9 +2542,20 @@ function GrapesPageEditor({
|
|
|
2512
2542
|
selected.removeStyle?.(negativePaddingVariableForSide(side));
|
|
2513
2543
|
selected.removeAttributes?.(negativePaddingAttributeForSide(side));
|
|
2514
2544
|
selected.removeClass?.(`is-orion-negative-padding-${side}`);
|
|
2545
|
+
removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
|
|
2515
2546
|
if (!hasOtherNegativePadding) {
|
|
2516
2547
|
if (negativePaddingBackground) {
|
|
2517
2548
|
selected.addStyle?.({ "background-color": negativePaddingBackground });
|
|
2549
|
+
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
2550
|
+
if (Object.keys(block).length > 0) {
|
|
2551
|
+
selected.addAttributes?.({
|
|
2552
|
+
"data-orion-background-color": negativePaddingBackground,
|
|
2553
|
+
"data-orion-block": serializeOrionBlockAttribute({
|
|
2554
|
+
...block,
|
|
2555
|
+
backgroundColor: negativePaddingBackground
|
|
2556
|
+
})
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2518
2559
|
}
|
|
2519
2560
|
selected.removeStyle?.(negativePaddingBackgroundVariable);
|
|
2520
2561
|
selected.removeAttributes?.(negativePaddingBackgroundAttribute);
|
|
@@ -2535,6 +2576,13 @@ function GrapesPageEditor({
|
|
|
2535
2576
|
}
|
|
2536
2577
|
selected.addStyle?.({ [property]: value });
|
|
2537
2578
|
editorRef.current?.select?.(selected);
|
|
2579
|
+
if (property.startsWith("padding-")) {
|
|
2580
|
+
window.requestAnimationFrame(() => {
|
|
2581
|
+
spacingProperties.filter((spacingProperty) => spacingProperty.startsWith("margin-")).forEach((spacingProperty) => {
|
|
2582
|
+
writeStylePanelLength(spacingProperty, firstString(selected.getStyle?.()?.[spacingProperty], "0px"));
|
|
2583
|
+
});
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2538
2586
|
};
|
|
2539
2587
|
const applyNegativeSpacingInput = (property, value, baseValue) => {
|
|
2540
2588
|
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
@@ -2564,6 +2612,7 @@ function GrapesPageEditor({
|
|
|
2564
2612
|
);
|
|
2565
2613
|
selected.addClass?.("orion-builder-v2-negative-padding");
|
|
2566
2614
|
selected.addClass?.(`is-orion-negative-padding-${side}`);
|
|
2615
|
+
removeGeneratedSelectionMargins(selected);
|
|
2567
2616
|
selected.addAttributes?.({
|
|
2568
2617
|
...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
|
|
2569
2618
|
[negativePaddingAttributeForSide(side)]: negativeStyleValue
|
|
@@ -2667,7 +2716,10 @@ function GrapesPageEditor({
|
|
|
2667
2716
|
if (Object.keys(block).length === 0) {
|
|
2668
2717
|
return;
|
|
2669
2718
|
}
|
|
2670
|
-
const
|
|
2719
|
+
const targetStyle = target.getStyle?.() || {};
|
|
2720
|
+
const componentStyle = component?.getStyle?.() || targetStyle;
|
|
2721
|
+
const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
|
|
2722
|
+
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2671
2723
|
if (!backgroundColor) {
|
|
2672
2724
|
return;
|
|
2673
2725
|
}
|
|
@@ -2768,15 +2820,18 @@ function GrapesPageEditor({
|
|
|
2768
2820
|
return;
|
|
2769
2821
|
}
|
|
2770
2822
|
const panelBackgroundColor = normalizeCssColorValue(readStylePanelColor("background-color"));
|
|
2771
|
-
const
|
|
2772
|
-
const
|
|
2823
|
+
const targetStyle = target.getStyle?.() || {};
|
|
2824
|
+
const componentStyle = component?.getStyle?.() || targetStyle;
|
|
2825
|
+
const styleBackgroundColor = getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2826
|
+
const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
|
|
2827
|
+
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
|
|
2773
2828
|
if (!backgroundColor) {
|
|
2774
2829
|
return;
|
|
2775
2830
|
}
|
|
2776
|
-
if (getStyleColorValue(
|
|
2831
|
+
if (!negativePaddingActive && getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
|
|
2777
2832
|
target.addStyle?.({ "background-color": backgroundColor });
|
|
2778
2833
|
}
|
|
2779
|
-
if (component && component !== target && getStyleColorValue(
|
|
2834
|
+
if (!negativePaddingActive && component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
|
|
2780
2835
|
component.addStyle?.({ "background-color": backgroundColor });
|
|
2781
2836
|
}
|
|
2782
2837
|
target.addAttributes?.({
|
|
@@ -2802,7 +2857,9 @@ function GrapesPageEditor({
|
|
|
2802
2857
|
if (Object.keys(block).length === 0) {
|
|
2803
2858
|
return;
|
|
2804
2859
|
}
|
|
2805
|
-
const
|
|
2860
|
+
const style = component.getStyle?.() || {};
|
|
2861
|
+
const negativePaddingActive = hasNegativePaddingState(attrs, style);
|
|
2862
|
+
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, style) : getStyleColorValue(style, "background-color");
|
|
2806
2863
|
if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
|
|
2807
2864
|
return;
|
|
2808
2865
|
}
|
|
@@ -2872,7 +2929,11 @@ function GrapesPageEditor({
|
|
|
2872
2929
|
rememberComponentSnapshot(component);
|
|
2873
2930
|
markSelectedCanvasBlock(component);
|
|
2874
2931
|
refreshSelectedState(component);
|
|
2875
|
-
|
|
2932
|
+
const writeSpacingControls = () => {
|
|
2933
|
+
const activeComponent = selectedComponentRef.current;
|
|
2934
|
+
if (!activeComponent || component !== activeComponent && getCurrentOrionBlockTarget(component) !== activeComponent) {
|
|
2935
|
+
return;
|
|
2936
|
+
}
|
|
2876
2937
|
const element = spacingTargetForComponent(component);
|
|
2877
2938
|
if (!element) {
|
|
2878
2939
|
return;
|
|
@@ -2880,6 +2941,9 @@ function GrapesPageEditor({
|
|
|
2880
2941
|
const computed = window.getComputedStyle(element);
|
|
2881
2942
|
const attrs = component.getAttributes?.() || {};
|
|
2882
2943
|
const style = component.getStyle?.() || {};
|
|
2944
|
+
if (hasNegativePaddingState(attrs, style)) {
|
|
2945
|
+
removeGeneratedSelectionMargins(component);
|
|
2946
|
+
}
|
|
2883
2947
|
spacingProperties.forEach((property) => {
|
|
2884
2948
|
const negativePaddingSide = negativePaddingSideFromProperty(property);
|
|
2885
2949
|
const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
|
|
@@ -2888,12 +2952,16 @@ function GrapesPageEditor({
|
|
|
2888
2952
|
return;
|
|
2889
2953
|
}
|
|
2890
2954
|
if (property.startsWith("margin-")) {
|
|
2891
|
-
writeStylePanelLength(property, firstString(style[property],
|
|
2955
|
+
writeStylePanelLength(property, firstString(style[property], "0px"));
|
|
2892
2956
|
return;
|
|
2893
2957
|
}
|
|
2894
2958
|
writeStylePanelLength(property, computed.getPropertyValue(property));
|
|
2895
2959
|
});
|
|
2896
|
-
}
|
|
2960
|
+
};
|
|
2961
|
+
window.requestAnimationFrame(writeSpacingControls);
|
|
2962
|
+
window.setTimeout(writeSpacingControls, 80);
|
|
2963
|
+
window.setTimeout(writeSpacingControls, 240);
|
|
2964
|
+
window.setTimeout(writeSpacingControls, 600);
|
|
2897
2965
|
};
|
|
2898
2966
|
const applyQuickLayout = (layout) => {
|
|
2899
2967
|
const component = selectedComponentRef.current;
|
package/dist/index.mjs
CHANGED
|
@@ -5,21 +5,21 @@ import {
|
|
|
5
5
|
nextjs_exports
|
|
6
6
|
} from "./chunk-ZADL33R6.mjs";
|
|
7
7
|
import "./chunk-ZTXJG4K5.mjs";
|
|
8
|
-
import {
|
|
9
|
-
studio_pages_exports
|
|
10
|
-
} from "./chunk-7HME6R2V.mjs";
|
|
11
|
-
import "./chunk-7ZMXZRBP.mjs";
|
|
12
|
-
import {
|
|
13
|
-
studio_exports
|
|
14
|
-
} from "./chunk-ADIIWIYL.mjs";
|
|
15
8
|
import {
|
|
16
9
|
blocks_exports
|
|
17
10
|
} from "./chunk-JQAHXYAM.mjs";
|
|
18
|
-
import "./chunk-OQSEJXC4.mjs";
|
|
19
11
|
import {
|
|
20
12
|
admin_app_exports
|
|
21
13
|
} from "./chunk-RKTIFEUY.mjs";
|
|
22
14
|
import "./chunk-W2UOCJDX.mjs";
|
|
15
|
+
import {
|
|
16
|
+
studio_pages_exports
|
|
17
|
+
} from "./chunk-276KAPGM.mjs";
|
|
18
|
+
import "./chunk-7ZMXZRBP.mjs";
|
|
19
|
+
import "./chunk-OQSEJXC4.mjs";
|
|
20
|
+
import {
|
|
21
|
+
studio_exports
|
|
22
|
+
} from "./chunk-ADIIWIYL.mjs";
|
|
23
23
|
import "./chunk-6BWS3CLP.mjs";
|
|
24
24
|
export {
|
|
25
25
|
admin_exports as admin,
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-studios/payload-studio",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.179",
|
|
4
4
|
"description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -139,6 +139,7 @@
|
|
|
139
139
|
"typescript": "^5.3.0"
|
|
140
140
|
},
|
|
141
141
|
"dependencies": {
|
|
142
|
+
"@orion-studios/payload-studio": "file:",
|
|
142
143
|
"grapesjs": "^0.22.16",
|
|
143
144
|
"sanitize-html": "^2.17.3"
|
|
144
145
|
}
|
|
@@ -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";
|