@orion-studios/payload-studio 0.6.0-beta.129 → 0.6.0-beta.130

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.
@@ -1110,7 +1110,8 @@ var registerProjectDynamicComponents = (editor, adapter) => {
1110
1110
  defaults: {
1111
1111
  attributes: {
1112
1112
  "data-orion-component": type,
1113
- "data-orion-id": `${type}-${Date.now()}`
1113
+ "data-orion-id": `${type}-${Date.now()}`,
1114
+ ...definition.designControls ? { "data-orion-design-controls": JSON.stringify(definition.designControls) } : {}
1114
1115
  },
1115
1116
  components: "",
1116
1117
  droppable: false,
@@ -1174,6 +1175,49 @@ var quickLayoutOptions = [
1174
1175
  { description: "Center content in the section.", label: "Centered", value: "centered" },
1175
1176
  { description: "Prepare the section for layered content.", label: "Overlay", value: "overlay" }
1176
1177
  ];
1178
+ var defaultQuickDesignControls = {
1179
+ alignment: true,
1180
+ layout: quickLayoutOptions.map((option) => option.value),
1181
+ spacing: true
1182
+ };
1183
+ var quickDesignControlsByComponentType = {
1184
+ xoCta: {
1185
+ alignment: true,
1186
+ layout: ["centered", "natural"],
1187
+ spacing: true
1188
+ },
1189
+ xoFaq: {
1190
+ alignment: true,
1191
+ layout: ["natural", "stacked"],
1192
+ spacing: true
1193
+ },
1194
+ xoFeatureGrid: {
1195
+ alignment: true,
1196
+ layout: ["natural", "two-column", "three-column"],
1197
+ spacing: true
1198
+ },
1199
+ xoForm: {
1200
+ alignment: true,
1201
+ layout: ["natural", "centered"],
1202
+ spacing: true
1203
+ },
1204
+ xoHero: {
1205
+ alignment: true,
1206
+ layout: ["natural", "centered", "overlay"],
1207
+ spacing: true
1208
+ },
1209
+ xoMarquee: {
1210
+ alignment: false,
1211
+ layout: [],
1212
+ spacing: true
1213
+ },
1214
+ xoRichText: {
1215
+ alignment: true,
1216
+ layout: ["natural", "centered"],
1217
+ spacing: true
1218
+ },
1219
+ xoSection: defaultQuickDesignControls
1220
+ };
1177
1221
  var quickSpacingOptions = [
1178
1222
  { label: "Compact", value: "compact" },
1179
1223
  { label: "Medium", value: "medium" },
@@ -1862,6 +1906,35 @@ var parseItemsJson = (value) => {
1862
1906
  return [];
1863
1907
  }
1864
1908
  };
1909
+ var parseQuickDesignControls = (value) => {
1910
+ if (typeof value !== "string" || !value.trim()) {
1911
+ return defaultQuickDesignControls;
1912
+ }
1913
+ try {
1914
+ const parsed = JSON.parse(value);
1915
+ const layout = Array.isArray(parsed.layout) ? parsed.layout.filter(
1916
+ (item) => quickLayoutOptions.some((option) => option.value === item)
1917
+ ) : defaultQuickDesignControls.layout;
1918
+ return {
1919
+ alignment: parsed.alignment !== false,
1920
+ layout,
1921
+ spacing: parsed.spacing !== false
1922
+ };
1923
+ } catch {
1924
+ return defaultQuickDesignControls;
1925
+ }
1926
+ };
1927
+ var quickDesignControlsForSelection = (selectionSummary, component) => {
1928
+ if (!selectionSummary || !component) {
1929
+ return defaultQuickDesignControls;
1930
+ }
1931
+ const attrs = component.getAttributes?.() || {};
1932
+ const componentType = String(attrs["data-orion-component"] || selectionSummary.type || "");
1933
+ if (!attrs["data-orion-design-controls"] && quickDesignControlsByComponentType[componentType]) {
1934
+ return quickDesignControlsByComponentType[componentType];
1935
+ }
1936
+ return parseQuickDesignControls(attrs["data-orion-design-controls"]);
1937
+ };
1865
1938
  var postToParent = (payload) => {
1866
1939
  window.parent?.postMessage(
1867
1940
  {
@@ -2094,6 +2167,8 @@ function GrapesPageEditor({
2094
2167
  const pageTree = initialData?.meta?.pageTree || [];
2095
2168
  const role = initialData?.meta?.permissions?.role || "client";
2096
2169
  const canUseDeveloperControls = role === "developer";
2170
+ const quickDesignControls = quickDesignControlsForSelection(selectionSummary, selectedComponentRef.current);
2171
+ const availableQuickLayoutOptions = quickLayoutOptions.filter((option) => quickDesignControls.layout.includes(option.value));
2097
2172
  const summarizeSelectedComponent = (component) => {
2098
2173
  if (!component) {
2099
2174
  return null;
@@ -3623,12 +3698,12 @@ function GrapesPageEditor({
3623
3698
  renderInspectorPanel("design", "Design", /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
3624
3699
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Use quick controls for common layout changes, then fine tune exact values in Detailed design below." }),
3625
3700
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-quick-layout", "aria-label": "Quick layout controls", children: [
3626
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-control-group", children: [
3701
+ availableQuickLayoutOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-control-group", children: [
3627
3702
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
3628
3703
  "Layout",
3629
3704
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HelpTrigger, { help: "Choose a common arrangement for the selected section, such as stacked, row, columns, centered, or overlay.", label: "Layout" })
3630
3705
  ] }),
3631
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "orion-builder-v2-choice-grid", children: quickLayoutOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
3706
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "orion-builder-v2-choice-grid", children: availableQuickLayoutOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
3632
3707
  "button",
3633
3708
  {
3634
3709
  "aria-pressed": quickLayoutState.layout === option.value,
@@ -3646,8 +3721,8 @@ function GrapesPageEditor({
3646
3721
  },
3647
3722
  option.value
3648
3723
  )) })
3649
- ] }),
3650
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-control-group", children: [
3724
+ ] }) : null,
3725
+ quickDesignControls.alignment ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-control-group", children: [
3651
3726
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
3652
3727
  "Alignment",
3653
3728
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HelpTrigger, { help: "Control where content sits inside the selected section horizontally and vertically.", label: "Alignment" })
@@ -3680,8 +3755,8 @@ function GrapesPageEditor({
3680
3755
  },
3681
3756
  option.value
3682
3757
  )) })
3683
- ] }),
3684
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-control-group", children: [
3758
+ ] }) : null,
3759
+ quickDesignControls.spacing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-control-group", children: [
3685
3760
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h3", { children: [
3686
3761
  "Spacing",
3687
3762
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HelpTrigger, { help: "Set a quick inside-padding preset for the selected section.", label: "Spacing" })
@@ -3700,7 +3775,7 @@ function GrapesPageEditor({
3700
3775
  },
3701
3776
  option.value
3702
3777
  )) })
3703
- ] }),
3778
+ ] }) : null,
3704
3779
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "orion-builder-v2-toggle-list", children: [
3705
3780
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
3706
3781
  "button",
@@ -986,7 +986,8 @@ var registerProjectDynamicComponents = (editor, adapter) => {
986
986
  defaults: {
987
987
  attributes: {
988
988
  "data-orion-component": type,
989
- "data-orion-id": `${type}-${Date.now()}`
989
+ "data-orion-id": `${type}-${Date.now()}`,
990
+ ...definition.designControls ? { "data-orion-design-controls": JSON.stringify(definition.designControls) } : {}
990
991
  },
991
992
  components: "",
992
993
  droppable: false,
@@ -1050,6 +1051,49 @@ var quickLayoutOptions = [
1050
1051
  { description: "Center content in the section.", label: "Centered", value: "centered" },
1051
1052
  { description: "Prepare the section for layered content.", label: "Overlay", value: "overlay" }
1052
1053
  ];
1054
+ var defaultQuickDesignControls = {
1055
+ alignment: true,
1056
+ layout: quickLayoutOptions.map((option) => option.value),
1057
+ spacing: true
1058
+ };
1059
+ var quickDesignControlsByComponentType = {
1060
+ xoCta: {
1061
+ alignment: true,
1062
+ layout: ["centered", "natural"],
1063
+ spacing: true
1064
+ },
1065
+ xoFaq: {
1066
+ alignment: true,
1067
+ layout: ["natural", "stacked"],
1068
+ spacing: true
1069
+ },
1070
+ xoFeatureGrid: {
1071
+ alignment: true,
1072
+ layout: ["natural", "two-column", "three-column"],
1073
+ spacing: true
1074
+ },
1075
+ xoForm: {
1076
+ alignment: true,
1077
+ layout: ["natural", "centered"],
1078
+ spacing: true
1079
+ },
1080
+ xoHero: {
1081
+ alignment: true,
1082
+ layout: ["natural", "centered", "overlay"],
1083
+ spacing: true
1084
+ },
1085
+ xoMarquee: {
1086
+ alignment: false,
1087
+ layout: [],
1088
+ spacing: true
1089
+ },
1090
+ xoRichText: {
1091
+ alignment: true,
1092
+ layout: ["natural", "centered"],
1093
+ spacing: true
1094
+ },
1095
+ xoSection: defaultQuickDesignControls
1096
+ };
1053
1097
  var quickSpacingOptions = [
1054
1098
  { label: "Compact", value: "compact" },
1055
1099
  { label: "Medium", value: "medium" },
@@ -1738,6 +1782,35 @@ var parseItemsJson = (value) => {
1738
1782
  return [];
1739
1783
  }
1740
1784
  };
1785
+ var parseQuickDesignControls = (value) => {
1786
+ if (typeof value !== "string" || !value.trim()) {
1787
+ return defaultQuickDesignControls;
1788
+ }
1789
+ try {
1790
+ const parsed = JSON.parse(value);
1791
+ const layout = Array.isArray(parsed.layout) ? parsed.layout.filter(
1792
+ (item) => quickLayoutOptions.some((option) => option.value === item)
1793
+ ) : defaultQuickDesignControls.layout;
1794
+ return {
1795
+ alignment: parsed.alignment !== false,
1796
+ layout,
1797
+ spacing: parsed.spacing !== false
1798
+ };
1799
+ } catch {
1800
+ return defaultQuickDesignControls;
1801
+ }
1802
+ };
1803
+ var quickDesignControlsForSelection = (selectionSummary, component) => {
1804
+ if (!selectionSummary || !component) {
1805
+ return defaultQuickDesignControls;
1806
+ }
1807
+ const attrs = component.getAttributes?.() || {};
1808
+ const componentType = String(attrs["data-orion-component"] || selectionSummary.type || "");
1809
+ if (!attrs["data-orion-design-controls"] && quickDesignControlsByComponentType[componentType]) {
1810
+ return quickDesignControlsByComponentType[componentType];
1811
+ }
1812
+ return parseQuickDesignControls(attrs["data-orion-design-controls"]);
1813
+ };
1741
1814
  var postToParent = (payload) => {
1742
1815
  window.parent?.postMessage(
1743
1816
  {
@@ -1970,6 +2043,8 @@ function GrapesPageEditor({
1970
2043
  const pageTree = initialData?.meta?.pageTree || [];
1971
2044
  const role = initialData?.meta?.permissions?.role || "client";
1972
2045
  const canUseDeveloperControls = role === "developer";
2046
+ const quickDesignControls = quickDesignControlsForSelection(selectionSummary, selectedComponentRef.current);
2047
+ const availableQuickLayoutOptions = quickLayoutOptions.filter((option) => quickDesignControls.layout.includes(option.value));
1973
2048
  const summarizeSelectedComponent = (component) => {
1974
2049
  if (!component) {
1975
2050
  return null;
@@ -3499,12 +3574,12 @@ function GrapesPageEditor({
3499
3574
  renderInspectorPanel("design", "Design", /* @__PURE__ */ jsxs(Fragment, { children: [
3500
3575
  /* @__PURE__ */ jsx("p", { children: "Use quick controls for common layout changes, then fine tune exact values in Detailed design below." }),
3501
3576
  /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-quick-layout", "aria-label": "Quick layout controls", children: [
3502
- /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-control-group", children: [
3577
+ availableQuickLayoutOptions.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-control-group", children: [
3503
3578
  /* @__PURE__ */ jsxs("h3", { children: [
3504
3579
  "Layout",
3505
3580
  /* @__PURE__ */ jsx(HelpTrigger, { help: "Choose a common arrangement for the selected section, such as stacked, row, columns, centered, or overlay.", label: "Layout" })
3506
3581
  ] }),
3507
- /* @__PURE__ */ jsx("div", { className: "orion-builder-v2-choice-grid", children: quickLayoutOptions.map((option) => /* @__PURE__ */ jsxs(
3582
+ /* @__PURE__ */ jsx("div", { className: "orion-builder-v2-choice-grid", children: availableQuickLayoutOptions.map((option) => /* @__PURE__ */ jsxs(
3508
3583
  "button",
3509
3584
  {
3510
3585
  "aria-pressed": quickLayoutState.layout === option.value,
@@ -3522,8 +3597,8 @@ function GrapesPageEditor({
3522
3597
  },
3523
3598
  option.value
3524
3599
  )) })
3525
- ] }),
3526
- /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-control-group", children: [
3600
+ ] }) : null,
3601
+ quickDesignControls.alignment ? /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-control-group", children: [
3527
3602
  /* @__PURE__ */ jsxs("h3", { children: [
3528
3603
  "Alignment",
3529
3604
  /* @__PURE__ */ jsx(HelpTrigger, { help: "Control where content sits inside the selected section horizontally and vertically.", label: "Alignment" })
@@ -3556,8 +3631,8 @@ function GrapesPageEditor({
3556
3631
  },
3557
3632
  option.value
3558
3633
  )) })
3559
- ] }),
3560
- /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-control-group", children: [
3634
+ ] }) : null,
3635
+ quickDesignControls.spacing ? /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-control-group", children: [
3561
3636
  /* @__PURE__ */ jsxs("h3", { children: [
3562
3637
  "Spacing",
3563
3638
  /* @__PURE__ */ jsx(HelpTrigger, { help: "Set a quick inside-padding preset for the selected section.", label: "Spacing" })
@@ -3576,7 +3651,7 @@ function GrapesPageEditor({
3576
3651
  },
3577
3652
  option.value
3578
3653
  )) })
3579
- ] }),
3654
+ ] }) : null,
3580
3655
  /* @__PURE__ */ jsxs("div", { className: "orion-builder-v2-toggle-list", children: [
3581
3656
  /* @__PURE__ */ jsx(
3582
3657
  "button",
@@ -115,12 +115,18 @@ type BuilderV2RuntimeComponentProps = {
115
115
  };
116
116
  type BuilderV2RuntimeComponent = ComponentType<BuilderV2RuntimeComponentProps>;
117
117
  type BuilderV2ProjectComponentDefinition = {
118
+ designControls?: BuilderV2ProjectComponentDesignControls;
118
119
  editorPreview?: (props: Record<string, unknown>) => string;
119
120
  label: string;
120
121
  render: BuilderV2RuntimeComponent;
121
122
  traits?: BuilderV2TraitDefinition[];
122
123
  type: string;
123
124
  };
125
+ type BuilderV2ProjectComponentDesignControls = {
126
+ alignment?: boolean;
127
+ layout?: Array<'centered' | 'natural' | 'overlay' | 'row' | 'stacked' | 'three-column' | 'two-column'>;
128
+ spacing?: boolean;
129
+ };
124
130
  type BuilderV2TraitDefinition = {
125
131
  label: string;
126
132
  name: string;
@@ -115,12 +115,18 @@ type BuilderV2RuntimeComponentProps = {
115
115
  };
116
116
  type BuilderV2RuntimeComponent = ComponentType<BuilderV2RuntimeComponentProps>;
117
117
  type BuilderV2ProjectComponentDefinition = {
118
+ designControls?: BuilderV2ProjectComponentDesignControls;
118
119
  editorPreview?: (props: Record<string, unknown>) => string;
119
120
  label: string;
120
121
  render: BuilderV2RuntimeComponent;
121
122
  traits?: BuilderV2TraitDefinition[];
122
123
  type: string;
123
124
  };
125
+ type BuilderV2ProjectComponentDesignControls = {
126
+ alignment?: boolean;
127
+ layout?: Array<'centered' | 'natural' | 'overlay' | 'row' | 'stacked' | 'three-column' | 'two-column'>;
128
+ spacing?: boolean;
129
+ };
124
130
  type BuilderV2TraitDefinition = {
125
131
  label: string;
126
132
  name: string;
@@ -923,6 +923,25 @@
923
923
  );
924
924
  }
925
925
 
926
+ .orion-builder-v2-block-preview.is-xoSection,
927
+ .orion-builder-v2-block-preview.is-section {
928
+ align-content: center;
929
+ }
930
+
931
+ .orion-builder-v2-block-preview.is-xoSection .wire-image,
932
+ .orion-builder-v2-block-preview.is-xoSection .wire-card,
933
+ .orion-builder-v2-block-preview.is-xoSection .wire-button {
934
+ display: none;
935
+ }
936
+
937
+ .orion-builder-v2-block-preview.is-xoSection .wire-title {
938
+ grid-column: 2 / 12;
939
+ }
940
+
941
+ .orion-builder-v2-block-preview.is-xoSection .wire-copy {
942
+ grid-column: 3 / 11;
943
+ }
944
+
926
945
  .orion-builder-v2-block-preview.is-xoRichText,
927
946
  .orion-builder-v2-block-preview.is-richText,
928
947
  .orion-builder-v2-block-preview.is-testimonials {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.129",
3
+ "version": "0.6.0-beta.130",
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",