@orion-studios/payload-studio 0.6.0-beta.4 → 0.6.0-beta.41
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.
- package/dist/admin/client.d.mts +1 -0
- package/dist/admin/client.d.ts +1 -0
- package/dist/admin/client.js +3924 -1355
- package/dist/admin/client.mjs +4090 -1533
- package/dist/admin/index.d.mts +2 -3
- package/dist/admin/index.d.ts +2 -3
- package/dist/admin/index.js +141 -1522
- package/dist/admin/index.mjs +2 -4
- package/dist/admin-app/client.js +11 -4
- package/dist/admin-app/client.mjs +1 -1
- package/dist/admin-app/index.d.mts +2 -2
- package/dist/admin-app/index.d.ts +2 -2
- package/dist/admin-app/index.mjs +4 -4
- package/dist/admin-app/styles.css +343 -41
- package/dist/admin.css +18 -2
- package/dist/{chunk-KPIX7OSV.mjs → chunk-2XH7X34N.mjs} +11 -4
- package/dist/{chunk-PF3EBZXF.mjs → chunk-7ZMXZRBP.mjs} +39 -3
- package/dist/chunk-JC3UV74N.mjs +1033 -0
- package/dist/{chunk-XKUTZ7IU.mjs → chunk-OL53KHTB.mjs} +46 -2
- package/dist/{chunk-EHUE4LCT.mjs → chunk-RKTIFEUY.mjs} +33 -3
- package/dist/chunk-W2UOCJDX.mjs +32 -0
- package/dist/{chunk-OTHERBGX.mjs → chunk-ZADL33R6.mjs} +1 -1
- package/dist/{index-bbA3HSxa.d.ts → index-BV0vEGl6.d.ts} +6 -9
- package/dist/{index-Cv-6qnrw.d.mts → index-D5zrOdyv.d.mts} +3 -1
- package/dist/{index-52HdVLQq.d.ts → index-DAdN56fM.d.ts} +1 -1
- package/dist/{index-DEkV-sMs.d.mts → index-DLfPOqYA.d.mts} +6 -9
- package/dist/{index-Crx_MtPw.d.ts → index-Dv-Alx4h.d.ts} +3 -1
- package/dist/{index-DEQC3Dwj.d.mts → index-G_uTNffQ.d.mts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +287 -1542
- package/dist/index.mjs +6 -6
- package/dist/nextjs/index.js +39 -3
- package/dist/nextjs/index.mjs +2 -2
- package/dist/{sitePreviewTypes-BkHCWxNW.d.mts → sitePreviewTypes-BrJwGzJj.d.mts} +1 -1
- package/dist/{sitePreviewTypes-BkHCWxNW.d.ts → sitePreviewTypes-BrJwGzJj.d.ts} +1 -1
- package/dist/studio-pages/builder.css +24 -5
- package/dist/studio-pages/client.js +529 -63
- package/dist/studio-pages/client.mjs +529 -63
- package/dist/studio-pages/index.d.mts +1 -1
- package/dist/studio-pages/index.d.ts +1 -1
- package/dist/studio-pages/index.js +84 -4
- package/dist/studio-pages/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-DYXSAVUQ.mjs +0 -2372
- package/dist/chunk-Z6L5K5MH.mjs +0 -64
|
@@ -70,7 +70,9 @@ var defaultBuilderBlockSettingsV2 = {
|
|
|
70
70
|
},
|
|
71
71
|
typography: {
|
|
72
72
|
bodyAlign: "left",
|
|
73
|
+
bodySizePt: null,
|
|
73
74
|
headingAlign: "left",
|
|
75
|
+
headingSizePt: null,
|
|
74
76
|
letterSpacingPreset: "normal",
|
|
75
77
|
lineHeightPreset: "normal",
|
|
76
78
|
maxTextWidth: "auto"
|
|
@@ -99,7 +101,9 @@ var defaultBuilderItemSettingsV2 = {
|
|
|
99
101
|
},
|
|
100
102
|
typography: {
|
|
101
103
|
bodyAlign: "left",
|
|
104
|
+
bodySizePt: null,
|
|
102
105
|
headingAlign: "left",
|
|
106
|
+
headingSizePt: null,
|
|
103
107
|
letterSpacingPreset: "normal",
|
|
104
108
|
lineHeightPreset: "normal",
|
|
105
109
|
maxTextWidth: "auto"
|
|
@@ -129,6 +133,7 @@ var defaultBuilderThemeTokens = {
|
|
|
129
133
|
|
|
130
134
|
// src/studio-pages/builder/adapters/settingsV2.ts
|
|
131
135
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
136
|
+
var isTextAlign = (value) => value === "left" || value === "center" || value === "right" || value === "justify";
|
|
132
137
|
var parsePercent = (value) => {
|
|
133
138
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
134
139
|
return Math.max(0, Math.min(100, value));
|
|
@@ -153,6 +158,18 @@ var parsePixel = (value) => {
|
|
|
153
158
|
}
|
|
154
159
|
return null;
|
|
155
160
|
};
|
|
161
|
+
var parsePoint = (value) => {
|
|
162
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
163
|
+
return Math.max(6, Math.min(120, Math.round(value)));
|
|
164
|
+
}
|
|
165
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
166
|
+
const parsed = Number(value);
|
|
167
|
+
if (Number.isFinite(parsed)) {
|
|
168
|
+
return Math.max(6, Math.min(120, Math.round(parsed)));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
};
|
|
156
173
|
var mergeSettings = (defaults, input) => {
|
|
157
174
|
if (!isRecord(input)) {
|
|
158
175
|
return structuredClone(defaults);
|
|
@@ -171,6 +188,10 @@ var mergeSettings = (defaults, input) => {
|
|
|
171
188
|
};
|
|
172
189
|
var legacyBlockToV2Settings = (block) => {
|
|
173
190
|
const current = structuredClone(defaultBuilderBlockSettingsV2);
|
|
191
|
+
if (block.blockType === "hero" && block.variant === "centered") {
|
|
192
|
+
current.typography.headingAlign = "center";
|
|
193
|
+
current.typography.bodyAlign = "center";
|
|
194
|
+
}
|
|
174
195
|
current.layout.contentWidth = block.contentWidth === "narrow" || block.contentWidth === "content" || block.contentWidth === "wide" || block.contentWidth === "full" || block.contentWidth === "inherit" ? block.contentWidth : current.layout.contentWidth;
|
|
175
196
|
current.layout.sectionPaddingX = block.sectionPaddingX === "none" || block.sectionPaddingX === "sm" || block.sectionPaddingX === "md" || block.sectionPaddingX === "lg" || block.sectionPaddingX === "inherit" ? block.sectionPaddingX : current.layout.sectionPaddingX;
|
|
176
197
|
current.layout.sectionPaddingY = block.sectionPaddingY === "none" || block.sectionPaddingY === "sm" || block.sectionPaddingY === "lg" ? block.sectionPaddingY : current.layout.sectionPaddingY;
|
|
@@ -207,15 +228,28 @@ var legacyBlockToV2Settings = (block) => {
|
|
|
207
228
|
current.media.positionX = parsePercent(block.imagePositionX ?? block.backgroundImagePositionX);
|
|
208
229
|
current.media.positionY = parsePercent(block.imagePositionY ?? block.backgroundImagePositionY);
|
|
209
230
|
current.media.height = parsePixel(block.imageHeight);
|
|
210
|
-
current.typography.headingAlign = block.textHeadingAlign
|
|
211
|
-
current.typography.bodyAlign = block.textBodyAlign
|
|
231
|
+
current.typography.headingAlign = isTextAlign(block.textHeadingAlign) ? block.textHeadingAlign : current.typography.headingAlign;
|
|
232
|
+
current.typography.bodyAlign = isTextAlign(block.textBodyAlign) ? block.textBodyAlign : current.typography.bodyAlign;
|
|
233
|
+
current.typography.headingSizePt = parsePoint(block.textHeadingSizePt);
|
|
234
|
+
current.typography.bodySizePt = parsePoint(block.textBodySizePt);
|
|
212
235
|
current.typography.maxTextWidth = block.textMaxWidth === "auto" || block.textMaxWidth === "sm" || block.textMaxWidth === "md" || block.textMaxWidth === "lg" || block.textMaxWidth === "full" ? block.textMaxWidth : current.typography.maxTextWidth;
|
|
213
236
|
current.typography.lineHeightPreset = block.textLineHeightPreset === "tight" || block.textLineHeightPreset === "normal" || block.textLineHeightPreset === "relaxed" ? block.textLineHeightPreset : current.typography.lineHeightPreset;
|
|
214
237
|
current.typography.letterSpacingPreset = block.textLetterSpacingPreset === "tight" || block.textLetterSpacingPreset === "normal" || block.textLetterSpacingPreset === "relaxed" ? block.textLetterSpacingPreset : current.typography.letterSpacingPreset;
|
|
215
238
|
current.advanced.editCopyInPanel = Boolean(block.editCopyInPanel ?? current.advanced.editCopyInPanel);
|
|
216
239
|
current.advanced.customClassName = typeof block.customClassName === "string" ? block.customClassName : current.advanced.customClassName;
|
|
217
240
|
current.advanced.hideOnMobile = Boolean(block.hideOnMobile ?? current.advanced.hideOnMobile);
|
|
218
|
-
|
|
241
|
+
const settings = mergeSettings(current, block.settings);
|
|
242
|
+
if (block.blockType === "hero") {
|
|
243
|
+
const top = settings.layout.paddingTopPt;
|
|
244
|
+
const bottom = settings.layout.paddingBottomPt;
|
|
245
|
+
const hasLegacyLinkedHeroPadding = settings.layout.linkVerticalPadding !== false && (top === null || typeof top === "undefined" || top === 30) && (bottom === null || typeof bottom === "undefined" || bottom === 30 || bottom === 20);
|
|
246
|
+
if (hasLegacyLinkedHeroPadding) {
|
|
247
|
+
settings.layout.linkVerticalPadding = false;
|
|
248
|
+
settings.layout.paddingTopPt = 30;
|
|
249
|
+
settings.layout.paddingBottomPt = 20;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return settings;
|
|
219
253
|
};
|
|
220
254
|
var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
221
255
|
const settings = legacyBlockToV2Settings(blockWithSettings);
|
|
@@ -241,6 +275,8 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
241
275
|
next.contentGradientAngle = settings.appearance.contentGradientAngle;
|
|
242
276
|
next.textHeadingAlign = settings.typography.headingAlign;
|
|
243
277
|
next.textBodyAlign = settings.typography.bodyAlign;
|
|
278
|
+
next.textHeadingSizePt = settings.typography.headingSizePt;
|
|
279
|
+
next.textBodySizePt = settings.typography.bodySizePt;
|
|
244
280
|
next.textMaxWidth = settings.typography.maxTextWidth;
|
|
245
281
|
next.textLineHeightPreset = settings.typography.lineHeightPreset;
|
|
246
282
|
next.textLetterSpacingPreset = settings.typography.letterSpacingPreset;
|
|
@@ -335,6 +371,7 @@ var resolveTypographyStyleFromSettings = (settings) => {
|
|
|
335
371
|
const letterSpacing = settings.letterSpacingPreset === "tight" ? "-0.01em" : settings.letterSpacingPreset === "relaxed" ? "0.02em" : "0.01em";
|
|
336
372
|
const maxWidth = settings.maxTextWidth === "sm" ? "36ch" : settings.maxTextWidth === "md" ? "52ch" : settings.maxTextWidth === "lg" ? "72ch" : settings.maxTextWidth === "full" ? "100%" : void 0;
|
|
337
373
|
return {
|
|
374
|
+
...typeof settings.bodySizePt === "number" && Number.isFinite(settings.bodySizePt) ? { fontSize: `${settings.bodySizePt}pt` } : {},
|
|
338
375
|
letterSpacing,
|
|
339
376
|
lineHeight,
|
|
340
377
|
maxWidth,
|
|
@@ -504,8 +541,52 @@ var alignOptions = [
|
|
|
504
541
|
{ label: "Right", value: "right" },
|
|
505
542
|
{ label: "Justify", value: "justify" }
|
|
506
543
|
];
|
|
507
|
-
var layoutFieldSet = [
|
|
544
|
+
var layoutFieldSet = [
|
|
545
|
+
{
|
|
546
|
+
group: "layout",
|
|
547
|
+
key: "settings.layout.linkVerticalPadding",
|
|
548
|
+
label: "Link Top/Bottom Padding",
|
|
549
|
+
tags: ["spacing", "padding", "vertical"],
|
|
550
|
+
type: "checkbox"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
group: "layout",
|
|
554
|
+
key: "settings.layout.paddingTopPt",
|
|
555
|
+
label: "Top Padding (pt)",
|
|
556
|
+
max: 240,
|
|
557
|
+
min: 0,
|
|
558
|
+
tags: ["spacing", "padding", "top"],
|
|
559
|
+
type: "number"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
group: "layout",
|
|
563
|
+
key: "settings.layout.paddingBottomPt",
|
|
564
|
+
label: "Bottom Padding (pt)",
|
|
565
|
+
max: 240,
|
|
566
|
+
min: 0,
|
|
567
|
+
tags: ["spacing", "padding", "bottom"],
|
|
568
|
+
type: "number"
|
|
569
|
+
}
|
|
570
|
+
];
|
|
508
571
|
var typographyFieldSet = [
|
|
572
|
+
{
|
|
573
|
+
group: "typography",
|
|
574
|
+
key: "settings.typography.headingSizePt",
|
|
575
|
+
label: "Heading Text Size (pt)",
|
|
576
|
+
max: 120,
|
|
577
|
+
min: 6,
|
|
578
|
+
tags: ["text", "size", "heading", "font"],
|
|
579
|
+
type: "number"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
group: "typography",
|
|
583
|
+
key: "settings.typography.bodySizePt",
|
|
584
|
+
label: "Body Text Size (pt)",
|
|
585
|
+
max: 72,
|
|
586
|
+
min: 6,
|
|
587
|
+
tags: ["text", "size", "body", "paragraph", "font"],
|
|
588
|
+
type: "number"
|
|
589
|
+
},
|
|
509
590
|
{
|
|
510
591
|
group: "typography",
|
|
511
592
|
key: "settings.typography.headingAlign",
|
|
@@ -612,6 +693,7 @@ var mediaFieldSet = [
|
|
|
612
693
|
];
|
|
613
694
|
var commonInspectorGroups = [
|
|
614
695
|
{ key: "basics", label: "Basics" },
|
|
696
|
+
{ key: "layout", label: "Layout" },
|
|
615
697
|
{ key: "typography", label: "Typography" },
|
|
616
698
|
{ key: "media", label: "Media" },
|
|
617
699
|
{ key: "advanced", label: "Advanced" }
|
|
@@ -897,6 +979,69 @@ var normalizeNumber = (value, fallback) => {
|
|
|
897
979
|
}
|
|
898
980
|
return fallback;
|
|
899
981
|
};
|
|
982
|
+
var sectionPaddingPointMap = {
|
|
983
|
+
none: 0,
|
|
984
|
+
sm: 17,
|
|
985
|
+
md: 31,
|
|
986
|
+
lg: 41
|
|
987
|
+
};
|
|
988
|
+
var heroDefaultPaddingTopPt = 30;
|
|
989
|
+
var heroDefaultPaddingBottomPt = 20;
|
|
990
|
+
var defaultTextSizePointMap = {
|
|
991
|
+
cta: { body: 14, heading: 36 },
|
|
992
|
+
faq: { body: 12, heading: 18 },
|
|
993
|
+
featureGrid: { body: 12, heading: 36 },
|
|
994
|
+
formEmbed: { body: 12, heading: 36 },
|
|
995
|
+
hero: { body: 14, heading: 48 },
|
|
996
|
+
media: { body: 12, heading: 36 },
|
|
997
|
+
richText: { body: 12, heading: 39 },
|
|
998
|
+
stats: { body: 11, heading: 30 },
|
|
999
|
+
testimonials: { body: 12, heading: 36 }
|
|
1000
|
+
};
|
|
1001
|
+
var normalizeSectionPaddingY = (value) => value === "none" || value === "sm" || value === "lg" ? value : "md";
|
|
1002
|
+
var normalizePaddingPointValue = (value) => {
|
|
1003
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
1004
|
+
return Math.max(0, Math.min(240, Math.round(value)));
|
|
1005
|
+
}
|
|
1006
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
1007
|
+
const parsed = Number(value);
|
|
1008
|
+
if (Number.isFinite(parsed)) {
|
|
1009
|
+
return Math.max(0, Math.min(240, Math.round(parsed)));
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
return null;
|
|
1013
|
+
};
|
|
1014
|
+
var normalizeTextSizePointValue = (value) => {
|
|
1015
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
1016
|
+
return Math.max(6, Math.min(120, Math.round(value)));
|
|
1017
|
+
}
|
|
1018
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
1019
|
+
const parsed = Number(value);
|
|
1020
|
+
if (Number.isFinite(parsed)) {
|
|
1021
|
+
return Math.max(6, Math.min(120, Math.round(parsed)));
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
return null;
|
|
1025
|
+
};
|
|
1026
|
+
var getEffectiveVerticalPaddingValue = (block, key) => {
|
|
1027
|
+
const explicit = normalizePaddingPointValue(getByPath(block, key));
|
|
1028
|
+
if (explicit !== null) {
|
|
1029
|
+
return explicit;
|
|
1030
|
+
}
|
|
1031
|
+
const layoutSectionPaddingY = getByPath(block, "settings.layout.sectionPaddingY");
|
|
1032
|
+
const legacySectionPaddingY = block.sectionPaddingY;
|
|
1033
|
+
const inherited = block.blockType === "hero" ? key === "settings.layout.paddingBottomPt" ? heroDefaultPaddingBottomPt : heroDefaultPaddingTopPt : sectionPaddingPointMap[normalizeSectionPaddingY(layoutSectionPaddingY || legacySectionPaddingY)];
|
|
1034
|
+
return inherited;
|
|
1035
|
+
};
|
|
1036
|
+
var getEffectiveTextSizeValue = (block, key) => {
|
|
1037
|
+
const explicit = normalizeTextSizePointValue(getByPath(block, key));
|
|
1038
|
+
if (explicit !== null) {
|
|
1039
|
+
return explicit;
|
|
1040
|
+
}
|
|
1041
|
+
const blockType = typeof block.blockType === "string" ? block.blockType : "";
|
|
1042
|
+
const defaults = defaultTextSizePointMap[blockType] || { body: 12, heading: 36 };
|
|
1043
|
+
return key === "settings.typography.headingSizePt" ? defaults.heading : defaults.body;
|
|
1044
|
+
};
|
|
900
1045
|
var getRelationID = (value) => {
|
|
901
1046
|
if (typeof value === "number" || typeof value === "string") {
|
|
902
1047
|
return value;
|
|
@@ -925,6 +1070,12 @@ var toMediaLibraryItem = (value) => {
|
|
|
925
1070
|
};
|
|
926
1071
|
};
|
|
927
1072
|
var mediaLabel = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
1073
|
+
var findMediaLibraryItem = (library, id) => {
|
|
1074
|
+
if (id === null) {
|
|
1075
|
+
return null;
|
|
1076
|
+
}
|
|
1077
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
1078
|
+
};
|
|
928
1079
|
var groupLabel = (key) => commonInspectorGroups.find((group) => group.key === key)?.label || key;
|
|
929
1080
|
function BlockInspectorRenderer({
|
|
930
1081
|
block,
|
|
@@ -1048,8 +1199,9 @@ function BlockInspectorRenderer({
|
|
|
1048
1199
|
title: group.label,
|
|
1049
1200
|
children: /* @__PURE__ */ jsxs3("div", { className: "orion-builder-settings-field-list", children: [
|
|
1050
1201
|
group.key === "media" ? effectiveMediaSources.map((source) => {
|
|
1051
|
-
const selectedSourceMedia = toMediaLibraryItem(source.value);
|
|
1052
1202
|
const selectedSourceMediaID = getRelationID(source.value);
|
|
1203
|
+
const selectedRelationMedia = toMediaLibraryItem(source.value);
|
|
1204
|
+
const selectedSourceMedia = selectedRelationMedia ?? findMediaLibraryItem(source.library, selectedSourceMediaID);
|
|
1053
1205
|
const sourceOptions = selectedSourceMedia && !source.library.some((item) => String(item.id) === String(selectedSourceMedia.id)) ? [selectedSourceMedia, ...source.library] : source.library;
|
|
1054
1206
|
return /* @__PURE__ */ jsxs3(
|
|
1055
1207
|
"div",
|
|
@@ -1074,6 +1226,10 @@ function BlockInspectorRenderer({
|
|
|
1074
1226
|
}
|
|
1075
1227
|
)
|
|
1076
1228
|
] }),
|
|
1229
|
+
selectedSourceMedia?.alt ? /* @__PURE__ */ jsxs3("label", { className: "orion-builder-settings-label", children: [
|
|
1230
|
+
"Media Description",
|
|
1231
|
+
/* @__PURE__ */ jsx3("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedSourceMedia.alt })
|
|
1232
|
+
] }) : selectedSourceMediaID !== null ? /* @__PURE__ */ jsx3("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
1077
1233
|
/* @__PURE__ */ jsx3(
|
|
1078
1234
|
"button",
|
|
1079
1235
|
{
|
|
@@ -1130,19 +1286,20 @@ function BlockInspectorRenderer({
|
|
|
1130
1286
|
}
|
|
1131
1287
|
) : null,
|
|
1132
1288
|
(hasMediaGroupContent ? group.fields.filter((field) => !(group.key === "media" && field.key.startsWith("settings.media."))) : group.fields).map((field) => {
|
|
1133
|
-
if (field.key === "settings.layout.paddingBottomPt" &&
|
|
1289
|
+
if (field.key === "settings.layout.paddingBottomPt" && getByPath(block, "settings.layout.linkVerticalPadding") !== false && block.blockType !== "hero") {
|
|
1134
1290
|
return null;
|
|
1135
1291
|
}
|
|
1136
|
-
if (field.key === "settings.layout.paddingRightPt" &&
|
|
1292
|
+
if (field.key === "settings.layout.paddingRightPt" && getByPath(block, "settings.layout.linkHorizontalPadding") !== false) {
|
|
1137
1293
|
return null;
|
|
1138
1294
|
}
|
|
1139
1295
|
const fieldValue = getByPath(block, field.key);
|
|
1140
1296
|
if (field.type === "checkbox") {
|
|
1297
|
+
const checked = field.key === "settings.layout.linkVerticalPadding" || field.key === "settings.layout.linkHorizontalPadding" ? typeof fieldValue === "boolean" ? fieldValue : block.blockType === "hero" ? false : true : Boolean(fieldValue);
|
|
1141
1298
|
return /* @__PURE__ */ jsxs3("label", { className: "orion-builder-settings-label is-checkbox", children: [
|
|
1142
1299
|
/* @__PURE__ */ jsx3(
|
|
1143
1300
|
"input",
|
|
1144
1301
|
{
|
|
1145
|
-
checked
|
|
1302
|
+
checked,
|
|
1146
1303
|
onChange: (event) => updateForKey(field.key, event.target.checked),
|
|
1147
1304
|
type: "checkbox"
|
|
1148
1305
|
}
|
|
@@ -1165,8 +1322,10 @@ function BlockInspectorRenderer({
|
|
|
1165
1322
|
] }, field.key);
|
|
1166
1323
|
}
|
|
1167
1324
|
if (field.type === "number") {
|
|
1168
|
-
const
|
|
1169
|
-
const
|
|
1325
|
+
const isPaddingPointField = field.key === "settings.layout.paddingTopPt" || field.key === "settings.layout.paddingBottomPt";
|
|
1326
|
+
const isTextSizePointField = field.key === "settings.typography.headingSizePt" || field.key === "settings.typography.bodySizePt";
|
|
1327
|
+
const numberValue = isTextSizePointField ? normalizeTextSizePointValue(fieldValue) : normalizePaddingPointValue(fieldValue);
|
|
1328
|
+
const resolvedValue = numberValue !== null ? numberValue : isPaddingPointField ? getEffectiveVerticalPaddingValue(block, field.key) : isTextSizePointField ? getEffectiveTextSizeValue(block, field.key) : "";
|
|
1170
1329
|
return /* @__PURE__ */ jsxs3("label", { className: "orion-builder-settings-label", children: [
|
|
1171
1330
|
field.label,
|
|
1172
1331
|
/* @__PURE__ */ jsx3(
|
|
@@ -2129,8 +2288,8 @@ function renderSimpleBlockPreview(args) {
|
|
|
2129
2288
|
getImagePresentationStyle: getImagePresentationStyle2,
|
|
2130
2289
|
index,
|
|
2131
2290
|
isBlockUploadTarget,
|
|
2132
|
-
normalizeImageCornerStyle:
|
|
2133
|
-
normalizeImageFit:
|
|
2291
|
+
normalizeImageCornerStyle: normalizeImageCornerStyle3,
|
|
2292
|
+
normalizeImageFit: normalizeImageFit3,
|
|
2134
2293
|
normalizeText: normalizeText3,
|
|
2135
2294
|
onDropAt,
|
|
2136
2295
|
renderWithSectionShell,
|
|
@@ -2314,8 +2473,8 @@ function renderSimpleBlockPreview(args) {
|
|
|
2314
2473
|
const imagePositionX = parseOptionalPercentNumber(mediaSettings.positionX ?? block?.imagePositionX);
|
|
2315
2474
|
const imagePositionY = parseOptionalPercentNumber(mediaSettings.positionY ?? block?.imagePositionY);
|
|
2316
2475
|
const imageStyle = getImagePresentationStyle2({
|
|
2317
|
-
cornerStyle:
|
|
2318
|
-
fit:
|
|
2476
|
+
cornerStyle: normalizeImageCornerStyle3(mediaSettings.cornerStyle ?? block?.imageCornerStyle),
|
|
2477
|
+
fit: normalizeImageFit3(mediaSettings.fit ?? block?.imageFit),
|
|
2319
2478
|
positionX: imagePositionX,
|
|
2320
2479
|
positionY: imagePositionY
|
|
2321
2480
|
});
|
|
@@ -2845,6 +3004,63 @@ var normalizeNumber2 = (value, fallback) => {
|
|
|
2845
3004
|
return fallback;
|
|
2846
3005
|
};
|
|
2847
3006
|
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
3007
|
+
var getRelationID2 = (value) => {
|
|
3008
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
3009
|
+
return value;
|
|
3010
|
+
}
|
|
3011
|
+
if (!isRecord5(value)) {
|
|
3012
|
+
return null;
|
|
3013
|
+
}
|
|
3014
|
+
const id = value.id;
|
|
3015
|
+
return typeof id === "number" || typeof id === "string" ? id : null;
|
|
3016
|
+
};
|
|
3017
|
+
var toMediaLibraryItem2 = (value) => {
|
|
3018
|
+
if (!isRecord5(value)) {
|
|
3019
|
+
return null;
|
|
3020
|
+
}
|
|
3021
|
+
const id = getRelationID2(value);
|
|
3022
|
+
if (id === null) {
|
|
3023
|
+
return null;
|
|
3024
|
+
}
|
|
3025
|
+
const filename = typeof value.filename === "string" ? value.filename : "";
|
|
3026
|
+
const url = typeof value.url === "string" && value.url.length > 0 ? value.url : filename ? `/api/media/file/${encodeURIComponent(filename)}` : "";
|
|
3027
|
+
return {
|
|
3028
|
+
alt: typeof value.alt === "string" ? value.alt : "",
|
|
3029
|
+
filename,
|
|
3030
|
+
id,
|
|
3031
|
+
url
|
|
3032
|
+
};
|
|
3033
|
+
};
|
|
3034
|
+
var mediaLabel2 = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
3035
|
+
var findMediaLibraryItem2 = (library, id) => {
|
|
3036
|
+
if (id === null) {
|
|
3037
|
+
return null;
|
|
3038
|
+
}
|
|
3039
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
3040
|
+
};
|
|
3041
|
+
var normalizeImageFit = (value) => value === "contain" ? "contain" : "cover";
|
|
3042
|
+
var normalizeImageCornerStyle = (value) => value === "square" ? "square" : "rounded";
|
|
3043
|
+
var getItemMediaSettings = (item) => {
|
|
3044
|
+
const settings = isRecord5(item.settings) ? item.settings : {};
|
|
3045
|
+
const media = isRecord5(settings.media) ? settings.media : {};
|
|
3046
|
+
return {
|
|
3047
|
+
cornerStyle: normalizeImageCornerStyle(media.cornerStyle ?? item.imageCornerStyle),
|
|
3048
|
+
fit: normalizeImageFit(media.fit ?? item.imageFit),
|
|
3049
|
+
height: (() => {
|
|
3050
|
+
const value = media.height ?? item.imageHeight;
|
|
3051
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
3052
|
+
return value;
|
|
3053
|
+
}
|
|
3054
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
3055
|
+
const parsed = Number(value);
|
|
3056
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
3057
|
+
}
|
|
3058
|
+
return null;
|
|
3059
|
+
})(),
|
|
3060
|
+
positionX: clamp(normalizeNumber2(media.positionX ?? item.imagePositionX, 50), 0, 100),
|
|
3061
|
+
positionY: clamp(normalizeNumber2(media.positionY ?? item.imagePositionY, 50), 0, 100)
|
|
3062
|
+
};
|
|
3063
|
+
};
|
|
2848
3064
|
var hasQueryMatch = (query, ...values) => {
|
|
2849
3065
|
const normalized = query.trim().toLowerCase();
|
|
2850
3066
|
if (!normalized) {
|
|
@@ -2891,18 +3107,157 @@ var bulletsToTextareaValue = (value) => {
|
|
|
2891
3107
|
return value.map((item) => isRecord5(item) && typeof item.label === "string" ? item.label.trim() : "").filter(Boolean).join("\n");
|
|
2892
3108
|
};
|
|
2893
3109
|
var textareaValueToBullets = (value) => value.split("\n").map((line) => line.trim()).filter(Boolean).map((label) => ({ label }));
|
|
3110
|
+
function ItemMediaControl({
|
|
3111
|
+
fieldName,
|
|
3112
|
+
imageURLFieldName,
|
|
3113
|
+
item,
|
|
3114
|
+
itemIndex,
|
|
3115
|
+
label,
|
|
3116
|
+
mediaLibrary,
|
|
3117
|
+
mediaLibraryError,
|
|
3118
|
+
mediaLibraryLoading,
|
|
3119
|
+
maxHeight,
|
|
3120
|
+
minHeight,
|
|
3121
|
+
onRemoveItemMedia,
|
|
3122
|
+
onSelectItemMedia,
|
|
3123
|
+
onUpdateItemField,
|
|
3124
|
+
onUpdateItemMediaPresentation,
|
|
3125
|
+
onUploadItemMedia,
|
|
3126
|
+
searchQuery,
|
|
3127
|
+
uploadDisabled,
|
|
3128
|
+
uploadLabel,
|
|
3129
|
+
uploading
|
|
3130
|
+
}) {
|
|
3131
|
+
const selectedMediaID = getRelationID2(item[fieldName]);
|
|
3132
|
+
const selectedRelationMedia = toMediaLibraryItem2(item[fieldName]);
|
|
3133
|
+
const selectedMedia = selectedRelationMedia ?? findMediaLibraryItem2(mediaLibrary, selectedMediaID);
|
|
3134
|
+
const directImageURL = normalizeText(item[imageURLFieldName]);
|
|
3135
|
+
const previewURL = selectedMedia?.url || directImageURL;
|
|
3136
|
+
const mediaSettings = getItemMediaSettings(item);
|
|
3137
|
+
const sourceOptions = selectedMedia && !mediaLibrary.some((libraryItem) => String(libraryItem.id) === String(selectedMedia.id)) ? [selectedMedia, ...mediaLibrary] : mediaLibrary;
|
|
3138
|
+
if (!hasQueryMatch(searchQuery, label, "image", "media", "photo", "picture", "url", "fit", "crop", "height")) {
|
|
3139
|
+
return null;
|
|
3140
|
+
}
|
|
3141
|
+
return /* @__PURE__ */ jsxs11("div", { className: "orion-builder-settings-item-card", style: { padding: "0.56rem" }, children: [
|
|
3142
|
+
/* @__PURE__ */ jsx12("div", { className: "orion-builder-settings-label", children: label }),
|
|
3143
|
+
previewURL ? (
|
|
3144
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
3145
|
+
/* @__PURE__ */ jsx12(
|
|
3146
|
+
"img",
|
|
3147
|
+
{
|
|
3148
|
+
alt: selectedMedia?.alt || label,
|
|
3149
|
+
src: previewURL,
|
|
3150
|
+
style: {
|
|
3151
|
+
aspectRatio: "16 / 9",
|
|
3152
|
+
border: "1px solid rgba(35, 51, 82, 0.14)",
|
|
3153
|
+
borderRadius: mediaSettings.cornerStyle === "square" ? 4 : 10,
|
|
3154
|
+
display: "block",
|
|
3155
|
+
objectFit: mediaSettings.fit,
|
|
3156
|
+
objectPosition: `${mediaSettings.positionX}% ${mediaSettings.positionY}%`,
|
|
3157
|
+
width: "100%"
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
)
|
|
3161
|
+
) : /* @__PURE__ */ jsx12("div", { className: "orion-builder-settings-empty", children: "No image selected." }),
|
|
3162
|
+
mediaLibraryLoading ? /* @__PURE__ */ jsx12("div", { className: "orion-builder-settings-note", children: "Loading media library..." }) : null,
|
|
3163
|
+
mediaLibraryError ? /* @__PURE__ */ jsx12("div", { className: "orion-builder-settings-error", children: mediaLibraryError }) : null,
|
|
3164
|
+
/* @__PURE__ */ jsxs11("label", { className: "orion-builder-settings-label", children: [
|
|
3165
|
+
"Media Library Image",
|
|
3166
|
+
/* @__PURE__ */ jsxs11(
|
|
3167
|
+
"select",
|
|
3168
|
+
{
|
|
3169
|
+
className: "orion-builder-settings-input",
|
|
3170
|
+
onChange: (event) => onSelectItemMedia?.(itemIndex, fieldName, event.target.value),
|
|
3171
|
+
value: selectedMediaID !== null ? String(selectedMediaID) : "",
|
|
3172
|
+
children: [
|
|
3173
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "No library image" }),
|
|
3174
|
+
sourceOptions.map((libraryItem) => /* @__PURE__ */ jsx12("option", { value: String(libraryItem.id), children: mediaLabel2(libraryItem) }, String(libraryItem.id)))
|
|
3175
|
+
]
|
|
3176
|
+
}
|
|
3177
|
+
)
|
|
3178
|
+
] }),
|
|
3179
|
+
selectedMedia?.alt ? /* @__PURE__ */ jsxs11("label", { className: "orion-builder-settings-label", children: [
|
|
3180
|
+
"Media Description",
|
|
3181
|
+
/* @__PURE__ */ jsx12("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedMedia.alt })
|
|
3182
|
+
] }) : selectedMediaID !== null ? /* @__PURE__ */ jsx12("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
3183
|
+
/* @__PURE__ */ jsx12(
|
|
3184
|
+
"button",
|
|
3185
|
+
{
|
|
3186
|
+
className: "orion-builder-settings-inline-btn",
|
|
3187
|
+
disabled: selectedMediaID === null,
|
|
3188
|
+
onClick: () => onRemoveItemMedia?.(itemIndex, fieldName),
|
|
3189
|
+
type: "button",
|
|
3190
|
+
children: "Remove Library Image"
|
|
3191
|
+
}
|
|
3192
|
+
),
|
|
3193
|
+
/* @__PURE__ */ jsxs11("label", { className: "orion-builder-settings-label", children: [
|
|
3194
|
+
"Direct Image URL",
|
|
3195
|
+
/* @__PURE__ */ jsx12(
|
|
3196
|
+
"input",
|
|
3197
|
+
{
|
|
3198
|
+
className: "orion-builder-settings-input",
|
|
3199
|
+
onChange: (event) => onUpdateItemField(itemIndex, imageURLFieldName, event.target.value),
|
|
3200
|
+
type: "text",
|
|
3201
|
+
value: directImageURL
|
|
3202
|
+
}
|
|
3203
|
+
)
|
|
3204
|
+
] }),
|
|
3205
|
+
/* @__PURE__ */ jsxs11("label", { className: "orion-builder-settings-label", children: [
|
|
3206
|
+
uploadLabel,
|
|
3207
|
+
/* @__PURE__ */ jsx12(
|
|
3208
|
+
"input",
|
|
3209
|
+
{
|
|
3210
|
+
accept: "image/*",
|
|
3211
|
+
className: "orion-builder-settings-input",
|
|
3212
|
+
disabled: uploadDisabled,
|
|
3213
|
+
onChange: (event) => {
|
|
3214
|
+
const file = event.currentTarget.files?.[0];
|
|
3215
|
+
if (file) {
|
|
3216
|
+
onUploadItemMedia?.(itemIndex, fieldName, file);
|
|
3217
|
+
}
|
|
3218
|
+
event.currentTarget.value = "";
|
|
3219
|
+
},
|
|
3220
|
+
type: "file"
|
|
3221
|
+
}
|
|
3222
|
+
)
|
|
3223
|
+
] }),
|
|
3224
|
+
uploading ? /* @__PURE__ */ jsx12("div", { className: "orion-builder-settings-note", children: "Uploading image..." }) : null,
|
|
3225
|
+
/* @__PURE__ */ jsx12(
|
|
3226
|
+
ImageControls,
|
|
3227
|
+
{
|
|
3228
|
+
cornerStyle: mediaSettings.cornerStyle,
|
|
3229
|
+
fit: mediaSettings.fit,
|
|
3230
|
+
height: mediaSettings.height,
|
|
3231
|
+
maxHeight,
|
|
3232
|
+
minHeight,
|
|
3233
|
+
onChange: (field, value) => onUpdateItemMediaPresentation?.(itemIndex, field, value),
|
|
3234
|
+
positionX: mediaSettings.positionX,
|
|
3235
|
+
positionY: mediaSettings.positionY
|
|
3236
|
+
}
|
|
3237
|
+
)
|
|
3238
|
+
] });
|
|
3239
|
+
}
|
|
2894
3240
|
function ArrayItemsEditor({
|
|
2895
3241
|
blockType,
|
|
2896
3242
|
expandedItemIndex,
|
|
2897
3243
|
items,
|
|
3244
|
+
mediaLibrary = [],
|
|
3245
|
+
mediaLibraryError = "",
|
|
3246
|
+
mediaLibraryLoading = false,
|
|
2898
3247
|
mode,
|
|
2899
3248
|
onAddItem,
|
|
3249
|
+
onRemoveItemMedia,
|
|
2900
3250
|
onRemoveItem,
|
|
3251
|
+
onSelectItemMedia,
|
|
2901
3252
|
onToggleItem,
|
|
2902
3253
|
onUpdateItemField,
|
|
3254
|
+
onUpdateItemMediaPresentation,
|
|
2903
3255
|
onUpdateItemSetting,
|
|
3256
|
+
onUploadItemMedia,
|
|
2904
3257
|
searchQuery,
|
|
2905
|
-
showInlineCopyFields
|
|
3258
|
+
showInlineCopyFields,
|
|
3259
|
+
uploadDisabled = false,
|
|
3260
|
+
isItemMediaUploading
|
|
2906
3261
|
}) {
|
|
2907
3262
|
const config = blockConfig[blockType];
|
|
2908
3263
|
const normalizedQuery = searchQuery.trim().toLowerCase();
|
|
@@ -3052,11 +3407,30 @@ function ArrayItemsEditor({
|
|
|
3052
3407
|
}
|
|
3053
3408
|
)
|
|
3054
3409
|
] }) : null,
|
|
3055
|
-
/* @__PURE__ */
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3410
|
+
/* @__PURE__ */ jsx12(
|
|
3411
|
+
ItemMediaControl,
|
|
3412
|
+
{
|
|
3413
|
+
fieldName: "media",
|
|
3414
|
+
imageURLFieldName: "imageURL",
|
|
3415
|
+
item,
|
|
3416
|
+
itemIndex,
|
|
3417
|
+
label: "Feature Image",
|
|
3418
|
+
maxHeight: 600,
|
|
3419
|
+
mediaLibrary,
|
|
3420
|
+
mediaLibraryError,
|
|
3421
|
+
mediaLibraryLoading,
|
|
3422
|
+
minHeight: 40,
|
|
3423
|
+
onRemoveItemMedia,
|
|
3424
|
+
onSelectItemMedia,
|
|
3425
|
+
onUpdateItemField,
|
|
3426
|
+
onUpdateItemMediaPresentation,
|
|
3427
|
+
onUploadItemMedia,
|
|
3428
|
+
searchQuery: normalizedQuery,
|
|
3429
|
+
uploadDisabled,
|
|
3430
|
+
uploadLabel: "Upload Feature Image",
|
|
3431
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "media"))
|
|
3432
|
+
}
|
|
3433
|
+
)
|
|
3060
3434
|
] }) : null,
|
|
3061
3435
|
blockType === "logoWall" ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3062
3436
|
showInlineCopyFields ? /* @__PURE__ */ jsxs11("label", { className: "orion-builder-settings-label", children: [
|
|
@@ -3083,11 +3457,30 @@ function ArrayItemsEditor({
|
|
|
3083
3457
|
}
|
|
3084
3458
|
)
|
|
3085
3459
|
] }) : null,
|
|
3086
|
-
/* @__PURE__ */
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3460
|
+
/* @__PURE__ */ jsx12(
|
|
3461
|
+
ItemMediaControl,
|
|
3462
|
+
{
|
|
3463
|
+
fieldName: "media",
|
|
3464
|
+
imageURLFieldName: "imageURL",
|
|
3465
|
+
item,
|
|
3466
|
+
itemIndex,
|
|
3467
|
+
label: "Logo Image",
|
|
3468
|
+
maxHeight: 200,
|
|
3469
|
+
mediaLibrary,
|
|
3470
|
+
mediaLibraryError,
|
|
3471
|
+
mediaLibraryLoading,
|
|
3472
|
+
minHeight: 24,
|
|
3473
|
+
onRemoveItemMedia,
|
|
3474
|
+
onSelectItemMedia,
|
|
3475
|
+
onUpdateItemField,
|
|
3476
|
+
onUpdateItemMediaPresentation,
|
|
3477
|
+
onUploadItemMedia,
|
|
3478
|
+
searchQuery: normalizedQuery,
|
|
3479
|
+
uploadDisabled,
|
|
3480
|
+
uploadLabel: "Upload Logo Image",
|
|
3481
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "media"))
|
|
3482
|
+
}
|
|
3483
|
+
)
|
|
3091
3484
|
] }) : null,
|
|
3092
3485
|
blockType === "beforeAfter" ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3093
3486
|
showInlineCopyFields ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
@@ -3115,11 +3508,54 @@ function ArrayItemsEditor({
|
|
|
3115
3508
|
)
|
|
3116
3509
|
] })
|
|
3117
3510
|
] }) : null,
|
|
3118
|
-
/* @__PURE__ */
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3511
|
+
/* @__PURE__ */ jsx12(
|
|
3512
|
+
ItemMediaControl,
|
|
3513
|
+
{
|
|
3514
|
+
fieldName: "beforeMedia",
|
|
3515
|
+
imageURLFieldName: "beforeImageURL",
|
|
3516
|
+
item,
|
|
3517
|
+
itemIndex,
|
|
3518
|
+
label: "Before Image",
|
|
3519
|
+
maxHeight: 600,
|
|
3520
|
+
mediaLibrary,
|
|
3521
|
+
mediaLibraryError,
|
|
3522
|
+
mediaLibraryLoading,
|
|
3523
|
+
minHeight: 60,
|
|
3524
|
+
onRemoveItemMedia,
|
|
3525
|
+
onSelectItemMedia,
|
|
3526
|
+
onUpdateItemField,
|
|
3527
|
+
onUpdateItemMediaPresentation,
|
|
3528
|
+
onUploadItemMedia,
|
|
3529
|
+
searchQuery: normalizedQuery,
|
|
3530
|
+
uploadDisabled,
|
|
3531
|
+
uploadLabel: "Upload Before Image",
|
|
3532
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "beforeMedia"))
|
|
3533
|
+
}
|
|
3534
|
+
),
|
|
3535
|
+
/* @__PURE__ */ jsx12(
|
|
3536
|
+
ItemMediaControl,
|
|
3537
|
+
{
|
|
3538
|
+
fieldName: "afterMedia",
|
|
3539
|
+
imageURLFieldName: "afterImageURL",
|
|
3540
|
+
item,
|
|
3541
|
+
itemIndex,
|
|
3542
|
+
label: "After Image",
|
|
3543
|
+
maxHeight: 600,
|
|
3544
|
+
mediaLibrary,
|
|
3545
|
+
mediaLibraryError,
|
|
3546
|
+
mediaLibraryLoading,
|
|
3547
|
+
minHeight: 60,
|
|
3548
|
+
onRemoveItemMedia,
|
|
3549
|
+
onSelectItemMedia,
|
|
3550
|
+
onUpdateItemField,
|
|
3551
|
+
onUpdateItemMediaPresentation,
|
|
3552
|
+
onUploadItemMedia,
|
|
3553
|
+
searchQuery: normalizedQuery,
|
|
3554
|
+
uploadDisabled,
|
|
3555
|
+
uploadLabel: "Upload After Image",
|
|
3556
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "afterMedia"))
|
|
3557
|
+
}
|
|
3558
|
+
)
|
|
3123
3559
|
] }) : null,
|
|
3124
3560
|
blockType === "stats" ? /* @__PURE__ */ jsx12(Fragment4, { children: showInlineCopyFields ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3125
3561
|
/* @__PURE__ */ jsxs11("label", { className: "orion-builder-settings-label", children: [
|
|
@@ -3325,8 +3761,8 @@ var resolveBuilderMediumHeroHeight = (topViewportHeight) => {
|
|
|
3325
3761
|
}
|
|
3326
3762
|
return "50svh";
|
|
3327
3763
|
};
|
|
3328
|
-
var
|
|
3329
|
-
var
|
|
3764
|
+
var normalizeImageFit2 = (value) => normalizeHeroImageFit(value);
|
|
3765
|
+
var normalizeImageCornerStyle2 = (value, legacyFitValue) => normalizeHeroImageCornerStyle(value, legacyFitValue);
|
|
3330
3766
|
var positionPercent = (value, fit) => {
|
|
3331
3767
|
const resolved = fit === "cover" && (value === "left" || value === "right") ? "center" : value;
|
|
3332
3768
|
switch (resolved) {
|
|
@@ -3495,6 +3931,8 @@ var sectionPaddingMap = {
|
|
|
3495
3931
|
md: "2.6rem",
|
|
3496
3932
|
lg: "3.4rem"
|
|
3497
3933
|
};
|
|
3934
|
+
var heroDefaultPaddingTop = "30pt";
|
|
3935
|
+
var heroDefaultPaddingBottom = "20pt";
|
|
3498
3936
|
var quickAddBlockTypes = [
|
|
3499
3937
|
"hero",
|
|
3500
3938
|
"featureGrid",
|
|
@@ -3758,6 +4196,12 @@ function getThemeColorOverride(tokens, colorKey) {
|
|
|
3758
4196
|
const normalized = value.trim();
|
|
3759
4197
|
return normalized.length > 0 ? normalized : null;
|
|
3760
4198
|
}
|
|
4199
|
+
function normalizeCustomClassName(value) {
|
|
4200
|
+
if (typeof value !== "string") {
|
|
4201
|
+
return "";
|
|
4202
|
+
}
|
|
4203
|
+
return value.split(/\s+/).map((className) => className.trim()).filter(Boolean).join(" ");
|
|
4204
|
+
}
|
|
3761
4205
|
var sectionStyleFromBlock = (block, pageDefaults) => {
|
|
3762
4206
|
const settings = isRecord6(block.settings) ? block.settings : {};
|
|
3763
4207
|
const layoutSettings = isRecord6(settings.layout) ? settings.layout : {};
|
|
@@ -3843,15 +4287,15 @@ var sectionStyleFromBlock = (block, pageDefaults) => {
|
|
|
3843
4287
|
} : {},
|
|
3844
4288
|
sectionClass: `orion-builder-shell is-${pageDefaults.pageWidthDefault} padx-${resolvedSectionPaddingX}`,
|
|
3845
4289
|
sectionInnerStyle: {
|
|
3846
|
-
paddingBottom: customPaddingBottom === null ? sectionPaddingMap[sectionPaddingY] : `${customPaddingBottom}pt`,
|
|
4290
|
+
paddingBottom: customPaddingBottom === null ? block.blockType === "hero" ? heroDefaultPaddingBottom : sectionPaddingMap[sectionPaddingY] : `${customPaddingBottom}pt`,
|
|
3847
4291
|
paddingLeft: customPaddingLeft === null ? void 0 : `${customPaddingLeft}pt`,
|
|
3848
4292
|
paddingRight: customPaddingRight === null ? void 0 : `${customPaddingRight}pt`,
|
|
3849
|
-
paddingTop: customPaddingTop === null ? sectionPaddingMap[sectionPaddingY] : `${customPaddingTop}pt`
|
|
4293
|
+
paddingTop: customPaddingTop === null ? block.blockType === "hero" ? heroDefaultPaddingTop : sectionPaddingMap[sectionPaddingY] : `${customPaddingTop}pt`
|
|
3850
4294
|
},
|
|
3851
4295
|
sectionStyle: sectionMode === "color" ? { background: sectionColor } : sectionMode === "gradient" ? { background: sectionGradient } : block.blockType === "hero" ? { background: "transparent" } : {}
|
|
3852
4296
|
};
|
|
3853
4297
|
};
|
|
3854
|
-
function
|
|
4298
|
+
function getRelationID3(value) {
|
|
3855
4299
|
if (typeof value === "number" || typeof value === "string") {
|
|
3856
4300
|
return value;
|
|
3857
4301
|
}
|
|
@@ -3884,7 +4328,7 @@ function extractUploadedMedia(value) {
|
|
|
3884
4328
|
if (!candidate || typeof candidate !== "object") {
|
|
3885
4329
|
return null;
|
|
3886
4330
|
}
|
|
3887
|
-
const id =
|
|
4331
|
+
const id = getRelationID3(candidate);
|
|
3888
4332
|
if (id === null) {
|
|
3889
4333
|
return null;
|
|
3890
4334
|
}
|
|
@@ -3895,11 +4339,11 @@ function extractUploadedMedia(value) {
|
|
|
3895
4339
|
url: typeof candidate.url === "string" ? candidate.url : ""
|
|
3896
4340
|
};
|
|
3897
4341
|
}
|
|
3898
|
-
function
|
|
4342
|
+
function toMediaLibraryItem3(value) {
|
|
3899
4343
|
if (!value || typeof value !== "object") {
|
|
3900
4344
|
return null;
|
|
3901
4345
|
}
|
|
3902
|
-
const id =
|
|
4346
|
+
const id = getRelationID3(value);
|
|
3903
4347
|
if (id === null) {
|
|
3904
4348
|
return null;
|
|
3905
4349
|
}
|
|
@@ -4077,7 +4521,7 @@ function BuilderPageEditor({
|
|
|
4077
4521
|
}
|
|
4078
4522
|
const json = await response.json();
|
|
4079
4523
|
const docs = Array.isArray(json.docs) ? json.docs : [];
|
|
4080
|
-
const items = docs.map((doc2) =>
|
|
4524
|
+
const items = docs.map((doc2) => toMediaLibraryItem3(doc2)).filter((item) => item !== null);
|
|
4081
4525
|
setMediaLibrary(items);
|
|
4082
4526
|
} catch (error) {
|
|
4083
4527
|
setMediaLibraryError(error instanceof Error ? error.message : "Could not load media library.");
|
|
@@ -4431,7 +4875,7 @@ function BuilderPageEditor({
|
|
|
4431
4875
|
const nextLayout = cloneBlockLayout(layout);
|
|
4432
4876
|
const block = nextLayout[selectedIndex];
|
|
4433
4877
|
if (target.kind === "hero") {
|
|
4434
|
-
const uploadedItem =
|
|
4878
|
+
const uploadedItem = toMediaLibraryItem3(uploaded);
|
|
4435
4879
|
nextLayout[selectedIndex] = {
|
|
4436
4880
|
...block,
|
|
4437
4881
|
backgroundImageURL: uploadedItem?.url || normalizeText2(uploaded.url),
|
|
@@ -4495,13 +4939,13 @@ function BuilderPageEditor({
|
|
|
4495
4939
|
const nextBlock = { ...migrateBlockToSettingsV2(block) };
|
|
4496
4940
|
const blockType = normalizeText2(nextBlock.blockType);
|
|
4497
4941
|
if (blockType === "hero") {
|
|
4498
|
-
const mediaID =
|
|
4942
|
+
const mediaID = getRelationID3(nextBlock.media);
|
|
4499
4943
|
if (mediaID !== null) {
|
|
4500
4944
|
nextBlock.media = mediaID;
|
|
4501
4945
|
}
|
|
4502
4946
|
}
|
|
4503
4947
|
if (blockType === "media") {
|
|
4504
|
-
const imageID =
|
|
4948
|
+
const imageID = getRelationID3(nextBlock.image);
|
|
4505
4949
|
if (imageID !== null) {
|
|
4506
4950
|
nextBlock.image = imageID;
|
|
4507
4951
|
}
|
|
@@ -4513,15 +4957,15 @@ function BuilderPageEditor({
|
|
|
4513
4957
|
return rawItem;
|
|
4514
4958
|
}
|
|
4515
4959
|
const nextItem = { ...rawItem };
|
|
4516
|
-
const mediaID =
|
|
4960
|
+
const mediaID = getRelationID3(nextItem.media);
|
|
4517
4961
|
if (mediaID !== null) {
|
|
4518
4962
|
nextItem.media = mediaID;
|
|
4519
4963
|
}
|
|
4520
|
-
const beforeMediaID =
|
|
4964
|
+
const beforeMediaID = getRelationID3(nextItem.beforeMedia);
|
|
4521
4965
|
if (beforeMediaID !== null) {
|
|
4522
4966
|
nextItem.beforeMedia = beforeMediaID;
|
|
4523
4967
|
}
|
|
4524
|
-
const afterMediaID =
|
|
4968
|
+
const afterMediaID = getRelationID3(nextItem.afterMedia);
|
|
4525
4969
|
if (afterMediaID !== null) {
|
|
4526
4970
|
nextItem.afterMedia = afterMediaID;
|
|
4527
4971
|
}
|
|
@@ -4577,6 +5021,7 @@ function BuilderPageEditor({
|
|
|
4577
5021
|
const inheritProjectStyles = options?.inheritProjectStyles === true;
|
|
4578
5022
|
const shell = sectionStyleFromBlock(block, pageDefaults);
|
|
4579
5023
|
const blockSettings = isRecord6(block.settings) ? block.settings : {};
|
|
5024
|
+
const blockAdvanced = isRecord6(blockSettings.advanced) ? blockSettings.advanced : {};
|
|
4580
5025
|
const blockTypography = isRecord6(blockSettings.typography) ? blockSettings.typography : {};
|
|
4581
5026
|
const blockTheme = isRecord6(blockSettings.theme) ? blockSettings.theme : {};
|
|
4582
5027
|
const heroBackgroundColor = normalizeText2(block.backgroundColor).trim();
|
|
@@ -4584,23 +5029,35 @@ function BuilderPageEditor({
|
|
|
4584
5029
|
const heroMedia = block.blockType === "hero" ? resolveMedia(block.media) : null;
|
|
4585
5030
|
const heroHasImage = block.blockType === "hero" && Boolean(heroBackgroundImageURL || heroMedia?.url);
|
|
4586
5031
|
const heroTextColor = block.blockType === "hero" ? heroHasImage ? "#ffffff" : heroBackgroundColor ? getReadableTextColor(heroBackgroundColor, resolvedThemeTokens.colors.headingText, "#ffffff") : resolvedThemeTokens.colors.headingText : null;
|
|
5032
|
+
const bodyAlign = blockTypography.bodyAlign === "center" || blockTypography.bodyAlign === "justify" || blockTypography.bodyAlign === "right" ? blockTypography.bodyAlign : "left";
|
|
4587
5033
|
const typographyStyle = resolveTypographyStyleFromSettings({
|
|
4588
|
-
bodyAlign
|
|
5034
|
+
bodyAlign,
|
|
4589
5035
|
letterSpacingPreset: blockTypography.letterSpacingPreset === "tight" || blockTypography.letterSpacingPreset === "relaxed" ? blockTypography.letterSpacingPreset : "normal",
|
|
4590
5036
|
lineHeightPreset: blockTypography.lineHeightPreset === "tight" || blockTypography.lineHeightPreset === "relaxed" ? blockTypography.lineHeightPreset : "normal",
|
|
5037
|
+
bodySizePt: typeof blockTypography.bodySizePt === "number" && Number.isFinite(blockTypography.bodySizePt) ? blockTypography.bodySizePt : null,
|
|
4591
5038
|
maxTextWidth: blockTypography.maxTextWidth === "sm" || blockTypography.maxTextWidth === "md" || blockTypography.maxTextWidth === "lg" || blockTypography.maxTextWidth === "full" ? blockTypography.maxTextWidth : "auto"
|
|
4592
5039
|
});
|
|
4593
5040
|
const headingAlign = blockTypography.headingAlign === "center" || blockTypography.headingAlign === "justify" || blockTypography.headingAlign === "right" ? blockTypography.headingAlign : "left";
|
|
4594
5041
|
const headingColor = getThemeColorOverride(blockTheme, "headingText") || getThemeColorOverride(pageDefaults.themePage, "headingText") || getThemeColorOverride(siteThemeTokens, "headingText") || heroTextColor || resolvedThemeTokens.colors.headingText;
|
|
4595
5042
|
const bodyColor = getThemeColorOverride(blockTheme, "bodyText") || getThemeColorOverride(pageDefaults.themePage, "bodyText") || getThemeColorOverride(siteThemeTokens, "bodyText") || heroTextColor || resolvedThemeTokens.colors.bodyText;
|
|
4596
|
-
|
|
5043
|
+
const customClassName = normalizeCustomClassName(blockAdvanced.customClassName ?? block.customClassName);
|
|
5044
|
+
const hideOnMobile = Boolean(blockAdvanced.hideOnMobile ?? block.hideOnMobile);
|
|
5045
|
+
const sectionClassName = [
|
|
5046
|
+
className,
|
|
5047
|
+
shell.sectionClass,
|
|
5048
|
+
customClassName,
|
|
5049
|
+
hideOnMobile ? "orion-builder-hide-mobile" : ""
|
|
5050
|
+
].filter(Boolean).join(" ");
|
|
5051
|
+
return /* @__PURE__ */ jsx13("section", { className: sectionClassName, style: shell.sectionStyle, children: /* @__PURE__ */ jsx13("div", { style: shell.sectionInnerStyle, children: /* @__PURE__ */ jsx13(
|
|
4597
5052
|
"div",
|
|
4598
5053
|
{
|
|
4599
5054
|
className: shell.contentClass,
|
|
4600
5055
|
style: {
|
|
4601
5056
|
...shell.contentStyle,
|
|
5057
|
+
"--orion-builder-heading-align": headingAlign,
|
|
5058
|
+
"--orion-builder-body-align": bodyAlign,
|
|
5059
|
+
"--orion-builder-actions-align": bodyAlign === "center" ? "center" : bodyAlign === "right" ? "flex-end" : "flex-start",
|
|
4602
5060
|
...inheritProjectStyles ? {} : {
|
|
4603
|
-
"--orion-builder-heading-align": headingAlign,
|
|
4604
5061
|
"--orion-builder-heading-color": headingColor,
|
|
4605
5062
|
color: bodyColor,
|
|
4606
5063
|
...typographyStyle
|
|
@@ -5087,8 +5544,8 @@ function BuilderPageEditor({
|
|
|
5087
5544
|
}
|
|
5088
5545
|
] : [];
|
|
5089
5546
|
const selectedMediaImageControls = selectedItemRecord && typeof selectedItemIndex === "number" && (selectedType === "featureGrid" || selectedType === "logoWall" || selectedType === "beforeAfter") ? {
|
|
5090
|
-
cornerStyle:
|
|
5091
|
-
fit:
|
|
5547
|
+
cornerStyle: normalizeImageCornerStyle2(selectedItemRecord.imageCornerStyle),
|
|
5548
|
+
fit: normalizeImageFit2(selectedItemRecord.imageFit),
|
|
5092
5549
|
height: (() => {
|
|
5093
5550
|
if (typeof selectedItemRecord.imageHeight === "number" && Number.isFinite(selectedItemRecord.imageHeight)) {
|
|
5094
5551
|
return selectedItemRecord.imageHeight;
|
|
@@ -5563,8 +6020,8 @@ function BuilderPageEditor({
|
|
|
5563
6020
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
5564
6021
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
5565
6022
|
const itemImageStyle = getImagePresentationStyle({
|
|
5566
|
-
cornerStyle:
|
|
5567
|
-
fit:
|
|
6023
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6024
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
5568
6025
|
positionX: itemPositionX,
|
|
5569
6026
|
positionY: itemPositionY
|
|
5570
6027
|
});
|
|
@@ -5681,8 +6138,8 @@ function BuilderPageEditor({
|
|
|
5681
6138
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
5682
6139
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
5683
6140
|
const itemImageStyle = getImagePresentationStyle({
|
|
5684
|
-
cornerStyle:
|
|
5685
|
-
fit:
|
|
6141
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6142
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
5686
6143
|
positionX: itemPositionX,
|
|
5687
6144
|
positionY: itemPositionY
|
|
5688
6145
|
});
|
|
@@ -5888,8 +6345,8 @@ function BuilderPageEditor({
|
|
|
5888
6345
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
5889
6346
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
5890
6347
|
const imageStyle = getImagePresentationStyle({
|
|
5891
|
-
cornerStyle:
|
|
5892
|
-
fit:
|
|
6348
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6349
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
5893
6350
|
positionX: itemPositionX,
|
|
5894
6351
|
positionY: itemPositionY,
|
|
5895
6352
|
roundedRadius: 10
|
|
@@ -6002,8 +6459,8 @@ function BuilderPageEditor({
|
|
|
6002
6459
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
6003
6460
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
6004
6461
|
const imageStyle = getImagePresentationStyle({
|
|
6005
|
-
cornerStyle:
|
|
6006
|
-
fit:
|
|
6462
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6463
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
6007
6464
|
positionX: itemPositionX,
|
|
6008
6465
|
positionY: itemPositionY
|
|
6009
6466
|
});
|
|
@@ -6309,8 +6766,8 @@ function BuilderPageEditor({
|
|
|
6309
6766
|
getImagePresentationStyle,
|
|
6310
6767
|
index,
|
|
6311
6768
|
isBlockUploadTarget,
|
|
6312
|
-
normalizeImageCornerStyle,
|
|
6313
|
-
normalizeImageFit,
|
|
6769
|
+
normalizeImageCornerStyle: normalizeImageCornerStyle2,
|
|
6770
|
+
normalizeImageFit: normalizeImageFit2,
|
|
6314
6771
|
normalizeText: normalizeText2,
|
|
6315
6772
|
onDropAt,
|
|
6316
6773
|
renderWithSectionShell,
|
|
@@ -6539,23 +6996,32 @@ function BuilderPageEditor({
|
|
|
6539
6996
|
blockType: selectedType,
|
|
6540
6997
|
expandedItemIndex,
|
|
6541
6998
|
items: selectedItems,
|
|
6999
|
+
isItemMediaUploading: isSelectedItemMediaUploading,
|
|
7000
|
+
mediaLibrary,
|
|
7001
|
+
mediaLibraryError,
|
|
7002
|
+
mediaLibraryLoading,
|
|
6542
7003
|
mode: settingsPanelMode,
|
|
6543
7004
|
onAddItem: appendDefaultItemToSelected,
|
|
6544
7005
|
onRemoveItem: (itemIndex) => removeItemFromSelected("items", itemIndex),
|
|
7006
|
+
onRemoveItemMedia: (itemIndex, fieldName) => setSelectedItemMediaFieldFromLibrary(itemIndex, fieldName, ""),
|
|
7007
|
+
onSelectItemMedia: (itemIndex, fieldName, mediaID) => setSelectedItemMediaFieldFromLibrary(itemIndex, fieldName, mediaID),
|
|
6545
7008
|
onToggleItem: toggleSelectedItem,
|
|
6546
7009
|
onUpdateItemField: (itemIndex, fieldName, value) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, fieldName, value),
|
|
7010
|
+
onUpdateItemMediaPresentation: (itemIndex, fieldName, value) => updateArrayItemSettingField(selectedIndex ?? 0, "items", itemIndex, `media.${fieldName}`, value),
|
|
6547
7011
|
onUpdateItemSetting: (itemIndex, path, value) => updateArrayItemSettingField(selectedIndex ?? 0, "items", itemIndex, path, value),
|
|
7012
|
+
onUploadItemMedia: uploadItemMediaFromV2,
|
|
6548
7013
|
searchQuery: settingsSearchQuery,
|
|
6549
|
-
showInlineCopyFields: editCopyInPanelEnabled
|
|
7014
|
+
showInlineCopyFields: editCopyInPanelEnabled,
|
|
7015
|
+
uploadDisabled: uploadingTarget !== null
|
|
6550
7016
|
}
|
|
6551
7017
|
) : null,
|
|
6552
7018
|
/* @__PURE__ */ jsxs12("label", { style: sidebarLabelStyle, children: [
|
|
6553
|
-
"Upload Alt Text",
|
|
7019
|
+
"New Upload Alt Text",
|
|
6554
7020
|
/* @__PURE__ */ jsx13(
|
|
6555
7021
|
"input",
|
|
6556
7022
|
{
|
|
6557
7023
|
onChange: (event) => setUploadAltText(event.target.value),
|
|
6558
|
-
placeholder: "
|
|
7024
|
+
placeholder: "Used only when uploading a new image",
|
|
6559
7025
|
style: sidebarInputStyle,
|
|
6560
7026
|
type: "text",
|
|
6561
7027
|
value: uploadAltText
|