@orion-studios/payload-studio 0.6.0-beta.4 → 0.6.0-beta.40
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-OTHERBGX.mjs → chunk-AWL7TIEI.mjs} +1 -1
- package/dist/{chunk-PF3EBZXF.mjs → chunk-CUPMTHGX.mjs} +19 -3
- package/dist/chunk-JC3UV74N.mjs +1033 -0
- package/dist/{chunk-XKUTZ7IU.mjs → chunk-LUF62ZWF.mjs} +31 -5
- package/dist/{chunk-EHUE4LCT.mjs → chunk-RKTIFEUY.mjs} +33 -3
- package/dist/chunk-W2UOCJDX.mjs +32 -0
- package/dist/{index-bbA3HSxa.d.ts → index-BV0vEGl6.d.ts} +6 -9
- 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-Cv-6qnrw.d.mts → index-DRu4fKxf.d.mts} +1 -1
- package/dist/{index-DEQC3Dwj.d.mts → index-G_uTNffQ.d.mts} +1 -1
- package/dist/{index-Crx_MtPw.d.ts → index-vkEwwsoC.d.ts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +249 -1542
- package/dist/index.mjs +10 -10
- package/dist/nextjs/index.js +19 -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 +455 -63
- package/dist/studio-pages/client.mjs +455 -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 +46 -4
- package/dist/studio-pages/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-DYXSAVUQ.mjs +0 -2372
- package/dist/chunk-Z6L5K5MH.mjs +0 -64
|
@@ -156,6 +156,7 @@ var defaultBuilderThemeTokens = {
|
|
|
156
156
|
|
|
157
157
|
// src/studio-pages/builder/adapters/settingsV2.ts
|
|
158
158
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
159
|
+
var isTextAlign = (value) => value === "left" || value === "center" || value === "right" || value === "justify";
|
|
159
160
|
var parsePercent = (value) => {
|
|
160
161
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
161
162
|
return Math.max(0, Math.min(100, value));
|
|
@@ -198,6 +199,10 @@ var mergeSettings = (defaults, input) => {
|
|
|
198
199
|
};
|
|
199
200
|
var legacyBlockToV2Settings = (block) => {
|
|
200
201
|
const current = structuredClone(defaultBuilderBlockSettingsV2);
|
|
202
|
+
if (block.blockType === "hero" && block.variant === "centered") {
|
|
203
|
+
current.typography.headingAlign = "center";
|
|
204
|
+
current.typography.bodyAlign = "center";
|
|
205
|
+
}
|
|
201
206
|
current.layout.contentWidth = block.contentWidth === "narrow" || block.contentWidth === "content" || block.contentWidth === "wide" || block.contentWidth === "full" || block.contentWidth === "inherit" ? block.contentWidth : current.layout.contentWidth;
|
|
202
207
|
current.layout.sectionPaddingX = block.sectionPaddingX === "none" || block.sectionPaddingX === "sm" || block.sectionPaddingX === "md" || block.sectionPaddingX === "lg" || block.sectionPaddingX === "inherit" ? block.sectionPaddingX : current.layout.sectionPaddingX;
|
|
203
208
|
current.layout.sectionPaddingY = block.sectionPaddingY === "none" || block.sectionPaddingY === "sm" || block.sectionPaddingY === "lg" ? block.sectionPaddingY : current.layout.sectionPaddingY;
|
|
@@ -234,15 +239,26 @@ var legacyBlockToV2Settings = (block) => {
|
|
|
234
239
|
current.media.positionX = parsePercent(block.imagePositionX ?? block.backgroundImagePositionX);
|
|
235
240
|
current.media.positionY = parsePercent(block.imagePositionY ?? block.backgroundImagePositionY);
|
|
236
241
|
current.media.height = parsePixel(block.imageHeight);
|
|
237
|
-
current.typography.headingAlign = block.textHeadingAlign
|
|
238
|
-
current.typography.bodyAlign = block.textBodyAlign
|
|
242
|
+
current.typography.headingAlign = isTextAlign(block.textHeadingAlign) ? block.textHeadingAlign : current.typography.headingAlign;
|
|
243
|
+
current.typography.bodyAlign = isTextAlign(block.textBodyAlign) ? block.textBodyAlign : current.typography.bodyAlign;
|
|
239
244
|
current.typography.maxTextWidth = block.textMaxWidth === "auto" || block.textMaxWidth === "sm" || block.textMaxWidth === "md" || block.textMaxWidth === "lg" || block.textMaxWidth === "full" ? block.textMaxWidth : current.typography.maxTextWidth;
|
|
240
245
|
current.typography.lineHeightPreset = block.textLineHeightPreset === "tight" || block.textLineHeightPreset === "normal" || block.textLineHeightPreset === "relaxed" ? block.textLineHeightPreset : current.typography.lineHeightPreset;
|
|
241
246
|
current.typography.letterSpacingPreset = block.textLetterSpacingPreset === "tight" || block.textLetterSpacingPreset === "normal" || block.textLetterSpacingPreset === "relaxed" ? block.textLetterSpacingPreset : current.typography.letterSpacingPreset;
|
|
242
247
|
current.advanced.editCopyInPanel = Boolean(block.editCopyInPanel ?? current.advanced.editCopyInPanel);
|
|
243
248
|
current.advanced.customClassName = typeof block.customClassName === "string" ? block.customClassName : current.advanced.customClassName;
|
|
244
249
|
current.advanced.hideOnMobile = Boolean(block.hideOnMobile ?? current.advanced.hideOnMobile);
|
|
245
|
-
|
|
250
|
+
const settings = mergeSettings(current, block.settings);
|
|
251
|
+
if (block.blockType === "hero") {
|
|
252
|
+
const top = settings.layout.paddingTopPt;
|
|
253
|
+
const bottom = settings.layout.paddingBottomPt;
|
|
254
|
+
const hasLegacyLinkedHeroPadding = settings.layout.linkVerticalPadding !== false && (top === null || typeof top === "undefined" || top === 30) && (bottom === null || typeof bottom === "undefined" || bottom === 30 || bottom === 20);
|
|
255
|
+
if (hasLegacyLinkedHeroPadding) {
|
|
256
|
+
settings.layout.linkVerticalPadding = false;
|
|
257
|
+
settings.layout.paddingTopPt = 30;
|
|
258
|
+
settings.layout.paddingBottomPt = 20;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return settings;
|
|
246
262
|
};
|
|
247
263
|
var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
248
264
|
const settings = legacyBlockToV2Settings(blockWithSettings);
|
|
@@ -531,7 +547,33 @@ var alignOptions = [
|
|
|
531
547
|
{ label: "Right", value: "right" },
|
|
532
548
|
{ label: "Justify", value: "justify" }
|
|
533
549
|
];
|
|
534
|
-
var layoutFieldSet = [
|
|
550
|
+
var layoutFieldSet = [
|
|
551
|
+
{
|
|
552
|
+
group: "layout",
|
|
553
|
+
key: "settings.layout.linkVerticalPadding",
|
|
554
|
+
label: "Link Top/Bottom Padding",
|
|
555
|
+
tags: ["spacing", "padding", "vertical"],
|
|
556
|
+
type: "checkbox"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
group: "layout",
|
|
560
|
+
key: "settings.layout.paddingTopPt",
|
|
561
|
+
label: "Top Padding (pt)",
|
|
562
|
+
max: 240,
|
|
563
|
+
min: 0,
|
|
564
|
+
tags: ["spacing", "padding", "top"],
|
|
565
|
+
type: "number"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
group: "layout",
|
|
569
|
+
key: "settings.layout.paddingBottomPt",
|
|
570
|
+
label: "Bottom Padding (pt)",
|
|
571
|
+
max: 240,
|
|
572
|
+
min: 0,
|
|
573
|
+
tags: ["spacing", "padding", "bottom"],
|
|
574
|
+
type: "number"
|
|
575
|
+
}
|
|
576
|
+
];
|
|
535
577
|
var typographyFieldSet = [
|
|
536
578
|
{
|
|
537
579
|
group: "typography",
|
|
@@ -639,6 +681,7 @@ var mediaFieldSet = [
|
|
|
639
681
|
];
|
|
640
682
|
var commonInspectorGroups = [
|
|
641
683
|
{ key: "basics", label: "Basics" },
|
|
684
|
+
{ key: "layout", label: "Layout" },
|
|
642
685
|
{ key: "typography", label: "Typography" },
|
|
643
686
|
{ key: "media", label: "Media" },
|
|
644
687
|
{ key: "advanced", label: "Advanced" }
|
|
@@ -924,6 +967,37 @@ var normalizeNumber = (value, fallback) => {
|
|
|
924
967
|
}
|
|
925
968
|
return fallback;
|
|
926
969
|
};
|
|
970
|
+
var sectionPaddingPointMap = {
|
|
971
|
+
none: 0,
|
|
972
|
+
sm: 17,
|
|
973
|
+
md: 31,
|
|
974
|
+
lg: 41
|
|
975
|
+
};
|
|
976
|
+
var heroDefaultPaddingTopPt = 30;
|
|
977
|
+
var heroDefaultPaddingBottomPt = 20;
|
|
978
|
+
var normalizeSectionPaddingY = (value) => value === "none" || value === "sm" || value === "lg" ? value : "md";
|
|
979
|
+
var normalizePaddingPointValue = (value) => {
|
|
980
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
981
|
+
return Math.max(0, Math.min(240, Math.round(value)));
|
|
982
|
+
}
|
|
983
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
984
|
+
const parsed = Number(value);
|
|
985
|
+
if (Number.isFinite(parsed)) {
|
|
986
|
+
return Math.max(0, Math.min(240, Math.round(parsed)));
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
return null;
|
|
990
|
+
};
|
|
991
|
+
var getEffectiveVerticalPaddingValue = (block, key) => {
|
|
992
|
+
const explicit = normalizePaddingPointValue(getByPath(block, key));
|
|
993
|
+
if (explicit !== null) {
|
|
994
|
+
return explicit;
|
|
995
|
+
}
|
|
996
|
+
const layoutSectionPaddingY = getByPath(block, "settings.layout.sectionPaddingY");
|
|
997
|
+
const legacySectionPaddingY = block.sectionPaddingY;
|
|
998
|
+
const inherited = block.blockType === "hero" ? key === "settings.layout.paddingBottomPt" ? heroDefaultPaddingBottomPt : heroDefaultPaddingTopPt : sectionPaddingPointMap[normalizeSectionPaddingY(layoutSectionPaddingY || legacySectionPaddingY)];
|
|
999
|
+
return inherited;
|
|
1000
|
+
};
|
|
927
1001
|
var getRelationID = (value) => {
|
|
928
1002
|
if (typeof value === "number" || typeof value === "string") {
|
|
929
1003
|
return value;
|
|
@@ -952,6 +1026,12 @@ var toMediaLibraryItem = (value) => {
|
|
|
952
1026
|
};
|
|
953
1027
|
};
|
|
954
1028
|
var mediaLabel = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
1029
|
+
var findMediaLibraryItem = (library, id) => {
|
|
1030
|
+
if (id === null) {
|
|
1031
|
+
return null;
|
|
1032
|
+
}
|
|
1033
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
1034
|
+
};
|
|
955
1035
|
var groupLabel = (key) => commonInspectorGroups.find((group) => group.key === key)?.label || key;
|
|
956
1036
|
function BlockInspectorRenderer({
|
|
957
1037
|
block,
|
|
@@ -1075,8 +1155,9 @@ function BlockInspectorRenderer({
|
|
|
1075
1155
|
title: group.label,
|
|
1076
1156
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "orion-builder-settings-field-list", children: [
|
|
1077
1157
|
group.key === "media" ? effectiveMediaSources.map((source) => {
|
|
1078
|
-
const selectedSourceMedia = toMediaLibraryItem(source.value);
|
|
1079
1158
|
const selectedSourceMediaID = getRelationID(source.value);
|
|
1159
|
+
const selectedRelationMedia = toMediaLibraryItem(source.value);
|
|
1160
|
+
const selectedSourceMedia = selectedRelationMedia ?? findMediaLibraryItem(source.library, selectedSourceMediaID);
|
|
1080
1161
|
const sourceOptions = selectedSourceMedia && !source.library.some((item) => String(item.id) === String(selectedSourceMedia.id)) ? [selectedSourceMedia, ...source.library] : source.library;
|
|
1081
1162
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1082
1163
|
"div",
|
|
@@ -1101,6 +1182,10 @@ function BlockInspectorRenderer({
|
|
|
1101
1182
|
}
|
|
1102
1183
|
)
|
|
1103
1184
|
] }),
|
|
1185
|
+
selectedSourceMedia?.alt ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
1186
|
+
"Media Description",
|
|
1187
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedSourceMedia.alt })
|
|
1188
|
+
] }) : selectedSourceMediaID !== null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
1104
1189
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1105
1190
|
"button",
|
|
1106
1191
|
{
|
|
@@ -1157,19 +1242,20 @@ function BlockInspectorRenderer({
|
|
|
1157
1242
|
}
|
|
1158
1243
|
) : null,
|
|
1159
1244
|
(hasMediaGroupContent ? group.fields.filter((field) => !(group.key === "media" && field.key.startsWith("settings.media."))) : group.fields).map((field) => {
|
|
1160
|
-
if (field.key === "settings.layout.paddingBottomPt" &&
|
|
1245
|
+
if (field.key === "settings.layout.paddingBottomPt" && getByPath(block, "settings.layout.linkVerticalPadding") !== false && block.blockType !== "hero") {
|
|
1161
1246
|
return null;
|
|
1162
1247
|
}
|
|
1163
|
-
if (field.key === "settings.layout.paddingRightPt" &&
|
|
1248
|
+
if (field.key === "settings.layout.paddingRightPt" && getByPath(block, "settings.layout.linkHorizontalPadding") !== false) {
|
|
1164
1249
|
return null;
|
|
1165
1250
|
}
|
|
1166
1251
|
const fieldValue = getByPath(block, field.key);
|
|
1167
1252
|
if (field.type === "checkbox") {
|
|
1253
|
+
const checked = field.key === "settings.layout.linkVerticalPadding" || field.key === "settings.layout.linkHorizontalPadding" ? typeof fieldValue === "boolean" ? fieldValue : block.blockType === "hero" ? false : true : Boolean(fieldValue);
|
|
1168
1254
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "orion-builder-settings-label is-checkbox", children: [
|
|
1169
1255
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1170
1256
|
"input",
|
|
1171
1257
|
{
|
|
1172
|
-
checked
|
|
1258
|
+
checked,
|
|
1173
1259
|
onChange: (event) => updateForKey(field.key, event.target.checked),
|
|
1174
1260
|
type: "checkbox"
|
|
1175
1261
|
}
|
|
@@ -1192,8 +1278,8 @@ function BlockInspectorRenderer({
|
|
|
1192
1278
|
] }, field.key);
|
|
1193
1279
|
}
|
|
1194
1280
|
if (field.type === "number") {
|
|
1195
|
-
const numberValue =
|
|
1196
|
-
const resolvedValue =
|
|
1281
|
+
const numberValue = normalizePaddingPointValue(fieldValue);
|
|
1282
|
+
const resolvedValue = numberValue !== null ? numberValue : field.key === "settings.layout.paddingTopPt" || field.key === "settings.layout.paddingBottomPt" ? getEffectiveVerticalPaddingValue(block, field.key) : "";
|
|
1197
1283
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
1198
1284
|
field.label,
|
|
1199
1285
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -2249,8 +2335,8 @@ function renderSimpleBlockPreview(args) {
|
|
|
2249
2335
|
getImagePresentationStyle: getImagePresentationStyle2,
|
|
2250
2336
|
index,
|
|
2251
2337
|
isBlockUploadTarget,
|
|
2252
|
-
normalizeImageCornerStyle:
|
|
2253
|
-
normalizeImageFit:
|
|
2338
|
+
normalizeImageCornerStyle: normalizeImageCornerStyle3,
|
|
2339
|
+
normalizeImageFit: normalizeImageFit3,
|
|
2254
2340
|
normalizeText: normalizeText3,
|
|
2255
2341
|
onDropAt,
|
|
2256
2342
|
renderWithSectionShell,
|
|
@@ -2434,8 +2520,8 @@ function renderSimpleBlockPreview(args) {
|
|
|
2434
2520
|
const imagePositionX = parseOptionalPercentNumber(mediaSettings.positionX ?? block?.imagePositionX);
|
|
2435
2521
|
const imagePositionY = parseOptionalPercentNumber(mediaSettings.positionY ?? block?.imagePositionY);
|
|
2436
2522
|
const imageStyle = getImagePresentationStyle2({
|
|
2437
|
-
cornerStyle:
|
|
2438
|
-
fit:
|
|
2523
|
+
cornerStyle: normalizeImageCornerStyle3(mediaSettings.cornerStyle ?? block?.imageCornerStyle),
|
|
2524
|
+
fit: normalizeImageFit3(mediaSettings.fit ?? block?.imageFit),
|
|
2439
2525
|
positionX: imagePositionX,
|
|
2440
2526
|
positionY: imagePositionY
|
|
2441
2527
|
});
|
|
@@ -2965,6 +3051,63 @@ var normalizeNumber2 = (value, fallback) => {
|
|
|
2965
3051
|
return fallback;
|
|
2966
3052
|
};
|
|
2967
3053
|
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
3054
|
+
var getRelationID2 = (value) => {
|
|
3055
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
3056
|
+
return value;
|
|
3057
|
+
}
|
|
3058
|
+
if (!isRecord5(value)) {
|
|
3059
|
+
return null;
|
|
3060
|
+
}
|
|
3061
|
+
const id = value.id;
|
|
3062
|
+
return typeof id === "number" || typeof id === "string" ? id : null;
|
|
3063
|
+
};
|
|
3064
|
+
var toMediaLibraryItem2 = (value) => {
|
|
3065
|
+
if (!isRecord5(value)) {
|
|
3066
|
+
return null;
|
|
3067
|
+
}
|
|
3068
|
+
const id = getRelationID2(value);
|
|
3069
|
+
if (id === null) {
|
|
3070
|
+
return null;
|
|
3071
|
+
}
|
|
3072
|
+
const filename = typeof value.filename === "string" ? value.filename : "";
|
|
3073
|
+
const url = typeof value.url === "string" && value.url.length > 0 ? value.url : filename ? `/api/media/file/${encodeURIComponent(filename)}` : "";
|
|
3074
|
+
return {
|
|
3075
|
+
alt: typeof value.alt === "string" ? value.alt : "",
|
|
3076
|
+
filename,
|
|
3077
|
+
id,
|
|
3078
|
+
url
|
|
3079
|
+
};
|
|
3080
|
+
};
|
|
3081
|
+
var mediaLabel2 = (item) => item.filename || item.alt || `Media #${item.id}`;
|
|
3082
|
+
var findMediaLibraryItem2 = (library, id) => {
|
|
3083
|
+
if (id === null) {
|
|
3084
|
+
return null;
|
|
3085
|
+
}
|
|
3086
|
+
return library.find((item) => String(item.id) === String(id)) || null;
|
|
3087
|
+
};
|
|
3088
|
+
var normalizeImageFit = (value) => value === "contain" ? "contain" : "cover";
|
|
3089
|
+
var normalizeImageCornerStyle = (value) => value === "square" ? "square" : "rounded";
|
|
3090
|
+
var getItemMediaSettings = (item) => {
|
|
3091
|
+
const settings = isRecord5(item.settings) ? item.settings : {};
|
|
3092
|
+
const media = isRecord5(settings.media) ? settings.media : {};
|
|
3093
|
+
return {
|
|
3094
|
+
cornerStyle: normalizeImageCornerStyle(media.cornerStyle ?? item.imageCornerStyle),
|
|
3095
|
+
fit: normalizeImageFit(media.fit ?? item.imageFit),
|
|
3096
|
+
height: (() => {
|
|
3097
|
+
const value = media.height ?? item.imageHeight;
|
|
3098
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
3099
|
+
return value;
|
|
3100
|
+
}
|
|
3101
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
3102
|
+
const parsed = Number(value);
|
|
3103
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
3104
|
+
}
|
|
3105
|
+
return null;
|
|
3106
|
+
})(),
|
|
3107
|
+
positionX: clamp(normalizeNumber2(media.positionX ?? item.imagePositionX, 50), 0, 100),
|
|
3108
|
+
positionY: clamp(normalizeNumber2(media.positionY ?? item.imagePositionY, 50), 0, 100)
|
|
3109
|
+
};
|
|
3110
|
+
};
|
|
2968
3111
|
var hasQueryMatch = (query, ...values) => {
|
|
2969
3112
|
const normalized = query.trim().toLowerCase();
|
|
2970
3113
|
if (!normalized) {
|
|
@@ -3011,18 +3154,157 @@ var bulletsToTextareaValue = (value) => {
|
|
|
3011
3154
|
return value.map((item) => isRecord5(item) && typeof item.label === "string" ? item.label.trim() : "").filter(Boolean).join("\n");
|
|
3012
3155
|
};
|
|
3013
3156
|
var textareaValueToBullets = (value) => value.split("\n").map((line) => line.trim()).filter(Boolean).map((label) => ({ label }));
|
|
3157
|
+
function ItemMediaControl({
|
|
3158
|
+
fieldName,
|
|
3159
|
+
imageURLFieldName,
|
|
3160
|
+
item,
|
|
3161
|
+
itemIndex,
|
|
3162
|
+
label,
|
|
3163
|
+
mediaLibrary,
|
|
3164
|
+
mediaLibraryError,
|
|
3165
|
+
mediaLibraryLoading,
|
|
3166
|
+
maxHeight,
|
|
3167
|
+
minHeight,
|
|
3168
|
+
onRemoveItemMedia,
|
|
3169
|
+
onSelectItemMedia,
|
|
3170
|
+
onUpdateItemField,
|
|
3171
|
+
onUpdateItemMediaPresentation,
|
|
3172
|
+
onUploadItemMedia,
|
|
3173
|
+
searchQuery,
|
|
3174
|
+
uploadDisabled,
|
|
3175
|
+
uploadLabel,
|
|
3176
|
+
uploading
|
|
3177
|
+
}) {
|
|
3178
|
+
const selectedMediaID = getRelationID2(item[fieldName]);
|
|
3179
|
+
const selectedRelationMedia = toMediaLibraryItem2(item[fieldName]);
|
|
3180
|
+
const selectedMedia = selectedRelationMedia ?? findMediaLibraryItem2(mediaLibrary, selectedMediaID);
|
|
3181
|
+
const directImageURL = normalizeText(item[imageURLFieldName]);
|
|
3182
|
+
const previewURL = selectedMedia?.url || directImageURL;
|
|
3183
|
+
const mediaSettings = getItemMediaSettings(item);
|
|
3184
|
+
const sourceOptions = selectedMedia && !mediaLibrary.some((libraryItem) => String(libraryItem.id) === String(selectedMedia.id)) ? [selectedMedia, ...mediaLibrary] : mediaLibrary;
|
|
3185
|
+
if (!hasQueryMatch(searchQuery, label, "image", "media", "photo", "picture", "url", "fit", "crop", "height")) {
|
|
3186
|
+
return null;
|
|
3187
|
+
}
|
|
3188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "orion-builder-settings-item-card", style: { padding: "0.56rem" }, children: [
|
|
3189
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "orion-builder-settings-label", children: label }),
|
|
3190
|
+
previewURL ? (
|
|
3191
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3193
|
+
"img",
|
|
3194
|
+
{
|
|
3195
|
+
alt: selectedMedia?.alt || label,
|
|
3196
|
+
src: previewURL,
|
|
3197
|
+
style: {
|
|
3198
|
+
aspectRatio: "16 / 9",
|
|
3199
|
+
border: "1px solid rgba(35, 51, 82, 0.14)",
|
|
3200
|
+
borderRadius: mediaSettings.cornerStyle === "square" ? 4 : 10,
|
|
3201
|
+
display: "block",
|
|
3202
|
+
objectFit: mediaSettings.fit,
|
|
3203
|
+
objectPosition: `${mediaSettings.positionX}% ${mediaSettings.positionY}%`,
|
|
3204
|
+
width: "100%"
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
)
|
|
3208
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "orion-builder-settings-empty", children: "No image selected." }),
|
|
3209
|
+
mediaLibraryLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "orion-builder-settings-note", children: "Loading media library..." }) : null,
|
|
3210
|
+
mediaLibraryError ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "orion-builder-settings-error", children: mediaLibraryError }) : null,
|
|
3211
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
3212
|
+
"Media Library Image",
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3214
|
+
"select",
|
|
3215
|
+
{
|
|
3216
|
+
className: "orion-builder-settings-input",
|
|
3217
|
+
onChange: (event) => onSelectItemMedia?.(itemIndex, fieldName, event.target.value),
|
|
3218
|
+
value: selectedMediaID !== null ? String(selectedMediaID) : "",
|
|
3219
|
+
children: [
|
|
3220
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "No library image" }),
|
|
3221
|
+
sourceOptions.map((libraryItem) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: String(libraryItem.id), children: mediaLabel2(libraryItem) }, String(libraryItem.id)))
|
|
3222
|
+
]
|
|
3223
|
+
}
|
|
3224
|
+
)
|
|
3225
|
+
] }),
|
|
3226
|
+
selectedMedia?.alt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
3227
|
+
"Media Description",
|
|
3228
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { className: "orion-builder-settings-input", readOnly: true, type: "text", value: selectedMedia.alt })
|
|
3229
|
+
] }) : selectedMediaID !== null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "orion-builder-settings-note", children: "This media item does not have a description yet." }) : null,
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3231
|
+
"button",
|
|
3232
|
+
{
|
|
3233
|
+
className: "orion-builder-settings-inline-btn",
|
|
3234
|
+
disabled: selectedMediaID === null,
|
|
3235
|
+
onClick: () => onRemoveItemMedia?.(itemIndex, fieldName),
|
|
3236
|
+
type: "button",
|
|
3237
|
+
children: "Remove Library Image"
|
|
3238
|
+
}
|
|
3239
|
+
),
|
|
3240
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
3241
|
+
"Direct Image URL",
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3243
|
+
"input",
|
|
3244
|
+
{
|
|
3245
|
+
className: "orion-builder-settings-input",
|
|
3246
|
+
onChange: (event) => onUpdateItemField(itemIndex, imageURLFieldName, event.target.value),
|
|
3247
|
+
type: "text",
|
|
3248
|
+
value: directImageURL
|
|
3249
|
+
}
|
|
3250
|
+
)
|
|
3251
|
+
] }),
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
3253
|
+
uploadLabel,
|
|
3254
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3255
|
+
"input",
|
|
3256
|
+
{
|
|
3257
|
+
accept: "image/*",
|
|
3258
|
+
className: "orion-builder-settings-input",
|
|
3259
|
+
disabled: uploadDisabled,
|
|
3260
|
+
onChange: (event) => {
|
|
3261
|
+
const file = event.currentTarget.files?.[0];
|
|
3262
|
+
if (file) {
|
|
3263
|
+
onUploadItemMedia?.(itemIndex, fieldName, file);
|
|
3264
|
+
}
|
|
3265
|
+
event.currentTarget.value = "";
|
|
3266
|
+
},
|
|
3267
|
+
type: "file"
|
|
3268
|
+
}
|
|
3269
|
+
)
|
|
3270
|
+
] }),
|
|
3271
|
+
uploading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "orion-builder-settings-note", children: "Uploading image..." }) : null,
|
|
3272
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3273
|
+
ImageControls,
|
|
3274
|
+
{
|
|
3275
|
+
cornerStyle: mediaSettings.cornerStyle,
|
|
3276
|
+
fit: mediaSettings.fit,
|
|
3277
|
+
height: mediaSettings.height,
|
|
3278
|
+
maxHeight,
|
|
3279
|
+
minHeight,
|
|
3280
|
+
onChange: (field, value) => onUpdateItemMediaPresentation?.(itemIndex, field, value),
|
|
3281
|
+
positionX: mediaSettings.positionX,
|
|
3282
|
+
positionY: mediaSettings.positionY
|
|
3283
|
+
}
|
|
3284
|
+
)
|
|
3285
|
+
] });
|
|
3286
|
+
}
|
|
3014
3287
|
function ArrayItemsEditor({
|
|
3015
3288
|
blockType,
|
|
3016
3289
|
expandedItemIndex,
|
|
3017
3290
|
items,
|
|
3291
|
+
mediaLibrary = [],
|
|
3292
|
+
mediaLibraryError = "",
|
|
3293
|
+
mediaLibraryLoading = false,
|
|
3018
3294
|
mode,
|
|
3019
3295
|
onAddItem,
|
|
3296
|
+
onRemoveItemMedia,
|
|
3020
3297
|
onRemoveItem,
|
|
3298
|
+
onSelectItemMedia,
|
|
3021
3299
|
onToggleItem,
|
|
3022
3300
|
onUpdateItemField,
|
|
3301
|
+
onUpdateItemMediaPresentation,
|
|
3023
3302
|
onUpdateItemSetting,
|
|
3303
|
+
onUploadItemMedia,
|
|
3024
3304
|
searchQuery,
|
|
3025
|
-
showInlineCopyFields
|
|
3305
|
+
showInlineCopyFields,
|
|
3306
|
+
uploadDisabled = false,
|
|
3307
|
+
isItemMediaUploading
|
|
3026
3308
|
}) {
|
|
3027
3309
|
const config = blockConfig[blockType];
|
|
3028
3310
|
const normalizedQuery = searchQuery.trim().toLowerCase();
|
|
@@ -3172,11 +3454,30 @@ function ArrayItemsEditor({
|
|
|
3172
3454
|
}
|
|
3173
3455
|
)
|
|
3174
3456
|
] }) : null,
|
|
3175
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3457
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3458
|
+
ItemMediaControl,
|
|
3459
|
+
{
|
|
3460
|
+
fieldName: "media",
|
|
3461
|
+
imageURLFieldName: "imageURL",
|
|
3462
|
+
item,
|
|
3463
|
+
itemIndex,
|
|
3464
|
+
label: "Feature Image",
|
|
3465
|
+
maxHeight: 600,
|
|
3466
|
+
mediaLibrary,
|
|
3467
|
+
mediaLibraryError,
|
|
3468
|
+
mediaLibraryLoading,
|
|
3469
|
+
minHeight: 40,
|
|
3470
|
+
onRemoveItemMedia,
|
|
3471
|
+
onSelectItemMedia,
|
|
3472
|
+
onUpdateItemField,
|
|
3473
|
+
onUpdateItemMediaPresentation,
|
|
3474
|
+
onUploadItemMedia,
|
|
3475
|
+
searchQuery: normalizedQuery,
|
|
3476
|
+
uploadDisabled,
|
|
3477
|
+
uploadLabel: "Upload Feature Image",
|
|
3478
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "media"))
|
|
3479
|
+
}
|
|
3480
|
+
)
|
|
3180
3481
|
] }) : null,
|
|
3181
3482
|
blockType === "logoWall" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
3182
3483
|
showInlineCopyFields ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
@@ -3203,11 +3504,30 @@ function ArrayItemsEditor({
|
|
|
3203
3504
|
}
|
|
3204
3505
|
)
|
|
3205
3506
|
] }) : null,
|
|
3206
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3508
|
+
ItemMediaControl,
|
|
3509
|
+
{
|
|
3510
|
+
fieldName: "media",
|
|
3511
|
+
imageURLFieldName: "imageURL",
|
|
3512
|
+
item,
|
|
3513
|
+
itemIndex,
|
|
3514
|
+
label: "Logo Image",
|
|
3515
|
+
maxHeight: 200,
|
|
3516
|
+
mediaLibrary,
|
|
3517
|
+
mediaLibraryError,
|
|
3518
|
+
mediaLibraryLoading,
|
|
3519
|
+
minHeight: 24,
|
|
3520
|
+
onRemoveItemMedia,
|
|
3521
|
+
onSelectItemMedia,
|
|
3522
|
+
onUpdateItemField,
|
|
3523
|
+
onUpdateItemMediaPresentation,
|
|
3524
|
+
onUploadItemMedia,
|
|
3525
|
+
searchQuery: normalizedQuery,
|
|
3526
|
+
uploadDisabled,
|
|
3527
|
+
uploadLabel: "Upload Logo Image",
|
|
3528
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "media"))
|
|
3529
|
+
}
|
|
3530
|
+
)
|
|
3211
3531
|
] }) : null,
|
|
3212
3532
|
blockType === "beforeAfter" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
3213
3533
|
showInlineCopyFields ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
@@ -3235,11 +3555,54 @@ function ArrayItemsEditor({
|
|
|
3235
3555
|
)
|
|
3236
3556
|
] })
|
|
3237
3557
|
] }) : null,
|
|
3238
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3558
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3559
|
+
ItemMediaControl,
|
|
3560
|
+
{
|
|
3561
|
+
fieldName: "beforeMedia",
|
|
3562
|
+
imageURLFieldName: "beforeImageURL",
|
|
3563
|
+
item,
|
|
3564
|
+
itemIndex,
|
|
3565
|
+
label: "Before Image",
|
|
3566
|
+
maxHeight: 600,
|
|
3567
|
+
mediaLibrary,
|
|
3568
|
+
mediaLibraryError,
|
|
3569
|
+
mediaLibraryLoading,
|
|
3570
|
+
minHeight: 60,
|
|
3571
|
+
onRemoveItemMedia,
|
|
3572
|
+
onSelectItemMedia,
|
|
3573
|
+
onUpdateItemField,
|
|
3574
|
+
onUpdateItemMediaPresentation,
|
|
3575
|
+
onUploadItemMedia,
|
|
3576
|
+
searchQuery: normalizedQuery,
|
|
3577
|
+
uploadDisabled,
|
|
3578
|
+
uploadLabel: "Upload Before Image",
|
|
3579
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "beforeMedia"))
|
|
3580
|
+
}
|
|
3581
|
+
),
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3583
|
+
ItemMediaControl,
|
|
3584
|
+
{
|
|
3585
|
+
fieldName: "afterMedia",
|
|
3586
|
+
imageURLFieldName: "afterImageURL",
|
|
3587
|
+
item,
|
|
3588
|
+
itemIndex,
|
|
3589
|
+
label: "After Image",
|
|
3590
|
+
maxHeight: 600,
|
|
3591
|
+
mediaLibrary,
|
|
3592
|
+
mediaLibraryError,
|
|
3593
|
+
mediaLibraryLoading,
|
|
3594
|
+
minHeight: 60,
|
|
3595
|
+
onRemoveItemMedia,
|
|
3596
|
+
onSelectItemMedia,
|
|
3597
|
+
onUpdateItemField,
|
|
3598
|
+
onUpdateItemMediaPresentation,
|
|
3599
|
+
onUploadItemMedia,
|
|
3600
|
+
searchQuery: normalizedQuery,
|
|
3601
|
+
uploadDisabled,
|
|
3602
|
+
uploadLabel: "Upload After Image",
|
|
3603
|
+
uploading: Boolean(isItemMediaUploading?.(itemIndex, "afterMedia"))
|
|
3604
|
+
}
|
|
3605
|
+
)
|
|
3243
3606
|
] }) : null,
|
|
3244
3607
|
blockType === "stats" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: showInlineCopyFields ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
3245
3608
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
@@ -3445,8 +3808,8 @@ var resolveBuilderMediumHeroHeight = (topViewportHeight) => {
|
|
|
3445
3808
|
}
|
|
3446
3809
|
return "50svh";
|
|
3447
3810
|
};
|
|
3448
|
-
var
|
|
3449
|
-
var
|
|
3811
|
+
var normalizeImageFit2 = (value) => normalizeHeroImageFit(value);
|
|
3812
|
+
var normalizeImageCornerStyle2 = (value, legacyFitValue) => normalizeHeroImageCornerStyle(value, legacyFitValue);
|
|
3450
3813
|
var positionPercent = (value, fit) => {
|
|
3451
3814
|
const resolved = fit === "cover" && (value === "left" || value === "right") ? "center" : value;
|
|
3452
3815
|
switch (resolved) {
|
|
@@ -3615,6 +3978,8 @@ var sectionPaddingMap = {
|
|
|
3615
3978
|
md: "2.6rem",
|
|
3616
3979
|
lg: "3.4rem"
|
|
3617
3980
|
};
|
|
3981
|
+
var heroDefaultPaddingTop = "30pt";
|
|
3982
|
+
var heroDefaultPaddingBottom = "20pt";
|
|
3618
3983
|
var quickAddBlockTypes = [
|
|
3619
3984
|
"hero",
|
|
3620
3985
|
"featureGrid",
|
|
@@ -3878,6 +4243,12 @@ function getThemeColorOverride(tokens, colorKey) {
|
|
|
3878
4243
|
const normalized = value.trim();
|
|
3879
4244
|
return normalized.length > 0 ? normalized : null;
|
|
3880
4245
|
}
|
|
4246
|
+
function normalizeCustomClassName(value) {
|
|
4247
|
+
if (typeof value !== "string") {
|
|
4248
|
+
return "";
|
|
4249
|
+
}
|
|
4250
|
+
return value.split(/\s+/).map((className) => className.trim()).filter(Boolean).join(" ");
|
|
4251
|
+
}
|
|
3881
4252
|
var sectionStyleFromBlock = (block, pageDefaults) => {
|
|
3882
4253
|
const settings = isRecord6(block.settings) ? block.settings : {};
|
|
3883
4254
|
const layoutSettings = isRecord6(settings.layout) ? settings.layout : {};
|
|
@@ -3963,15 +4334,15 @@ var sectionStyleFromBlock = (block, pageDefaults) => {
|
|
|
3963
4334
|
} : {},
|
|
3964
4335
|
sectionClass: `orion-builder-shell is-${pageDefaults.pageWidthDefault} padx-${resolvedSectionPaddingX}`,
|
|
3965
4336
|
sectionInnerStyle: {
|
|
3966
|
-
paddingBottom: customPaddingBottom === null ? sectionPaddingMap[sectionPaddingY] : `${customPaddingBottom}pt`,
|
|
4337
|
+
paddingBottom: customPaddingBottom === null ? block.blockType === "hero" ? heroDefaultPaddingBottom : sectionPaddingMap[sectionPaddingY] : `${customPaddingBottom}pt`,
|
|
3967
4338
|
paddingLeft: customPaddingLeft === null ? void 0 : `${customPaddingLeft}pt`,
|
|
3968
4339
|
paddingRight: customPaddingRight === null ? void 0 : `${customPaddingRight}pt`,
|
|
3969
|
-
paddingTop: customPaddingTop === null ? sectionPaddingMap[sectionPaddingY] : `${customPaddingTop}pt`
|
|
4340
|
+
paddingTop: customPaddingTop === null ? block.blockType === "hero" ? heroDefaultPaddingTop : sectionPaddingMap[sectionPaddingY] : `${customPaddingTop}pt`
|
|
3970
4341
|
},
|
|
3971
4342
|
sectionStyle: sectionMode === "color" ? { background: sectionColor } : sectionMode === "gradient" ? { background: sectionGradient } : block.blockType === "hero" ? { background: "transparent" } : {}
|
|
3972
4343
|
};
|
|
3973
4344
|
};
|
|
3974
|
-
function
|
|
4345
|
+
function getRelationID3(value) {
|
|
3975
4346
|
if (typeof value === "number" || typeof value === "string") {
|
|
3976
4347
|
return value;
|
|
3977
4348
|
}
|
|
@@ -4004,7 +4375,7 @@ function extractUploadedMedia(value) {
|
|
|
4004
4375
|
if (!candidate || typeof candidate !== "object") {
|
|
4005
4376
|
return null;
|
|
4006
4377
|
}
|
|
4007
|
-
const id =
|
|
4378
|
+
const id = getRelationID3(candidate);
|
|
4008
4379
|
if (id === null) {
|
|
4009
4380
|
return null;
|
|
4010
4381
|
}
|
|
@@ -4015,11 +4386,11 @@ function extractUploadedMedia(value) {
|
|
|
4015
4386
|
url: typeof candidate.url === "string" ? candidate.url : ""
|
|
4016
4387
|
};
|
|
4017
4388
|
}
|
|
4018
|
-
function
|
|
4389
|
+
function toMediaLibraryItem3(value) {
|
|
4019
4390
|
if (!value || typeof value !== "object") {
|
|
4020
4391
|
return null;
|
|
4021
4392
|
}
|
|
4022
|
-
const id =
|
|
4393
|
+
const id = getRelationID3(value);
|
|
4023
4394
|
if (id === null) {
|
|
4024
4395
|
return null;
|
|
4025
4396
|
}
|
|
@@ -4197,7 +4568,7 @@ function BuilderPageEditor({
|
|
|
4197
4568
|
}
|
|
4198
4569
|
const json = await response.json();
|
|
4199
4570
|
const docs = Array.isArray(json.docs) ? json.docs : [];
|
|
4200
|
-
const items = docs.map((doc2) =>
|
|
4571
|
+
const items = docs.map((doc2) => toMediaLibraryItem3(doc2)).filter((item) => item !== null);
|
|
4201
4572
|
setMediaLibrary(items);
|
|
4202
4573
|
} catch (error) {
|
|
4203
4574
|
setMediaLibraryError(error instanceof Error ? error.message : "Could not load media library.");
|
|
@@ -4551,7 +4922,7 @@ function BuilderPageEditor({
|
|
|
4551
4922
|
const nextLayout = cloneBlockLayout(layout);
|
|
4552
4923
|
const block = nextLayout[selectedIndex];
|
|
4553
4924
|
if (target.kind === "hero") {
|
|
4554
|
-
const uploadedItem =
|
|
4925
|
+
const uploadedItem = toMediaLibraryItem3(uploaded);
|
|
4555
4926
|
nextLayout[selectedIndex] = {
|
|
4556
4927
|
...block,
|
|
4557
4928
|
backgroundImageURL: uploadedItem?.url || normalizeText2(uploaded.url),
|
|
@@ -4615,13 +4986,13 @@ function BuilderPageEditor({
|
|
|
4615
4986
|
const nextBlock = { ...migrateBlockToSettingsV2(block) };
|
|
4616
4987
|
const blockType = normalizeText2(nextBlock.blockType);
|
|
4617
4988
|
if (blockType === "hero") {
|
|
4618
|
-
const mediaID =
|
|
4989
|
+
const mediaID = getRelationID3(nextBlock.media);
|
|
4619
4990
|
if (mediaID !== null) {
|
|
4620
4991
|
nextBlock.media = mediaID;
|
|
4621
4992
|
}
|
|
4622
4993
|
}
|
|
4623
4994
|
if (blockType === "media") {
|
|
4624
|
-
const imageID =
|
|
4995
|
+
const imageID = getRelationID3(nextBlock.image);
|
|
4625
4996
|
if (imageID !== null) {
|
|
4626
4997
|
nextBlock.image = imageID;
|
|
4627
4998
|
}
|
|
@@ -4633,15 +5004,15 @@ function BuilderPageEditor({
|
|
|
4633
5004
|
return rawItem;
|
|
4634
5005
|
}
|
|
4635
5006
|
const nextItem = { ...rawItem };
|
|
4636
|
-
const mediaID =
|
|
5007
|
+
const mediaID = getRelationID3(nextItem.media);
|
|
4637
5008
|
if (mediaID !== null) {
|
|
4638
5009
|
nextItem.media = mediaID;
|
|
4639
5010
|
}
|
|
4640
|
-
const beforeMediaID =
|
|
5011
|
+
const beforeMediaID = getRelationID3(nextItem.beforeMedia);
|
|
4641
5012
|
if (beforeMediaID !== null) {
|
|
4642
5013
|
nextItem.beforeMedia = beforeMediaID;
|
|
4643
5014
|
}
|
|
4644
|
-
const afterMediaID =
|
|
5015
|
+
const afterMediaID = getRelationID3(nextItem.afterMedia);
|
|
4645
5016
|
if (afterMediaID !== null) {
|
|
4646
5017
|
nextItem.afterMedia = afterMediaID;
|
|
4647
5018
|
}
|
|
@@ -4697,6 +5068,7 @@ function BuilderPageEditor({
|
|
|
4697
5068
|
const inheritProjectStyles = options?.inheritProjectStyles === true;
|
|
4698
5069
|
const shell = sectionStyleFromBlock(block, pageDefaults);
|
|
4699
5070
|
const blockSettings = isRecord6(block.settings) ? block.settings : {};
|
|
5071
|
+
const blockAdvanced = isRecord6(blockSettings.advanced) ? blockSettings.advanced : {};
|
|
4700
5072
|
const blockTypography = isRecord6(blockSettings.typography) ? blockSettings.typography : {};
|
|
4701
5073
|
const blockTheme = isRecord6(blockSettings.theme) ? blockSettings.theme : {};
|
|
4702
5074
|
const heroBackgroundColor = normalizeText2(block.backgroundColor).trim();
|
|
@@ -4704,8 +5076,9 @@ function BuilderPageEditor({
|
|
|
4704
5076
|
const heroMedia = block.blockType === "hero" ? resolveMedia(block.media) : null;
|
|
4705
5077
|
const heroHasImage = block.blockType === "hero" && Boolean(heroBackgroundImageURL || heroMedia?.url);
|
|
4706
5078
|
const heroTextColor = block.blockType === "hero" ? heroHasImage ? "#ffffff" : heroBackgroundColor ? getReadableTextColor(heroBackgroundColor, resolvedThemeTokens.colors.headingText, "#ffffff") : resolvedThemeTokens.colors.headingText : null;
|
|
5079
|
+
const bodyAlign = blockTypography.bodyAlign === "center" || blockTypography.bodyAlign === "justify" || blockTypography.bodyAlign === "right" ? blockTypography.bodyAlign : "left";
|
|
4707
5080
|
const typographyStyle = resolveTypographyStyleFromSettings({
|
|
4708
|
-
bodyAlign
|
|
5081
|
+
bodyAlign,
|
|
4709
5082
|
letterSpacingPreset: blockTypography.letterSpacingPreset === "tight" || blockTypography.letterSpacingPreset === "relaxed" ? blockTypography.letterSpacingPreset : "normal",
|
|
4710
5083
|
lineHeightPreset: blockTypography.lineHeightPreset === "tight" || blockTypography.lineHeightPreset === "relaxed" ? blockTypography.lineHeightPreset : "normal",
|
|
4711
5084
|
maxTextWidth: blockTypography.maxTextWidth === "sm" || blockTypography.maxTextWidth === "md" || blockTypography.maxTextWidth === "lg" || blockTypography.maxTextWidth === "full" ? blockTypography.maxTextWidth : "auto"
|
|
@@ -4713,14 +5086,24 @@ function BuilderPageEditor({
|
|
|
4713
5086
|
const headingAlign = blockTypography.headingAlign === "center" || blockTypography.headingAlign === "justify" || blockTypography.headingAlign === "right" ? blockTypography.headingAlign : "left";
|
|
4714
5087
|
const headingColor = getThemeColorOverride(blockTheme, "headingText") || getThemeColorOverride(pageDefaults.themePage, "headingText") || getThemeColorOverride(siteThemeTokens, "headingText") || heroTextColor || resolvedThemeTokens.colors.headingText;
|
|
4715
5088
|
const bodyColor = getThemeColorOverride(blockTheme, "bodyText") || getThemeColorOverride(pageDefaults.themePage, "bodyText") || getThemeColorOverride(siteThemeTokens, "bodyText") || heroTextColor || resolvedThemeTokens.colors.bodyText;
|
|
4716
|
-
|
|
5089
|
+
const customClassName = normalizeCustomClassName(blockAdvanced.customClassName ?? block.customClassName);
|
|
5090
|
+
const hideOnMobile = Boolean(blockAdvanced.hideOnMobile ?? block.hideOnMobile);
|
|
5091
|
+
const sectionClassName = [
|
|
5092
|
+
className,
|
|
5093
|
+
shell.sectionClass,
|
|
5094
|
+
customClassName,
|
|
5095
|
+
hideOnMobile ? "orion-builder-hide-mobile" : ""
|
|
5096
|
+
].filter(Boolean).join(" ");
|
|
5097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("section", { className: sectionClassName, style: shell.sectionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: shell.sectionInnerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4717
5098
|
"div",
|
|
4718
5099
|
{
|
|
4719
5100
|
className: shell.contentClass,
|
|
4720
5101
|
style: {
|
|
4721
5102
|
...shell.contentStyle,
|
|
5103
|
+
"--orion-builder-heading-align": headingAlign,
|
|
5104
|
+
"--orion-builder-body-align": bodyAlign,
|
|
5105
|
+
"--orion-builder-actions-align": bodyAlign === "center" ? "center" : bodyAlign === "right" ? "flex-end" : "flex-start",
|
|
4722
5106
|
...inheritProjectStyles ? {} : {
|
|
4723
|
-
"--orion-builder-heading-align": headingAlign,
|
|
4724
5107
|
"--orion-builder-heading-color": headingColor,
|
|
4725
5108
|
color: bodyColor,
|
|
4726
5109
|
...typographyStyle
|
|
@@ -5207,8 +5590,8 @@ function BuilderPageEditor({
|
|
|
5207
5590
|
}
|
|
5208
5591
|
] : [];
|
|
5209
5592
|
const selectedMediaImageControls = selectedItemRecord && typeof selectedItemIndex === "number" && (selectedType === "featureGrid" || selectedType === "logoWall" || selectedType === "beforeAfter") ? {
|
|
5210
|
-
cornerStyle:
|
|
5211
|
-
fit:
|
|
5593
|
+
cornerStyle: normalizeImageCornerStyle2(selectedItemRecord.imageCornerStyle),
|
|
5594
|
+
fit: normalizeImageFit2(selectedItemRecord.imageFit),
|
|
5212
5595
|
height: (() => {
|
|
5213
5596
|
if (typeof selectedItemRecord.imageHeight === "number" && Number.isFinite(selectedItemRecord.imageHeight)) {
|
|
5214
5597
|
return selectedItemRecord.imageHeight;
|
|
@@ -5683,8 +6066,8 @@ function BuilderPageEditor({
|
|
|
5683
6066
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
5684
6067
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
5685
6068
|
const itemImageStyle = getImagePresentationStyle({
|
|
5686
|
-
cornerStyle:
|
|
5687
|
-
fit:
|
|
6069
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6070
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
5688
6071
|
positionX: itemPositionX,
|
|
5689
6072
|
positionY: itemPositionY
|
|
5690
6073
|
});
|
|
@@ -5801,8 +6184,8 @@ function BuilderPageEditor({
|
|
|
5801
6184
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
5802
6185
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
5803
6186
|
const itemImageStyle = getImagePresentationStyle({
|
|
5804
|
-
cornerStyle:
|
|
5805
|
-
fit:
|
|
6187
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6188
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
5806
6189
|
positionX: itemPositionX,
|
|
5807
6190
|
positionY: itemPositionY
|
|
5808
6191
|
});
|
|
@@ -6008,8 +6391,8 @@ function BuilderPageEditor({
|
|
|
6008
6391
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
6009
6392
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
6010
6393
|
const imageStyle = getImagePresentationStyle({
|
|
6011
|
-
cornerStyle:
|
|
6012
|
-
fit:
|
|
6394
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6395
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
6013
6396
|
positionX: itemPositionX,
|
|
6014
6397
|
positionY: itemPositionY,
|
|
6015
6398
|
roundedRadius: 10
|
|
@@ -6122,8 +6505,8 @@ function BuilderPageEditor({
|
|
|
6122
6505
|
const itemPositionX = parseOptionalPercentNumber2(itemRecord?.imagePositionX);
|
|
6123
6506
|
const itemPositionY = parseOptionalPercentNumber2(itemRecord?.imagePositionY);
|
|
6124
6507
|
const imageStyle = getImagePresentationStyle({
|
|
6125
|
-
cornerStyle:
|
|
6126
|
-
fit:
|
|
6508
|
+
cornerStyle: normalizeImageCornerStyle2(itemRecord?.imageCornerStyle),
|
|
6509
|
+
fit: normalizeImageFit2(itemRecord?.imageFit),
|
|
6127
6510
|
positionX: itemPositionX,
|
|
6128
6511
|
positionY: itemPositionY
|
|
6129
6512
|
});
|
|
@@ -6429,8 +6812,8 @@ function BuilderPageEditor({
|
|
|
6429
6812
|
getImagePresentationStyle,
|
|
6430
6813
|
index,
|
|
6431
6814
|
isBlockUploadTarget,
|
|
6432
|
-
normalizeImageCornerStyle,
|
|
6433
|
-
normalizeImageFit,
|
|
6815
|
+
normalizeImageCornerStyle: normalizeImageCornerStyle2,
|
|
6816
|
+
normalizeImageFit: normalizeImageFit2,
|
|
6434
6817
|
normalizeText: normalizeText2,
|
|
6435
6818
|
onDropAt,
|
|
6436
6819
|
renderWithSectionShell,
|
|
@@ -6659,23 +7042,32 @@ function BuilderPageEditor({
|
|
|
6659
7042
|
blockType: selectedType,
|
|
6660
7043
|
expandedItemIndex,
|
|
6661
7044
|
items: selectedItems,
|
|
7045
|
+
isItemMediaUploading: isSelectedItemMediaUploading,
|
|
7046
|
+
mediaLibrary,
|
|
7047
|
+
mediaLibraryError,
|
|
7048
|
+
mediaLibraryLoading,
|
|
6662
7049
|
mode: settingsPanelMode,
|
|
6663
7050
|
onAddItem: appendDefaultItemToSelected,
|
|
6664
7051
|
onRemoveItem: (itemIndex) => removeItemFromSelected("items", itemIndex),
|
|
7052
|
+
onRemoveItemMedia: (itemIndex, fieldName) => setSelectedItemMediaFieldFromLibrary(itemIndex, fieldName, ""),
|
|
7053
|
+
onSelectItemMedia: (itemIndex, fieldName, mediaID) => setSelectedItemMediaFieldFromLibrary(itemIndex, fieldName, mediaID),
|
|
6665
7054
|
onToggleItem: toggleSelectedItem,
|
|
6666
7055
|
onUpdateItemField: (itemIndex, fieldName, value) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, fieldName, value),
|
|
7056
|
+
onUpdateItemMediaPresentation: (itemIndex, fieldName, value) => updateArrayItemSettingField(selectedIndex ?? 0, "items", itemIndex, `media.${fieldName}`, value),
|
|
6667
7057
|
onUpdateItemSetting: (itemIndex, path, value) => updateArrayItemSettingField(selectedIndex ?? 0, "items", itemIndex, path, value),
|
|
7058
|
+
onUploadItemMedia: uploadItemMediaFromV2,
|
|
6668
7059
|
searchQuery: settingsSearchQuery,
|
|
6669
|
-
showInlineCopyFields: editCopyInPanelEnabled
|
|
7060
|
+
showInlineCopyFields: editCopyInPanelEnabled,
|
|
7061
|
+
uploadDisabled: uploadingTarget !== null
|
|
6670
7062
|
}
|
|
6671
7063
|
) : null,
|
|
6672
7064
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { style: sidebarLabelStyle, children: [
|
|
6673
|
-
"Upload Alt Text",
|
|
7065
|
+
"New Upload Alt Text",
|
|
6674
7066
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
6675
7067
|
"input",
|
|
6676
7068
|
{
|
|
6677
7069
|
onChange: (event) => setUploadAltText(event.target.value),
|
|
6678
|
-
placeholder: "
|
|
7070
|
+
placeholder: "Used only when uploading a new image",
|
|
6679
7071
|
style: sidebarInputStyle,
|
|
6680
7072
|
type: "text",
|
|
6681
7073
|
value: uploadAltText
|