@orion-studios/payload-studio 0.5.0-beta.85 → 0.5.0-beta.87
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/{chunk-AFLEATYB.mjs → chunk-VQFGBAW2.mjs} +1 -1
- package/dist/{chunk-FWVVRZ32.mjs → chunk-ZXKYAGTC.mjs} +8 -7
- package/dist/index.js +8 -7
- package/dist/index.mjs +8 -8
- package/dist/nextjs/index.js +8 -7
- package/dist/nextjs/index.mjs +2 -2
- package/dist/studio-pages/client.js +62 -56
- package/dist/studio-pages/client.mjs +62 -56
- package/dist/studio-pages/index.js +8 -7
- package/dist/studio-pages/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -202,6 +202,7 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
202
202
|
...blockWithSettings,
|
|
203
203
|
settings
|
|
204
204
|
};
|
|
205
|
+
const blockType = typeof next.blockType === "string" ? next.blockType : "";
|
|
205
206
|
next.contentWidth = settings.layout.contentWidth;
|
|
206
207
|
next.sectionPaddingX = settings.layout.sectionPaddingX;
|
|
207
208
|
next.sectionPaddingY = settings.layout.sectionPaddingY;
|
|
@@ -225,19 +226,19 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
225
226
|
next.editCopyInPanel = settings.advanced.editCopyInPanel;
|
|
226
227
|
next.customClassName = settings.advanced.customClassName;
|
|
227
228
|
next.hideOnMobile = settings.advanced.hideOnMobile;
|
|
228
|
-
|
|
229
|
+
delete next.backgroundImagePositionX;
|
|
230
|
+
delete next.backgroundImagePositionY;
|
|
231
|
+
delete next.imageHeight;
|
|
232
|
+
delete next.imagePositionX;
|
|
233
|
+
delete next.imagePositionY;
|
|
234
|
+
if (blockType === "hero") {
|
|
229
235
|
next.backgroundImageFit = settings.media.fit;
|
|
230
236
|
next.backgroundImageCornerStyle = settings.media.cornerStyle;
|
|
231
237
|
next.backgroundImagePosition = settings.media.position;
|
|
232
|
-
|
|
233
|
-
next.backgroundImagePositionY = settings.media.positionY;
|
|
234
|
-
} else {
|
|
238
|
+
} else if (blockType === "media") {
|
|
235
239
|
next.imageFit = settings.media.fit;
|
|
236
240
|
next.imageCornerStyle = settings.media.cornerStyle;
|
|
237
241
|
next.imagePosition = settings.media.position;
|
|
238
|
-
next.imagePositionX = settings.media.positionX;
|
|
239
|
-
next.imagePositionY = settings.media.positionY;
|
|
240
|
-
next.imageHeight = settings.media.height;
|
|
241
242
|
}
|
|
242
243
|
if (Array.isArray(next.items)) {
|
|
243
244
|
next.items = next.items.map((rawItem) => isRecord(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
|
package/dist/index.js
CHANGED
|
@@ -2892,6 +2892,7 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
2892
2892
|
...blockWithSettings,
|
|
2893
2893
|
settings
|
|
2894
2894
|
};
|
|
2895
|
+
const blockType = typeof next.blockType === "string" ? next.blockType : "";
|
|
2895
2896
|
next.contentWidth = settings.layout.contentWidth;
|
|
2896
2897
|
next.sectionPaddingX = settings.layout.sectionPaddingX;
|
|
2897
2898
|
next.sectionPaddingY = settings.layout.sectionPaddingY;
|
|
@@ -2915,19 +2916,19 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
2915
2916
|
next.editCopyInPanel = settings.advanced.editCopyInPanel;
|
|
2916
2917
|
next.customClassName = settings.advanced.customClassName;
|
|
2917
2918
|
next.hideOnMobile = settings.advanced.hideOnMobile;
|
|
2918
|
-
|
|
2919
|
+
delete next.backgroundImagePositionX;
|
|
2920
|
+
delete next.backgroundImagePositionY;
|
|
2921
|
+
delete next.imageHeight;
|
|
2922
|
+
delete next.imagePositionX;
|
|
2923
|
+
delete next.imagePositionY;
|
|
2924
|
+
if (blockType === "hero") {
|
|
2919
2925
|
next.backgroundImageFit = settings.media.fit;
|
|
2920
2926
|
next.backgroundImageCornerStyle = settings.media.cornerStyle;
|
|
2921
2927
|
next.backgroundImagePosition = settings.media.position;
|
|
2922
|
-
|
|
2923
|
-
next.backgroundImagePositionY = settings.media.positionY;
|
|
2924
|
-
} else {
|
|
2928
|
+
} else if (blockType === "media") {
|
|
2925
2929
|
next.imageFit = settings.media.fit;
|
|
2926
2930
|
next.imageCornerStyle = settings.media.cornerStyle;
|
|
2927
2931
|
next.imagePosition = settings.media.position;
|
|
2928
|
-
next.imagePositionX = settings.media.positionX;
|
|
2929
|
-
next.imagePositionY = settings.media.positionY;
|
|
2930
|
-
next.imageHeight = settings.media.height;
|
|
2931
2932
|
}
|
|
2932
2933
|
if (Array.isArray(next.items)) {
|
|
2933
2934
|
next.items = next.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
|
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
admin_exports
|
|
3
3
|
} from "./chunk-HCEPGEAI.mjs";
|
|
4
|
+
import {
|
|
5
|
+
admin_app_exports
|
|
6
|
+
} from "./chunk-XVH5SCBD.mjs";
|
|
7
|
+
import {
|
|
8
|
+
blocks_exports
|
|
9
|
+
} from "./chunk-XK3K5GRP.mjs";
|
|
4
10
|
import {
|
|
5
11
|
nextjs_exports
|
|
6
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VQFGBAW2.mjs";
|
|
7
13
|
import {
|
|
8
14
|
studio_exports
|
|
9
15
|
} from "./chunk-ADIIWIYL.mjs";
|
|
10
16
|
import {
|
|
11
17
|
studio_pages_exports
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
blocks_exports
|
|
15
|
-
} from "./chunk-XK3K5GRP.mjs";
|
|
18
|
+
} from "./chunk-ZXKYAGTC.mjs";
|
|
16
19
|
import "./chunk-SIL2J5MF.mjs";
|
|
17
|
-
import {
|
|
18
|
-
admin_app_exports
|
|
19
|
-
} from "./chunk-XVH5SCBD.mjs";
|
|
20
20
|
import "./chunk-6BWS3CLP.mjs";
|
|
21
21
|
export {
|
|
22
22
|
admin_exports as admin,
|
package/dist/nextjs/index.js
CHANGED
|
@@ -282,6 +282,7 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
282
282
|
...blockWithSettings,
|
|
283
283
|
settings
|
|
284
284
|
};
|
|
285
|
+
const blockType = typeof next.blockType === "string" ? next.blockType : "";
|
|
285
286
|
next.contentWidth = settings.layout.contentWidth;
|
|
286
287
|
next.sectionPaddingX = settings.layout.sectionPaddingX;
|
|
287
288
|
next.sectionPaddingY = settings.layout.sectionPaddingY;
|
|
@@ -305,19 +306,19 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
305
306
|
next.editCopyInPanel = settings.advanced.editCopyInPanel;
|
|
306
307
|
next.customClassName = settings.advanced.customClassName;
|
|
307
308
|
next.hideOnMobile = settings.advanced.hideOnMobile;
|
|
308
|
-
|
|
309
|
+
delete next.backgroundImagePositionX;
|
|
310
|
+
delete next.backgroundImagePositionY;
|
|
311
|
+
delete next.imageHeight;
|
|
312
|
+
delete next.imagePositionX;
|
|
313
|
+
delete next.imagePositionY;
|
|
314
|
+
if (blockType === "hero") {
|
|
309
315
|
next.backgroundImageFit = settings.media.fit;
|
|
310
316
|
next.backgroundImageCornerStyle = settings.media.cornerStyle;
|
|
311
317
|
next.backgroundImagePosition = settings.media.position;
|
|
312
|
-
|
|
313
|
-
next.backgroundImagePositionY = settings.media.positionY;
|
|
314
|
-
} else {
|
|
318
|
+
} else if (blockType === "media") {
|
|
315
319
|
next.imageFit = settings.media.fit;
|
|
316
320
|
next.imageCornerStyle = settings.media.cornerStyle;
|
|
317
321
|
next.imagePosition = settings.media.position;
|
|
318
|
-
next.imagePositionX = settings.media.positionX;
|
|
319
|
-
next.imagePositionY = settings.media.positionY;
|
|
320
|
-
next.imageHeight = settings.media.height;
|
|
321
322
|
}
|
|
322
323
|
if (Array.isArray(next.items)) {
|
|
323
324
|
next.items = next.items.map((rawItem) => isRecord2(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
|
package/dist/nextjs/index.mjs
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
createPayloadClient,
|
|
5
5
|
createSiteQueries,
|
|
6
6
|
resolveMedia
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-VQFGBAW2.mjs";
|
|
8
8
|
import "../chunk-ADIIWIYL.mjs";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-ZXKYAGTC.mjs";
|
|
10
10
|
import "../chunk-SIL2J5MF.mjs";
|
|
11
11
|
import "../chunk-6BWS3CLP.mjs";
|
|
12
12
|
export {
|
|
@@ -237,6 +237,7 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
237
237
|
...blockWithSettings,
|
|
238
238
|
settings
|
|
239
239
|
};
|
|
240
|
+
const blockType = typeof next.blockType === "string" ? next.blockType : "";
|
|
240
241
|
next.contentWidth = settings.layout.contentWidth;
|
|
241
242
|
next.sectionPaddingX = settings.layout.sectionPaddingX;
|
|
242
243
|
next.sectionPaddingY = settings.layout.sectionPaddingY;
|
|
@@ -260,19 +261,19 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
260
261
|
next.editCopyInPanel = settings.advanced.editCopyInPanel;
|
|
261
262
|
next.customClassName = settings.advanced.customClassName;
|
|
262
263
|
next.hideOnMobile = settings.advanced.hideOnMobile;
|
|
263
|
-
|
|
264
|
+
delete next.backgroundImagePositionX;
|
|
265
|
+
delete next.backgroundImagePositionY;
|
|
266
|
+
delete next.imageHeight;
|
|
267
|
+
delete next.imagePositionX;
|
|
268
|
+
delete next.imagePositionY;
|
|
269
|
+
if (blockType === "hero") {
|
|
264
270
|
next.backgroundImageFit = settings.media.fit;
|
|
265
271
|
next.backgroundImageCornerStyle = settings.media.cornerStyle;
|
|
266
272
|
next.backgroundImagePosition = settings.media.position;
|
|
267
|
-
|
|
268
|
-
next.backgroundImagePositionY = settings.media.positionY;
|
|
269
|
-
} else {
|
|
273
|
+
} else if (blockType === "media") {
|
|
270
274
|
next.imageFit = settings.media.fit;
|
|
271
275
|
next.imageCornerStyle = settings.media.cornerStyle;
|
|
272
276
|
next.imagePosition = settings.media.position;
|
|
273
|
-
next.imagePositionX = settings.media.positionX;
|
|
274
|
-
next.imagePositionY = settings.media.positionY;
|
|
275
|
-
next.imageHeight = settings.media.height;
|
|
276
277
|
}
|
|
277
278
|
if (Array.isArray(next.items)) {
|
|
278
279
|
next.items = next.items.map((rawItem) => isRecord(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
|
|
@@ -447,7 +448,7 @@ function ImageControls({
|
|
|
447
448
|
)
|
|
448
449
|
] }),
|
|
449
450
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
450
|
-
"Focus
|
|
451
|
+
"Horizontal Image Focus (%)",
|
|
451
452
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "orion-builder-settings-input-split", children: [
|
|
452
453
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
453
454
|
"input",
|
|
@@ -473,7 +474,7 @@ function ImageControls({
|
|
|
473
474
|
] })
|
|
474
475
|
] }),
|
|
475
476
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "orion-builder-settings-label", children: [
|
|
476
|
-
"Focus
|
|
477
|
+
"Vertical Image Focus (%)",
|
|
477
478
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "orion-builder-settings-input-split", children: [
|
|
478
479
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
479
480
|
"input",
|
|
@@ -2247,6 +2248,7 @@ function BlockFrame({
|
|
|
2247
2248
|
|
|
2248
2249
|
// src/studio-pages/builder/renderers/renderSimpleBlockPreview.tsx
|
|
2249
2250
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2251
|
+
var isRecord4 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2250
2252
|
var parseOptionalPercentNumber = (value) => {
|
|
2251
2253
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
2252
2254
|
return Math.max(0, Math.min(100, value));
|
|
@@ -2442,12 +2444,14 @@ function renderSimpleBlockPreview(args) {
|
|
|
2442
2444
|
if (type === "media") {
|
|
2443
2445
|
const image = resolveMedia2(block.image);
|
|
2444
2446
|
const size = normalizeText3(block.size, "default");
|
|
2445
|
-
const
|
|
2446
|
-
const
|
|
2447
|
+
const blockSettings = isRecord4(block.settings) ? block.settings : {};
|
|
2448
|
+
const mediaSettings = isRecord4(blockSettings.media) ? blockSettings.media : {};
|
|
2449
|
+
const imagePositionX = parseOptionalPercentNumber(mediaSettings.positionX ?? block?.imagePositionX);
|
|
2450
|
+
const imagePositionY = parseOptionalPercentNumber(mediaSettings.positionY ?? block?.imagePositionY);
|
|
2447
2451
|
const imageStyle = getImagePresentationStyle2({
|
|
2448
|
-
cornerStyle: normalizeImageCornerStyle3(block?.imageCornerStyle),
|
|
2449
|
-
fit: normalizeImageFit3(block?.imageFit),
|
|
2450
|
-
position: normalizeImagePosition3(block?.imagePosition),
|
|
2452
|
+
cornerStyle: normalizeImageCornerStyle3(mediaSettings.cornerStyle ?? block?.imageCornerStyle),
|
|
2453
|
+
fit: normalizeImageFit3(mediaSettings.fit ?? block?.imageFit),
|
|
2454
|
+
position: normalizeImagePosition3(mediaSettings.position ?? block?.imagePosition),
|
|
2451
2455
|
positionX: imagePositionX,
|
|
2452
2456
|
positionY: imagePositionY
|
|
2453
2457
|
});
|
|
@@ -2962,20 +2966,20 @@ var lucideIconOptions = [
|
|
|
2962
2966
|
"BadgeCheck",
|
|
2963
2967
|
"CalendarClock"
|
|
2964
2968
|
];
|
|
2965
|
-
var
|
|
2969
|
+
var isRecord5 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2966
2970
|
var normalizeText = (value, fallback = "") => typeof value === "string" ? value : fallback;
|
|
2967
2971
|
var getRelationID2 = (value) => {
|
|
2968
2972
|
if (typeof value === "number" || typeof value === "string") {
|
|
2969
2973
|
return value;
|
|
2970
2974
|
}
|
|
2971
|
-
if (!
|
|
2975
|
+
if (!isRecord5(value)) {
|
|
2972
2976
|
return null;
|
|
2973
2977
|
}
|
|
2974
2978
|
const id = value.id;
|
|
2975
2979
|
return typeof id === "number" || typeof id === "string" ? id : null;
|
|
2976
2980
|
};
|
|
2977
2981
|
var toMediaLibraryItem2 = (value) => {
|
|
2978
|
-
if (!
|
|
2982
|
+
if (!isRecord5(value)) {
|
|
2979
2983
|
return null;
|
|
2980
2984
|
}
|
|
2981
2985
|
const id = getRelationID2(value);
|
|
@@ -3042,8 +3046,8 @@ var blockConfig = {
|
|
|
3042
3046
|
}
|
|
3043
3047
|
};
|
|
3044
3048
|
var getItemTypographyAlign = (item) => {
|
|
3045
|
-
const settings =
|
|
3046
|
-
const typography =
|
|
3049
|
+
const settings = isRecord5(item.settings) ? item.settings : {};
|
|
3050
|
+
const typography = isRecord5(settings.typography) ? settings.typography : {};
|
|
3047
3051
|
const value = typography.bodyAlign;
|
|
3048
3052
|
return value === "center" || value === "justify" || value === "right" ? value : "left";
|
|
3049
3053
|
};
|
|
@@ -3404,25 +3408,25 @@ function ArrayItemsEditor({
|
|
|
3404
3408
|
minHeight: blockType === "logoWall" ? 24 : blockType === "beforeAfter" ? 60 : 40,
|
|
3405
3409
|
onChange: (field, value) => {
|
|
3406
3410
|
if (field === "height") {
|
|
3407
|
-
|
|
3411
|
+
onUpdateItemSetting(itemIndex, "media.height", value);
|
|
3408
3412
|
return;
|
|
3409
3413
|
}
|
|
3410
3414
|
if (field === "fit") {
|
|
3411
|
-
|
|
3415
|
+
onUpdateItemSetting(itemIndex, "media.fit", value);
|
|
3412
3416
|
return;
|
|
3413
3417
|
}
|
|
3414
3418
|
if (field === "cornerStyle") {
|
|
3415
|
-
|
|
3419
|
+
onUpdateItemSetting(itemIndex, "media.cornerStyle", value);
|
|
3416
3420
|
return;
|
|
3417
3421
|
}
|
|
3418
3422
|
if (field === "position") {
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3423
|
+
onUpdateItemSetting(itemIndex, "media.position", value);
|
|
3424
|
+
onUpdateItemSetting(itemIndex, "media.positionX", null);
|
|
3425
|
+
onUpdateItemSetting(itemIndex, "media.positionY", null);
|
|
3422
3426
|
return;
|
|
3423
3427
|
}
|
|
3424
3428
|
if (field === "positionX" || field === "positionY") {
|
|
3425
|
-
|
|
3429
|
+
onUpdateItemSetting(itemIndex, `media.${field}`, value);
|
|
3426
3430
|
}
|
|
3427
3431
|
},
|
|
3428
3432
|
position: normalizeImagePosition(item.imagePosition),
|
|
@@ -3459,18 +3463,18 @@ function ArrayItemsEditor({
|
|
|
3459
3463
|
|
|
3460
3464
|
// src/studio-pages/builder/BuilderPageEditor.tsx
|
|
3461
3465
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3462
|
-
var
|
|
3466
|
+
var isRecord6 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3463
3467
|
var resolveMedia = (value) => {
|
|
3464
3468
|
if (!value) return null;
|
|
3465
3469
|
if (typeof value === "string" || typeof value === "number") return null;
|
|
3466
|
-
if (!
|
|
3470
|
+
if (!isRecord6(value)) return null;
|
|
3467
3471
|
if (typeof value.url === "string") {
|
|
3468
3472
|
return {
|
|
3469
3473
|
url: value.url,
|
|
3470
3474
|
alt: typeof value.alt === "string" ? value.alt : void 0
|
|
3471
3475
|
};
|
|
3472
3476
|
}
|
|
3473
|
-
if (
|
|
3477
|
+
if (isRecord6(value.value) && typeof value.value.url === "string") {
|
|
3474
3478
|
return {
|
|
3475
3479
|
url: value.value.url,
|
|
3476
3480
|
alt: typeof value.value.alt === "string" ? value.value.alt : void 0
|
|
@@ -4079,10 +4083,10 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4079
4083
|
const title = normalizeText2(doc.title, "Untitled Page");
|
|
4080
4084
|
const pageTemplate = normalizeText2(doc.template, "standard");
|
|
4081
4085
|
const initialLayout = Array.isArray(doc.layout) ? doc.layout : [];
|
|
4082
|
-
const sourceThemePage =
|
|
4086
|
+
const sourceThemePage = isRecord6(sourceMetadata.theme) ? sourceMetadata.theme : {};
|
|
4083
4087
|
const initialPageDefaults = {
|
|
4084
4088
|
pageWidthDefault: sourceMetadata.pageWidthDefault === "wide" || sourceMetadata.pageWidthDefault === "full" ? sourceMetadata.pageWidthDefault : defaultPageDefaults.pageWidthDefault,
|
|
4085
|
-
themePage:
|
|
4089
|
+
themePage: isRecord6(sourceThemePage.page) ? sourceThemePage.page : {}
|
|
4086
4090
|
};
|
|
4087
4091
|
const [layout, setLayout] = (0, import_react5.useState)(
|
|
4088
4092
|
migrateLayoutToSettingsV2(cloneBlockLayout(initialLayout).map((block) => withSectionStyleDefaults2(block)))
|
|
@@ -4122,12 +4126,12 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4122
4126
|
);
|
|
4123
4127
|
const selectedType = normalizeText2(selectedBlock?.blockType, "");
|
|
4124
4128
|
const selectedItems = Array.isArray(selectedBlock?.items) ? selectedBlock?.items : [];
|
|
4125
|
-
const selectedBlockSettings =
|
|
4126
|
-
const selectedBlockAdvancedSettings =
|
|
4129
|
+
const selectedBlockSettings = isRecord6(selectedBlock?.settings) ? selectedBlock.settings : {};
|
|
4130
|
+
const selectedBlockAdvancedSettings = isRecord6(selectedBlockSettings.advanced) ? selectedBlockSettings.advanced : {};
|
|
4127
4131
|
const isArrayItemBlockSelected = selectedType === "featureGrid" || selectedType === "logoWall" || selectedType === "beforeAfter" || selectedType === "stats" || selectedType === "faq" || selectedType === "testimonials";
|
|
4128
4132
|
const selectedBlockHasMediaSource = selectedType === "hero" || selectedType === "media";
|
|
4129
4133
|
const selectedBlockMediaValue = selectedType === "hero" ? selectedBlock?.media : selectedType === "media" ? selectedBlock?.image : null;
|
|
4130
|
-
const selectedItemRecord = typeof selectedItemIndex === "number" && selectedItemIndex >= 0 && selectedItemIndex < selectedItems.length &&
|
|
4134
|
+
const selectedItemRecord = typeof selectedItemIndex === "number" && selectedItemIndex >= 0 && selectedItemIndex < selectedItems.length && isRecord6(selectedItems[selectedItemIndex]) ? selectedItems[selectedItemIndex] : null;
|
|
4131
4135
|
const editCopyInPanelEnabled = Boolean(selectedBlockAdvancedSettings.editCopyInPanel);
|
|
4132
4136
|
const isBlockUploadTarget = (blockIndex, kind) => selectedIndex === blockIndex && uploadingTarget?.kind === kind;
|
|
4133
4137
|
const isFeatureGridItemUploading = (blockIndex, itemIndex) => selectedIndex === blockIndex && uploadingTarget?.kind === "featureGridItem" && uploadingTarget.itemIndex === itemIndex;
|
|
@@ -4458,29 +4462,29 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4458
4462
|
return;
|
|
4459
4463
|
}
|
|
4460
4464
|
if (field === "height") {
|
|
4461
|
-
|
|
4465
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.height", value);
|
|
4462
4466
|
return;
|
|
4463
4467
|
}
|
|
4464
4468
|
if (field === "fit") {
|
|
4465
|
-
|
|
4469
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.fit", value);
|
|
4466
4470
|
return;
|
|
4467
4471
|
}
|
|
4468
4472
|
if (field === "cornerStyle") {
|
|
4469
|
-
|
|
4473
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.cornerStyle", value);
|
|
4470
4474
|
return;
|
|
4471
4475
|
}
|
|
4472
4476
|
if (field === "position") {
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4477
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.position", value);
|
|
4478
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionX", null);
|
|
4479
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionY", null);
|
|
4476
4480
|
return;
|
|
4477
4481
|
}
|
|
4478
4482
|
if (field === "positionX") {
|
|
4479
|
-
|
|
4483
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionX", value);
|
|
4480
4484
|
return;
|
|
4481
4485
|
}
|
|
4482
4486
|
if (field === "positionY") {
|
|
4483
|
-
|
|
4487
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionY", value);
|
|
4484
4488
|
}
|
|
4485
4489
|
};
|
|
4486
4490
|
const uploadItemMediaFromV2 = (itemIndex, field, file) => {
|
|
@@ -4609,7 +4613,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4609
4613
|
if (blockType === "featureGrid" || blockType === "logoWall" || blockType === "beforeAfter") {
|
|
4610
4614
|
const items = Array.isArray(nextBlock.items) ? nextBlock.items : [];
|
|
4611
4615
|
nextBlock.items = items.map((rawItem) => {
|
|
4612
|
-
if (!
|
|
4616
|
+
if (!isRecord6(rawItem)) {
|
|
4613
4617
|
return rawItem;
|
|
4614
4618
|
}
|
|
4615
4619
|
const nextItem = { ...rawItem };
|
|
@@ -4639,9 +4643,9 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4639
4643
|
);
|
|
4640
4644
|
const renderWithSectionShell = (block, className, content) => {
|
|
4641
4645
|
const shell = sectionStyleFromBlock(block, pageDefaults);
|
|
4642
|
-
const blockSettings =
|
|
4643
|
-
const blockTypography =
|
|
4644
|
-
const blockTheme =
|
|
4646
|
+
const blockSettings = isRecord6(block.settings) ? block.settings : {};
|
|
4647
|
+
const blockTypography = isRecord6(blockSettings.typography) ? blockSettings.typography : {};
|
|
4648
|
+
const blockTheme = isRecord6(blockSettings.theme) ? blockSettings.theme : {};
|
|
4645
4649
|
const typographyStyle = resolveTypographyStyleFromSettings({
|
|
4646
4650
|
bodyAlign: blockTypography.bodyAlign === "center" || blockTypography.bodyAlign === "justify" || blockTypography.bodyAlign === "right" ? blockTypography.bodyAlign : "left",
|
|
4647
4651
|
letterSpacingPreset: blockTypography.letterSpacingPreset === "tight" || blockTypography.letterSpacingPreset === "relaxed" ? blockTypography.letterSpacingPreset : "normal",
|
|
@@ -4700,7 +4704,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4700
4704
|
break;
|
|
4701
4705
|
}
|
|
4702
4706
|
const currentValue = cursor[key];
|
|
4703
|
-
const child =
|
|
4707
|
+
const child = isRecord6(currentValue) ? { ...currentValue } : {};
|
|
4704
4708
|
cursor[key] = child;
|
|
4705
4709
|
cursor = child;
|
|
4706
4710
|
}
|
|
@@ -4720,8 +4724,8 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4720
4724
|
const updateBlockSettingsField = (blockIndex, path, value) => {
|
|
4721
4725
|
setLayout((current) => {
|
|
4722
4726
|
const next = cloneBlockLayout(current);
|
|
4723
|
-
const currentBlock =
|
|
4724
|
-
const currentSettings =
|
|
4727
|
+
const currentBlock = isRecord6(next[blockIndex]) ? next[blockIndex] : {};
|
|
4728
|
+
const currentSettings = isRecord6(currentBlock.settings) ? currentBlock.settings : {};
|
|
4725
4729
|
const nextSettings = setByPath(currentSettings, path, value);
|
|
4726
4730
|
next[blockIndex] = migrateBlockToSettingsV2({
|
|
4727
4731
|
...currentBlock,
|
|
@@ -4755,7 +4759,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4755
4759
|
const existingArray = Array.isArray(block[arrayField]) ? block[arrayField] : [];
|
|
4756
4760
|
const nextArray = [...existingArray];
|
|
4757
4761
|
const targetItem = nextArray[itemIndex] && typeof nextArray[itemIndex] === "object" ? nextArray[itemIndex] : {};
|
|
4758
|
-
const currentSettings =
|
|
4762
|
+
const currentSettings = isRecord6(targetItem.settings) ? targetItem.settings : {};
|
|
4759
4763
|
nextArray[itemIndex] = {
|
|
4760
4764
|
...targetItem,
|
|
4761
4765
|
settings: setByPath(currentSettings, path, value)
|
|
@@ -5280,16 +5284,18 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5280
5284
|
};
|
|
5281
5285
|
if (type === "hero") {
|
|
5282
5286
|
const media = resolveMedia(block.media);
|
|
5287
|
+
const blockSettings = isRecord6(block.settings) ? block.settings : {};
|
|
5288
|
+
const mediaSettings = isRecord6(blockSettings.media) ? blockSettings.media : {};
|
|
5283
5289
|
const variant = normalizeText2(block.variant, "default");
|
|
5284
5290
|
const backgroundColor = normalizeText2(block.backgroundColor).trim();
|
|
5285
|
-
const backgroundImageFit = normalizeHeroImageFit(block.backgroundImageFit);
|
|
5291
|
+
const backgroundImageFit = normalizeHeroImageFit(mediaSettings.fit ?? block.backgroundImageFit);
|
|
5286
5292
|
const backgroundImageCornerStyle = normalizeHeroImageCornerStyle(
|
|
5287
|
-
block.backgroundImageCornerStyle,
|
|
5288
|
-
block.backgroundImageFit
|
|
5293
|
+
mediaSettings.cornerStyle ?? block.backgroundImageCornerStyle,
|
|
5294
|
+
mediaSettings.fit ?? block.backgroundImageFit
|
|
5289
5295
|
);
|
|
5290
|
-
const backgroundImagePosition = normalizeHeroImagePosition(block.backgroundImagePosition);
|
|
5291
|
-
const backgroundImagePositionX = parseOptionalPercentNumber2(block.backgroundImagePositionX);
|
|
5292
|
-
const backgroundImagePositionY = parseOptionalPercentNumber2(block.backgroundImagePositionY);
|
|
5296
|
+
const backgroundImagePosition = normalizeHeroImagePosition(mediaSettings.position ?? block.backgroundImagePosition);
|
|
5297
|
+
const backgroundImagePositionX = parseOptionalPercentNumber2(mediaSettings.positionX ?? block.backgroundImagePositionX);
|
|
5298
|
+
const backgroundImagePositionY = parseOptionalPercentNumber2(mediaSettings.positionY ?? block.backgroundImagePositionY);
|
|
5293
5299
|
const heroHeight = normalizeHeroHeight(block.heroHeight);
|
|
5294
5300
|
const heroMinHeight = heroHeight === "full" ? "100svh" : heroHeight === "md" ? resolveBuilderMediumHeroHeight(topViewportHeight) : "360px";
|
|
5295
5301
|
const heroCornerRadius = getHeroImageCornerRadius(backgroundImageCornerStyle);
|
|
@@ -211,6 +211,7 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
211
211
|
...blockWithSettings,
|
|
212
212
|
settings
|
|
213
213
|
};
|
|
214
|
+
const blockType = typeof next.blockType === "string" ? next.blockType : "";
|
|
214
215
|
next.contentWidth = settings.layout.contentWidth;
|
|
215
216
|
next.sectionPaddingX = settings.layout.sectionPaddingX;
|
|
216
217
|
next.sectionPaddingY = settings.layout.sectionPaddingY;
|
|
@@ -234,19 +235,19 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
234
235
|
next.editCopyInPanel = settings.advanced.editCopyInPanel;
|
|
235
236
|
next.customClassName = settings.advanced.customClassName;
|
|
236
237
|
next.hideOnMobile = settings.advanced.hideOnMobile;
|
|
237
|
-
|
|
238
|
+
delete next.backgroundImagePositionX;
|
|
239
|
+
delete next.backgroundImagePositionY;
|
|
240
|
+
delete next.imageHeight;
|
|
241
|
+
delete next.imagePositionX;
|
|
242
|
+
delete next.imagePositionY;
|
|
243
|
+
if (blockType === "hero") {
|
|
238
244
|
next.backgroundImageFit = settings.media.fit;
|
|
239
245
|
next.backgroundImageCornerStyle = settings.media.cornerStyle;
|
|
240
246
|
next.backgroundImagePosition = settings.media.position;
|
|
241
|
-
|
|
242
|
-
next.backgroundImagePositionY = settings.media.positionY;
|
|
243
|
-
} else {
|
|
247
|
+
} else if (blockType === "media") {
|
|
244
248
|
next.imageFit = settings.media.fit;
|
|
245
249
|
next.imageCornerStyle = settings.media.cornerStyle;
|
|
246
250
|
next.imagePosition = settings.media.position;
|
|
247
|
-
next.imagePositionX = settings.media.positionX;
|
|
248
|
-
next.imagePositionY = settings.media.positionY;
|
|
249
|
-
next.imageHeight = settings.media.height;
|
|
250
251
|
}
|
|
251
252
|
if (Array.isArray(next.items)) {
|
|
252
253
|
next.items = next.items.map((rawItem) => isRecord(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
|
|
@@ -421,7 +422,7 @@ function ImageControls({
|
|
|
421
422
|
)
|
|
422
423
|
] }),
|
|
423
424
|
/* @__PURE__ */ jsxs2("label", { className: "orion-builder-settings-label", children: [
|
|
424
|
-
"Focus
|
|
425
|
+
"Horizontal Image Focus (%)",
|
|
425
426
|
/* @__PURE__ */ jsxs2("div", { className: "orion-builder-settings-input-split", children: [
|
|
426
427
|
/* @__PURE__ */ jsx2(
|
|
427
428
|
"input",
|
|
@@ -447,7 +448,7 @@ function ImageControls({
|
|
|
447
448
|
] })
|
|
448
449
|
] }),
|
|
449
450
|
/* @__PURE__ */ jsxs2("label", { className: "orion-builder-settings-label", children: [
|
|
450
|
-
"Focus
|
|
451
|
+
"Vertical Image Focus (%)",
|
|
451
452
|
/* @__PURE__ */ jsxs2("div", { className: "orion-builder-settings-input-split", children: [
|
|
452
453
|
/* @__PURE__ */ jsx2(
|
|
453
454
|
"input",
|
|
@@ -2128,6 +2129,7 @@ function BlockFrame({
|
|
|
2128
2129
|
|
|
2129
2130
|
// src/studio-pages/builder/renderers/renderSimpleBlockPreview.tsx
|
|
2130
2131
|
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2132
|
+
var isRecord4 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2131
2133
|
var parseOptionalPercentNumber = (value) => {
|
|
2132
2134
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
2133
2135
|
return Math.max(0, Math.min(100, value));
|
|
@@ -2323,12 +2325,14 @@ function renderSimpleBlockPreview(args) {
|
|
|
2323
2325
|
if (type === "media") {
|
|
2324
2326
|
const image = resolveMedia2(block.image);
|
|
2325
2327
|
const size = normalizeText3(block.size, "default");
|
|
2326
|
-
const
|
|
2327
|
-
const
|
|
2328
|
+
const blockSettings = isRecord4(block.settings) ? block.settings : {};
|
|
2329
|
+
const mediaSettings = isRecord4(blockSettings.media) ? blockSettings.media : {};
|
|
2330
|
+
const imagePositionX = parseOptionalPercentNumber(mediaSettings.positionX ?? block?.imagePositionX);
|
|
2331
|
+
const imagePositionY = parseOptionalPercentNumber(mediaSettings.positionY ?? block?.imagePositionY);
|
|
2328
2332
|
const imageStyle = getImagePresentationStyle2({
|
|
2329
|
-
cornerStyle: normalizeImageCornerStyle3(block?.imageCornerStyle),
|
|
2330
|
-
fit: normalizeImageFit3(block?.imageFit),
|
|
2331
|
-
position: normalizeImagePosition3(block?.imagePosition),
|
|
2333
|
+
cornerStyle: normalizeImageCornerStyle3(mediaSettings.cornerStyle ?? block?.imageCornerStyle),
|
|
2334
|
+
fit: normalizeImageFit3(mediaSettings.fit ?? block?.imageFit),
|
|
2335
|
+
position: normalizeImagePosition3(mediaSettings.position ?? block?.imagePosition),
|
|
2332
2336
|
positionX: imagePositionX,
|
|
2333
2337
|
positionY: imagePositionY
|
|
2334
2338
|
});
|
|
@@ -2843,20 +2847,20 @@ var lucideIconOptions = [
|
|
|
2843
2847
|
"BadgeCheck",
|
|
2844
2848
|
"CalendarClock"
|
|
2845
2849
|
];
|
|
2846
|
-
var
|
|
2850
|
+
var isRecord5 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2847
2851
|
var normalizeText = (value, fallback = "") => typeof value === "string" ? value : fallback;
|
|
2848
2852
|
var getRelationID2 = (value) => {
|
|
2849
2853
|
if (typeof value === "number" || typeof value === "string") {
|
|
2850
2854
|
return value;
|
|
2851
2855
|
}
|
|
2852
|
-
if (!
|
|
2856
|
+
if (!isRecord5(value)) {
|
|
2853
2857
|
return null;
|
|
2854
2858
|
}
|
|
2855
2859
|
const id = value.id;
|
|
2856
2860
|
return typeof id === "number" || typeof id === "string" ? id : null;
|
|
2857
2861
|
};
|
|
2858
2862
|
var toMediaLibraryItem2 = (value) => {
|
|
2859
|
-
if (!
|
|
2863
|
+
if (!isRecord5(value)) {
|
|
2860
2864
|
return null;
|
|
2861
2865
|
}
|
|
2862
2866
|
const id = getRelationID2(value);
|
|
@@ -2923,8 +2927,8 @@ var blockConfig = {
|
|
|
2923
2927
|
}
|
|
2924
2928
|
};
|
|
2925
2929
|
var getItemTypographyAlign = (item) => {
|
|
2926
|
-
const settings =
|
|
2927
|
-
const typography =
|
|
2930
|
+
const settings = isRecord5(item.settings) ? item.settings : {};
|
|
2931
|
+
const typography = isRecord5(settings.typography) ? settings.typography : {};
|
|
2928
2932
|
const value = typography.bodyAlign;
|
|
2929
2933
|
return value === "center" || value === "justify" || value === "right" ? value : "left";
|
|
2930
2934
|
};
|
|
@@ -3285,25 +3289,25 @@ function ArrayItemsEditor({
|
|
|
3285
3289
|
minHeight: blockType === "logoWall" ? 24 : blockType === "beforeAfter" ? 60 : 40,
|
|
3286
3290
|
onChange: (field, value) => {
|
|
3287
3291
|
if (field === "height") {
|
|
3288
|
-
|
|
3292
|
+
onUpdateItemSetting(itemIndex, "media.height", value);
|
|
3289
3293
|
return;
|
|
3290
3294
|
}
|
|
3291
3295
|
if (field === "fit") {
|
|
3292
|
-
|
|
3296
|
+
onUpdateItemSetting(itemIndex, "media.fit", value);
|
|
3293
3297
|
return;
|
|
3294
3298
|
}
|
|
3295
3299
|
if (field === "cornerStyle") {
|
|
3296
|
-
|
|
3300
|
+
onUpdateItemSetting(itemIndex, "media.cornerStyle", value);
|
|
3297
3301
|
return;
|
|
3298
3302
|
}
|
|
3299
3303
|
if (field === "position") {
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3304
|
+
onUpdateItemSetting(itemIndex, "media.position", value);
|
|
3305
|
+
onUpdateItemSetting(itemIndex, "media.positionX", null);
|
|
3306
|
+
onUpdateItemSetting(itemIndex, "media.positionY", null);
|
|
3303
3307
|
return;
|
|
3304
3308
|
}
|
|
3305
3309
|
if (field === "positionX" || field === "positionY") {
|
|
3306
|
-
|
|
3310
|
+
onUpdateItemSetting(itemIndex, `media.${field}`, value);
|
|
3307
3311
|
}
|
|
3308
3312
|
},
|
|
3309
3313
|
position: normalizeImagePosition(item.imagePosition),
|
|
@@ -3340,18 +3344,18 @@ function ArrayItemsEditor({
|
|
|
3340
3344
|
|
|
3341
3345
|
// src/studio-pages/builder/BuilderPageEditor.tsx
|
|
3342
3346
|
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3343
|
-
var
|
|
3347
|
+
var isRecord6 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3344
3348
|
var resolveMedia = (value) => {
|
|
3345
3349
|
if (!value) return null;
|
|
3346
3350
|
if (typeof value === "string" || typeof value === "number") return null;
|
|
3347
|
-
if (!
|
|
3351
|
+
if (!isRecord6(value)) return null;
|
|
3348
3352
|
if (typeof value.url === "string") {
|
|
3349
3353
|
return {
|
|
3350
3354
|
url: value.url,
|
|
3351
3355
|
alt: typeof value.alt === "string" ? value.alt : void 0
|
|
3352
3356
|
};
|
|
3353
3357
|
}
|
|
3354
|
-
if (
|
|
3358
|
+
if (isRecord6(value.value) && typeof value.value.url === "string") {
|
|
3355
3359
|
return {
|
|
3356
3360
|
url: value.value.url,
|
|
3357
3361
|
alt: typeof value.value.alt === "string" ? value.value.alt : void 0
|
|
@@ -3960,10 +3964,10 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
3960
3964
|
const title = normalizeText2(doc.title, "Untitled Page");
|
|
3961
3965
|
const pageTemplate = normalizeText2(doc.template, "standard");
|
|
3962
3966
|
const initialLayout = Array.isArray(doc.layout) ? doc.layout : [];
|
|
3963
|
-
const sourceThemePage =
|
|
3967
|
+
const sourceThemePage = isRecord6(sourceMetadata.theme) ? sourceMetadata.theme : {};
|
|
3964
3968
|
const initialPageDefaults = {
|
|
3965
3969
|
pageWidthDefault: sourceMetadata.pageWidthDefault === "wide" || sourceMetadata.pageWidthDefault === "full" ? sourceMetadata.pageWidthDefault : defaultPageDefaults.pageWidthDefault,
|
|
3966
|
-
themePage:
|
|
3970
|
+
themePage: isRecord6(sourceThemePage.page) ? sourceThemePage.page : {}
|
|
3967
3971
|
};
|
|
3968
3972
|
const [layout, setLayout] = useState5(
|
|
3969
3973
|
migrateLayoutToSettingsV2(cloneBlockLayout(initialLayout).map((block) => withSectionStyleDefaults2(block)))
|
|
@@ -4003,12 +4007,12 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4003
4007
|
);
|
|
4004
4008
|
const selectedType = normalizeText2(selectedBlock?.blockType, "");
|
|
4005
4009
|
const selectedItems = Array.isArray(selectedBlock?.items) ? selectedBlock?.items : [];
|
|
4006
|
-
const selectedBlockSettings =
|
|
4007
|
-
const selectedBlockAdvancedSettings =
|
|
4010
|
+
const selectedBlockSettings = isRecord6(selectedBlock?.settings) ? selectedBlock.settings : {};
|
|
4011
|
+
const selectedBlockAdvancedSettings = isRecord6(selectedBlockSettings.advanced) ? selectedBlockSettings.advanced : {};
|
|
4008
4012
|
const isArrayItemBlockSelected = selectedType === "featureGrid" || selectedType === "logoWall" || selectedType === "beforeAfter" || selectedType === "stats" || selectedType === "faq" || selectedType === "testimonials";
|
|
4009
4013
|
const selectedBlockHasMediaSource = selectedType === "hero" || selectedType === "media";
|
|
4010
4014
|
const selectedBlockMediaValue = selectedType === "hero" ? selectedBlock?.media : selectedType === "media" ? selectedBlock?.image : null;
|
|
4011
|
-
const selectedItemRecord = typeof selectedItemIndex === "number" && selectedItemIndex >= 0 && selectedItemIndex < selectedItems.length &&
|
|
4015
|
+
const selectedItemRecord = typeof selectedItemIndex === "number" && selectedItemIndex >= 0 && selectedItemIndex < selectedItems.length && isRecord6(selectedItems[selectedItemIndex]) ? selectedItems[selectedItemIndex] : null;
|
|
4012
4016
|
const editCopyInPanelEnabled = Boolean(selectedBlockAdvancedSettings.editCopyInPanel);
|
|
4013
4017
|
const isBlockUploadTarget = (blockIndex, kind) => selectedIndex === blockIndex && uploadingTarget?.kind === kind;
|
|
4014
4018
|
const isFeatureGridItemUploading = (blockIndex, itemIndex) => selectedIndex === blockIndex && uploadingTarget?.kind === "featureGridItem" && uploadingTarget.itemIndex === itemIndex;
|
|
@@ -4339,29 +4343,29 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4339
4343
|
return;
|
|
4340
4344
|
}
|
|
4341
4345
|
if (field === "height") {
|
|
4342
|
-
|
|
4346
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.height", value);
|
|
4343
4347
|
return;
|
|
4344
4348
|
}
|
|
4345
4349
|
if (field === "fit") {
|
|
4346
|
-
|
|
4350
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.fit", value);
|
|
4347
4351
|
return;
|
|
4348
4352
|
}
|
|
4349
4353
|
if (field === "cornerStyle") {
|
|
4350
|
-
|
|
4354
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.cornerStyle", value);
|
|
4351
4355
|
return;
|
|
4352
4356
|
}
|
|
4353
4357
|
if (field === "position") {
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4358
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.position", value);
|
|
4359
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionX", null);
|
|
4360
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionY", null);
|
|
4357
4361
|
return;
|
|
4358
4362
|
}
|
|
4359
4363
|
if (field === "positionX") {
|
|
4360
|
-
|
|
4364
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionX", value);
|
|
4361
4365
|
return;
|
|
4362
4366
|
}
|
|
4363
4367
|
if (field === "positionY") {
|
|
4364
|
-
|
|
4368
|
+
updateArrayItemSettingField(selectedIndex, "items", selectedItemIndex, "media.positionY", value);
|
|
4365
4369
|
}
|
|
4366
4370
|
};
|
|
4367
4371
|
const uploadItemMediaFromV2 = (itemIndex, field, file) => {
|
|
@@ -4490,7 +4494,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4490
4494
|
if (blockType === "featureGrid" || blockType === "logoWall" || blockType === "beforeAfter") {
|
|
4491
4495
|
const items = Array.isArray(nextBlock.items) ? nextBlock.items : [];
|
|
4492
4496
|
nextBlock.items = items.map((rawItem) => {
|
|
4493
|
-
if (!
|
|
4497
|
+
if (!isRecord6(rawItem)) {
|
|
4494
4498
|
return rawItem;
|
|
4495
4499
|
}
|
|
4496
4500
|
const nextItem = { ...rawItem };
|
|
@@ -4520,9 +4524,9 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4520
4524
|
);
|
|
4521
4525
|
const renderWithSectionShell = (block, className, content) => {
|
|
4522
4526
|
const shell = sectionStyleFromBlock(block, pageDefaults);
|
|
4523
|
-
const blockSettings =
|
|
4524
|
-
const blockTypography =
|
|
4525
|
-
const blockTheme =
|
|
4527
|
+
const blockSettings = isRecord6(block.settings) ? block.settings : {};
|
|
4528
|
+
const blockTypography = isRecord6(blockSettings.typography) ? blockSettings.typography : {};
|
|
4529
|
+
const blockTheme = isRecord6(blockSettings.theme) ? blockSettings.theme : {};
|
|
4526
4530
|
const typographyStyle = resolveTypographyStyleFromSettings({
|
|
4527
4531
|
bodyAlign: blockTypography.bodyAlign === "center" || blockTypography.bodyAlign === "justify" || blockTypography.bodyAlign === "right" ? blockTypography.bodyAlign : "left",
|
|
4528
4532
|
letterSpacingPreset: blockTypography.letterSpacingPreset === "tight" || blockTypography.letterSpacingPreset === "relaxed" ? blockTypography.letterSpacingPreset : "normal",
|
|
@@ -4581,7 +4585,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4581
4585
|
break;
|
|
4582
4586
|
}
|
|
4583
4587
|
const currentValue = cursor[key];
|
|
4584
|
-
const child =
|
|
4588
|
+
const child = isRecord6(currentValue) ? { ...currentValue } : {};
|
|
4585
4589
|
cursor[key] = child;
|
|
4586
4590
|
cursor = child;
|
|
4587
4591
|
}
|
|
@@ -4601,8 +4605,8 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4601
4605
|
const updateBlockSettingsField = (blockIndex, path, value) => {
|
|
4602
4606
|
setLayout((current) => {
|
|
4603
4607
|
const next = cloneBlockLayout(current);
|
|
4604
|
-
const currentBlock =
|
|
4605
|
-
const currentSettings =
|
|
4608
|
+
const currentBlock = isRecord6(next[blockIndex]) ? next[blockIndex] : {};
|
|
4609
|
+
const currentSettings = isRecord6(currentBlock.settings) ? currentBlock.settings : {};
|
|
4606
4610
|
const nextSettings = setByPath(currentSettings, path, value);
|
|
4607
4611
|
next[blockIndex] = migrateBlockToSettingsV2({
|
|
4608
4612
|
...currentBlock,
|
|
@@ -4636,7 +4640,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4636
4640
|
const existingArray = Array.isArray(block[arrayField]) ? block[arrayField] : [];
|
|
4637
4641
|
const nextArray = [...existingArray];
|
|
4638
4642
|
const targetItem = nextArray[itemIndex] && typeof nextArray[itemIndex] === "object" ? nextArray[itemIndex] : {};
|
|
4639
|
-
const currentSettings =
|
|
4643
|
+
const currentSettings = isRecord6(targetItem.settings) ? targetItem.settings : {};
|
|
4640
4644
|
nextArray[itemIndex] = {
|
|
4641
4645
|
...targetItem,
|
|
4642
4646
|
settings: setByPath(currentSettings, path, value)
|
|
@@ -5161,16 +5165,18 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5161
5165
|
};
|
|
5162
5166
|
if (type === "hero") {
|
|
5163
5167
|
const media = resolveMedia(block.media);
|
|
5168
|
+
const blockSettings = isRecord6(block.settings) ? block.settings : {};
|
|
5169
|
+
const mediaSettings = isRecord6(blockSettings.media) ? blockSettings.media : {};
|
|
5164
5170
|
const variant = normalizeText2(block.variant, "default");
|
|
5165
5171
|
const backgroundColor = normalizeText2(block.backgroundColor).trim();
|
|
5166
|
-
const backgroundImageFit = normalizeHeroImageFit(block.backgroundImageFit);
|
|
5172
|
+
const backgroundImageFit = normalizeHeroImageFit(mediaSettings.fit ?? block.backgroundImageFit);
|
|
5167
5173
|
const backgroundImageCornerStyle = normalizeHeroImageCornerStyle(
|
|
5168
|
-
block.backgroundImageCornerStyle,
|
|
5169
|
-
block.backgroundImageFit
|
|
5174
|
+
mediaSettings.cornerStyle ?? block.backgroundImageCornerStyle,
|
|
5175
|
+
mediaSettings.fit ?? block.backgroundImageFit
|
|
5170
5176
|
);
|
|
5171
|
-
const backgroundImagePosition = normalizeHeroImagePosition(block.backgroundImagePosition);
|
|
5172
|
-
const backgroundImagePositionX = parseOptionalPercentNumber2(block.backgroundImagePositionX);
|
|
5173
|
-
const backgroundImagePositionY = parseOptionalPercentNumber2(block.backgroundImagePositionY);
|
|
5177
|
+
const backgroundImagePosition = normalizeHeroImagePosition(mediaSettings.position ?? block.backgroundImagePosition);
|
|
5178
|
+
const backgroundImagePositionX = parseOptionalPercentNumber2(mediaSettings.positionX ?? block.backgroundImagePositionX);
|
|
5179
|
+
const backgroundImagePositionY = parseOptionalPercentNumber2(mediaSettings.positionY ?? block.backgroundImagePositionY);
|
|
5174
5180
|
const heroHeight = normalizeHeroHeight(block.heroHeight);
|
|
5175
5181
|
const heroMinHeight = heroHeight === "full" ? "100svh" : heroHeight === "md" ? resolveBuilderMediumHeroHeight(topViewportHeight) : "360px";
|
|
5176
5182
|
const heroCornerRadius = getHeroImageCornerRadius(backgroundImageCornerStyle);
|
|
@@ -235,6 +235,7 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
235
235
|
...blockWithSettings,
|
|
236
236
|
settings
|
|
237
237
|
};
|
|
238
|
+
const blockType = typeof next.blockType === "string" ? next.blockType : "";
|
|
238
239
|
next.contentWidth = settings.layout.contentWidth;
|
|
239
240
|
next.sectionPaddingX = settings.layout.sectionPaddingX;
|
|
240
241
|
next.sectionPaddingY = settings.layout.sectionPaddingY;
|
|
@@ -258,19 +259,19 @@ var v2SettingsToLegacyBlock = (blockWithSettings) => {
|
|
|
258
259
|
next.editCopyInPanel = settings.advanced.editCopyInPanel;
|
|
259
260
|
next.customClassName = settings.advanced.customClassName;
|
|
260
261
|
next.hideOnMobile = settings.advanced.hideOnMobile;
|
|
261
|
-
|
|
262
|
+
delete next.backgroundImagePositionX;
|
|
263
|
+
delete next.backgroundImagePositionY;
|
|
264
|
+
delete next.imageHeight;
|
|
265
|
+
delete next.imagePositionX;
|
|
266
|
+
delete next.imagePositionY;
|
|
267
|
+
if (blockType === "hero") {
|
|
262
268
|
next.backgroundImageFit = settings.media.fit;
|
|
263
269
|
next.backgroundImageCornerStyle = settings.media.cornerStyle;
|
|
264
270
|
next.backgroundImagePosition = settings.media.position;
|
|
265
|
-
|
|
266
|
-
next.backgroundImagePositionY = settings.media.positionY;
|
|
267
|
-
} else {
|
|
271
|
+
} else if (blockType === "media") {
|
|
268
272
|
next.imageFit = settings.media.fit;
|
|
269
273
|
next.imageCornerStyle = settings.media.cornerStyle;
|
|
270
274
|
next.imagePosition = settings.media.position;
|
|
271
|
-
next.imagePositionX = settings.media.positionX;
|
|
272
|
-
next.imagePositionY = settings.media.positionY;
|
|
273
|
-
next.imageHeight = settings.media.height;
|
|
274
275
|
}
|
|
275
276
|
if (Array.isArray(next.items)) {
|
|
276
277
|
next.items = next.items.map((rawItem) => isRecord(rawItem) ? v2SettingsToLegacyItem(rawItem) : rawItem);
|