@orion-studios/payload-studio 0.6.0-beta.168 → 0.6.0-beta.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1772,7 +1772,21 @@ var quickVerticalAlignStyles = {
1772
1772
  middle: "center",
1773
1773
  top: "flex-start"
1774
1774
  };
1775
+ var negativePaddingCss = `
1776
+ .orion-builder-v2-negative-padding {
1777
+ overflow: visible;
1778
+ }
1779
+
1780
+ .orion-builder-v2-negative-padding > * {
1781
+ margin-top: var(--orion-negative-padding-top, 0px);
1782
+ margin-right: var(--orion-negative-padding-right, 0px);
1783
+ margin-bottom: var(--orion-negative-padding-bottom, 0px);
1784
+ margin-left: var(--orion-negative-padding-left, 0px);
1785
+ }
1786
+ `;
1775
1787
  var canvasSelectionCss = `
1788
+ ${negativePaddingCss}
1789
+
1776
1790
  .gjs-selected,
1777
1791
  [data-gjs-highlightable].gjs-selected {
1778
1792
  outline-color: #c7643d !important;
@@ -1980,6 +1994,10 @@ var spacingProperties = [
1980
1994
  "padding-left",
1981
1995
  "padding-right"
1982
1996
  ];
1997
+ var negativePaddingSides = ["top", "bottom", "left", "right"];
1998
+ var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
1999
+ var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
2000
+ var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
1983
2001
  var spacingTargetForComponent = (component) => {
1984
2002
  const element = component?.getEl?.();
1985
2003
  return element || null;
@@ -2171,7 +2189,8 @@ var postToParent = (payload) => {
2171
2189
  };
2172
2190
  var buildSavePayload = (editor, status, projectData) => ({
2173
2191
  builderMode: "grapes-v2",
2174
- compiledCss: scopeBuilderCss(editor.getCss()),
2192
+ compiledCss: scopeBuilderCss(`${negativePaddingCss}
2193
+ ${editor.getCss()}`),
2175
2194
  compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
2176
2195
  projectData,
2177
2196
  status
@@ -2563,6 +2582,20 @@ function GrapesPageEditor({
2563
2582
  const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2564
2583
  selectedComponentRef.current = selected;
2565
2584
  lastSelectedComponentRef.current = selected;
2585
+ if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
2586
+ const side = negativePaddingSideFromProperty(property);
2587
+ if (side) {
2588
+ selected.removeStyle?.(negativePaddingVariableForSide(side));
2589
+ selected.removeAttributes?.(negativePaddingAttributeForSide(side));
2590
+ const attrs = selected.getAttributes?.() || {};
2591
+ const hasOtherNegativePadding = negativePaddingSides.some(
2592
+ (paddingSide) => paddingSide !== side && Boolean(attrs[negativePaddingAttributeForSide(paddingSide)])
2593
+ );
2594
+ if (!hasOtherNegativePadding) {
2595
+ selected.removeClass?.("orion-builder-v2-negative-padding");
2596
+ }
2597
+ }
2598
+ }
2566
2599
  selected.addStyle?.({ [property]: value });
2567
2600
  editorRef.current?.select?.(selected);
2568
2601
  };
@@ -2583,7 +2616,18 @@ function GrapesPageEditor({
2583
2616
  const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2584
2617
  selectedComponentRef.current = selected;
2585
2618
  lastSelectedComponentRef.current = selected;
2586
- selected.addStyle?.({ [property]: styleValue });
2619
+ if (isPadding) {
2620
+ const side = negativePaddingSideFromProperty(property);
2621
+ const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2622
+ selected.addClass?.("orion-builder-v2-negative-padding");
2623
+ selected.addAttributes?.({ [negativePaddingAttributeForSide(side)]: negativeStyleValue });
2624
+ selected.addStyle?.({
2625
+ [negativePaddingVariableForSide(side)]: negativeStyleValue,
2626
+ [property]: "0px"
2627
+ });
2628
+ } else {
2629
+ selected.addStyle?.({ [property]: styleValue });
2630
+ }
2587
2631
  editorRef.current?.select?.(selected);
2588
2632
  };
2589
2633
  const updateSelectedOrionBlock = (updates) => {
@@ -2883,7 +2927,14 @@ function GrapesPageEditor({
2883
2927
  return;
2884
2928
  }
2885
2929
  const computed = window.getComputedStyle(element);
2930
+ const attrs = component.getAttributes?.() || {};
2886
2931
  spacingProperties.forEach((property) => {
2932
+ const negativePaddingSide = negativePaddingSideFromProperty(property);
2933
+ const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
2934
+ if (negativePaddingValue) {
2935
+ writeStylePanelLength(property, negativePaddingValue);
2936
+ return;
2937
+ }
2887
2938
  writeStylePanelLength(property, computed.getPropertyValue(property));
2888
2939
  });
2889
2940
  });
@@ -1648,7 +1648,21 @@ var quickVerticalAlignStyles = {
1648
1648
  middle: "center",
1649
1649
  top: "flex-start"
1650
1650
  };
1651
+ var negativePaddingCss = `
1652
+ .orion-builder-v2-negative-padding {
1653
+ overflow: visible;
1654
+ }
1655
+
1656
+ .orion-builder-v2-negative-padding > * {
1657
+ margin-top: var(--orion-negative-padding-top, 0px);
1658
+ margin-right: var(--orion-negative-padding-right, 0px);
1659
+ margin-bottom: var(--orion-negative-padding-bottom, 0px);
1660
+ margin-left: var(--orion-negative-padding-left, 0px);
1661
+ }
1662
+ `;
1651
1663
  var canvasSelectionCss = `
1664
+ ${negativePaddingCss}
1665
+
1652
1666
  .gjs-selected,
1653
1667
  [data-gjs-highlightable].gjs-selected {
1654
1668
  outline-color: #c7643d !important;
@@ -1856,6 +1870,10 @@ var spacingProperties = [
1856
1870
  "padding-left",
1857
1871
  "padding-right"
1858
1872
  ];
1873
+ var negativePaddingSides = ["top", "bottom", "left", "right"];
1874
+ var negativePaddingSideFromProperty = (property) => property.startsWith("padding-") ? property.replace(/^padding-/, "") : "";
1875
+ var negativePaddingAttributeForSide = (side) => `data-orion-negative-padding-${side}`;
1876
+ var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
1859
1877
  var spacingTargetForComponent = (component) => {
1860
1878
  const element = component?.getEl?.();
1861
1879
  return element || null;
@@ -2047,7 +2065,8 @@ var postToParent = (payload) => {
2047
2065
  };
2048
2066
  var buildSavePayload = (editor, status, projectData) => ({
2049
2067
  builderMode: "grapes-v2",
2050
- compiledCss: scopeBuilderCss(editor.getCss()),
2068
+ compiledCss: scopeBuilderCss(`${negativePaddingCss}
2069
+ ${editor.getCss()}`),
2051
2070
  compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
2052
2071
  projectData,
2053
2072
  status
@@ -2439,6 +2458,20 @@ function GrapesPageEditor({
2439
2458
  const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2440
2459
  selectedComponentRef.current = selected;
2441
2460
  lastSelectedComponentRef.current = selected;
2461
+ if (property.startsWith("padding-") && !String(value).trim().startsWith("-")) {
2462
+ const side = negativePaddingSideFromProperty(property);
2463
+ if (side) {
2464
+ selected.removeStyle?.(negativePaddingVariableForSide(side));
2465
+ selected.removeAttributes?.(negativePaddingAttributeForSide(side));
2466
+ const attrs = selected.getAttributes?.() || {};
2467
+ const hasOtherNegativePadding = negativePaddingSides.some(
2468
+ (paddingSide) => paddingSide !== side && Boolean(attrs[negativePaddingAttributeForSide(paddingSide)])
2469
+ );
2470
+ if (!hasOtherNegativePadding) {
2471
+ selected.removeClass?.("orion-builder-v2-negative-padding");
2472
+ }
2473
+ }
2474
+ }
2442
2475
  selected.addStyle?.({ [property]: value });
2443
2476
  editorRef.current?.select?.(selected);
2444
2477
  };
@@ -2459,7 +2492,18 @@ function GrapesPageEditor({
2459
2492
  const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2460
2493
  selectedComponentRef.current = selected;
2461
2494
  lastSelectedComponentRef.current = selected;
2462
- selected.addStyle?.({ [property]: styleValue });
2495
+ if (isPadding) {
2496
+ const side = negativePaddingSideFromProperty(property);
2497
+ const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
2498
+ selected.addClass?.("orion-builder-v2-negative-padding");
2499
+ selected.addAttributes?.({ [negativePaddingAttributeForSide(side)]: negativeStyleValue });
2500
+ selected.addStyle?.({
2501
+ [negativePaddingVariableForSide(side)]: negativeStyleValue,
2502
+ [property]: "0px"
2503
+ });
2504
+ } else {
2505
+ selected.addStyle?.({ [property]: styleValue });
2506
+ }
2463
2507
  editorRef.current?.select?.(selected);
2464
2508
  };
2465
2509
  const updateSelectedOrionBlock = (updates) => {
@@ -2759,7 +2803,14 @@ function GrapesPageEditor({
2759
2803
  return;
2760
2804
  }
2761
2805
  const computed = window.getComputedStyle(element);
2806
+ const attrs = component.getAttributes?.() || {};
2762
2807
  spacingProperties.forEach((property) => {
2808
+ const negativePaddingSide = negativePaddingSideFromProperty(property);
2809
+ const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
2810
+ if (negativePaddingValue) {
2811
+ writeStylePanelLength(property, negativePaddingValue);
2812
+ return;
2813
+ }
2763
2814
  writeStylePanelLength(property, computed.getPropertyValue(property));
2764
2815
  });
2765
2816
  });
package/dist/index.mjs CHANGED
@@ -10,12 +10,12 @@ import {
10
10
  } from "./chunk-JQAHXYAM.mjs";
11
11
  import {
12
12
  studio_pages_exports
13
- } from "./chunk-7HME6R2V.mjs";
13
+ } from "./chunk-276KAPGM.mjs";
14
14
  import "./chunk-7ZMXZRBP.mjs";
15
+ import "./chunk-OQSEJXC4.mjs";
15
16
  import {
16
17
  studio_exports
17
18
  } from "./chunk-ADIIWIYL.mjs";
18
- import "./chunk-OQSEJXC4.mjs";
19
19
  import {
20
20
  admin_app_exports
21
21
  } from "./chunk-RKTIFEUY.mjs";
@@ -7,15 +7,15 @@ import {
7
7
  pageStudioModuleManifest,
8
8
  resolveBuilderThemeTokens,
9
9
  toEditorInitialDoc
10
- } from "../chunk-7HME6R2V.mjs";
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.168",
3
+ "version": "0.6.0-beta.169",
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",
@@ -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";