@orion-studios/payload-studio 0.6.0-beta.181 → 0.6.0-beta.182

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.
@@ -7,14 +7,14 @@ import {
7
7
  socialMediaConnectionsField,
8
8
  themePreferenceField,
9
9
  withTooltips
10
- } from "../chunk-KHK6RTGC.mjs";
10
+ } from "../chunk-JC3UV74N.mjs";
11
+ import "../chunk-W2UOCJDX.mjs";
11
12
  import {
12
13
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
13
14
  SOCIAL_MEDIA_ICON_OPTIONS,
14
15
  SOCIAL_MEDIA_PLATFORMS,
15
16
  SOCIAL_MEDIA_PLATFORM_LABELS
16
17
  } from "../chunk-ZTXJG4K5.mjs";
17
- import "../chunk-W2UOCJDX.mjs";
18
18
  import "../chunk-6BWS3CLP.mjs";
19
19
  export {
20
20
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
@@ -1773,22 +1773,7 @@ var quickVerticalAlignStyles = {
1773
1773
  middle: "center",
1774
1774
  top: "flex-start"
1775
1775
  };
1776
- var negativePaddingCss = `
1777
- .orion-builder-v2-negative-padding {
1778
- display: flow-root;
1779
- margin-top: var(--orion-negative-padding-top, 0px) !important;
1780
- margin-right: var(--orion-negative-padding-right, 0px) !important;
1781
- margin-bottom: var(--orion-negative-padding-bottom, 0px) !important;
1782
- margin-left: var(--orion-negative-padding-left, 0px) !important;
1783
- max-width: none !important;
1784
- overflow: visible;
1785
- position: relative;
1786
- width: calc(100% - var(--orion-negative-padding-left, 0px) - var(--orion-negative-padding-right, 0px)) !important;
1787
- }
1788
- `;
1789
1776
  var canvasSelectionCss = `
1790
- ${negativePaddingCss}
1791
-
1792
1777
  .gjs-selected,
1793
1778
  [data-gjs-highlightable].gjs-selected {
1794
1779
  outline-color: #c7643d !important;
@@ -1957,14 +1942,6 @@ var readStylePanelColor = (property) => {
1957
1942
  return swatchColor;
1958
1943
  };
1959
1944
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1960
- var cssPixelValue = (value) => {
1961
- const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
1962
- if (!match) {
1963
- return null;
1964
- }
1965
- const parsed = Number.parseFloat(match[1]);
1966
- return Number.isFinite(parsed) ? parsed : null;
1967
- };
1968
1945
  var propertyNameFromStyleControl = (element) => {
1969
1946
  const property = element?.closest(".gjs-sm-property");
1970
1947
  const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
@@ -1997,13 +1974,9 @@ var spacingProperties = [
1997
1974
  "padding-left",
1998
1975
  "padding-right"
1999
1976
  ];
2000
- var negativePaddingSides = ["top", "bottom", "left", "right"];
2001
- var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
2002
- var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
2003
- var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
2004
- var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
2005
- var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
2006
- var hasNegativePaddingState = (attrs, style) => negativePaddingSides.some((side) => Boolean(attrs[negativePaddingAttributeForSide(side)] || style[negativePaddingVariableForSide(side)]));
1977
+ var legacyNegativePaddingSides = ["top", "bottom", "left", "right"];
1978
+ var legacyNegativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
1979
+ var legacyNegativePaddingBackgroundVariable = "--orion-negative-padding-background";
2007
1980
  var removeGeneratedSelectionMargins = (component) => {
2008
1981
  const style = component?.getStyle?.() || {};
2009
1982
  const cleanup = {};
@@ -2017,38 +1990,45 @@ var removeGeneratedSelectionMargins = (component) => {
2017
1990
  component?.addStyle?.(cleanup);
2018
1991
  }
2019
1992
  };
2020
- var removeGeneratedNegativePaddingMargin = (component, side, negativePaddingValue) => {
2021
- if (side !== "top" && side !== "bottom") {
2022
- return;
2023
- }
2024
- const property = `margin-${side}`;
1993
+ var stripLegacyNegativePadding = (component) => {
1994
+ const attrs = component?.getAttributes?.() || {};
2025
1995
  const style = component?.getStyle?.() || {};
2026
- const currentMargin = String(style[property] || "").trim();
2027
- const generatedMargin = String(negativePaddingValue || "").trim();
2028
- if (generatedMargin && currentMargin === generatedMargin) {
2029
- component?.addStyle?.({ [property]: "" });
2030
- writeStylePanelLength(property, "0px");
1996
+ const hasLegacyNegativePadding = component?.getEl?.()?.classList.contains("orion-builder-v2-negative-padding") || legacyNegativePaddingSides.some((side) => Boolean(attrs[`data-orion-negative-padding-${side}`] || style[`--orion-negative-padding-${side}`]));
1997
+ if (!hasLegacyNegativePadding) {
1998
+ return;
2031
1999
  }
2032
- };
2033
- var getStoredOrionBackgroundColor = (attrs, style) => {
2034
2000
  const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
2035
- return firstString(
2036
- attrs[negativePaddingBackgroundAttribute],
2037
- style[negativePaddingBackgroundVariable],
2001
+ const backgroundColor = firstString(
2002
+ attrs[legacyNegativePaddingBackgroundAttribute],
2003
+ style[legacyNegativePaddingBackgroundVariable],
2038
2004
  attrs["data-orion-background-color"],
2039
2005
  block.backgroundColor
2040
2006
  );
2041
- };
2042
- var ensureNegativePaddingBackground = (component) => {
2043
- const attrs = component?.getAttributes?.() || {};
2044
- const style = component?.getStyle?.() || {};
2045
- if (!hasNegativePaddingState(attrs, style)) {
2046
- return;
2047
- }
2048
- const backgroundColor = getStoredOrionBackgroundColor(attrs, style);
2049
- if (backgroundColor && getStyleColorValue(style, "background-color") !== backgroundColor) {
2050
- component?.addStyle?.({ "background-color": backgroundColor });
2007
+ const cleanupStyle = {
2008
+ [legacyNegativePaddingBackgroundVariable]: ""
2009
+ };
2010
+ const cleanupAttributes = [legacyNegativePaddingBackgroundAttribute];
2011
+ legacyNegativePaddingSides.forEach((side) => {
2012
+ cleanupStyle[`--orion-negative-padding-${side}`] = "";
2013
+ cleanupAttributes.push(`data-orion-negative-padding-${side}`);
2014
+ component?.removeClass?.(`is-orion-negative-padding-${side}`);
2015
+ });
2016
+ component?.removeClass?.("orion-builder-v2-negative-padding");
2017
+ component?.addStyle?.({
2018
+ ...cleanupStyle,
2019
+ ...backgroundColor ? { "background-color": backgroundColor } : {}
2020
+ });
2021
+ component?.removeAttributes?.(cleanupAttributes);
2022
+ if (backgroundColor && Object.keys(block).length > 0) {
2023
+ component?.addAttributes?.({
2024
+ "data-orion-background-color": backgroundColor,
2025
+ "data-orion-block": serializeOrionBlockAttribute({
2026
+ ...block,
2027
+ backgroundColor
2028
+ })
2029
+ });
2051
2030
  }
2031
+ removeGeneratedSelectionMargins(component);
2052
2032
  };
2053
2033
  var spacingTargetForComponent = (component) => {
2054
2034
  const element = component?.getEl?.();
@@ -2241,8 +2221,7 @@ var postToParent = (payload) => {
2241
2221
  };
2242
2222
  var buildSavePayload = (editor, status, projectData) => ({
2243
2223
  builderMode: "grapes-v2",
2244
- compiledCss: scopeBuilderCss(`${negativePaddingCss}
2245
- ${editor.getCss()}`),
2224
+ compiledCss: scopeBuilderCss(editor.getCss()),
2246
2225
  compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
2247
2226
  projectData,
2248
2227
  status
@@ -2631,60 +2610,13 @@ function GrapesPageEditor({
2631
2610
  if (!selected) {
2632
2611
  return;
2633
2612
  }
2634
- const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2613
+ let value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2635
2614
  selectedComponentRef.current = selected;
2636
2615
  lastSelectedComponentRef.current = selected;
2637
- if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
2638
- removeGeneratedSelectionMargins(selected);
2639
- const side = negativePaddingSideFromProperty(property);
2640
- if (side) {
2641
- const attrs = selected.getAttributes?.() || {};
2642
- const selectedStyle = selected.getStyle?.() || {};
2643
- const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
2644
- const nextNegativePaddingBySide = Object.fromEntries(
2645
- negativePaddingSides.map((paddingSide) => [
2646
- paddingSide,
2647
- paddingSide === side ? "" : firstString(attrs[negativePaddingAttributeForSide(paddingSide)])
2648
- ])
2649
- );
2650
- const hasOtherNegativePadding = negativePaddingSides.some(
2651
- (paddingSide) => Boolean(nextNegativePaddingBySide[paddingSide])
2652
- );
2653
- const negativePaddingBackground = getStoredOrionBackgroundColor(attrs, selectedStyle);
2654
- selected.removeStyle?.(negativePaddingVariableForSide(side));
2655
- selected.removeAttributes?.(negativePaddingAttributeForSide(side));
2656
- selected.removeClass?.(`is-orion-negative-padding-${side}`);
2657
- removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
2658
- if (!hasOtherNegativePadding) {
2659
- if (negativePaddingBackground) {
2660
- selected.addStyle?.({ "background-color": negativePaddingBackground });
2661
- const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
2662
- if (Object.keys(block).length > 0) {
2663
- selected.addAttributes?.({
2664
- "data-orion-background-color": negativePaddingBackground,
2665
- "data-orion-block": serializeOrionBlockAttribute({
2666
- ...block,
2667
- backgroundColor: negativePaddingBackground
2668
- })
2669
- });
2670
- }
2671
- }
2672
- selected.removeStyle?.(negativePaddingBackgroundVariable);
2673
- selected.removeAttributes?.(negativePaddingBackgroundAttribute);
2674
- negativePaddingSides.forEach((paddingSide) => {
2675
- selected.removeStyle?.(negativePaddingVariableForSide(paddingSide));
2676
- selected.removeAttributes?.(negativePaddingAttributeForSide(paddingSide));
2677
- selected.removeClass?.(`is-orion-negative-padding-${paddingSide}`);
2678
- });
2679
- selected.removeClass?.("orion-builder-v2-negative-padding");
2680
- } else if (negativePaddingBackground) {
2681
- selected.addStyle?.({
2682
- [negativePaddingBackgroundVariable]: negativePaddingBackground,
2683
- "background-color": negativePaddingBackground
2684
- });
2685
- selected.addAttributes?.({ [negativePaddingBackgroundAttribute]: negativePaddingBackground });
2686
- }
2687
- }
2616
+ stripLegacyNegativePadding(selected);
2617
+ if (property.startsWith("padding-") && String(value).trim().startsWith("-")) {
2618
+ value = "0px";
2619
+ writeStylePanelLength(property, value);
2688
2620
  }
2689
2621
  selected.addStyle?.({ [property]: value });
2690
2622
  editorRef.current?.select?.(selected);
@@ -2696,11 +2628,10 @@ function GrapesPageEditor({
2696
2628
  });
2697
2629
  }
2698
2630
  };
2699
- const applyNegativeSpacingInput = (property, value, baseValue) => {
2631
+ const applyNegativeSpacingInput = (property, value) => {
2700
2632
  const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
2701
- const isPadding = property.startsWith("padding-");
2702
2633
  const isMargin = property.startsWith("margin-");
2703
- if (!selected || !isPadding && !isMargin || !value.startsWith("-")) {
2634
+ if (!selected || !isMargin || !value.startsWith("-")) {
2704
2635
  return;
2705
2636
  }
2706
2637
  const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
@@ -2708,38 +2639,11 @@ function GrapesPageEditor({
2708
2639
  if (!Number.isFinite(adjustment)) {
2709
2640
  return;
2710
2641
  }
2711
- const base = isPadding ? cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0 : 0;
2712
- const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
2713
- const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2642
+ const styleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2714
2643
  selectedComponentRef.current = selected;
2715
2644
  lastSelectedComponentRef.current = selected;
2716
- if (isPadding) {
2717
- const side = negativePaddingSideFromProperty(property);
2718
- const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2719
- const currentStyle = selected.getStyle?.() || {};
2720
- const currentAttributes = selected.getAttributes?.() || {};
2721
- const backgroundColor = firstString(
2722
- getStoredOrionBackgroundColor(currentAttributes, currentStyle),
2723
- getStyleColorValue(currentStyle, "background-color")
2724
- );
2725
- selected.addClass?.("orion-builder-v2-negative-padding");
2726
- selected.addClass?.(`is-orion-negative-padding-${side}`);
2727
- removeGeneratedSelectionMargins(selected);
2728
- selected.addAttributes?.({
2729
- ...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
2730
- [negativePaddingAttributeForSide(side)]: negativeStyleValue
2731
- });
2732
- selected.addStyle?.({
2733
- ...backgroundColor ? {
2734
- [negativePaddingBackgroundVariable]: backgroundColor,
2735
- "background-color": backgroundColor
2736
- } : {},
2737
- [negativePaddingVariableForSide(side)]: negativeStyleValue,
2738
- [property]: "0px"
2739
- });
2740
- } else {
2741
- selected.addStyle?.({ [property]: styleValue });
2742
- }
2645
+ stripLegacyNegativePadding(selected);
2646
+ selected.addStyle?.({ [property]: styleValue });
2743
2647
  editorRef.current?.select?.(selected);
2744
2648
  };
2745
2649
  const updateSelectedOrionBlock = (updates) => {
@@ -2828,10 +2732,8 @@ function GrapesPageEditor({
2828
2732
  if (Object.keys(block).length === 0) {
2829
2733
  return;
2830
2734
  }
2831
- const targetStyle = target.getStyle?.() || {};
2832
- const componentStyle = component?.getStyle?.() || targetStyle;
2833
- const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
2834
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : getStyleColorValue(componentStyle || targetStyle, "background-color");
2735
+ const componentStyle = component?.getStyle?.() || target.getStyle?.() || {};
2736
+ const backgroundColor = getStyleColorValue(componentStyle, "background-color");
2835
2737
  if (!backgroundColor) {
2836
2738
  return;
2837
2739
  }
@@ -2935,15 +2837,14 @@ function GrapesPageEditor({
2935
2837
  const targetStyle = target.getStyle?.() || {};
2936
2838
  const componentStyle = component?.getStyle?.() || targetStyle;
2937
2839
  const styleBackgroundColor = getStyleColorValue(componentStyle || targetStyle, "background-color");
2938
- const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
2939
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
2840
+ const backgroundColor = normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
2940
2841
  if (!backgroundColor) {
2941
2842
  return;
2942
2843
  }
2943
- if (!negativePaddingActive && getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2844
+ if (getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2944
2845
  target.addStyle?.({ "background-color": backgroundColor });
2945
2846
  }
2946
- if (!negativePaddingActive && component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2847
+ if (component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2947
2848
  component.addStyle?.({ "background-color": backgroundColor });
2948
2849
  }
2949
2850
  target.addAttributes?.({
@@ -2969,9 +2870,9 @@ function GrapesPageEditor({
2969
2870
  if (Object.keys(block).length === 0) {
2970
2871
  return;
2971
2872
  }
2873
+ stripLegacyNegativePadding(component);
2972
2874
  const style = component.getStyle?.() || {};
2973
- const negativePaddingActive = hasNegativePaddingState(attrs, style);
2974
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, style) : getStyleColorValue(style, "background-color");
2875
+ const backgroundColor = getStyleColorValue(style, "background-color");
2975
2876
  if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
2976
2877
  return;
2977
2878
  }
@@ -3038,7 +2939,7 @@ function GrapesPageEditor({
3038
2939
  return;
3039
2940
  }
3040
2941
  hydrateSelectedTypographyStyleFromOrionBlock(component);
3041
- ensureNegativePaddingBackground(component);
2942
+ stripLegacyNegativePadding(component);
3042
2943
  rememberComponentSnapshot(component);
3043
2944
  markSelectedCanvasBlock(component);
3044
2945
  refreshSelectedState(component);
@@ -3052,18 +2953,8 @@ function GrapesPageEditor({
3052
2953
  return;
3053
2954
  }
3054
2955
  const computed = window.getComputedStyle(element);
3055
- const attrs = component.getAttributes?.() || {};
3056
2956
  const style = component.getStyle?.() || {};
3057
- if (hasNegativePaddingState(attrs, style)) {
3058
- removeGeneratedSelectionMargins(component);
3059
- }
3060
2957
  spacingProperties.forEach((property) => {
3061
- const negativePaddingSide = negativePaddingSideFromProperty(property);
3062
- const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
3063
- if (negativePaddingValue) {
3064
- writeStylePanelLength(property, negativePaddingValue);
3065
- return;
3066
- }
3067
2958
  if (property.startsWith("margin-")) {
3068
2959
  writeStylePanelLength(property, firstString(style[property], "0px"));
3069
2960
  return;
@@ -3914,7 +3805,7 @@ function GrapesPageEditor({
3914
3805
  if (!detail.property || !detail.value) {
3915
3806
  return;
3916
3807
  }
3917
- applyNegativeSpacingInput(detail.property, detail.value, detail.baseValue || "0");
3808
+ applyNegativeSpacingInput(detail.property, detail.value);
3918
3809
  };
3919
3810
  const observer = new MutationObserver(() => {
3920
3811
  decorateBuilderControls();
@@ -1649,22 +1649,7 @@ var quickVerticalAlignStyles = {
1649
1649
  middle: "center",
1650
1650
  top: "flex-start"
1651
1651
  };
1652
- var negativePaddingCss = `
1653
- .orion-builder-v2-negative-padding {
1654
- display: flow-root;
1655
- margin-top: var(--orion-negative-padding-top, 0px) !important;
1656
- margin-right: var(--orion-negative-padding-right, 0px) !important;
1657
- margin-bottom: var(--orion-negative-padding-bottom, 0px) !important;
1658
- margin-left: var(--orion-negative-padding-left, 0px) !important;
1659
- max-width: none !important;
1660
- overflow: visible;
1661
- position: relative;
1662
- width: calc(100% - var(--orion-negative-padding-left, 0px) - var(--orion-negative-padding-right, 0px)) !important;
1663
- }
1664
- `;
1665
1652
  var canvasSelectionCss = `
1666
- ${negativePaddingCss}
1667
-
1668
1653
  .gjs-selected,
1669
1654
  [data-gjs-highlightable].gjs-selected {
1670
1655
  outline-color: #c7643d !important;
@@ -1833,14 +1818,6 @@ var readStylePanelColor = (property) => {
1833
1818
  return swatchColor;
1834
1819
  };
1835
1820
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1836
- var cssPixelValue = (value) => {
1837
- const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
1838
- if (!match) {
1839
- return null;
1840
- }
1841
- const parsed = Number.parseFloat(match[1]);
1842
- return Number.isFinite(parsed) ? parsed : null;
1843
- };
1844
1821
  var propertyNameFromStyleControl = (element) => {
1845
1822
  const property = element?.closest(".gjs-sm-property");
1846
1823
  const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
@@ -1873,13 +1850,9 @@ var spacingProperties = [
1873
1850
  "padding-left",
1874
1851
  "padding-right"
1875
1852
  ];
1876
- var negativePaddingSides = ["top", "bottom", "left", "right"];
1877
- var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
1878
- var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
1879
- var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
1880
- var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
1881
- var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
1882
- var hasNegativePaddingState = (attrs, style) => negativePaddingSides.some((side) => Boolean(attrs[negativePaddingAttributeForSide(side)] || style[negativePaddingVariableForSide(side)]));
1853
+ var legacyNegativePaddingSides = ["top", "bottom", "left", "right"];
1854
+ var legacyNegativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
1855
+ var legacyNegativePaddingBackgroundVariable = "--orion-negative-padding-background";
1883
1856
  var removeGeneratedSelectionMargins = (component) => {
1884
1857
  const style = component?.getStyle?.() || {};
1885
1858
  const cleanup = {};
@@ -1893,38 +1866,45 @@ var removeGeneratedSelectionMargins = (component) => {
1893
1866
  component?.addStyle?.(cleanup);
1894
1867
  }
1895
1868
  };
1896
- var removeGeneratedNegativePaddingMargin = (component, side, negativePaddingValue) => {
1897
- if (side !== "top" && side !== "bottom") {
1898
- return;
1899
- }
1900
- const property = `margin-${side}`;
1869
+ var stripLegacyNegativePadding = (component) => {
1870
+ const attrs = component?.getAttributes?.() || {};
1901
1871
  const style = component?.getStyle?.() || {};
1902
- const currentMargin = String(style[property] || "").trim();
1903
- const generatedMargin = String(negativePaddingValue || "").trim();
1904
- if (generatedMargin && currentMargin === generatedMargin) {
1905
- component?.addStyle?.({ [property]: "" });
1906
- writeStylePanelLength(property, "0px");
1872
+ const hasLegacyNegativePadding = component?.getEl?.()?.classList.contains("orion-builder-v2-negative-padding") || legacyNegativePaddingSides.some((side) => Boolean(attrs[`data-orion-negative-padding-${side}`] || style[`--orion-negative-padding-${side}`]));
1873
+ if (!hasLegacyNegativePadding) {
1874
+ return;
1907
1875
  }
1908
- };
1909
- var getStoredOrionBackgroundColor = (attrs, style) => {
1910
1876
  const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
1911
- return firstString(
1912
- attrs[negativePaddingBackgroundAttribute],
1913
- style[negativePaddingBackgroundVariable],
1877
+ const backgroundColor = firstString(
1878
+ attrs[legacyNegativePaddingBackgroundAttribute],
1879
+ style[legacyNegativePaddingBackgroundVariable],
1914
1880
  attrs["data-orion-background-color"],
1915
1881
  block.backgroundColor
1916
1882
  );
1917
- };
1918
- var ensureNegativePaddingBackground = (component) => {
1919
- const attrs = component?.getAttributes?.() || {};
1920
- const style = component?.getStyle?.() || {};
1921
- if (!hasNegativePaddingState(attrs, style)) {
1922
- return;
1923
- }
1924
- const backgroundColor = getStoredOrionBackgroundColor(attrs, style);
1925
- if (backgroundColor && getStyleColorValue(style, "background-color") !== backgroundColor) {
1926
- component?.addStyle?.({ "background-color": backgroundColor });
1883
+ const cleanupStyle = {
1884
+ [legacyNegativePaddingBackgroundVariable]: ""
1885
+ };
1886
+ const cleanupAttributes = [legacyNegativePaddingBackgroundAttribute];
1887
+ legacyNegativePaddingSides.forEach((side) => {
1888
+ cleanupStyle[`--orion-negative-padding-${side}`] = "";
1889
+ cleanupAttributes.push(`data-orion-negative-padding-${side}`);
1890
+ component?.removeClass?.(`is-orion-negative-padding-${side}`);
1891
+ });
1892
+ component?.removeClass?.("orion-builder-v2-negative-padding");
1893
+ component?.addStyle?.({
1894
+ ...cleanupStyle,
1895
+ ...backgroundColor ? { "background-color": backgroundColor } : {}
1896
+ });
1897
+ component?.removeAttributes?.(cleanupAttributes);
1898
+ if (backgroundColor && Object.keys(block).length > 0) {
1899
+ component?.addAttributes?.({
1900
+ "data-orion-background-color": backgroundColor,
1901
+ "data-orion-block": serializeOrionBlockAttribute({
1902
+ ...block,
1903
+ backgroundColor
1904
+ })
1905
+ });
1927
1906
  }
1907
+ removeGeneratedSelectionMargins(component);
1928
1908
  };
1929
1909
  var spacingTargetForComponent = (component) => {
1930
1910
  const element = component?.getEl?.();
@@ -2117,8 +2097,7 @@ var postToParent = (payload) => {
2117
2097
  };
2118
2098
  var buildSavePayload = (editor, status, projectData) => ({
2119
2099
  builderMode: "grapes-v2",
2120
- compiledCss: scopeBuilderCss(`${negativePaddingCss}
2121
- ${editor.getCss()}`),
2100
+ compiledCss: scopeBuilderCss(editor.getCss()),
2122
2101
  compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
2123
2102
  projectData,
2124
2103
  status
@@ -2507,60 +2486,13 @@ function GrapesPageEditor({
2507
2486
  if (!selected) {
2508
2487
  return;
2509
2488
  }
2510
- const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2489
+ let value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2511
2490
  selectedComponentRef.current = selected;
2512
2491
  lastSelectedComponentRef.current = selected;
2513
- if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
2514
- removeGeneratedSelectionMargins(selected);
2515
- const side = negativePaddingSideFromProperty(property);
2516
- if (side) {
2517
- const attrs = selected.getAttributes?.() || {};
2518
- const selectedStyle = selected.getStyle?.() || {};
2519
- const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
2520
- const nextNegativePaddingBySide = Object.fromEntries(
2521
- negativePaddingSides.map((paddingSide) => [
2522
- paddingSide,
2523
- paddingSide === side ? "" : firstString(attrs[negativePaddingAttributeForSide(paddingSide)])
2524
- ])
2525
- );
2526
- const hasOtherNegativePadding = negativePaddingSides.some(
2527
- (paddingSide) => Boolean(nextNegativePaddingBySide[paddingSide])
2528
- );
2529
- const negativePaddingBackground = getStoredOrionBackgroundColor(attrs, selectedStyle);
2530
- selected.removeStyle?.(negativePaddingVariableForSide(side));
2531
- selected.removeAttributes?.(negativePaddingAttributeForSide(side));
2532
- selected.removeClass?.(`is-orion-negative-padding-${side}`);
2533
- removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
2534
- if (!hasOtherNegativePadding) {
2535
- if (negativePaddingBackground) {
2536
- selected.addStyle?.({ "background-color": negativePaddingBackground });
2537
- const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
2538
- if (Object.keys(block).length > 0) {
2539
- selected.addAttributes?.({
2540
- "data-orion-background-color": negativePaddingBackground,
2541
- "data-orion-block": serializeOrionBlockAttribute({
2542
- ...block,
2543
- backgroundColor: negativePaddingBackground
2544
- })
2545
- });
2546
- }
2547
- }
2548
- selected.removeStyle?.(negativePaddingBackgroundVariable);
2549
- selected.removeAttributes?.(negativePaddingBackgroundAttribute);
2550
- negativePaddingSides.forEach((paddingSide) => {
2551
- selected.removeStyle?.(negativePaddingVariableForSide(paddingSide));
2552
- selected.removeAttributes?.(negativePaddingAttributeForSide(paddingSide));
2553
- selected.removeClass?.(`is-orion-negative-padding-${paddingSide}`);
2554
- });
2555
- selected.removeClass?.("orion-builder-v2-negative-padding");
2556
- } else if (negativePaddingBackground) {
2557
- selected.addStyle?.({
2558
- [negativePaddingBackgroundVariable]: negativePaddingBackground,
2559
- "background-color": negativePaddingBackground
2560
- });
2561
- selected.addAttributes?.({ [negativePaddingBackgroundAttribute]: negativePaddingBackground });
2562
- }
2563
- }
2492
+ stripLegacyNegativePadding(selected);
2493
+ if (property.startsWith("padding-") && String(value).trim().startsWith("-")) {
2494
+ value = "0px";
2495
+ writeStylePanelLength(property, value);
2564
2496
  }
2565
2497
  selected.addStyle?.({ [property]: value });
2566
2498
  editorRef.current?.select?.(selected);
@@ -2572,11 +2504,10 @@ function GrapesPageEditor({
2572
2504
  });
2573
2505
  }
2574
2506
  };
2575
- const applyNegativeSpacingInput = (property, value, baseValue) => {
2507
+ const applyNegativeSpacingInput = (property, value) => {
2576
2508
  const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
2577
- const isPadding = property.startsWith("padding-");
2578
2509
  const isMargin = property.startsWith("margin-");
2579
- if (!selected || !isPadding && !isMargin || !value.startsWith("-")) {
2510
+ if (!selected || !isMargin || !value.startsWith("-")) {
2580
2511
  return;
2581
2512
  }
2582
2513
  const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
@@ -2584,38 +2515,11 @@ function GrapesPageEditor({
2584
2515
  if (!Number.isFinite(adjustment)) {
2585
2516
  return;
2586
2517
  }
2587
- const base = isPadding ? cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0 : 0;
2588
- const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
2589
- const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2518
+ const styleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2590
2519
  selectedComponentRef.current = selected;
2591
2520
  lastSelectedComponentRef.current = selected;
2592
- if (isPadding) {
2593
- const side = negativePaddingSideFromProperty(property);
2594
- const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2595
- const currentStyle = selected.getStyle?.() || {};
2596
- const currentAttributes = selected.getAttributes?.() || {};
2597
- const backgroundColor = firstString(
2598
- getStoredOrionBackgroundColor(currentAttributes, currentStyle),
2599
- getStyleColorValue(currentStyle, "background-color")
2600
- );
2601
- selected.addClass?.("orion-builder-v2-negative-padding");
2602
- selected.addClass?.(`is-orion-negative-padding-${side}`);
2603
- removeGeneratedSelectionMargins(selected);
2604
- selected.addAttributes?.({
2605
- ...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
2606
- [negativePaddingAttributeForSide(side)]: negativeStyleValue
2607
- });
2608
- selected.addStyle?.({
2609
- ...backgroundColor ? {
2610
- [negativePaddingBackgroundVariable]: backgroundColor,
2611
- "background-color": backgroundColor
2612
- } : {},
2613
- [negativePaddingVariableForSide(side)]: negativeStyleValue,
2614
- [property]: "0px"
2615
- });
2616
- } else {
2617
- selected.addStyle?.({ [property]: styleValue });
2618
- }
2521
+ stripLegacyNegativePadding(selected);
2522
+ selected.addStyle?.({ [property]: styleValue });
2619
2523
  editorRef.current?.select?.(selected);
2620
2524
  };
2621
2525
  const updateSelectedOrionBlock = (updates) => {
@@ -2704,10 +2608,8 @@ function GrapesPageEditor({
2704
2608
  if (Object.keys(block).length === 0) {
2705
2609
  return;
2706
2610
  }
2707
- const targetStyle = target.getStyle?.() || {};
2708
- const componentStyle = component?.getStyle?.() || targetStyle;
2709
- const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
2710
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : getStyleColorValue(componentStyle || targetStyle, "background-color");
2611
+ const componentStyle = component?.getStyle?.() || target.getStyle?.() || {};
2612
+ const backgroundColor = getStyleColorValue(componentStyle, "background-color");
2711
2613
  if (!backgroundColor) {
2712
2614
  return;
2713
2615
  }
@@ -2811,15 +2713,14 @@ function GrapesPageEditor({
2811
2713
  const targetStyle = target.getStyle?.() || {};
2812
2714
  const componentStyle = component?.getStyle?.() || targetStyle;
2813
2715
  const styleBackgroundColor = getStyleColorValue(componentStyle || targetStyle, "background-color");
2814
- const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
2815
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
2716
+ const backgroundColor = normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
2816
2717
  if (!backgroundColor) {
2817
2718
  return;
2818
2719
  }
2819
- if (!negativePaddingActive && getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2720
+ if (getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2820
2721
  target.addStyle?.({ "background-color": backgroundColor });
2821
2722
  }
2822
- if (!negativePaddingActive && component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2723
+ if (component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2823
2724
  component.addStyle?.({ "background-color": backgroundColor });
2824
2725
  }
2825
2726
  target.addAttributes?.({
@@ -2845,9 +2746,9 @@ function GrapesPageEditor({
2845
2746
  if (Object.keys(block).length === 0) {
2846
2747
  return;
2847
2748
  }
2749
+ stripLegacyNegativePadding(component);
2848
2750
  const style = component.getStyle?.() || {};
2849
- const negativePaddingActive = hasNegativePaddingState(attrs, style);
2850
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, style) : getStyleColorValue(style, "background-color");
2751
+ const backgroundColor = getStyleColorValue(style, "background-color");
2851
2752
  if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
2852
2753
  return;
2853
2754
  }
@@ -2914,7 +2815,7 @@ function GrapesPageEditor({
2914
2815
  return;
2915
2816
  }
2916
2817
  hydrateSelectedTypographyStyleFromOrionBlock(component);
2917
- ensureNegativePaddingBackground(component);
2818
+ stripLegacyNegativePadding(component);
2918
2819
  rememberComponentSnapshot(component);
2919
2820
  markSelectedCanvasBlock(component);
2920
2821
  refreshSelectedState(component);
@@ -2928,18 +2829,8 @@ function GrapesPageEditor({
2928
2829
  return;
2929
2830
  }
2930
2831
  const computed = window.getComputedStyle(element);
2931
- const attrs = component.getAttributes?.() || {};
2932
2832
  const style = component.getStyle?.() || {};
2933
- if (hasNegativePaddingState(attrs, style)) {
2934
- removeGeneratedSelectionMargins(component);
2935
- }
2936
2833
  spacingProperties.forEach((property) => {
2937
- const negativePaddingSide = negativePaddingSideFromProperty(property);
2938
- const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
2939
- if (negativePaddingValue) {
2940
- writeStylePanelLength(property, negativePaddingValue);
2941
- return;
2942
- }
2943
2834
  if (property.startsWith("margin-")) {
2944
2835
  writeStylePanelLength(property, firstString(style[property], "0px"));
2945
2836
  return;
@@ -3790,7 +3681,7 @@ function GrapesPageEditor({
3790
3681
  if (!detail.property || !detail.value) {
3791
3682
  return;
3792
3683
  }
3793
- applyNegativeSpacingInput(detail.property, detail.value, detail.baseValue || "0");
3684
+ applyNegativeSpacingInput(detail.property, detail.value);
3794
3685
  };
3795
3686
  const observer = new MutationObserver(() => {
3796
3687
  decorateBuilderControls();
package/dist/index.mjs CHANGED
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  admin_exports
3
- } from "./chunk-KHK6RTGC.mjs";
3
+ } from "./chunk-JC3UV74N.mjs";
4
+ import {
5
+ blocks_exports
6
+ } from "./chunk-JQAHXYAM.mjs";
7
+ import {
8
+ admin_app_exports
9
+ } from "./chunk-RKTIFEUY.mjs";
10
+ import "./chunk-W2UOCJDX.mjs";
4
11
  import {
5
12
  nextjs_exports
6
13
  } from "./chunk-ZADL33R6.mjs";
7
14
  import "./chunk-ZTXJG4K5.mjs";
8
- import {
9
- blocks_exports
10
- } from "./chunk-JQAHXYAM.mjs";
11
15
  import {
12
16
  studio_pages_exports
13
- } from "./chunk-276KAPGM.mjs";
14
- import "./chunk-7ZMXZRBP.mjs";
17
+ } from "./chunk-NGLIA2OE.mjs";
15
18
  import "./chunk-OQSEJXC4.mjs";
19
+ import "./chunk-7ZMXZRBP.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,
@@ -7,14 +7,14 @@ import {
7
7
  pageStudioModuleManifest,
8
8
  resolveBuilderThemeTokens,
9
9
  toEditorInitialDoc
10
- } from "../chunk-276KAPGM.mjs";
10
+ } from "../chunk-NGLIA2OE.mjs";
11
+ import "../chunk-OQSEJXC4.mjs";
11
12
  import {
12
13
  createDefaultStudioDocument,
13
14
  defaultBuilderThemeTokens,
14
15
  layoutToStudioDocument,
15
16
  studioDocumentToLayout
16
17
  } from "../chunk-7ZMXZRBP.mjs";
17
- import "../chunk-OQSEJXC4.mjs";
18
18
  import "../chunk-ADIIWIYL.mjs";
19
19
  import "../chunk-6BWS3CLP.mjs";
20
20
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.181",
3
+ "version": "0.6.0-beta.182",
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",
@@ -1,12 +1,12 @@
1
+ import {
2
+ adminNavIcons
3
+ } from "./chunk-W2UOCJDX.mjs";
1
4
  import {
2
5
  SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM,
3
6
  SOCIAL_MEDIA_ICON_OPTIONS,
4
7
  SOCIAL_MEDIA_PLATFORMS,
5
8
  SOCIAL_MEDIA_PLATFORM_LABELS
6
9
  } from "./chunk-ZTXJG4K5.mjs";
7
- import {
8
- adminNavIcons
9
- } from "./chunk-W2UOCJDX.mjs";
10
10
  import {
11
11
  __export,
12
12
  __require
@@ -1,3 +1,6 @@
1
+ import {
2
+ sectionStyleDefaults
3
+ } from "./chunk-OQSEJXC4.mjs";
1
4
  import {
2
5
  createDefaultStudioDocument,
3
6
  defaultBuilderThemeTokens,
@@ -5,9 +8,6 @@ import {
5
8
  migrateBlockToSettingsV2,
6
9
  studioDocumentToLayout
7
10
  } from "./chunk-7ZMXZRBP.mjs";
8
- import {
9
- sectionStyleDefaults
10
- } from "./chunk-OQSEJXC4.mjs";
11
11
  import {
12
12
  assertStudioDocumentV1,
13
13
  compileStudioDocument,