@orion-studios/payload-studio 0.6.0-beta.180 → 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,45 +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
- isolation: isolate;
1780
- overflow: visible;
1781
- position: relative;
1782
- }
1783
-
1784
- .orion-builder-v2-negative-padding.is-orion-negative-padding-bottom:not(.is-orion-negative-padding-top),
1785
- .orion-builder-v2-negative-padding.is-orion-negative-padding-right:not(.is-orion-negative-padding-left) {
1786
- overflow: hidden;
1787
- }
1788
-
1789
- .orion-builder-v2-negative-padding::before {
1790
- background: var(--orion-negative-padding-background, transparent);
1791
- content: "";
1792
- inset: calc(-1 * var(--orion-negative-padding-top, 0px))
1793
- calc(-1 * var(--orion-negative-padding-right, 0px))
1794
- calc(-1 * var(--orion-negative-padding-bottom, 0px))
1795
- calc(-1 * var(--orion-negative-padding-left, 0px));
1796
- pointer-events: none;
1797
- position: absolute;
1798
- z-index: -1;
1799
- }
1800
-
1801
- .orion-builder-v2-negative-padding > * {
1802
- margin-top: var(--orion-negative-padding-top, 0px) !important;
1803
- margin-right: var(--orion-negative-padding-right, 0px) !important;
1804
- margin-bottom: var(--orion-negative-padding-bottom, 0px) !important;
1805
- margin-left: var(--orion-negative-padding-left, 0px) !important;
1806
- max-width: none !important;
1807
- position: relative;
1808
- width: calc(100% - var(--orion-negative-padding-left, 0px) - var(--orion-negative-padding-right, 0px)) !important;
1809
- z-index: 1;
1810
- }
1811
- `;
1812
1776
  var canvasSelectionCss = `
1813
- ${negativePaddingCss}
1814
-
1815
1777
  .gjs-selected,
1816
1778
  [data-gjs-highlightable].gjs-selected {
1817
1779
  outline-color: #c7643d !important;
@@ -1980,14 +1942,6 @@ var readStylePanelColor = (property) => {
1980
1942
  return swatchColor;
1981
1943
  };
1982
1944
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1983
- var cssPixelValue = (value) => {
1984
- const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
1985
- if (!match) {
1986
- return null;
1987
- }
1988
- const parsed = Number.parseFloat(match[1]);
1989
- return Number.isFinite(parsed) ? parsed : null;
1990
- };
1991
1945
  var propertyNameFromStyleControl = (element) => {
1992
1946
  const property = element?.closest(".gjs-sm-property");
1993
1947
  const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
@@ -2020,13 +1974,9 @@ var spacingProperties = [
2020
1974
  "padding-left",
2021
1975
  "padding-right"
2022
1976
  ];
2023
- var negativePaddingSides = ["top", "bottom", "left", "right"];
2024
- var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
2025
- var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
2026
- var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
2027
- var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
2028
- var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
2029
- 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";
2030
1980
  var removeGeneratedSelectionMargins = (component) => {
2031
1981
  const style = component?.getStyle?.() || {};
2032
1982
  const cleanup = {};
@@ -2040,27 +1990,45 @@ var removeGeneratedSelectionMargins = (component) => {
2040
1990
  component?.addStyle?.(cleanup);
2041
1991
  }
2042
1992
  };
2043
- var removeGeneratedNegativePaddingMargin = (component, side, negativePaddingValue) => {
2044
- if (side !== "top" && side !== "bottom") {
2045
- return;
2046
- }
2047
- const property = `margin-${side}`;
1993
+ var stripLegacyNegativePadding = (component) => {
1994
+ const attrs = component?.getAttributes?.() || {};
2048
1995
  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");
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;
2054
1999
  }
2055
- };
2056
- var getStoredOrionBackgroundColor = (attrs, style) => {
2057
2000
  const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
2058
- return firstString(
2059
- attrs[negativePaddingBackgroundAttribute],
2060
- style[negativePaddingBackgroundVariable],
2001
+ const backgroundColor = firstString(
2002
+ attrs[legacyNegativePaddingBackgroundAttribute],
2003
+ style[legacyNegativePaddingBackgroundVariable],
2061
2004
  attrs["data-orion-background-color"],
2062
2005
  block.backgroundColor
2063
2006
  );
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
+ });
2030
+ }
2031
+ removeGeneratedSelectionMargins(component);
2064
2032
  };
2065
2033
  var spacingTargetForComponent = (component) => {
2066
2034
  const element = component?.getEl?.();
@@ -2253,8 +2221,7 @@ var postToParent = (payload) => {
2253
2221
  };
2254
2222
  var buildSavePayload = (editor, status, projectData) => ({
2255
2223
  builderMode: "grapes-v2",
2256
- compiledCss: scopeBuilderCss(`${negativePaddingCss}
2257
- ${editor.getCss()}`),
2224
+ compiledCss: scopeBuilderCss(editor.getCss()),
2258
2225
  compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
2259
2226
  projectData,
2260
2227
  status
@@ -2643,60 +2610,13 @@ function GrapesPageEditor({
2643
2610
  if (!selected) {
2644
2611
  return;
2645
2612
  }
2646
- 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);
2647
2614
  selectedComponentRef.current = selected;
2648
2615
  lastSelectedComponentRef.current = selected;
2649
- if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
2650
- removeGeneratedSelectionMargins(selected);
2651
- const side = negativePaddingSideFromProperty(property);
2652
- if (side) {
2653
- const attrs = selected.getAttributes?.() || {};
2654
- const selectedStyle = selected.getStyle?.() || {};
2655
- const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
2656
- const nextNegativePaddingBySide = Object.fromEntries(
2657
- negativePaddingSides.map((paddingSide) => [
2658
- paddingSide,
2659
- paddingSide === side ? "" : firstString(attrs[negativePaddingAttributeForSide(paddingSide)])
2660
- ])
2661
- );
2662
- const hasOtherNegativePadding = negativePaddingSides.some(
2663
- (paddingSide) => Boolean(nextNegativePaddingBySide[paddingSide])
2664
- );
2665
- const negativePaddingBackground = getStoredOrionBackgroundColor(attrs, selectedStyle);
2666
- selected.removeStyle?.(negativePaddingVariableForSide(side));
2667
- selected.removeAttributes?.(negativePaddingAttributeForSide(side));
2668
- selected.removeClass?.(`is-orion-negative-padding-${side}`);
2669
- removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
2670
- if (!hasOtherNegativePadding) {
2671
- if (negativePaddingBackground) {
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
- }
2683
- }
2684
- selected.removeStyle?.(negativePaddingBackgroundVariable);
2685
- selected.removeAttributes?.(negativePaddingBackgroundAttribute);
2686
- negativePaddingSides.forEach((paddingSide) => {
2687
- selected.removeStyle?.(negativePaddingVariableForSide(paddingSide));
2688
- selected.removeAttributes?.(negativePaddingAttributeForSide(paddingSide));
2689
- selected.removeClass?.(`is-orion-negative-padding-${paddingSide}`);
2690
- });
2691
- selected.removeClass?.("orion-builder-v2-negative-padding");
2692
- } else if (negativePaddingBackground) {
2693
- selected.addStyle?.({
2694
- [negativePaddingBackgroundVariable]: negativePaddingBackground,
2695
- "background-color": "transparent"
2696
- });
2697
- selected.addAttributes?.({ [negativePaddingBackgroundAttribute]: negativePaddingBackground });
2698
- }
2699
- }
2616
+ stripLegacyNegativePadding(selected);
2617
+ if (property.startsWith("padding-") && String(value).trim().startsWith("-")) {
2618
+ value = "0px";
2619
+ writeStylePanelLength(property, value);
2700
2620
  }
2701
2621
  selected.addStyle?.({ [property]: value });
2702
2622
  editorRef.current?.select?.(selected);
@@ -2708,11 +2628,10 @@ function GrapesPageEditor({
2708
2628
  });
2709
2629
  }
2710
2630
  };
2711
- const applyNegativeSpacingInput = (property, value, baseValue) => {
2631
+ const applyNegativeSpacingInput = (property, value) => {
2712
2632
  const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
2713
- const isPadding = property.startsWith("padding-");
2714
2633
  const isMargin = property.startsWith("margin-");
2715
- if (!selected || !isPadding && !isMargin || !value.startsWith("-")) {
2634
+ if (!selected || !isMargin || !value.startsWith("-")) {
2716
2635
  return;
2717
2636
  }
2718
2637
  const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
@@ -2720,38 +2639,11 @@ function GrapesPageEditor({
2720
2639
  if (!Number.isFinite(adjustment)) {
2721
2640
  return;
2722
2641
  }
2723
- const base = isPadding ? cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0 : 0;
2724
- const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
2725
- const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2642
+ const styleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2726
2643
  selectedComponentRef.current = selected;
2727
2644
  lastSelectedComponentRef.current = selected;
2728
- if (isPadding) {
2729
- const side = negativePaddingSideFromProperty(property);
2730
- const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2731
- const currentStyle = selected.getStyle?.() || {};
2732
- const currentAttributes = selected.getAttributes?.() || {};
2733
- const backgroundColor = firstString(
2734
- getStoredOrionBackgroundColor(currentAttributes, currentStyle),
2735
- getStyleColorValue(currentStyle, "background-color")
2736
- );
2737
- selected.addClass?.("orion-builder-v2-negative-padding");
2738
- selected.addClass?.(`is-orion-negative-padding-${side}`);
2739
- removeGeneratedSelectionMargins(selected);
2740
- selected.addAttributes?.({
2741
- ...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
2742
- [negativePaddingAttributeForSide(side)]: negativeStyleValue
2743
- });
2744
- selected.addStyle?.({
2745
- ...backgroundColor ? {
2746
- [negativePaddingBackgroundVariable]: backgroundColor,
2747
- "background-color": "transparent"
2748
- } : {},
2749
- [negativePaddingVariableForSide(side)]: negativeStyleValue,
2750
- [property]: "0px"
2751
- });
2752
- } else {
2753
- selected.addStyle?.({ [property]: styleValue });
2754
- }
2645
+ stripLegacyNegativePadding(selected);
2646
+ selected.addStyle?.({ [property]: styleValue });
2755
2647
  editorRef.current?.select?.(selected);
2756
2648
  };
2757
2649
  const updateSelectedOrionBlock = (updates) => {
@@ -2840,10 +2732,8 @@ function GrapesPageEditor({
2840
2732
  if (Object.keys(block).length === 0) {
2841
2733
  return;
2842
2734
  }
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");
2735
+ const componentStyle = component?.getStyle?.() || target.getStyle?.() || {};
2736
+ const backgroundColor = getStyleColorValue(componentStyle, "background-color");
2847
2737
  if (!backgroundColor) {
2848
2738
  return;
2849
2739
  }
@@ -2947,15 +2837,14 @@ function GrapesPageEditor({
2947
2837
  const targetStyle = target.getStyle?.() || {};
2948
2838
  const componentStyle = component?.getStyle?.() || targetStyle;
2949
2839
  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;
2840
+ const backgroundColor = normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
2952
2841
  if (!backgroundColor) {
2953
2842
  return;
2954
2843
  }
2955
- if (!negativePaddingActive && getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2844
+ if (getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2956
2845
  target.addStyle?.({ "background-color": backgroundColor });
2957
2846
  }
2958
- if (!negativePaddingActive && component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2847
+ if (component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2959
2848
  component.addStyle?.({ "background-color": backgroundColor });
2960
2849
  }
2961
2850
  target.addAttributes?.({
@@ -2981,9 +2870,9 @@ function GrapesPageEditor({
2981
2870
  if (Object.keys(block).length === 0) {
2982
2871
  return;
2983
2872
  }
2873
+ stripLegacyNegativePadding(component);
2984
2874
  const style = component.getStyle?.() || {};
2985
- const negativePaddingActive = hasNegativePaddingState(attrs, style);
2986
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, style) : getStyleColorValue(style, "background-color");
2875
+ const backgroundColor = getStyleColorValue(style, "background-color");
2987
2876
  if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
2988
2877
  return;
2989
2878
  }
@@ -3050,6 +2939,7 @@ function GrapesPageEditor({
3050
2939
  return;
3051
2940
  }
3052
2941
  hydrateSelectedTypographyStyleFromOrionBlock(component);
2942
+ stripLegacyNegativePadding(component);
3053
2943
  rememberComponentSnapshot(component);
3054
2944
  markSelectedCanvasBlock(component);
3055
2945
  refreshSelectedState(component);
@@ -3063,18 +2953,8 @@ function GrapesPageEditor({
3063
2953
  return;
3064
2954
  }
3065
2955
  const computed = window.getComputedStyle(element);
3066
- const attrs = component.getAttributes?.() || {};
3067
2956
  const style = component.getStyle?.() || {};
3068
- if (hasNegativePaddingState(attrs, style)) {
3069
- removeGeneratedSelectionMargins(component);
3070
- }
3071
2957
  spacingProperties.forEach((property) => {
3072
- const negativePaddingSide = negativePaddingSideFromProperty(property);
3073
- const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
3074
- if (negativePaddingValue) {
3075
- writeStylePanelLength(property, negativePaddingValue);
3076
- return;
3077
- }
3078
2958
  if (property.startsWith("margin-")) {
3079
2959
  writeStylePanelLength(property, firstString(style[property], "0px"));
3080
2960
  return;
@@ -3925,7 +3805,7 @@ function GrapesPageEditor({
3925
3805
  if (!detail.property || !detail.value) {
3926
3806
  return;
3927
3807
  }
3928
- applyNegativeSpacingInput(detail.property, detail.value, detail.baseValue || "0");
3808
+ applyNegativeSpacingInput(detail.property, detail.value);
3929
3809
  };
3930
3810
  const observer = new MutationObserver(() => {
3931
3811
  decorateBuilderControls();
@@ -1649,45 +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
- isolation: isolate;
1656
- overflow: visible;
1657
- position: relative;
1658
- }
1659
-
1660
- .orion-builder-v2-negative-padding.is-orion-negative-padding-bottom:not(.is-orion-negative-padding-top),
1661
- .orion-builder-v2-negative-padding.is-orion-negative-padding-right:not(.is-orion-negative-padding-left) {
1662
- overflow: hidden;
1663
- }
1664
-
1665
- .orion-builder-v2-negative-padding::before {
1666
- background: var(--orion-negative-padding-background, transparent);
1667
- content: "";
1668
- inset: calc(-1 * var(--orion-negative-padding-top, 0px))
1669
- calc(-1 * var(--orion-negative-padding-right, 0px))
1670
- calc(-1 * var(--orion-negative-padding-bottom, 0px))
1671
- calc(-1 * var(--orion-negative-padding-left, 0px));
1672
- pointer-events: none;
1673
- position: absolute;
1674
- z-index: -1;
1675
- }
1676
-
1677
- .orion-builder-v2-negative-padding > * {
1678
- margin-top: var(--orion-negative-padding-top, 0px) !important;
1679
- margin-right: var(--orion-negative-padding-right, 0px) !important;
1680
- margin-bottom: var(--orion-negative-padding-bottom, 0px) !important;
1681
- margin-left: var(--orion-negative-padding-left, 0px) !important;
1682
- max-width: none !important;
1683
- position: relative;
1684
- width: calc(100% - var(--orion-negative-padding-left, 0px) - var(--orion-negative-padding-right, 0px)) !important;
1685
- z-index: 1;
1686
- }
1687
- `;
1688
1652
  var canvasSelectionCss = `
1689
- ${negativePaddingCss}
1690
-
1691
1653
  .gjs-selected,
1692
1654
  [data-gjs-highlightable].gjs-selected {
1693
1655
  outline-color: #c7643d !important;
@@ -1856,14 +1818,6 @@ var readStylePanelColor = (property) => {
1856
1818
  return swatchColor;
1857
1819
  };
1858
1820
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1859
- var cssPixelValue = (value) => {
1860
- const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
1861
- if (!match) {
1862
- return null;
1863
- }
1864
- const parsed = Number.parseFloat(match[1]);
1865
- return Number.isFinite(parsed) ? parsed : null;
1866
- };
1867
1821
  var propertyNameFromStyleControl = (element) => {
1868
1822
  const property = element?.closest(".gjs-sm-property");
1869
1823
  const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
@@ -1896,13 +1850,9 @@ var spacingProperties = [
1896
1850
  "padding-left",
1897
1851
  "padding-right"
1898
1852
  ];
1899
- var negativePaddingSides = ["top", "bottom", "left", "right"];
1900
- var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
1901
- var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
1902
- var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
1903
- var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
1904
- var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
1905
- 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";
1906
1856
  var removeGeneratedSelectionMargins = (component) => {
1907
1857
  const style = component?.getStyle?.() || {};
1908
1858
  const cleanup = {};
@@ -1916,27 +1866,45 @@ var removeGeneratedSelectionMargins = (component) => {
1916
1866
  component?.addStyle?.(cleanup);
1917
1867
  }
1918
1868
  };
1919
- var removeGeneratedNegativePaddingMargin = (component, side, negativePaddingValue) => {
1920
- if (side !== "top" && side !== "bottom") {
1921
- return;
1922
- }
1923
- const property = `margin-${side}`;
1869
+ var stripLegacyNegativePadding = (component) => {
1870
+ const attrs = component?.getAttributes?.() || {};
1924
1871
  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");
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;
1930
1875
  }
1931
- };
1932
- var getStoredOrionBackgroundColor = (attrs, style) => {
1933
1876
  const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
1934
- return firstString(
1935
- attrs[negativePaddingBackgroundAttribute],
1936
- style[negativePaddingBackgroundVariable],
1877
+ const backgroundColor = firstString(
1878
+ attrs[legacyNegativePaddingBackgroundAttribute],
1879
+ style[legacyNegativePaddingBackgroundVariable],
1937
1880
  attrs["data-orion-background-color"],
1938
1881
  block.backgroundColor
1939
1882
  );
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
+ });
1906
+ }
1907
+ removeGeneratedSelectionMargins(component);
1940
1908
  };
1941
1909
  var spacingTargetForComponent = (component) => {
1942
1910
  const element = component?.getEl?.();
@@ -2129,8 +2097,7 @@ var postToParent = (payload) => {
2129
2097
  };
2130
2098
  var buildSavePayload = (editor, status, projectData) => ({
2131
2099
  builderMode: "grapes-v2",
2132
- compiledCss: scopeBuilderCss(`${negativePaddingCss}
2133
- ${editor.getCss()}`),
2100
+ compiledCss: scopeBuilderCss(editor.getCss()),
2134
2101
  compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
2135
2102
  projectData,
2136
2103
  status
@@ -2519,60 +2486,13 @@ function GrapesPageEditor({
2519
2486
  if (!selected) {
2520
2487
  return;
2521
2488
  }
2522
- 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);
2523
2490
  selectedComponentRef.current = selected;
2524
2491
  lastSelectedComponentRef.current = selected;
2525
- if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
2526
- removeGeneratedSelectionMargins(selected);
2527
- const side = negativePaddingSideFromProperty(property);
2528
- if (side) {
2529
- const attrs = selected.getAttributes?.() || {};
2530
- const selectedStyle = selected.getStyle?.() || {};
2531
- const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
2532
- const nextNegativePaddingBySide = Object.fromEntries(
2533
- negativePaddingSides.map((paddingSide) => [
2534
- paddingSide,
2535
- paddingSide === side ? "" : firstString(attrs[negativePaddingAttributeForSide(paddingSide)])
2536
- ])
2537
- );
2538
- const hasOtherNegativePadding = negativePaddingSides.some(
2539
- (paddingSide) => Boolean(nextNegativePaddingBySide[paddingSide])
2540
- );
2541
- const negativePaddingBackground = getStoredOrionBackgroundColor(attrs, selectedStyle);
2542
- selected.removeStyle?.(negativePaddingVariableForSide(side));
2543
- selected.removeAttributes?.(negativePaddingAttributeForSide(side));
2544
- selected.removeClass?.(`is-orion-negative-padding-${side}`);
2545
- removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
2546
- if (!hasOtherNegativePadding) {
2547
- if (negativePaddingBackground) {
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
- }
2559
- }
2560
- selected.removeStyle?.(negativePaddingBackgroundVariable);
2561
- selected.removeAttributes?.(negativePaddingBackgroundAttribute);
2562
- negativePaddingSides.forEach((paddingSide) => {
2563
- selected.removeStyle?.(negativePaddingVariableForSide(paddingSide));
2564
- selected.removeAttributes?.(negativePaddingAttributeForSide(paddingSide));
2565
- selected.removeClass?.(`is-orion-negative-padding-${paddingSide}`);
2566
- });
2567
- selected.removeClass?.("orion-builder-v2-negative-padding");
2568
- } else if (negativePaddingBackground) {
2569
- selected.addStyle?.({
2570
- [negativePaddingBackgroundVariable]: negativePaddingBackground,
2571
- "background-color": "transparent"
2572
- });
2573
- selected.addAttributes?.({ [negativePaddingBackgroundAttribute]: negativePaddingBackground });
2574
- }
2575
- }
2492
+ stripLegacyNegativePadding(selected);
2493
+ if (property.startsWith("padding-") && String(value).trim().startsWith("-")) {
2494
+ value = "0px";
2495
+ writeStylePanelLength(property, value);
2576
2496
  }
2577
2497
  selected.addStyle?.({ [property]: value });
2578
2498
  editorRef.current?.select?.(selected);
@@ -2584,11 +2504,10 @@ function GrapesPageEditor({
2584
2504
  });
2585
2505
  }
2586
2506
  };
2587
- const applyNegativeSpacingInput = (property, value, baseValue) => {
2507
+ const applyNegativeSpacingInput = (property, value) => {
2588
2508
  const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
2589
- const isPadding = property.startsWith("padding-");
2590
2509
  const isMargin = property.startsWith("margin-");
2591
- if (!selected || !isPadding && !isMargin || !value.startsWith("-")) {
2510
+ if (!selected || !isMargin || !value.startsWith("-")) {
2592
2511
  return;
2593
2512
  }
2594
2513
  const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
@@ -2596,38 +2515,11 @@ function GrapesPageEditor({
2596
2515
  if (!Number.isFinite(adjustment)) {
2597
2516
  return;
2598
2517
  }
2599
- const base = isPadding ? cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0 : 0;
2600
- const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
2601
- const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2518
+ const styleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2602
2519
  selectedComponentRef.current = selected;
2603
2520
  lastSelectedComponentRef.current = selected;
2604
- if (isPadding) {
2605
- const side = negativePaddingSideFromProperty(property);
2606
- const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2607
- const currentStyle = selected.getStyle?.() || {};
2608
- const currentAttributes = selected.getAttributes?.() || {};
2609
- const backgroundColor = firstString(
2610
- getStoredOrionBackgroundColor(currentAttributes, currentStyle),
2611
- getStyleColorValue(currentStyle, "background-color")
2612
- );
2613
- selected.addClass?.("orion-builder-v2-negative-padding");
2614
- selected.addClass?.(`is-orion-negative-padding-${side}`);
2615
- removeGeneratedSelectionMargins(selected);
2616
- selected.addAttributes?.({
2617
- ...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
2618
- [negativePaddingAttributeForSide(side)]: negativeStyleValue
2619
- });
2620
- selected.addStyle?.({
2621
- ...backgroundColor ? {
2622
- [negativePaddingBackgroundVariable]: backgroundColor,
2623
- "background-color": "transparent"
2624
- } : {},
2625
- [negativePaddingVariableForSide(side)]: negativeStyleValue,
2626
- [property]: "0px"
2627
- });
2628
- } else {
2629
- selected.addStyle?.({ [property]: styleValue });
2630
- }
2521
+ stripLegacyNegativePadding(selected);
2522
+ selected.addStyle?.({ [property]: styleValue });
2631
2523
  editorRef.current?.select?.(selected);
2632
2524
  };
2633
2525
  const updateSelectedOrionBlock = (updates) => {
@@ -2716,10 +2608,8 @@ function GrapesPageEditor({
2716
2608
  if (Object.keys(block).length === 0) {
2717
2609
  return;
2718
2610
  }
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");
2611
+ const componentStyle = component?.getStyle?.() || target.getStyle?.() || {};
2612
+ const backgroundColor = getStyleColorValue(componentStyle, "background-color");
2723
2613
  if (!backgroundColor) {
2724
2614
  return;
2725
2615
  }
@@ -2823,15 +2713,14 @@ function GrapesPageEditor({
2823
2713
  const targetStyle = target.getStyle?.() || {};
2824
2714
  const componentStyle = component?.getStyle?.() || targetStyle;
2825
2715
  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;
2716
+ const backgroundColor = normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
2828
2717
  if (!backgroundColor) {
2829
2718
  return;
2830
2719
  }
2831
- if (!negativePaddingActive && getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2720
+ if (getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
2832
2721
  target.addStyle?.({ "background-color": backgroundColor });
2833
2722
  }
2834
- if (!negativePaddingActive && component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2723
+ if (component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
2835
2724
  component.addStyle?.({ "background-color": backgroundColor });
2836
2725
  }
2837
2726
  target.addAttributes?.({
@@ -2857,9 +2746,9 @@ function GrapesPageEditor({
2857
2746
  if (Object.keys(block).length === 0) {
2858
2747
  return;
2859
2748
  }
2749
+ stripLegacyNegativePadding(component);
2860
2750
  const style = component.getStyle?.() || {};
2861
- const negativePaddingActive = hasNegativePaddingState(attrs, style);
2862
- const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, style) : getStyleColorValue(style, "background-color");
2751
+ const backgroundColor = getStyleColorValue(style, "background-color");
2863
2752
  if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
2864
2753
  return;
2865
2754
  }
@@ -2926,6 +2815,7 @@ function GrapesPageEditor({
2926
2815
  return;
2927
2816
  }
2928
2817
  hydrateSelectedTypographyStyleFromOrionBlock(component);
2818
+ stripLegacyNegativePadding(component);
2929
2819
  rememberComponentSnapshot(component);
2930
2820
  markSelectedCanvasBlock(component);
2931
2821
  refreshSelectedState(component);
@@ -2939,18 +2829,8 @@ function GrapesPageEditor({
2939
2829
  return;
2940
2830
  }
2941
2831
  const computed = window.getComputedStyle(element);
2942
- const attrs = component.getAttributes?.() || {};
2943
2832
  const style = component.getStyle?.() || {};
2944
- if (hasNegativePaddingState(attrs, style)) {
2945
- removeGeneratedSelectionMargins(component);
2946
- }
2947
2833
  spacingProperties.forEach((property) => {
2948
- const negativePaddingSide = negativePaddingSideFromProperty(property);
2949
- const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
2950
- if (negativePaddingValue) {
2951
- writeStylePanelLength(property, negativePaddingValue);
2952
- return;
2953
- }
2954
2834
  if (property.startsWith("margin-")) {
2955
2835
  writeStylePanelLength(property, firstString(style[property], "0px"));
2956
2836
  return;
@@ -3801,7 +3681,7 @@ function GrapesPageEditor({
3801
3681
  if (!detail.property || !detail.value) {
3802
3682
  return;
3803
3683
  }
3804
- applyNegativeSpacingInput(detail.property, detail.value, detail.baseValue || "0");
3684
+ applyNegativeSpacingInput(detail.property, detail.value);
3805
3685
  };
3806
3686
  const observer = new MutationObserver(() => {
3807
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.180",
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,